From 0bea256d76b7ddb3da6f90a0f948355f344875fa Mon Sep 17 00:00:00 2001 From: Vegard Berg Date: Wed, 11 Oct 2023 12:14:53 +0200 Subject: [PATCH] Add changeable size for icons --- skyss/assets/index-ae4ca5a5.js | 674 +++++++++++++++++++++++++++++++++ skyss/index.html | 4 +- 2 files changed, 676 insertions(+), 2 deletions(-) create mode 100644 skyss/assets/index-ae4ca5a5.js diff --git a/skyss/assets/index-ae4ca5a5.js b/skyss/assets/index-ae4ca5a5.js new file mode 100644 index 0000000..24f8388 --- /dev/null +++ b/skyss/assets/index-ae4ca5a5.js @@ -0,0 +1,674 @@ +var Ng=Object.defineProperty;var Ug=(h,m,g)=>m in h?Ng(h,m,{enumerable:!0,configurable:!0,writable:!0,value:g}):h[m]=g;var Vg=(h,m)=>()=>(m||h((m={exports:{}}).exports,m),m.exports);var gh=(h,m,g)=>(Ug(h,typeof m!="symbol"?m+"":m,g),g);var sx=Vg((lx,Ph)=>{(function(){const m=document.createElement("link").relList;if(m&&m.supports&&m.supports("modulepreload"))return;for(const S of document.querySelectorAll('link[rel="modulepreload"]'))w(S);new MutationObserver(S=>{for(const I of S)if(I.type==="childList")for(const D of I.addedNodes)D.tagName==="LINK"&&D.rel==="modulepreload"&&w(D)}).observe(document,{childList:!0,subtree:!0});function g(S){const I={};return S.integrity&&(I.integrity=S.integrity),S.referrerPolicy&&(I.referrerPolicy=S.referrerPolicy),S.crossOrigin==="use-credentials"?I.credentials="include":S.crossOrigin==="anonymous"?I.credentials="omit":I.credentials="same-origin",I}function w(S){if(S.ep)return;S.ep=!0;const I=g(S);fetch(S.href,I)}})();function Pn(){}function jg(h,m){for(const g in m)h[g]=m[g];return h}function of(h){return h()}function wp(){return Object.create(null)}function wo(h){h.forEach(of)}function Fl(h){return typeof h=="function"}function Gr(h,m){return h!=h?m==m:h!==m||h&&typeof h=="object"||typeof h=="function"}function qg(h){return Object.keys(h).length===0}function af(h,...m){if(h==null){for(const w of m)w(void 0);return Pn}const g=h.subscribe(...m);return g.unsubscribe?()=>g.unsubscribe():g}function gr(h,m,g){h.$$.on_destroy.push(af(m,g))}function ka(h,m,g,w){if(h){const S=lf(h,m,g,w);return h[0](S)}}function lf(h,m,g,w){return h[1]&&w?jg(g.ctx.slice(),h[1](w(m))):g.ctx}function Ma(h,m,g,w){if(h[2]&&w){const S=h[2](w(g));if(m.dirty===void 0)return S;if(typeof S=="object"){const I=[],D=Math.max(m.dirty.length,S.length);for(let o=0;o32){const m=[],g=h.ctx.length/32;for(let w=0;wh.removeEventListener(m,g,w)}function Ct(h,m,g){g==null?h.removeAttribute(m):h.getAttribute(m)!==g&&h.setAttribute(m,g)}function Xg(h){return Array.from(h.childNodes)}function Ls(h,m){m=""+m,h.data!==m&&(h.data=m)}function Rs(h,m,g){h.classList.toggle(m,!!g)}function Wg(h,m,{bubbles:g=!1,cancelable:w=!1}={}){return new CustomEvent(h,{detail:m,bubbles:g,cancelable:w})}let Rl;function zl(h){Rl=h}function Nl(){if(!Rl)throw new Error("Function called outside component initialization");return Rl}function Hg(h){Nl().$$.on_mount.push(h)}function Ul(h){Nl().$$.on_destroy.push(h)}function cf(){const h=Nl();return(m,g,{cancelable:w=!1}={})=>{const S=h.$$.callbacks[m];if(S){const I=Wg(m,g,{cancelable:w});return S.slice().forEach(D=>{D.call(h,I)}),!I.defaultPrevented}return!0}}function Dh(h,m){return Nl().$$.context.set(h,m),m}function uf(h){return Nl().$$.context.get(h)}function Yg(h,m){const g=h.$$.callbacks[m.type];g&&g.slice().forEach(w=>w.call(this,m))}const va=[],Xc=[];let Ta=[];const Tp=[],Jg=Promise.resolve();let bh=!1;function Kg(){bh||(bh=!0,Jg.then(hf))}function wh(h){Ta.push(h)}const _h=new Set;let _a=0;function hf(){if(_a!==0)return;const h=Rl;do{try{for(;_ah.indexOf(w)===-1?m.push(w):g.push(w)),g.forEach(w=>w()),Ta=m}const Vc=new Set;let _o;function Da(){_o={r:0,c:[],p:_o}}function La(){_o.r||wo(_o.c),_o=_o.p}function St(h,m){h&&h.i&&(Vc.delete(h),h.i(m))}function Ot(h,m,g,w){if(h&&h.o){if(Vc.has(h))return;Vc.add(h),_o.c.push(()=>{Vc.delete(h),w&&(g&&h.d(1),w())}),h.o(m)}else w&&w()}function Ep(h){return(h==null?void 0:h.length)!==void 0?h:Array.from(h)}function Lr(h){h&&h.c()}function _r(h,m,g){const{fragment:w,after_update:S}=h.$$;w&&w.m(m,g),wh(()=>{const I=h.$$.on_mount.map(of).filter(Fl);h.$$.on_destroy?h.$$.on_destroy.push(...I):wo(I),h.$$.on_mount=[]}),S.forEach(wh)}function yr(h,m){const g=h.$$;g.fragment!==null&&(Qg(g.after_update),wo(g.on_destroy),g.fragment&&g.fragment.d(m),g.on_destroy=g.fragment=null,g.ctx=[])}function e_(h,m){h.$$.dirty[0]===-1&&(va.push(h),Kg(),h.$$.dirty.fill(0)),h.$$.dirty[m/31|0]|=1<{const ge=me.length?me[0]:he;return k.ctx&&S(k.ctx[$],k.ctx[$]=ge)&&(!k.skip_bound&&k.bound[$]&&k.bound[$](ge),W&&e_(h,$)),he}):[],k.update(),W=!0,wo(k.before_update),k.fragment=w?w(k.ctx):!1,m.target){if(m.hydrate){const $=Xg(m.target);k.fragment&&k.fragment.l($),$.forEach(zt)}else k.fragment&&k.fragment.c();m.intro&&St(h.$$.fragment),_r(h,m.target,m.anchor),hf()}zl(U)}class tn{constructor(){gh(this,"$$");gh(this,"$$set")}$destroy(){yr(this,1),this.$destroy=Pn}$on(m,g){if(!Fl(g))return Pn;const w=this.$$.callbacks[m]||(this.$$.callbacks[m]=[]);return w.push(g),()=>{const S=w.indexOf(g);S!==-1&&w.splice(S,1)}}$set(m){this.$$set&&!qg(m)&&(this.$$.skip_bound=!0,this.$$set(m),this.$$.skip_bound=!1)}}const t_="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(t_);const ya=[];function jc(h,m){return{subscribe:Dr(h,m).subscribe}}function Dr(h,m=Pn){let g;const w=new Set;function S(o){if(Gr(h,o)&&(h=o,g)){const U=!ya.length;for(const k of w)k[1](),ya.push(k,h);if(U){for(let k=0;k{w.delete(k),w.size===0&&g&&(g(),g=null)}}return{set:S,update:I,subscribe:D}}function df(h,m,g){const w=!Array.isArray(h),S=w?[h]:h;if(!S.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const I=m.length<2;return jc(g,(D,o)=>{let U=!1;const k=[];let W=0,$=Pn;const he=()=>{if(W)return;$();const ge=m(w?k[0]:k,D,o);I?D(ge):$=Fl(ge)?ge:Pn},me=S.map((ge,Ze)=>af(ge,Ee=>{k[Ze]=Ee,W&=~(1<{W|=1<{var I;let g=h.get(m.originalEvent);if(g!==void 0)return g;let S=(I=m.target.queryRenderedFeatures(m.point)[0])==null?void 0:I.layer.id;return h.set(m.originalEvent,S),S}}function r_(){return Dh(Lh,{map:Dr(null),source:jc(null),layer:jc(null),popupTarget:jc(null),cluster:Dr(),loadedImages:Dr(new Set),minzoom:Dr(0),maxzoom:Dr(24),layerEvent:Dr(null),eventTopMost:i_()})}function Sp(h){return{subscribe:h.subscribe}}function n_({key:h,setPopupTarget:m=!1,setCluster:g=!1,setMouseEvent:w=!1}){let S=To(),I=Dr(null),D=Sp(I),o={...S,[h]:Sp(I)};if(m&&(o.popupTarget=D),w){let U=Dr(null);o.layerEvent=U,S.layerEvent=U}return g&&(o.cluster=Dr()),Dh(Lh,o),{...S,self:I}}function s_(){return n_({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}var zn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function o_(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}function Rh(h){if(h.__esModule)return h;var m=h.default;if(typeof m=="function"){var g=function w(){return this instanceof w?Reflect.construct(m,arguments,this.constructor):m.apply(this,arguments)};g.prototype=m.prototype}else g={};return Object.defineProperty(g,"__esModule",{value:!0}),Object.keys(h).forEach(function(w){var S=Object.getOwnPropertyDescriptor(h,w);Object.defineProperty(g,w,S.get?S:{enumerable:!0,get:function(){return h[w]}})}),g}var pf={exports:{}};(function(h,m){(function(g,w){h.exports=w()})(zn,function(){var g,w,S;function I(o,U){if(!g)g=U;else if(!w)w=U;else{var k="var sharedChunk = {}; ("+g+")(sharedChunk); ("+w+")(sharedChunk);",W={};g(W),S=U(W),typeof window<"u"&&(S.workerUrl=window.URL.createObjectURL(new Blob([k],{type:"text/javascript"})))}}I(["exports"],function(o){function U(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var k=W;function W(i,e){this.x=i,this.y=e}W.prototype={clone:function(){return new W(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},W.convert=function(i){return i instanceof W?i:Array.isArray(i)?new W(i[0],i[1]):i};var $=U(k),he=me;function me(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}me.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?f=r:_=r,r=.5*(_-f)+f;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var ge=U(he);function Ze(i,e,r,s){const l=new ge(i,e,r,s);return function(p){return l.solve(p)}}const Ee=Ze(.25,.1,.25,1);function Ve(i,e,r){return Math.min(r,Math.max(e,i))}function Ae(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function Se(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let ye=1;function qe(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function Gt(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function wt(i){return Array.isArray(i)?i.map(wt):typeof i=="object"&&i?qe(i,wt):i}const ti={};function ft(i){ti[i]||(typeof console<"u"&&console.warn(i),ti[i]=!0)}function Tt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Ki(i){let e=0;for(let r,s,l=0,p=i.length,f=p-1;lcancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(Vi||(Vi=document.createElement("a")),Vi.href=i,Vi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(wi==null&&(wi=matchMedia("(prefers-reduced-motion: reduce)")),wi.matches)}},Ti={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class hi extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const di=rt()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,ri=i=>Ti.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function Zt(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,cache:i.cache,referrer:di(),signal:r.signal});let l=!1,p=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),p||fetch(s).then(f=>f.ok?(_=>{(i.type==="arrayBuffer"||i.type==="image"?_.arrayBuffer():i.type==="json"?_.json():_.text()).then(x=>{p||(l=!0,e(null,x,_.headers.get("Cache-Control"),_.headers.get("Expires")))}).catch(x=>{p||e(new Error(x.message))})})(f):f.blob().then(_=>e(new hi(f.status,f.statusText,i.url,_)))).catch(f=>{f.code!==20&&e(new Error(f.message))}),{cancel:()=>{p=!0,l||r.abort()}}}const ir=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(rt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!rt())return(ri(i.url)||Zt)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(di())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Zt(i,e);if(rt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const p=new XMLHttpRequest;p.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(p.responseType="arraybuffer");for(const f in s.headers)p.setRequestHeader(f,s.headers[f]);return s.type==="json"&&(p.responseType="text",p.setRequestHeader("Accept","application/json")),p.withCredentials=s.credentials==="include",p.onerror=()=>{l(new Error(p.statusText))},p.onload=()=>{if((p.status>=200&&p.status<300||p.status===0)&&p.response!==null){let f=p.response;if(s.type==="json")try{f=JSON.parse(p.response)}catch(_){return l(_)}l(null,f,p.getResponseHeader("Cache-Control"),p.getResponseHeader("Expires"))}else{const f=new Blob([p.response],{type:p.getResponseHeader("Content-Type")});l(new hi(p.status,p.statusText,s.url,f))}},p.send(s.body),{cancel:()=>p.abort()}}(i,e)},Be=function(i,e){return ir(Se(i,{type:"arrayBuffer"}),e)};function ut(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Xt(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Ei(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class rr{constructor(e,r={}){Se(this,r),this.type=e}}class Rr extends rr{constructor(e,r={}){super("error",Se({error:e},r))}}class Oe{on(e,r){return this._listeners=this._listeners||{},Xt(e,r,this._listeners),this}off(e,r){return Ei(e,r,this._listeners),Ei(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Xt(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new rr(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const _ of l)_.call(this,e);const p=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const _ of p)Ei(s,_,this._oneTimeListeners),_.call(this,e);const f=this._eventedParent;f&&(Se(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),f.fire(e))}else e instanceof Rr&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var fe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},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":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const xr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ds(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return xr.forEach(s=>{s in e&&(r[s]=e[s])}),r}function Ut(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Os=[Dn,De,ht,dt,ji,on,xn,Fi(ot),Ln,Br,Rn];function an(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!an(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Os)if(!an(r,e))return null}}return`Expected ${Wt(i)} but found ${Wt(e)} instead.`}function Z(i,e){return e.some(r=>r.kind===i.kind)}function z(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function R(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const N=.96422,Y=.82521,Q=4/29,oe=6/29,te=3*oe*oe,ee=oe*oe*oe,ae=Math.PI/180,ve=180/Math.PI;function be(i){return(i%=360)<0&&(i+=360),i}function we([i,e,r,s]){let l,p;const f=ct((.2225045*(i=nt(i))+.7168786*(e=nt(e))+.0606169*(r=nt(r)))/1);i===e&&e===r?l=p=f:(l=ct((.4360747*i+.3850649*e+.1430804*r)/N),p=ct((.0139322*i+.0971045*e+.7141733*r)/Y));const _=116*f-16;return[_<0?0:_,500*(l-f),200*(f-p),s]}function nt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function ct(i){return i>ee?Math.pow(i,1/3):i/te+Q}function We([i,e,r,s]){let l=(i+16)/116,p=isNaN(e)?l:l+e/500,f=isNaN(r)?l:l-r/200;return l=1*lt(l),p=N*lt(p),f=Y*lt(f),[$e(3.1338561*p-1.6168667*l-.4906146*f),$e(-.9787684*p+1.9161415*l+.033454*f),$e(.0719453*p-.2289914*l+1.4052427*f),s]}function $e(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function lt(i){return i>oe?i*i*i:te*(i-Q)}function At(i){return parseInt(i.padEnd(2,i),16)/255}function Vt(i,e){return yt(e?i/100:i,0,1)}function yt(i,e,r){return Math.min(Math.max(e,i),r)}function It(i){return!i.some(Number.isNaN)}const sr={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 at{constructor(e,r,s,l=1,p=!0){this.r=e,this.g=r,this.b=s,this.a=l,p||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof at)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=sr[s];if(l){const[f,_,x]=l;return[f/255,_/255,x/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const f=s.length<6?1:2;let _=1;return[At(s.slice(_,_+=f)),At(s.slice(_,_+=f)),At(s.slice(_,_+=f)),At(s.slice(_,_+f)||"ff")]}if(s.startsWith("rgb")){const f=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(f){const[_,x,T,C,P,L,O,F,q,H,K,se]=f,ie=[C||" ",O||" ",H].join("");if(ie===" "||ie===" /"||ie===",,"||ie===",,,"){const le=[T,L,q].join(""),ue=le==="%%%"?100:le===""?255:0;if(ue){const xe=[yt(+x/ue,0,1),yt(+P/ue,0,1),yt(+F/ue,0,1),K?Vt(+K,se):1];if(It(xe))return xe}}return}}const p=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,_,x,T,C,P,L,O,F]=p,q=[x||" ",C||" ",L].join("");if(q===" "||q===" /"||q===",,"||q===",,,"){const H=[+_,yt(+T,0,100),yt(+P,0,100),O?Vt(+O,F):1];if(It(H))return function([K,se,ie,le]){function ue(xe){const Ue=(xe+K/30)%12,Ye=se*Math.min(ie,1-ie);return ie-Ye*Math.max(-1,Math.min(Ue-3,9-Ue,1))}return K=be(K),se/=100,ie/=100,[ue(0),ue(8),ue(4),le]}(H)}}}(e);return r?new at(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,p=l||1/0;return this.overwriteGetter("rgb",[e/p,r/p,s/p,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,p]=we(e),f=Math.sqrt(s*s+l*l);return[Math.round(1e4*f)?be(Math.atan2(l,s)*ve):NaN,f,r,p]}(this.rgb))}get lab(){return this.overwriteGetter("lab",we(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,l]=this.rgb;return`rgba(${[e,r,s].map(p=>Math.round(255*p)).join(",")},${l})`}}at.black=new at(0,0,0,1),at.white=new at(1,1,1,1),at.transparent=new at(0,0,0,0),at.red=new at(1,0,0,1);class Si{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Ni{constructor(e,r,s,l,p){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=p}}class gi{constructor(e){this.sections=e}static fromString(e){return new gi([new Ni(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof gi?e:gi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class br{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof br)return e;if(typeof e=="number")return new br([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new br(e)}}toString(){return JSON.stringify(this.values)}}const nu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class qi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof qi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Io(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof at||i instanceof Si||i instanceof gi||i instanceof br||i instanceof qi||i instanceof Or)return!0;if(Array.isArray(i)){for(const e of i)if(!Io(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Io(i[e]))return!1;return!0}return!1}function _i(i){if(i===null)return Dn;if(typeof i=="string")return ht;if(typeof i=="boolean")return dt;if(typeof i=="number")return De;if(i instanceof at)return ji;if(i instanceof Si)return sn;if(i instanceof gi)return on;if(i instanceof br)return Ln;if(i instanceof qi)return Rn;if(i instanceof Or)return Br;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=_i(s);if(r){if(r===l)continue;r=ot;break}r=l}return Fi(r||ot,e)}return xn}function Bn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof at||i instanceof gi||i instanceof br||i instanceof qi||i instanceof Or?i.toString():JSON.stringify(i)}class Hn{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Io(e[1]))return r.error("invalid value");const s=e[1];let l=_i(s);const p=r.expectedType;return l.kind!=="array"||l.N!==0||!p||p.kind!=="array"||typeof p.N=="number"&&p.N!==0||(l=p),new Hn(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class yi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ao={string:ht,number:De,boolean:dt,object:xn};class Gi{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const p=e[0];if(p==="array"){let _,x;if(e.length>2){const T=e[1];if(typeof T!="string"||!(T in Ao)||T==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);_=Ao[T],l++}else _=ot;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);x=e[2],l++}s=Fi(_,x)}else{if(!Ao[p])throw new Error(`Types doesn't contain name = ${p}`);s=Ao[p]}const f=[];for(;le.outputDefined())}}const Co={"to-boolean":dt,"to-color":ji,"to-number":De,"to-string":ht};class ln{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!Co[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=Co[s],p=[];for(let f=1;f4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ql(r[0],r[1],r[2],r[3]),!s))return new at(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new yi(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(e);const l=br.parse(r);if(l)return l}throw new yi(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(e);const l=qi.parse(r);if(l)return l}throw new yi(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new yi(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return gi.fromString(Bn(this.args[0].evaluate(e)));case"resolvedImage":return Or.fromString(Bn(this.args[0].evaluate(e)));default:return Bn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Fs=["Unknown","Point","LineString","Polygon"];class Ft{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"?Fs[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=at.parse(e)),r}}class ko{constructor(e,r,s=[],l,p=new vn,f=[]){this.registry=e,this.path=s,this.key=s.map(_=>`[${_}]`).join(""),this.scope=p,this.errors=f,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,p={}){return r?this.concat(r,s,l)._parse(e,p):this._parse(e,p)}_parse(e,r){function s(l,p,f){return f==="assert"?new Gi(p,[l]):f==="coerce"?new ln(p,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const p=this.registry[l];if(p){let f=p.parse(e,this);if(!f)return null;if(this.expectedType){const _=this.expectedType,x=f.type;if(_.kind!=="string"&&_.kind!=="number"&&_.kind!=="boolean"&&_.kind!=="object"&&_.kind!=="array"||x.kind!=="value")if(_.kind!=="color"&&_.kind!=="formatted"&&_.kind!=="resolvedImage"||x.kind!=="value"&&x.kind!=="string")if(_.kind!=="padding"||x.kind!=="value"&&x.kind!=="number"&&x.kind!=="array")if(_.kind!=="variableAnchorOffsetCollection"||x.kind!=="value"&&x.kind!=="array"){if(this.checkSubtype(_,x))return null}else f=s(f,_,r.typeAnnotation||"coerce");else f=s(f,_,r.typeAnnotation||"coerce");else f=s(f,_,r.typeAnnotation||"coerce");else f=s(f,_,r.typeAnnotation||"assert")}if(!(f instanceof Hn)&&f.type.kind!=="resolvedImage"&&this._isConstant(f)){const _=new Ft;try{f=new Hn(f.type,f.evaluate(_))}catch(x){return this.error(x.message),null}}return f}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,p=s?this.scope.concat(s):this.scope;return new ko(this.registry,this._isConstant,l,r||null,p,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new nr(s,e))}checkSubtype(e,r){const s=an(e,r);return s&&this.error(s),s}}class fs{constructor(e,r,s){this.type=sn,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,dt);if(!l)return null;const p=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,dt);if(!p)return null;let f=null;return s.locale&&(f=r.parse(s.locale,1,ht),!f)?null:new fs(l,p,f)}evaluate(e){return new Si(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const On=8192;function Mo(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Ns(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function su(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*On),Math.round(s*l*On)]}function Gl(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],p=i[0]-r[0],f=i[1]-r[1];return s*f-p*l==0&&s*p<=0&&l*f<=0}function Po(i,e){let r=!1;for(let f=0,_=e.length;f<_;f++){const x=e[f];for(let T=0,C=x.length;T(s=i)[1]!=(p=x[T+1])[1]>s[1]&&s[0]<(p[0]-l[0])*(s[1]-l[1])/(p[1]-l[1])+l[0]&&(r=!r)}}var s,l,p;return r}function ou(i,e){for(let r=0;r0&&_<0||f<0&&_>0}function au(i,e,r){for(const T of r)for(let C=0;Cr[2]){const l=.5*s;let p=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;p===0&&(p=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=p}Mo(e,i)}function Do(i,e,r,s){const l=Math.pow(2,s.z)*On,p=[s.x*On,s.y*On],f=[];for(const _ of i)for(const x of _){const T=[x.x+p[0],x.y+p[1]];Yl(T,e,r,l),f.push(T)}return f}function Jl(i,e,r,s){const l=Math.pow(2,s.z)*On,p=[s.x*On,s.y*On],f=[];for(const x of i){const T=[];for(const C of x){const P=[C.x+p[0],C.y+p[1]];Mo(e,P),T.push(P)}f.push(T)}if(e[2]-e[0]<=l/2){(_=e)[0]=_[1]=1/0,_[2]=_[3]=-1/0;for(const x of f)for(const T of x)Yl(T,e,r,l)}var _;return f}class Yn{constructor(e,r){this.type=dt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Io(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l!Array.isArray(T)||T.length===e.length-1);let x=null;for(const[T,C]of _){x=new ko(r.registry,Us,r.path,null,r.scope);const P=[];let L=!1;for(let O=1;O{return L=P,Array.isArray(L)?`(${L.map(Wt).join(", ")})`:`(${Wt(L.type)}...)`;var L}).join(" | "),C=[];for(let P=1;P{r=e?r&&Us(s):r&&s instanceof Hn}),!!r&&Ro(i)&&js(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ro(i){if(i instanceof wr&&(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 Yn)return!1;let e=!0;return i.eachChild(r=>{e&&!Ro(r)&&(e=!1)}),e}function Vs(i){if(i instanceof wr&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Vs(r)&&(e=!1)}),e}function js(i,e){if(i instanceof wr&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!js(s,e)&&(r=!1)}),r}function qs(i,e){const r=i.length-1;let s,l,p=0,f=r,_=0;for(;p<=f;)if(_=Math.floor((p+f)/2),s=i[_],l=i[_+1],s<=e){if(_===r||ee))throw new yi("Input is not a number.");f=_-1}return 0}class Gs{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,p]of s)this.labels.push(l),this.outputs.push(p)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,De);if(!s)return null;const l=[];let p=null;r.expectedType&&r.expectedType.kind!=="value"&&(p=r.expectedType);for(let f=1;f=_)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);const P=r.parse(x,C,p);if(!P)return null;p=p||P.type,l.push([_,P])}return new Gs(p,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const p=r.length;return l>=r[p-1]?s[p-1].evaluate(e):s[qs(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Jn(i,e,r){return i+r*(e-i)}function Bo(i,e,r){return i.map((s,l)=>Jn(s,e[l],r))}const Tr={number:Jn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,p,f,_]=Bo(i.rgb,e.rgb,r);return new at(l,p,f,_,!1)}case"hcl":{const[l,p,f,_]=i.hcl,[x,T,C,P]=e.hcl;let L,O;if(isNaN(l)||isNaN(x))isNaN(l)?isNaN(x)?L=NaN:(L=x,f!==1&&f!==0||(O=T)):(L=l,C!==1&&C!==0||(O=p));else{let se=x-l;x>l&&se>180?se-=360:x180&&(se+=360),L=l+r*se}const[F,q,H,K]=function([se,ie,le,ue]){return se=isNaN(se)?0:se*ae,We([le,Math.cos(se)*ie,Math.sin(se)*ie,ue])}([L,O??Jn(p,T,r),Jn(f,C,r),Jn(_,P,r)]);return new at(F,q,H,K,!1)}case"lab":{const[l,p,f,_]=We(Bo(i.lab,e.lab,r));return new at(l,p,f,_,!1)}}},array:Bo,padding:function(i,e,r){return new br(Bo(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const s=i.values,l=e.values;if(s.length!==l.length)throw new yi(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const p=[];for(let f=0;ftypeof C!="number"||C<0||C>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:T}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(p=r.parse(p,2,De),!p)return null;const _=[];let x=null;s==="interpolate-hcl"||s==="interpolate-lab"?x=ji:r.expectedType&&r.expectedType.kind!=="value"&&(x=r.expectedType);for(let T=0;T=C)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',L);const F=r.parse(P,O,x);if(!F)return null;x=x||F.type,_.push([C,F])}return R(x,De)||R(x,ji)||R(x,Ln)||R(x,Rn)||R(x,Fi(De))?new Er(x,s,l,p,_):r.error(`Type ${Wt(x)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const p=r.length;if(l>=r[p-1])return s[p-1].evaluate(e);const f=qs(r,l),_=Er.interpolationFactor(this.interpolation,l,r[f],r[f+1]),x=s[f].evaluate(e),T=s[f+1].evaluate(e);switch(this.operator){case"interpolate":return Tr[this.type.kind](x,T,_);case"interpolate-hcl":return Tr.color(x,T,_,"hcl");case"interpolate-lab":return Tr.color(x,T,_,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Oa(i,e,r,s){const l=s-r,p=i-r;return l===0?0:e===1?p/l:(Math.pow(e,p)-1)/(Math.pow(e,l)-1)}class Oo{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const p=[];for(const _ of e.slice(1)){const x=r.parse(_,1+p.length,s,void 0,{typeAnnotation:"omit"});if(!x)return null;s=s||x.type,p.push(x)}if(!s)throw new Error("No output type");const f=l&&p.some(_=>an(l,_.type));return new Oo(f?ot:s,p)}evaluate(e){let r,s=null,l=0;for(const p of this.args)if(l++,s=p.evaluate(e),s&&s instanceof Or&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ms{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let p=1;p=s.length)throw new yi(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new yi(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Mt{constructor(e,r){this.type=dt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,ot),l=r.parse(e[2],2,ot);return s&&l?Z(s.type,[dt,ht,De,Dn,ot])?new Mt(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Wt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!z(r,["boolean","string","number","null"]))throw new yi(`Expected first argument to be of type boolean, string, number or null, but found ${Wt(_i(r))} instead.`);if(!z(s,["string","array"]))throw new yi(`Expected second argument to be of type array or string, but found ${Wt(_i(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Fo{constructor(e,r,s){this.type=De,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,ot),l=r.parse(e[2],2,ot);if(!s||!l)return null;if(!Z(s.type,[dt,ht,De,Dn,ot]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Wt(s.type)} instead`);if(e.length===4){const p=r.parse(e[3],3,De);return p?new Fo(s,l,p):null}return new Fo(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!z(r,["boolean","string","number","null"]))throw new yi(`Expected first argument to be of type boolean, string, number or null, but found ${Wt(_i(r))} instead.`);if(!z(s,["string","array"]))throw new yi(`Expected second argument to be of type array or string, but found ${Wt(_i(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Fa{constructor(e,r,s,l,p,f){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=p,this.otherwise=f}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const p={},f=[];for(let T=2;TNumber.MAX_SAFE_INTEGER)return L.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof F=="number"&&Math.floor(F)!==F)return L.error("Numeric branch labels must be integer values.");if(s){if(L.checkSubtype(s,_i(F)))return null}else s=_i(F);if(p[String(F)]!==void 0)return L.error("Branch labels must be unique.");p[String(F)]=f.length}const O=r.parse(P,T,l);if(!O)return null;l=l||O.type,f.push(O)}const _=r.parse(e[1],1,ot);if(!_)return null;const x=r.parse(e[e.length-1],e.length-1,l);return x?_.type.kind!=="value"&&r.concat(1).checkSubtype(s,_.type)?null:new Fa(s,l,_,p,f,x):null}evaluate(e){const r=this.input.evaluate(e);return(_i(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Na{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let f=1;fr.outputDefined())&&this.otherwise.outputDefined()}}class No{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,ot),l=r.parse(e[2],2,De);if(!s||!l)return null;if(!Z(s.type,[Fi(ot),ht,ot]))return r.error(`Expected first argument to be of type array or string, but found ${Wt(s.type)} instead`);if(e.length===4){const p=r.parse(e[3],3,De);return p?new No(s.type,s,l,p):null}return new No(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!z(r,["string","array"]))throw new yi(`Expected first argument to be of type array or string, but found ${Wt(_i(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Kl(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function $l(i,e,r,s){return s.compare(e,r)===0}function _s(i,e,r){const s=i!=="=="&&i!=="!=";return class ff{constructor(p,f,_){this.type=dt,this.lhs=p,this.rhs=f,this.collator=_,this.hasUntypedArgument=p.type.kind==="value"||f.type.kind==="value"}static parse(p,f){if(p.length!==3&&p.length!==4)return f.error("Expected two or three arguments.");const _=p[0];let x=f.parse(p[1],1,ot);if(!x)return null;if(!Kl(_,x.type))return f.concat(1).error(`"${_}" comparisons are not supported for type '${Wt(x.type)}'.`);let T=f.parse(p[2],2,ot);if(!T)return null;if(!Kl(_,T.type))return f.concat(2).error(`"${_}" comparisons are not supported for type '${Wt(T.type)}'.`);if(x.type.kind!==T.type.kind&&x.type.kind!=="value"&&T.type.kind!=="value")return f.error(`Cannot compare types '${Wt(x.type)}' and '${Wt(T.type)}'.`);s&&(x.type.kind==="value"&&T.type.kind!=="value"?x=new Gi(T.type,[x]):x.type.kind!=="value"&&T.type.kind==="value"&&(T=new Gi(x.type,[T])));let C=null;if(p.length===4){if(x.type.kind!=="string"&&T.type.kind!=="string"&&x.type.kind!=="value"&&T.type.kind!=="value")return f.error("Cannot use collator to compare non-string types.");if(C=f.parse(p[3],3,sn),!C)return null}return new ff(x,T,C)}evaluate(p){const f=this.lhs.evaluate(p),_=this.rhs.evaluate(p);if(s&&this.hasUntypedArgument){const x=_i(f),T=_i(_);if(x.kind!==T.kind||x.kind!=="string"&&x.kind!=="number")throw new yi(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${x.kind}, ${T.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const x=_i(f),T=_i(_);if(x.kind!=="string"||T.kind!=="string")return e(p,f,_)}return this.collator?r(p,f,_,this.collator.evaluate(p)):e(p,f,_)}eachChild(p){p(this.lhs),p(this.rhs),this.collator&&p(this.collator)}outputDefined(){return!0}}}const lu=_s("==",function(i,e,r){return e===r},$l),cu=_s("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!$l(0,e,r,s)}),uu=_s("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),du=_s("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),pu=_s(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ua{constructor(e,r,s,l,p){this.type=ht,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=p}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,De);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let p=null;if(l.locale&&(p=r.parse(l.locale,1,ht),!p))return null;let f=null;if(l.currency&&(f=r.parse(l.currency,1,ht),!f))return null;let _=null;if(l["min-fraction-digits"]&&(_=r.parse(l["min-fraction-digits"],1,De),!_))return null;let x=null;return l["max-fraction-digits"]&&(x=r.parse(l["max-fraction-digits"],1,De),!x)?null:new Ua(s,p,f,_,x)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Uo{constructor(e){this.type=on,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let p=!1;for(let f=1;f<=e.length-1;++f){const _=e[f];if(p&&typeof _=="object"&&!Array.isArray(_)){p=!1;let x=null;if(_["font-scale"]&&(x=r.parse(_["font-scale"],1,De),!x))return null;let T=null;if(_["text-font"]&&(T=r.parse(_["text-font"],1,Fi(ht)),!T))return null;let C=null;if(_["text-color"]&&(C=r.parse(_["text-color"],1,ji),!C))return null;const P=l[l.length-1];P.scale=x,P.font=T,P.textColor=C}else{const x=r.parse(e[f],1,ot);if(!x)return null;const T=x.type.kind;if(T!=="string"&&T!=="value"&&T!=="null"&&T!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");p=!0,l.push({content:x,scale:null,font:null,textColor:null})}}return new Uo(l)}evaluate(e){return new gi(this.sections.map(r=>{const s=r.content.evaluate(e);return _i(s)===Br?new Ni("",s,null,null,null):new Ni(Bn(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Va{constructor(e){this.type=Br,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,ht);return s?new Va(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=Or.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class ja{constructor(e){this.type=De,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Wt(s.type)} instead.`):new ja(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new yi(`Expected value to be of type string or array, but found ${Wt(_i(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ys={"==":lu,"!=":cu,">":hu,"<":uu,">=":pu,"<=":du,array:Gi,at:gs,boolean:Gi,case:Na,coalesce:Oo,collator:fs,format:Uo,image:Va,in:Mt,"index-of":Fo,interpolate:Er,"interpolate-hcl":Er,"interpolate-lab":Er,length:ja,let:ms,literal:Hn,match:Fa,number:Gi,"number-format":Ua,object:Gi,slice:No,step:Gs,string:Gi,"to-boolean":ln,"to-color":ln,"to-number":ln,"to-string":ln,var:Lo,within:Yn};function Ql(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const p=l?l.evaluate(i):1,f=ql(e,r,s,p);if(f)throw new yi(f);return new at(e/255,r/255,s/255,p,!1)}function ec(i,e){return i in e}function qa(i,e){const r=e[i];return r===void 0?null:r}function Kn(i){return{type:i}}function tc(i){return{result:"success",value:i}}function vs(i){return{result:"error",value:i}}function xs(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function ic(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ga(i){return!!i.expression&&i.expression.interpolated}function Dt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Vo(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function fu(i){return i}function rc(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),p=i.type||(Ga(e)?"exponential":"interval");if(r||e.type==="padding"){const C=r?at.parse:br.parse;(i=$i({},i)).stops&&(i.stops=i.stops.map(P=>[P[0],C(P[1])])),i.default=C(i.default?i.default:e.default)}if(i.colorSpace&&(f=i.colorSpace)!=="rgb"&&f!=="hcl"&&f!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var f;let _,x,T;if(p==="exponential")_=nc;else if(p==="interval")_=gu;else if(p==="categorical"){_=mu,x=Object.create(null);for(const C of i.stops)x[C[0]]=C[1];T=typeof i.stops[0][0]}else{if(p!=="identity")throw new Error(`Unknown function type "${p}"`);_=_u}if(s){const C={},P=[];for(let F=0;FF[0]),evaluate:({zoom:F},q)=>nc({stops:L,base:i.base},e,F).evaluate(F,q)}}if(l){const C=p==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:C,interpolationFactor:Er.interpolationFactor.bind(void 0,C),zoomStops:i.stops.map(P=>P[0]),evaluate:({zoom:P})=>_(i,e,P,x,T)}}return{kind:"source",evaluate(C,P){const L=P&&P.properties?P.properties[i.property]:void 0;return L===void 0?$n(i.default,e.default):_(i,e,L,x,T)}}}function $n(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function mu(i,e,r,s,l){return $n(typeof r===l?s[r]:void 0,i.default,e.default)}function gu(i,e,r){if(Dt(r)!=="number")return $n(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=qs(i.stops.map(p=>p[0]),r);return i.stops[l][1]}function nc(i,e,r){const s=i.base!==void 0?i.base:1;if(Dt(r)!=="number")return $n(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const p=qs(i.stops.map(C=>C[0]),r),f=function(C,P,L,O){const F=O-L,q=C-L;return F===0?0:P===1?q/F:(Math.pow(P,q)-1)/(Math.pow(P,F)-1)}(r,s,i.stops[p][0],i.stops[p+1][0]),_=i.stops[p][1],x=i.stops[p+1][1],T=Tr[e.type]||fu;return typeof _.evaluate=="function"?{evaluate(...C){const P=_.evaluate.apply(void 0,C),L=x.evaluate.apply(void 0,C);if(P!==void 0&&L!==void 0)return T(P,L,f,i.colorSpace)}}:T(_,x,f,i.colorSpace)}function _u(i,e,r){switch(e.type){case"color":r=at.parse(r);break;case"formatted":r=gi.fromString(r.toString());break;case"resolvedImage":r=Or.fromString(r.toString());break;case"padding":r=br.parse(r);break;default:Dt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return $n(r,i.default,e.default)}wr.register(ys,{error:[{kind:"error"},[ht],(i,[e])=>{throw new yi(e.evaluate(i))}],typeof:[ht,[ot],(i,[e])=>Wt(_i(e.evaluate(i)))],"to-rgba":[Fi(De,4),[ji],(i,[e])=>{const[r,s,l,p]=e.evaluate(i).rgb;return[255*r,255*s,255*l,p]}],rgb:[ji,[De,De,De],Ql],rgba:[ji,[De,De,De,De],Ql],has:{type:dt,overloads:[[[ht],(i,[e])=>ec(e.evaluate(i),i.properties())],[[ht,xn],(i,[e,r])=>ec(e.evaluate(i),r.evaluate(i))]]},get:{type:ot,overloads:[[[ht],(i,[e])=>qa(e.evaluate(i),i.properties())],[[ht,xn],(i,[e,r])=>qa(e.evaluate(i),r.evaluate(i))]]},"feature-state":[ot,[ht],(i,[e])=>qa(e.evaluate(i),i.featureState||{})],properties:[xn,[],i=>i.properties()],"geometry-type":[ht,[],i=>i.geometryType()],id:[ot,[],i=>i.id()],zoom:[De,[],i=>i.globals.zoom],"heatmap-density":[De,[],i=>i.globals.heatmapDensity||0],"line-progress":[De,[],i=>i.globals.lineProgress||0],accumulated:[ot,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[De,Kn(De),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[De,Kn(De),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:De,overloads:[[[De,De],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[De],(i,[e])=>-e.evaluate(i)]]},"/":[De,[De,De],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[De,[De,De],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[De,[],()=>Math.LN2],pi:[De,[],()=>Math.PI],e:[De,[],()=>Math.E],"^":[De,[De,De],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[De,[De],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[De,[De],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[De,[De],(i,[e])=>Math.log(e.evaluate(i))],log2:[De,[De],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[De,[De],(i,[e])=>Math.sin(e.evaluate(i))],cos:[De,[De],(i,[e])=>Math.cos(e.evaluate(i))],tan:[De,[De],(i,[e])=>Math.tan(e.evaluate(i))],asin:[De,[De],(i,[e])=>Math.asin(e.evaluate(i))],acos:[De,[De],(i,[e])=>Math.acos(e.evaluate(i))],atan:[De,[De],(i,[e])=>Math.atan(e.evaluate(i))],min:[De,Kn(De),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[De,Kn(De),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[De,[De],(i,[e])=>Math.abs(e.evaluate(i))],round:[De,[De],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[De,[De],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[De,[De],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[dt,[ht,ot],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[dt,[ot],(i,[e])=>i.id()===e.value],"filter-type-==":[dt,[ht],(i,[e])=>i.geometryType()===e.value],"filter-<":[dt,[ht,ot],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s{const r=i.id(),s=e.value;return typeof r==typeof s&&r":[dt,[ht,ot],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[dt,[ot],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[dt,[ht,ot],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[dt,[ot],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[dt,[ht,ot],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[dt,[ot],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[dt,[ot],(i,[e])=>e.value in i.properties()],"filter-has-id":[dt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[dt,[Fi(ht)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[dt,[Fi(ot)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[dt,[ht,Fi(ot)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[dt,[ht,Fi(ot)],(i,[e,r])=>function(s,l,p,f){for(;p<=f;){const _=p+f>>1;if(l[_]===s)return!0;l[_]>s?f=_-1:p=_+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Kn(dt),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:dt,overloads:[[[dt,dt],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Kn(dt),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[dt,[dt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[dt,[ht],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[ht,[ht],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ht,[ht],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ht,Kn(ot),(i,e)=>e.map(r=>Bn(r.evaluate(i))).join("")],"resolved-locale":[ht,[sn],(i,[e])=>e.evaluate(i).resolvedLocale()]});class li{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new Ft,this._defaultValue=r?(s=r).type==="color"&&Vo(s.default)?new at(0,0,0,0):s.type==="color"?at.parse(s.default)||null:s.type==="padding"?br.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?qi.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,p,f){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=f,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,p,f){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=f||null;try{const _=this.expression.evaluate(this._evaluator);if(_==null||typeof _=="number"&&_!=_)return this._defaultValue;if(this._enumValues&&!(_ in this._enumValues))throw new yi(`Expected value to be one of ${Object.keys(this._enumValues).map(x=>JSON.stringify(x)).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(_.message)),this._defaultValue}}}function jo(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ys}function vt(i,e){const r=new ko(ys,Us,[],e?function(l){const p={color:ji,string:ht,number:De,enum:ht,boolean:dt,formatted:on,padding:Ln,resolvedImage:Br,variableAnchorOffsetCollection:Rn};return l.type==="array"?Fi(p[l.value]||ot,l.length):p[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?tc(new li(s,e)):vs(r.errors)}class Zs{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Vs(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,p,f){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,p,f)}evaluate(e,r,s,l,p,f){return this._styleExpression.evaluate(e,r,s,l,p,f)}}class Yt{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Vs(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,p,f){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,p,f)}evaluate(e,r,s,l,p,f){return this._styleExpression.evaluate(e,r,s,l,p,f)}interpolationFactor(e,r,s){return this.interpolationType?Er.interpolationFactor(this.interpolationType,e,r,s):0}}function Jt(i,e){const r=vt(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Ro(s);if(!l&&!xs(e))return vs([new nr("","data expressions not supported")]);const p=js(s,["zoom"]);if(!p&&!ic(e))return vs([new nr("","zoom expressions not supported")]);const f=Xs(s);return f||p?f instanceof nr?vs([f]):f instanceof Er&&!Ga(e)?vs([new nr("",'"interpolate" expressions cannot be used with this property')]):tc(f?new Yt(l?"camera":"composite",r.value,f.labels,f instanceof Er?f.interpolation:void 0):new Zs(l?"constant":"source",r.value)):vs([new nr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Qn{constructor(e,r){this._parameters=e,this._specification=r,$i(this,rc(this._parameters,this._specification))}static deserialize(e){return new Qn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Xs(i){let e=null;if(i instanceof ms)e=Xs(i.result);else if(i instanceof Oo){for(const r of i.args)if(e=Xs(r),e)break}else(i instanceof Gs||i instanceof Er)&&i.input instanceof wr&&i.input.name==="zoom"&&(e=i);return e instanceof nr||i.eachChild(r=>{const s=Xs(r);s instanceof nr?e=s:!e&&s?e=new nr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new nr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Za(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Za(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const yu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Xa(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Za(i)||(i=Ws(i));const e=vt(i,yu);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:Wa(i)}}function vu(i,e){return ie?1:0}function Wa(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?qo(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Ws))):e==="all"?["all"].concat(i.slice(1).map(Ws)):e==="none"?["all"].concat(i.slice(1).map(Ws).map(Zo)):e==="in"?Ha(i[1],i.slice(2)):e==="!in"?Zo(Ha(i[1],i.slice(2))):e==="has"?Go(i[1]):e==="!has"?Zo(Go(i[1])):e!=="within"||i;var r}function qo(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Ha(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(vu)]]:["filter-in-small",i,["literal",e]]}}function Go(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Zo(i){return["!",i]}function Ya(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const p of i)l+=`${Ya(p)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;ls.maximum?[new Pe(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Ka(i){const e=i.valueSpec,r=pi(i.value.type);let s,l,p,f={};const _=r!=="categorical"&&i.value.property===void 0,x=!_,T=Dt(i.value.stops)==="array"&&Dt(i.value.stops[0])==="array"&&Dt(i.value.stops[0][0])==="object",C=Fr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(O){if(r==="identity")return[new Pe(O.key,O.value,'identity function may not have a "stops" property')];let F=[];const q=O.value;return F=F.concat(Ja({key:O.key,value:q,valueSpec:O.valueSpec,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:P})),Dt(q)==="array"&&q.length===0&&F.push(new Pe(O.key,q,"array must have at least one stop")),F},default:function(O){return O.validateSpec({key:O.key,value:O.value,valueSpec:e,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&_&&C.push(new Pe(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||C.push(new Pe(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ga(i.valueSpec)&&C.push(new Pe(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(x&&!xs(i.valueSpec)?C.push(new Pe(i.key,i.value,"property functions not supported")):_&&!ic(i.valueSpec)&&C.push(new Pe(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!T||i.value.property!==void 0||C.push(new Pe(i.key,i.value,'"property" property is required')),C;function P(O){let F=[];const q=O.value,H=O.key;if(Dt(q)!=="array")return[new Pe(H,q,`array expected, ${Dt(q)} found`)];if(q.length!==2)return[new Pe(H,q,`array length 2 expected, length ${q.length} found`)];if(T){if(Dt(q[0])!=="object")return[new Pe(H,q,`object expected, ${Dt(q[0])} found`)];if(q[0].zoom===void 0)return[new Pe(H,q,"object stop key must have zoom")];if(q[0].value===void 0)return[new Pe(H,q,"object stop key must have value")];if(p&&p>pi(q[0].zoom))return[new Pe(H,q[0].zoom,"stop zoom values must appear in ascending order")];pi(q[0].zoom)!==p&&(p=pi(q[0].zoom),l=void 0,f={}),F=F.concat(Fr({key:`${H}[0]`,value:q[0],valueSpec:{zoom:{}},validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:Xo,value:L}}))}else F=F.concat(L({key:`${H}[0]`,value:q[0],valueSpec:{},validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec},q));return jo(es(q[1]))?F.concat([new Pe(`${H}[1]`,q[1],"expressions are not allowed in function stops.")]):F.concat(O.validateSpec({key:`${H}[1]`,value:q[1],valueSpec:e,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec}))}function L(O,F){const q=Dt(O.value),H=pi(O.value),K=O.value!==null?O.value:F;if(s){if(q!==s)return[new Pe(O.key,K,`${q} stop domain type must match previous stop domain type ${s}`)]}else s=q;if(q!=="number"&&q!=="string"&&q!=="boolean")return[new Pe(O.key,K,"stop domain value must be a number, string, or boolean")];if(q!=="number"&&r!=="categorical"){let se=`number expected, ${q} found`;return xs(e)&&r===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Pe(O.key,K,se)]}return r!=="categorical"||q!=="number"||isFinite(H)&&Math.floor(H)===H?r!=="categorical"&&q==="number"&&l!==void 0&&Hnew Pe(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Pe(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Vs(r))return[new Pe(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Vs(r))return[new Pe(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!js(r,["zoom","feature-state"]))return[new Pe(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Ro(r))return[new Pe(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Hs(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(pi(r))===-1&&l.push(new Pe(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(pi(r))===-1&&l.push(new Pe(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Wo(i){return Za(es(i.value))?bn($i({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):oc(i)}function oc(i){const e=i.value,r=i.key;if(Dt(e)!=="array")return[new Pe(r,e,`array expected, ${Dt(e)} found`)];const s=i.styleSpec;let l,p=[];if(e.length<1)return[new Pe(r,e,"filter array must have at least 1 element")];switch(p=p.concat(Hs({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),pi(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&pi(e[1])==="$type"&&p.push(new Pe(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&p.push(new Pe(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=Dt(e[1]),l!=="string"&&p.push(new Pe(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let f=2;f{T in r&&e.push(new Pe(s,r[T],`"${T}" is prohibited for ref layers`))}),l.layers.forEach(T=>{pi(T.id)===_&&(x=T)}),x?x.ref?e.push(new Pe(s,r.ref,"ref cannot reference another ref layer")):f=pi(x.type):e.push(new Pe(s,r.ref,`ref layer "${_}" not found`))}else if(f!=="background")if(r.source){const x=l.sources&&l.sources[r.source],T=x&&pi(x.type);x?T==="vector"&&f==="raster"?e.push(new Pe(s,r.source,`layer "${r.id}" requires a raster source`)):T!=="raster-dem"&&f==="hillshade"?e.push(new Pe(s,r.source,`layer "${r.id}" requires a raster-dem source`)):T==="raster"&&f!=="raster"?e.push(new Pe(s,r.source,`layer "${r.id}" requires a vector source`)):T!=="vector"||r["source-layer"]?T==="raster-dem"&&f!=="hillshade"?e.push(new Pe(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):f!=="line"||!r.paint||!r.paint["line-gradient"]||T==="geojson"&&x.lineMetrics||e.push(new Pe(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Pe(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Pe(s,r.source,`source "${r.source}" not found`))}else e.push(new Pe(s,r,'missing required property "source"'));return e=e.concat(Fr({key:s,value:r,valueSpec:p.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:p.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Wo,layout:x=>Fr({layer:r,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":T=>Yo($i({layerType:f},T))}}),paint:x=>Fr({layer:r,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":T=>Ys($i({layerType:f},T))}})}})),e}function Fn(i){const e=i.value,r=i.key,s=Dt(e);return s!=="string"?[new Pe(r,e,`string expected, ${s} found`)]:[]}const ac={promoteId:function({key:i,value:e}){if(Dt(e)==="string")return Fn({key:i,value:e});{const r=[];for(const s in e)r.push(...Fn({key:`${i}.${s}`,value:e[s]}));return r}}};function Js(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,p=i.validateSpec;if(!e.type)return[new Pe(r,e,'"type" is required')];const f=pi(e.type);let _;switch(f){case"vector":case"raster":return _=Fr({key:r,value:e,valueSpec:s[`source_${f.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:ac,validateSpec:p}),_;case"raster-dem":return _=function(x){var T;const C=(T=x.sourceName)!==null&&T!==void 0?T:"",P=x.value,L=x.styleSpec,O=L.source_raster_dem,F=x.style;let q=[];const H=Dt(P);if(P===void 0)return q;if(H!=="object")return q.push(new Pe("source_raster_dem",P,`object expected, ${H} found`)),q;const K=pi(P.encoding)==="custom",se=["redFactor","greenFactor","blueFactor","baseShift"],ie=x.value.encoding?`"${x.value.encoding}"`:"Default";for(const le in P)!K&&se.includes(le)?q.push(new Pe(le,P[le],`In "${C}": "${le}" is only valid when "encoding" is set to "custom". ${ie} encoding found`)):O[le]?q=q.concat(x.validateSpec({key:le,value:P[le],valueSpec:O[le],validateSpec:x.validateSpec,style:F,styleSpec:L})):q.push(new Pe(le,P[le],`unknown property "${le}"`));return q}({sourceName:r,value:e,style:i.style,styleSpec:s,validateSpec:p}),_;case"geojson":if(_=Fr({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:p,objectElementValidators:ac}),e.cluster)for(const x in e.clusterProperties){const[T,C]=e.clusterProperties[x],P=typeof T=="string"?[T,["accumulated"],["get",x]]:T;_.push(...bn({key:`${r}.${x}.map`,value:C,validateSpec:p,expressionContext:"cluster-map"})),_.push(...bn({key:`${r}.${x}.reduce`,value:P,validateSpec:p,expressionContext:"cluster-reduce"}))}return _;case"video":return Fr({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:p,styleSpec:s});case"image":return Fr({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:p,styleSpec:s});case"canvas":return[new Pe(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Hs({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:p,styleSpec:s})}}function lc(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let p=[];const f=Dt(e);if(e===void 0)return p;if(f!=="object")return p=p.concat([new Pe("light",e,`object expected, ${f} found`)]),p;for(const _ in e){const x=_.match(/^(.*)-transition$/);p=p.concat(x&&s[x[1]]&&s[x[1]].transition?i.validateSpec({key:_,value:e[_],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[_]?i.validateSpec({key:_,value:e[_],valueSpec:s[_],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Pe(_,e[_],`unknown property "${_}"`)])}return p}function cc(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let p=[];const f=Dt(e);if(e===void 0)return p;if(f!=="object")return p=p.concat([new Pe("terrain",e,`object expected, ${f} found`)]),p;for(const _ in e)p=p.concat(s[_]?i.validateSpec({key:_,value:e[_],valueSpec:s[_],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Pe(_,e[_],`unknown property "${_}"`)]);return p}function uc(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],p=[];for(const f in r)r[f].id&&l.includes(r[f].id)&&e.push(new Pe(s,r,`all the sprites' ids must be unique, but ${r[f].id} is duplicated`)),l.push(r[f].id),r[f].url&&p.includes(r[f].url)&&e.push(new Pe(s,r,`all the sprites' URLs must be unique, but ${r[f].url} is duplicated`)),p.push(r[f].url),e=e.concat(Fr({key:`${s}[${f}]`,value:r[f],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Fn({key:s,value:r})}const hc={"*":()=>[],array:Ja,boolean:function(i){const e=i.value,r=i.key,s=Dt(e);return s!=="boolean"?[new Pe(r,e,`boolean expected, ${s} found`)]:[]},number:Xo,color:function(i){const e=i.key,r=i.value,s=Dt(r);return s!=="string"?[new Pe(e,r,`color expected, ${s} found`)]:at.parse(String(r))?[]:[new Pe(e,r,`color expected, "${r}" found`)]},constants:sc,enum:Hs,filter:Wo,function:Ka,layer:Jo,object:Fr,source:Js,light:lc,terrain:cc,string:Fn,formatted:function(i){return Fn(i).length===0?[]:bn(i)},resolvedImage:function(i){return Fn(i).length===0?[]:bn(i)},padding:function(i){const e=i.key,r=i.value;if(Dt(r)==="array"){if(r.length<1||r.length>4)return[new Pe(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let p=0;p[]}})),i.constants&&(r=r.concat(sc({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Ks}))),Qs(r)}function Ii(i){return function(e){return i({...e,validateSpec:Ks})}}function Qs(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function wn(i){return function(...e){return Qs(i.apply(this,e))}}Sr.source=wn(Ii(Js)),Sr.sprite=wn(Ii(uc)),Sr.glyphs=wn(Ii($s)),Sr.light=wn(Ii(lc)),Sr.terrain=wn(Ii(cc)),Sr.layer=wn(Ii(Jo)),Sr.filter=wn(Ii(Wo)),Sr.paintProperty=wn(Ii(Ys)),Sr.layoutProperty=wn(Ii(Yo));const eo=Sr,bu=eo.light,to=eo.paintProperty,wu=eo.layoutProperty;function Ko(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new Rr(new Error(s.message))),r=!0;return r}class io{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const f=new Int32Array(this.arrayBuffer);e=f[0],this.d=(r=f[1])+2*(s=f[2]);for(let x=0;x=P[F+0]&&l>=P[F+1])?(_[O]=!0,f.push(C[O])):_[O]=!1}}}}_forEachCell(e,r,s,l,p,f,_,x){const T=this._convertToCellCoord(e),C=this._convertToCellCoord(r),P=this._convertToCellCoord(s),L=this._convertToCellCoord(l);for(let O=T;O<=P;O++)for(let F=C;F<=L;F++){const q=this.d*F+O;if((!x||x(this._convertFromCellCoord(O),this._convertFromCellCoord(F),this._convertFromCellCoord(O+1),this._convertFromCellCoord(F+1)))&&p.call(this,e,r,s,l,q,f,_,x))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let f=0;f=0)continue;const f=i[p];l[p]=cn[s].shallow.indexOf(p)>=0?f:ro(f,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function ts(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||bs(i)||Ht(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(ts);if(typeof i=="object"){const e=i.$name||"Object";if(!cn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=cn[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const p=i[l];s[l]=cn[e].shallow.indexOf(l)>=0?p:ts(p)}return s}throw new Error("can't deserialize object of type "+typeof i)}class $a{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function $o(i){for(const e of i)if(no(e.charCodeAt(0)))return!0;return!1}function dc(i){for(const e of i)if(!Tu(e.charCodeAt(0)))return!1;return!0}function Tu(i){return!(Fe.Arabic(i)||Fe["Arabic Supplement"](i)||Fe["Arabic Extended-A"](i)||Fe["Arabic Presentation Forms-A"](i)||Fe["Arabic Presentation Forms-B"](i))}function no(i){return!(i!==746&&i!==747&&(i<4352||!(Fe["Bopomofo Extended"](i)||Fe.Bopomofo(i)||Fe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Fe["CJK Compatibility Ideographs"](i)||Fe["CJK Compatibility"](i)||Fe["CJK Radicals Supplement"](i)||Fe["CJK Strokes"](i)||!(!Fe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Fe["CJK Unified Ideographs Extension A"](i)||Fe["CJK Unified Ideographs"](i)||Fe["Enclosed CJK Letters and Months"](i)||Fe["Hangul Compatibility Jamo"](i)||Fe["Hangul Jamo Extended-A"](i)||Fe["Hangul Jamo Extended-B"](i)||Fe["Hangul Jamo"](i)||Fe["Hangul Syllables"](i)||Fe.Hiragana(i)||Fe["Ideographic Description Characters"](i)||Fe.Kanbun(i)||Fe["Kangxi Radicals"](i)||Fe["Katakana Phonetic Extensions"](i)||Fe.Katakana(i)&&i!==12540||!(!Fe["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)||!(!Fe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Fe["Unified Canadian Aboriginal Syllabics"](i)||Fe["Unified Canadian Aboriginal Syllabics Extended"](i)||Fe["Vertical Forms"](i)||Fe["Yijing Hexagram Symbols"](i)||Fe["Yi Syllables"](i)||Fe["Yi Radicals"](i))))}function so(i){return!(no(i)||function(e){return!!(Fe["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Fe["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Fe["Letterlike Symbols"](e)||Fe["Number Forms"](e)||Fe["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Fe["Control Pictures"](e)&&e!==9251||Fe["Optical Character Recognition"](e)||Fe["Enclosed Alphanumerics"](e)||Fe["Geometric Shapes"](e)||Fe["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Fe["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Fe["CJK Symbols and Punctuation"](e)||Fe.Katakana(e)||Fe["Private Use Area"](e)||Fe["CJK Compatibility Forms"](e)||Fe["Small Form Variants"](e)||Fe["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Qa(i){return i>=1424&&i<=2303||Fe["Arabic Presentation Forms-A"](i)||Fe["Arabic Presentation Forms-B"](i)}function Eu(i,e){return!(!e&&Qa(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Fe.Khmer(i))}function pc(i){for(const e of i)if(Qa(e.charCodeAt(0)))return!0;return!1}const el="deferred",oo="loading",tl="loaded";let il=null,or="unavailable",Nn=null;const rl=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(or="error"),il&&il(i)};function nl(){sl.fire(new rr("pluginStateChange",{pluginStatus:or,pluginURL:Nn}))}const sl=new Oe,ol=function(){return or},fc=function(){if(or!==el||!Nn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");or=oo,nl(),Nn&&Be({url:Nn},i=>{i?rl(i):(or=tl,nl())})},Nr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>or===tl||Nr.applyArabicShaping!=null,isLoading:()=>or===oo,setState(i){if(!rt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");or=i.pluginStatus,Nn=i.pluginURL},isParsed(){if(!rt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Nr.applyArabicShaping!=null&&Nr.processBidirectionalText!=null&&Nr.processStyledBidirectionalText!=null},getPluginURL(){if(!rt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Nn}};class $t{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new $a,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Eu(l.charCodeAt(0),s))return!1;return!0}(e,Nr.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class Qo{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(Vo(s))return new Qn(s,l);if(jo(s)){const p=Jt(s,l);if(p.result==="error")throw new Error(p.value.map(f=>`${f.key}: ${f.message}`).join(", "));return p.value}{let p=s;return l.type==="color"&&typeof s=="string"?p=at.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(p=qi.parse(s)):p=br.parse(s),{kind:"constant",evaluate:()=>p}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class ws{constructor(e){this.property=e,this.value=new Qo(e,void 0)}transitioned(e,r){return new ea(this.property,this.value,r,Se({},e.transition,this.transition),e.now)}untransitioned(){return new ea(this.property,this.value,null,{},0)}}class mc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return wt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ws(this._values[e].property)),this._values[e].value=new Qo(this._values[e].property,r===null?void 0:wt(r))}getTransition(e){return wt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ws(this._values[e].property)),this._values[e].transition=wt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new gc(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new gc(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ea{constructor(e,r,s,l,p){this.property=e,this.value=r,this.begin=p+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,p=this.value.possiblyEvaluate(e,r,s),f=this.prior;if(f){if(l>this.end)return this.prior=null,p;if(this.value.isDataDriven())return this.prior=null,p;if(l=1)return 1;const T=x*x,C=T*x;return 4*(x<.5?C:3*(x-T)+C-.75)}(_))}}return p}}class gc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new ao(this._properties);for(const p of Object.keys(this._values))l._values[p]=this._values[p].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Su{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return wt(this._values[e].value)}setValue(e,r){this._values[e]=new Qo(this._values[e].property,r===null?void 0:wt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new ao(this._properties);for(const p of Object.keys(this._values))l._values[p]=this._values[p].possiblyEvaluate(e,r,s);return l}}class Zr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class ao{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ke{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=Tr[this.specification.type];return l?l(e,r,s):e}}class st{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new Zr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Zr(this,{kind:"constant",value:void 0},e.parameters);const l=Tr[this.specification.type];if(l){const p=l(e.value.value,r.value.value,s);return new Zr(this,{kind:"constant",value:p},e.parameters)}return e}evaluate(e,r,s,l,p,f){return e.kind==="constant"?e.value:e.evaluate(r,s,l,p,f)}}class ta extends st{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new Zr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const p=e.expression.evaluate(r,null,{},s,l),f=e.property.specification.type==="resolvedImage"&&typeof p!="string"?p.name:p,_=this._calculate(f,f,f,r);return new Zr(this,{kind:"constant",value:_},r)}if(e.expression.kind==="camera"){const p=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Zr(this,{kind:"constant",value:p},r)}return new Zr(this,e.expression,r)}evaluate(e,r,s,l,p,f){if(e.kind==="source"){const _=e.evaluate(r,s,l,p,f);return this._calculate(_,_,_,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class al{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const p=e.expression.evaluate(r,null,{},s,l);return this._calculate(p,p,p,r)}return this._calculate(e.expression.evaluate(new $t(Math.floor(r.zoom-1),r)),e.expression.evaluate(new $t(Math.floor(r.zoom),r)),e.expression.evaluate(new $t(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class ll{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class ar{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Qo(s,void 0),p=this.defaultTransitionablePropertyValues[r]=new ws(s);this.defaultTransitioningPropertyValues[r]=p.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}je("DataDrivenProperty",st),je("DataConstantProperty",Ke),je("CrossFadedDataDrivenProperty",ta),je("CrossFadedProperty",al),je("ColorRampProperty",ll);const is="-transition";class un extends Oe{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Su(r.layout)),r.paint)){this._transitionablePaint=new mc(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ao(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(wu,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(is)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(to,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(is))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],p=l.property.specification["property-type"]==="cross-faded-data-driven",f=l.value.isDataDriven(),_=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const x=this._transitionablePaint._values[e].value;return x.isDataDriven()||f||p||this._handleOverridablePaintPropertyUpdate(e,_,x)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Gt(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,p={}){return(!p||p.validate!==!1)&&Ko(this,e.call(eo,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:fe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Zr&&xs(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Iu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class lo{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ni{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function vi(i,e=1){let r=0,s=0;return{members:i.map(l=>{const p=Iu[l.type].BYTES_PER_ELEMENT,f=r=_c(r,Math.max(e,p)),_=l.components||1;return s=Math.max(s,p),r+=p*_,{name:l.name,type:l.type,components:_,offset:f}}),size:_c(r,Math.max(s,e)),alignment:e}}function _c(i,e){return Math.ceil(i/e)*e}class Ur extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}Ur.prototype.bytesPerElement=4,je("StructArrayLayout2i4",Ur);class co extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const p=3*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,e}}co.prototype.bytesPerElement=6,je("StructArrayLayout3i6",co);class uo extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l)}emplace(e,r,s,l,p){const f=4*e;return this.int16[f+0]=r,this.int16[f+1]=s,this.int16[f+2]=l,this.int16[f+3]=p,e}}uo.prototype.bytesPerElement=8,je("StructArrayLayout4i8",uo);class ia extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,s,l,p,f)}emplace(e,r,s,l,p,f,_){const x=6*e;return this.int16[x+0]=r,this.int16[x+1]=s,this.int16[x+2]=l,this.int16[x+3]=p,this.int16[x+4]=f,this.int16[x+5]=_,e}}ia.prototype.bytesPerElement=12,je("StructArrayLayout2i4i12",ia);class ho extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,s,l,p,f)}emplace(e,r,s,l,p,f,_){const x=4*e,T=8*e;return this.int16[x+0]=r,this.int16[x+1]=s,this.uint8[T+4]=l,this.uint8[T+5]=p,this.uint8[T+6]=f,this.uint8[T+7]=_,e}}ho.prototype.bytesPerElement=8,je("StructArrayLayout2i4ub8",ho);class po extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}po.prototype.bytesPerElement=8,je("StructArrayLayout2f8",po);class Ts extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f,_,x,T,C){const P=this.length;return this.resize(P+1),this.emplace(P,e,r,s,l,p,f,_,x,T,C)}emplace(e,r,s,l,p,f,_,x,T,C,P){const L=10*e;return this.uint16[L+0]=r,this.uint16[L+1]=s,this.uint16[L+2]=l,this.uint16[L+3]=p,this.uint16[L+4]=f,this.uint16[L+5]=_,this.uint16[L+6]=x,this.uint16[L+7]=T,this.uint16[L+8]=C,this.uint16[L+9]=P,e}}Ts.prototype.bytesPerElement=20,je("StructArrayLayout10ui20",Ts);class rs extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f,_,x,T,C,P,L){const O=this.length;return this.resize(O+1),this.emplace(O,e,r,s,l,p,f,_,x,T,C,P,L)}emplace(e,r,s,l,p,f,_,x,T,C,P,L,O){const F=12*e;return this.int16[F+0]=r,this.int16[F+1]=s,this.int16[F+2]=l,this.int16[F+3]=p,this.uint16[F+4]=f,this.uint16[F+5]=_,this.uint16[F+6]=x,this.uint16[F+7]=T,this.int16[F+8]=C,this.int16[F+9]=P,this.int16[F+10]=L,this.int16[F+11]=O,e}}rs.prototype.bytesPerElement=24,je("StructArrayLayout4i4ui4i24",rs);class cl extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const p=3*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,e}}cl.prototype.bytesPerElement=12,je("StructArrayLayout3f12",cl);class ra extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}ra.prototype.bytesPerElement=4,je("StructArrayLayout1ul4",ra);class ns extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f,_,x,T){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,s,l,p,f,_,x,T)}emplace(e,r,s,l,p,f,_,x,T,C){const P=10*e,L=5*e;return this.int16[P+0]=r,this.int16[P+1]=s,this.int16[P+2]=l,this.int16[P+3]=p,this.int16[P+4]=f,this.int16[P+5]=_,this.uint32[L+3]=x,this.uint16[P+8]=T,this.uint16[P+9]=C,e}}ns.prototype.bytesPerElement=20,je("StructArrayLayout6i1ul2ui20",ns);class ul extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,s,l,p,f)}emplace(e,r,s,l,p,f,_){const x=6*e;return this.int16[x+0]=r,this.int16[x+1]=s,this.int16[x+2]=l,this.int16[x+3]=p,this.int16[x+4]=f,this.int16[x+5]=_,e}}ul.prototype.bytesPerElement=12,je("StructArrayLayout2i2i2i12",ul);class hl extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,p)}emplace(e,r,s,l,p,f){const _=4*e,x=8*e;return this.float32[_+0]=r,this.float32[_+1]=s,this.float32[_+2]=l,this.int16[x+6]=p,this.int16[x+7]=f,e}}hl.prototype.bytesPerElement=16,je("StructArrayLayout2f1f2i16",hl);class na extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l)}emplace(e,r,s,l,p){const f=12*e,_=3*e;return this.uint8[f+0]=r,this.uint8[f+1]=s,this.float32[_+1]=l,this.float32[_+2]=p,e}}na.prototype.bytesPerElement=12,je("StructArrayLayout2ub2f12",na);class sa extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const p=3*e;return this.uint16[p+0]=r,this.uint16[p+1]=s,this.uint16[p+2]=l,e}}sa.prototype.bytesPerElement=6,je("StructArrayLayout3ui6",sa);class dl extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f,_,x,T,C,P,L,O,F,q,H,K){const se=this.length;return this.resize(se+1),this.emplace(se,e,r,s,l,p,f,_,x,T,C,P,L,O,F,q,H,K)}emplace(e,r,s,l,p,f,_,x,T,C,P,L,O,F,q,H,K,se){const ie=24*e,le=12*e,ue=48*e;return this.int16[ie+0]=r,this.int16[ie+1]=s,this.uint16[ie+2]=l,this.uint16[ie+3]=p,this.uint32[le+2]=f,this.uint32[le+3]=_,this.uint32[le+4]=x,this.uint16[ie+10]=T,this.uint16[ie+11]=C,this.uint16[ie+12]=P,this.float32[le+7]=L,this.float32[le+8]=O,this.uint8[ue+36]=F,this.uint8[ue+37]=q,this.uint8[ue+38]=H,this.uint32[le+10]=K,this.int16[ie+22]=se,e}}dl.prototype.bytesPerElement=48,je("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",dl);class Lt extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,p,f,_,x,T,C,P,L,O,F,q,H,K,se,ie,le,ue,xe,Ue,Ye,Ne,Re,Me,Ge){const ze=this.length;return this.resize(ze+1),this.emplace(ze,e,r,s,l,p,f,_,x,T,C,P,L,O,F,q,H,K,se,ie,le,ue,xe,Ue,Ye,Ne,Re,Me,Ge)}emplace(e,r,s,l,p,f,_,x,T,C,P,L,O,F,q,H,K,se,ie,le,ue,xe,Ue,Ye,Ne,Re,Me,Ge,ze){const Ce=32*e,tt=16*e;return this.int16[Ce+0]=r,this.int16[Ce+1]=s,this.int16[Ce+2]=l,this.int16[Ce+3]=p,this.int16[Ce+4]=f,this.int16[Ce+5]=_,this.int16[Ce+6]=x,this.int16[Ce+7]=T,this.uint16[Ce+8]=C,this.uint16[Ce+9]=P,this.uint16[Ce+10]=L,this.uint16[Ce+11]=O,this.uint16[Ce+12]=F,this.uint16[Ce+13]=q,this.uint16[Ce+14]=H,this.uint16[Ce+15]=K,this.uint16[Ce+16]=se,this.uint16[Ce+17]=ie,this.uint16[Ce+18]=le,this.uint16[Ce+19]=ue,this.uint16[Ce+20]=xe,this.uint16[Ce+21]=Ue,this.uint16[Ce+22]=Ye,this.uint32[tt+12]=Ne,this.float32[tt+13]=Re,this.float32[tt+14]=Me,this.uint16[Ce+30]=Ge,this.uint16[Ce+31]=ze,e}}Lt.prototype.bytesPerElement=64,je("StructArrayLayout8i15ui1ul2f2ui64",Lt);class u extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}u.prototype.bytesPerElement=4,je("StructArrayLayout1f4",u);class t extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const p=3*e;return this.uint16[6*e+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,e}}t.prototype.bytesPerElement=12,je("StructArrayLayout1ui2f12",t);class n extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const p=4*e;return this.uint32[2*e+0]=r,this.uint16[p+2]=s,this.uint16[p+3]=l,e}}n.prototype.bytesPerElement=8,je("StructArrayLayout1ul2ui8",n);class a extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}a.prototype.bytesPerElement=4,je("StructArrayLayout2ui4",a);class c extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}c.prototype.bytesPerElement=2,je("StructArrayLayout1ui2",c);class d extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l)}emplace(e,r,s,l,p){const f=4*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.float32[f+3]=p,e}}d.prototype.bytesPerElement=16,je("StructArrayLayout4f16",d);class y extends lo{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 $(this.anchorPointX,this.anchorPointY)}}y.prototype.size=20;class v extends ns{get(e){return new y(this,e)}}je("CollisionBoxArray",v);class b extends lo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}b.prototype.size=48;class E extends dl{get(e){return new b(this,e)}}je("PlacedSymbolArray",E);class A extends lo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}A.prototype.size=64;class M extends Lt{get(e){return new A(this,e)}}je("SymbolInstanceArray",M);class B extends u{getoffsetX(e){return this.float32[1*e+0]}}je("GlyphOffsetArray",B);class G extends co{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}je("SymbolLineVertexArray",G);class j extends lo{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]}}j.prototype.size=12;class X extends t{get(e){return new j(this,e)}}je("TextAnchorOffsetArray",X);class V extends lo{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]}}V.prototype.size=8;class re extends n{get(e){return new V(this,e)}}je("FeatureIndexArray",re);class ce extends Ur{}class J extends Ur{}class ne extends Ur{}class de extends ia{}class pe extends ho{}class _e extends po{}class Ie extends Ts{}class Te extends rs{}class ke extends cl{}class He extends ra{}class mt extends ul{}class Le extends na{}class Qe extends sa{}class Xe extends a{}const Qt=vi([{name:"a_pos",components:2,type:"Int16"}],4),{members:gt}=Qt;class et{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let p=this.segments[this.segments.length-1];return e>et.MAX_VERTEX_ARRAY_LENGTH&&ft(`Max vertices per segment is ${et.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!p||p.vertexLength+e>et.MAX_VERTEX_ARRAY_LENGTH||p.sortKey!==l)&&(p={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(p.sortKey=l),this.segments.push(p)),p}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new et([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function _t(i,e){return 256*(i=Ve(Math.floor(i),0,255))+Ve(Math.floor(e),0,255)}et.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,je("SegmentVector",et);const si=vi([{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 Nt={exports:{}},Ir={exports:{}};Ir.exports=function(i,e){var r,s,l,p,f,_,x,T;for(s=i.length-(r=3&i.length),l=e,f=3432918353,_=461845907,T=0;T>>16)*f&65535)<<16)&4294967295)<<15|x>>>17))*_+(((x>>>16)*_&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(p>>>16)&65535)<<16);switch(x=0,r){case 3:x^=(255&i.charCodeAt(T+2))<<16;case 2:x^=(255&i.charCodeAt(T+1))<<8;case 1:l^=x=(65535&(x=(x=(65535&(x^=255&i.charCodeAt(T)))*f+(((x>>>16)*f&65535)<<16)&4294967295)<<15|x>>>17))*_+(((x>>>16)*_&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 Ui=Ir.exports,fi={exports:{}};fi.exports=function(i,e){for(var r,s=i.length,l=e^s,p=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(p)|(255&i.charCodeAt(++p))<<8|(255&i.charCodeAt(++p))<<16|(255&i.charCodeAt(++p))<<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,++p;switch(s){case 3:l^=(255&i.charCodeAt(p+2))<<16;case 2:l^=(255&i.charCodeAt(p+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(p)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var lr=Ui,hn=fi.exports;Nt.exports=lr,Nt.exports.murmur3=lr,Nt.exports.murmur2=hn;var Xr=U(Nt.exports);class dn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Es(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Es(e);let s=0,l=this.ids.length-1;for(;s>1;this.ids[f]>=r?l=f:s=f+1}const p=[];for(;this.ids[s]===r;)p.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return p}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Un(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new dn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Es(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Xr(String(i))}function Un(i,e,r,s){for(;r>1];let p=r-1,f=s+1;for(;;){do p++;while(i[p]l);if(p>=f)break;Tn(i,p,f),Tn(e,3*p,3*f),Tn(e,3*p+1,3*f+1),Tn(e,3*p+2,3*f+2)}f-r`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new Ss(e,r):new Pi(e,r)}}class oi{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const p=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;p&&e.set(p)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new Zi(e,r):new Pi(e,r)}}class En{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(p=>({name:`a_${p}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,p){const f=this.paintVertexArray.length,_=this.expression.evaluate(new $t(0),r,{},l,[],p);this.paintVertexArray.resize(e),this._setPaintValue(f,e,_)}updatePaintArray(e,r,s,l){const p=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,p)}_setPaintValue(e,r,s){if(this.type==="color"){const l=Ai(s);for(let p=e;p`u_${_}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=p,this.maxValue=0,this.paintVertexAttributes=r.map(_=>({name:`a_${_}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new f}populatePaintArray(e,r,s,l,p){const f=this.expression.evaluate(new $t(this.zoom),r,{},l,[],p),_=this.expression.evaluate(new $t(this.zoom+1),r,{},l,[],p),x=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(x,e,f,_)}updatePaintArray(e,r,s,l){const p=this.expression.evaluate({zoom:this.zoom},s,l),f=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,p,f)}_setPaintValue(e,r,s,l){if(this.type==="color"){const p=Ai(s),f=Ai(l);for(let _=e;_`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof En||s instanceof Wr)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new yc(l,r,s);this.needsUpload=!1,this._featureMap=new dn,this._bufferOffset=0}populatePaintArrays(e,r,s,l,p,f){for(const _ in this.programConfigurations)this.programConfigurations[_].populatePaintArrays(e,r,l,p,f);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const p of s)this.needsUpload=this.programConfigurations[p.id].updatePaintArrays(e,this._featureMap,r,p,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Au(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function os(i,e,r){const s={color:{source:po,composite:d},number:{source:u,composite:po}},l=function(p){return{"line-pattern":{source:Ie,composite:Ie},"fill-pattern":{source:Ie,composite:Ie},"fill-extrusion-pattern":{source:Ie,composite:Ie}}[p]}(i);return l&&l[r]||s[e][r]}je("ConstantBinder",Xi),je("CrossFadedConstantBinder",oi),je("SourceExpressionBinder",En),je("CrossFadedCompositeBinder",Vn),je("CompositeExpressionBinder",Wr),je("ProgramConfiguration",yc,{omit:["_buffers"]}),je("ProgramConfigurationSet",ss);const ci=8192,oa=Math.pow(2,14)-1,pl=-oa-1;function Sn(i){const e=ci/i.extent,r=i.loadGeometry();for(let s=0;sf.x+1||xf.y+1)&&ft("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function jn(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Sn(i):[]}}function Is(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class Cu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new J,this.indexArray=new Qe,this.segments=new et,this.programConfigurations=new ss(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],p=[];let f=null,_=!1;l.type==="circle"&&(f=l.layout.get("circle-sort-key"),_=!f.isConstant());for(const{feature:x,id:T,index:C,sourceLayerIndex:P}of e){const L=this.layers[0]._featureFilter.needGeometry,O=jn(x,L);if(!this.layers[0]._featureFilter.filter(new $t(this.zoom),O,s))continue;const F=_?f.evaluate(O,{},s):void 0,q={id:T,properties:x.properties,type:x.type,sourceLayerIndex:P,index:C,geometry:L?O.geometry:Sn(x),patterns:{},sortKey:F};p.push(q)}_&&p.sort((x,T)=>x.sortKey-T.sortKey);for(const x of p){const{geometry:T,index:C,sourceLayerIndex:P}=x,L=e[C].feature;this.addFeature(x,T,C,s),r.featureIndex.insert(L,T,C,P,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,gt),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const p of r)for(const f of p){const _=f.x,x=f.y;if(_<0||_>=ci||x<0||x>=ci)continue;const T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),C=T.vertexLength;Is(this.layoutVertexArray,_,x,-1,-1),Is(this.layoutVertexArray,_,x,1,-1),Is(this.layoutVertexArray,_,x,1,1),Is(this.layoutVertexArray,_,x,-1,1),this.indexArray.emplaceBack(C,C+1,C+2),this.indexArray.emplaceBack(C,C+3,C+2),T.vertexLength+=4,T.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function Zh(i,e){for(let r=0;r1){if(ku(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(l)._add(e))}function Hh(i,e){let r,s,l,p=!1;for(let f=0;fe.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(p=!p)}return p}function aa(i,e){let r=!1;for(let s=0,l=i.length-1;se.y!=f.y>e.y&&e.x<(f.x-p.x)*(e.y-p.y)/(f.y-p.y)+p.x&&(r=!r)}return r}function Yf(i,e,r){const s=r[0],l=r[2];if(i.xl.x&&e.x>l.x||i.yl.y&&e.y>l.y)return!1;const p=Tt(i,e,r[0]);return p!==Tt(i,e,r[1])||p!==Tt(i,e,r[2])||p!==Tt(i,e,r[3])}function fl(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function vc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function xc(i,e,r,s,l){if(!e[0]&&!e[1])return i;const p=$.convert(e)._mult(l);r==="viewport"&&p._rotate(-s);const f=[];for(let _=0;_$h(H,q))}(T,x),O=P?C*_:C;for(const F of l)for(const q of F){const H=P?q:$h(q,x);let K=O;const se=bc([],[q.x,q.y,0,1],x);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?K*=se[3]/f.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(K*=f.cameraToCenterDistance/se[3]),Xf(L,H,K))return!0}return!1}}function $h(i,e){const r=bc([],[i.x,i.y,0,1],e);return new $(r[0]/r[3],r[1]/r[3])}class Qh extends Cu{}let ed;je("HeatmapBucket",Qh,{omit:["layers"]});var Qf={get paint(){return ed=ed||new ar({"heatmap-radius":new st(fe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new st(fe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ke(fe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ll(fe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ke(fe.paint_heatmap["heatmap-opacity"])})}};function zu(i,{width:e,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*s}`)}else l=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=l,i}function td(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=zu({},{width:e,height:r},s);Du(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=l.data}function Du(i,e,r,s,l,p){if(l.width===0||l.height===0)return e;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const f=i.data,_=e.data;if(f===_)throw new Error("srcData equals dstData, so image is already copied");for(let x=0;x{e[i.evaluationKey]=x;const T=i.expression.evaluate(e);l.data[f+_+0]=Math.floor(255*T.r/T.a),l.data[f+_+1]=Math.floor(255*T.g/T.a),l.data[f+_+2]=Math.floor(255*T.b/T.a),l.data[f+_+3]=Math.floor(255*T.a)};if(i.clips)for(let f=0,_=0;f80*r){s=p=i[0],l=f=i[1];for(var F=r;Fp&&(p=_),x>f&&(f=x);T=(T=Math.max(p-s,f-l))!==0?32767/T:0}return _l(L,O,r,s,l,T,0),O}function nd(i,e,r,s,l){var p,f;if(l===Ou(i,e,r,s)>0)for(p=e;p=e;p-=s)f=ad(p,i[p],i[p+1],f);return f&&Tc(f,f.next)&&(vl(f),f=f.next),f}function fo(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!Tc(s,s.next)&&bi(s.prev,s,s.next)!==0)s=s.next;else{if(vl(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function _l(i,e,r,s,l,p,f){if(i){!f&&p&&function(C,P,L,O){var F=C;do F.z===0&&(F.z=Ru(F.x,F.y,P,L,O)),F.prevZ=F.prev,F.nextZ=F.next,F=F.next;while(F!==C);F.prevZ.nextZ=null,F.prevZ=null,function(q){var H,K,se,ie,le,ue,xe,Ue,Ye=1;do{for(K=q,q=null,le=null,ue=0;K;){for(ue++,se=K,xe=0,H=0;H0||Ue>0&&se;)xe!==0&&(Ue===0||!se||K.z<=se.z)?(ie=K,K=K.nextZ,xe--):(ie=se,se=se.nextZ,Ue--),le?le.nextZ=ie:q=ie,ie.prevZ=le,le=ie;K=se}le.nextZ=null,Ye*=2}while(ue>1)}(F)}(i,s,l,p);for(var _,x,T=i;i.prev!==i.next;)if(_=i.prev,x=i.next,p?om(i,s,l,p):sm(i))e.push(_.i/r|0),e.push(i.i/r|0),e.push(x.i/r|0),vl(i),i=x.next,T=x.next;else if((i=x)===T){f?f===1?_l(i=am(fo(i),e,r),e,r,s,l,p,2):f===2&&lm(i,e,r,s,l,p):_l(fo(i),e,r,s,l,p,1);break}}}function sm(i){var e=i.prev,r=i,s=i.next;if(bi(e,r,s)>=0)return!1;for(var l=e.x,p=r.x,f=s.x,_=e.y,x=r.y,T=s.y,C=lp?l>f?l:f:p>f?p:f,O=_>x?_>T?_:T:x>T?x:T,F=s.next;F!==e;){if(F.x>=C&&F.x<=L&&F.y>=P&&F.y<=O&&ca(l,_,p,x,f,T,F.x,F.y)&&bi(F.prev,F,F.next)>=0)return!1;F=F.next}return!0}function om(i,e,r,s){var l=i.prev,p=i,f=i.next;if(bi(l,p,f)>=0)return!1;for(var _=l.x,x=p.x,T=f.x,C=l.y,P=p.y,L=f.y,O=_x?_>T?_:T:x>T?x:T,H=C>P?C>L?C:L:P>L?P:L,K=Ru(O,F,e,r,s),se=Ru(q,H,e,r,s),ie=i.prevZ,le=i.nextZ;ie&&ie.z>=K&&le&&le.z<=se;){if(ie.x>=O&&ie.x<=q&&ie.y>=F&&ie.y<=H&&ie!==l&&ie!==f&&ca(_,C,x,P,T,L,ie.x,ie.y)&&bi(ie.prev,ie,ie.next)>=0||(ie=ie.prevZ,le.x>=O&&le.x<=q&&le.y>=F&&le.y<=H&&le!==l&&le!==f&&ca(_,C,x,P,T,L,le.x,le.y)&&bi(le.prev,le,le.next)>=0))return!1;le=le.nextZ}for(;ie&&ie.z>=K;){if(ie.x>=O&&ie.x<=q&&ie.y>=F&&ie.y<=H&&ie!==l&&ie!==f&&ca(_,C,x,P,T,L,ie.x,ie.y)&&bi(ie.prev,ie,ie.next)>=0)return!1;ie=ie.prevZ}for(;le&&le.z<=se;){if(le.x>=O&&le.x<=q&&le.y>=F&&le.y<=H&&le!==l&&le!==f&&ca(_,C,x,P,T,L,le.x,le.y)&&bi(le.prev,le,le.next)>=0)return!1;le=le.nextZ}return!0}function am(i,e,r){var s=i;do{var l=s.prev,p=s.next.next;!Tc(l,p)&&sd(l,s,s.next,p)&&yl(l,p)&&yl(p,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(p.i/r|0),vl(s),vl(s.next),s=i=p),s=s.next}while(s!==i);return fo(s)}function lm(i,e,r,s,l,p){var f=i;do{for(var _=f.next.next;_!==f.prev;){if(f.i!==_.i&&pm(f,_)){var x=od(f,_);return f=fo(f,f.next),x=fo(x,x.next),_l(f,e,r,s,l,p,0),void _l(x,e,r,s,l,p,0)}_=_.next}f=f.next}while(f!==i)}function cm(i,e){return i.x-e.x}function um(i,e){var r=function(l,p){var f,_=p,x=l.x,T=l.y,C=-1/0;do{if(T<=_.y&&T>=_.next.y&&_.next.y!==_.y){var P=_.x+(T-_.y)*(_.next.x-_.x)/(_.next.y-_.y);if(P<=x&&P>C&&(C=P,f=_.x<_.next.x?_:_.next,P===x))return f}_=_.next}while(_!==p);if(!f)return null;var L,O=f,F=f.x,q=f.y,H=1/0;_=f;do x>=_.x&&_.x>=F&&x!==_.x&&ca(Tf.x||_.x===f.x&&hm(f,_)))&&(f=_,H=L)),_=_.next;while(_!==O);return f}(i,e);if(!r)return e;var s=od(r,i);return fo(s,s.next),fo(r,r.next)}function hm(i,e){return bi(i.prev,i,e.prev)<0&&bi(e.next,i,i.next)<0}function Ru(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function dm(i){var e=i,r=i;do(e.x=(i-f)*(p-_)&&(i-f)*(s-_)>=(r-f)*(e-_)&&(r-f)*(p-_)>=(l-f)*(s-_)}function pm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&sd(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(yl(i,e)&&yl(e,i)&&function(r,s){var l=r,p=!1,f=(r.x+s.x)/2,_=(r.y+s.y)/2;do l.y>_!=l.next.y>_&&l.next.y!==l.y&&f<(l.next.x-l.x)*(_-l.y)/(l.next.y-l.y)+l.x&&(p=!p),l=l.next;while(l!==r);return p}(i,e)&&(bi(i.prev,i,e.prev)||bi(i,e.prev,e))||Tc(i,e)&&bi(i.prev,i,i.next)>0&&bi(e.prev,e,e.next)>0)}function bi(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Tc(i,e){return i.x===e.x&&i.y===e.y}function sd(i,e,r,s){var l=Sc(bi(i,e,r)),p=Sc(bi(i,e,s)),f=Sc(bi(r,s,i)),_=Sc(bi(r,s,e));return l!==p&&f!==_||!(l!==0||!Ec(i,r,e))||!(p!==0||!Ec(i,s,e))||!(f!==0||!Ec(r,i,s))||!(_!==0||!Ec(r,e,s))}function Ec(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Sc(i){return i>0?1:i<0?-1:0}function yl(i,e){return bi(i.prev,i,i.next)<0?bi(i,e,i.next)>=0&&bi(i,i.prev,e)>=0:bi(i,e,i.prev)<0||bi(i,i.next,e)<0}function od(i,e){var r=new Bu(i.i,i.x,i.y),s=new Bu(e.i,e.x,e.y),l=i.next,p=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,p.next=s,s.prev=p,s}function ad(i,e,r,s){var l=new Bu(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function vl(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 Bu(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ou(i,e,r,s){for(var l=0,p=e,f=r-s;p0&&r.holes.push(s+=i[l-1].length)}return r};var ld=U(Lu.exports);function fm(i,e,r,s,l){cd(i,e,r||0,s||i.length-1,l||mm)}function cd(i,e,r,s,l){for(;s>r;){if(s-r>600){var p=s-r+1,f=e-r+1,_=Math.log(p),x=.5*Math.exp(2*_/3),T=.5*Math.sqrt(_*x*(p-x)/p)*(f-p/2<0?-1:1);cd(i,e,Math.max(r,Math.floor(e-f*x/p+T)),Math.min(s,Math.floor(e+(p-f)*x/p+T)),l)}var C=i[e],P=r,L=s;for(xl(i,r,e),l(i[s],C)>0&&xl(i,r,s);P0;)L--}l(i[r],C)===0?xl(i,r,L):xl(i,++L,s),L<=e&&(r=L+1),e<=L&&(s=L-1)}}function xl(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function mm(i,e){return ie?1:0}function Fu(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,p;for(let f=0;f1)for(let f=0;fr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ne,this.indexArray=new Qe,this.indexArray2=new Xe,this.programConfigurations=new ss(e.layers,e.zoom),this.segments=new et,this.segments2=new et,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Nu("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),p=!l.isConstant(),f=[];for(const{feature:_,id:x,index:T,sourceLayerIndex:C}of e){const P=this.layers[0]._featureFilter.needGeometry,L=jn(_,P);if(!this.layers[0]._featureFilter.filter(new $t(this.zoom),L,s))continue;const O=p?l.evaluate(L,{},s,r.availableImages):void 0,F={id:x,properties:_.properties,type:_.type,sourceLayerIndex:C,index:T,geometry:P?L.geometry:Sn(_),patterns:{},sortKey:O};f.push(F)}p&&f.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of f){const{geometry:x,index:T,sourceLayerIndex:C}=_;if(this.hasPattern){const P=Uu("fill",this.layers,_,this.zoom,r);this.patternFeatures.push(P)}else this.addFeature(_,x,T,s,{});r.featureIndex.insert(e[T].feature,x,T,C,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nm),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,s,l,p){for(const f of Fu(r,500)){let _=0;for(const O of f)_+=O.length;const x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray),T=x.vertexLength,C=[],P=[];for(const O of f){if(O.length===0)continue;O!==f[0]&&P.push(C.length/2);const F=this.segments2.prepareSegment(O.length,this.layoutVertexArray,this.indexArray2),q=F.vertexLength;this.layoutVertexArray.emplaceBack(O[0].x,O[0].y),this.indexArray2.emplaceBack(q+O.length-1,q),C.push(O[0].x),C.push(O[0].y);for(let H=1;H>3}if(l--,s===1||s===2)p+=i.readSVarint(),f+=i.readSVarint(),s===1&&(e&&_.push(e),e=[]),e.push(new wm(p,f));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&_.push(e),_},ua.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,p=0,f=1/0,_=-1/0,x=1/0,T=-1/0;i.pos>3}if(s--,r===1||r===2)(l+=i.readSVarint())_&&(_=l),(p+=i.readSVarint())T&&(T=p);else if(r!==7)throw new Error("unknown command "+r)}return[f,x,_,T]},ua.prototype.toGeoJSON=function(i,e,r){var s,l,p=this.extent*Math.pow(2,r),f=this.extent*i,_=this.extent*e,x=this.loadGeometry(),T=ua.types[this.type];function C(O){for(var F=0;F>3;l=f===1?s.readString():f===2?s.readFloat():f===3?s.readDouble():f===4?s.readVarint64():f===5?s.readVarint():f===6?s.readSVarint():f===7?s.readBoolean():null}return l}(r))}fd.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Sm(this._pbf,e,this.extent,this._keys,this._values)};var Am=pd;function Cm(i,e,r){if(i===3){var s=new Am(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}As.VectorTile=function(i,e){this.layers=i.readFields(Cm,{},e)},As.VectorTileFeature=dd,As.VectorTileLayer=pd;const km=As.VectorTileFeature.types,ju=Math.pow(2,13);function bl(i,e,r,s,l,p,f,_){i.emplaceBack(e,r,2*Math.floor(s*ju)+f,l*ju*2,p*ju*2,Math.round(_))}class qu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new de,this.centroidVertexArray=new ce,this.indexArray=new Qe,this.programConfigurations=new ss(e.layers,e.zoom),this.segments=new et,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=Nu("fill-extrusion",this.layers,r);for(const{feature:l,id:p,index:f,sourceLayerIndex:_}of e){const x=this.layers[0]._featureFilter.needGeometry,T=jn(l,x);if(!this.layers[0]._featureFilter.filter(new $t(this.zoom),T,s))continue;const C={id:p,sourceLayerIndex:_,index:f,geometry:x?T.geometry:Sn(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Uu("fill-extrusion",this.layers,C,this.zoom,r)):this.addFeature(C,C.geometry,f,s,{}),r.featureIndex.insert(l,C.geometry,f,_,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:p}=l;this.addFeature(l,p,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bm),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,xm.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,p){const f={x:0,y:0,vertexCount:0};for(const _ of Fu(r,500)){let x=0;for(const F of _)x+=F.length;let T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const F of _){if(F.length===0||Pm(F))continue;let q=0;for(let H=0;H=1){const se=F[H-1];if(!Mm(K,se)){T.vertexLength+4>et.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ie=K.sub(se)._perp()._unit(),le=se.dist(K);q+le>32768&&(q=0),bl(this.layoutVertexArray,K.x,K.y,ie.x,ie.y,0,0,q),bl(this.layoutVertexArray,K.x,K.y,ie.x,ie.y,0,1,q),f.x+=2*K.x,f.y+=2*K.y,f.vertexCount+=2,q+=le,bl(this.layoutVertexArray,se.x,se.y,ie.x,ie.y,0,0,q),bl(this.layoutVertexArray,se.x,se.y,ie.x,ie.y,0,1,q),f.x+=2*se.x,f.y+=2*se.y,f.vertexCount+=2;const ue=T.vertexLength;this.indexArray.emplaceBack(ue,ue+2,ue+1),this.indexArray.emplaceBack(ue+1,ue+2,ue+3),T.vertexLength+=4,T.primitiveLength+=2}}}}if(T.vertexLength+x>et.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray)),km[e.type]!=="Polygon")continue;const C=[],P=[],L=T.vertexLength;for(const F of _)if(F.length!==0){F!==_[0]&&P.push(C.length/2);for(let q=0;qci)||i.y===e.y&&(i.y<0||i.y>ci)}function Pm(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ci)||i.every(e=>e.y<0)||i.every(e=>e.y>ci)}let md;je("FillExtrusionBucket",qu,{omit:["layers","features"]});var zm={get paint(){return md=md||new ar({"fill-extrusion-opacity":new Ke(fe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new st(fe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ke(fe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ke(fe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ta(fe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new st(fe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new st(fe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ke(fe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Dm extends un{constructor(e){super(e,zm)}createBucket(e){return new qu(e)}queryRadius(){return vc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,l,p,f,_,x){const T=xc(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),f.angle,_),C=this.paint.get("fill-extrusion-height").evaluate(r,s),P=this.paint.get("fill-extrusion-base").evaluate(r,s),L=function(F,q,H,K){const se=[];for(const ie of F){const le=[ie.x,ie.y,0,1];bc(le,le,q),se.push(new $(le[0]/le[3],le[1]/le[3]))}return se}(T,x),O=function(F,q,H,K){const se=[],ie=[],le=K[8]*q,ue=K[9]*q,xe=K[10]*q,Ue=K[11]*q,Ye=K[8]*H,Ne=K[9]*H,Re=K[10]*H,Me=K[11]*H;for(const Ge of F){const ze=[],Ce=[];for(const tt of Ge){const Je=tt.x,pt=tt.y,Kt=K[0]*Je+K[4]*pt+K[12],ei=K[1]*Je+K[5]*pt+K[13],Li=K[2]*Je+K[6]*pt+K[14],Vr=K[3]*Je+K[7]*pt+K[15],ur=Li+xe,Ci=Vr+Ue,Bi=Kt+Ye,Hi=ei+Ne,Cr=Li+Re,hr=Vr+Me,ki=new $((Kt+le)/Ci,(ei+ue)/Ci);ki.z=ur/Ci,ze.push(ki);const Ri=new $(Bi/hr,Hi/hr);Ri.z=Cr/hr,Ce.push(Ri)}se.push(ze),ie.push(Ce)}return[se,ie]}(l,P,C,x);return function(F,q,H){let K=1/0;Xh(H,q)&&(K=gd(H,q[0]));for(let se=0;ser.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new pe,this.layoutVertexArray2=new _e,this.indexArray=new Qe,this.programConfigurations=new ss(e.layers,e.zoom),this.segments=new et,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Nu("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),p=!l.isConstant(),f=[];for(const{feature:_,id:x,index:T,sourceLayerIndex:C}of e){const P=this.layers[0]._featureFilter.needGeometry,L=jn(_,P);if(!this.layers[0]._featureFilter.filter(new $t(this.zoom),L,s))continue;const O=p?l.evaluate(L,{},s):void 0,F={id:x,properties:_.properties,type:_.type,sourceLayerIndex:C,index:T,geometry:P?L.geometry:Sn(_),patterns:{},sortKey:O};f.push(F)}p&&f.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of f){const{geometry:x,index:T,sourceLayerIndex:C}=_;if(this.hasPattern){const P=Uu("line",this.layers,_,this.zoom,r);this.patternFeatures.push(P)}else this.addFeature(_,x,T,s,{});r.featureIndex.insert(e[T].feature,x,T,C,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Om)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,p){const f=this.layers[0].layout,_=f.get("line-join").evaluate(e,{}),x=f.get("line-cap"),T=f.get("line-miter-limit"),C=f.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const P of r)this.addLine(P,e,_,x,T,C);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,p,l)}addLine(e,r,s,l,p,f){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let K=0;K=2&&e[x-1].equals(e[x-2]);)x--;let T=0;for(;T0;if(Ue&&K>T){const Me=L.dist(O);if(Me>2*C){const Ge=L.sub(L.sub(O)._mult(C/Me)._round());this.updateDistance(O,Ge),this.addCurrentVertex(Ge,q,0,0,P),O=Ge}}const Ne=O&&F;let Re=Ne?s:_?"butt":l;if(Ne&&Re==="round"&&(uep&&(Re="bevel"),Re==="bevel"&&(ue>2&&(Re="flipbevel"),ue100)se=H.mult(-1);else{const Me=ue*q.add(H).mag()/q.sub(H).mag();se._perp()._mult(Me*(Ye?-1:1))}this.addCurrentVertex(L,se,0,0,P),this.addCurrentVertex(L,se.mult(-1),0,0,P)}else if(Re==="bevel"||Re==="fakeround"){const Me=-Math.sqrt(ue*ue-1),Ge=Ye?Me:0,ze=Ye?0:Me;if(O&&this.addCurrentVertex(L,q,Ge,ze,P),Re==="fakeround"){const Ce=Math.round(180*xe/Math.PI/20);for(let tt=1;tt2*C){const Ge=L.add(F.sub(L)._mult(C/Me)._round());this.updateDistance(L,Ge),this.addCurrentVertex(Ge,H,0,0,P),L=Ge}}}}addCurrentVertex(e,r,s,l,p,f=!1){const _=r.y*l-r.x,x=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,f,!1,s,p),this.addHalfVertex(e,_,x,f,!0,-l,p),this.distance>_d/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,p,f))}addHalfVertex({x:e,y:r},s,l,p,f,_,x){const T=.5*(this.lineClips?this.scaledDistance*(_d-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(p?1:0),(r<<1)+(f?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(_===0?0:_<0?-1:1)|(63&T)<<2,T>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const C=x.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,C),x.primitiveLength++),f?this.e2=C:this.e1=C}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let yd,vd;je("LineBucket",Gu,{omit:["layers","patternFeatures"]});var xd={get paint(){return vd=vd||new ar({"line-opacity":new st(fe.paint_line["line-opacity"]),"line-color":new st(fe.paint_line["line-color"]),"line-translate":new Ke(fe.paint_line["line-translate"]),"line-translate-anchor":new Ke(fe.paint_line["line-translate-anchor"]),"line-width":new st(fe.paint_line["line-width"]),"line-gap-width":new st(fe.paint_line["line-gap-width"]),"line-offset":new st(fe.paint_line["line-offset"]),"line-blur":new st(fe.paint_line["line-blur"]),"line-dasharray":new al(fe.paint_line["line-dasharray"]),"line-pattern":new ta(fe.paint_line["line-pattern"]),"line-gradient":new ll(fe.paint_line["line-gradient"])})},get layout(){return yd=yd||new ar({"line-cap":new Ke(fe.layout_line["line-cap"]),"line-join":new st(fe.layout_line["line-join"]),"line-miter-limit":new Ke(fe.layout_line["line-miter-limit"]),"line-round-limit":new Ke(fe.layout_line["line-round-limit"]),"line-sort-key":new st(fe.layout_line["line-sort-key"])})}};class Um extends st{possiblyEvaluate(e,r){return r=new $t(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,l){return r=Se({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let Ic;class Vm extends un{constructor(e){super(e,xd),this.gradientVersion=0,Ic||(Ic=new Um(xd.paint.properties["line-width"].specification),Ic.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Gs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Ic.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Gu(e)}queryRadius(e){const r=e,s=bd(fl("line-width",this,r),fl("line-gap-width",this,r)),l=fl("line-offset",this,r);return s/2+Math.abs(l)+vc(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,l,p,f,_){const x=xc(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),f.angle,_),T=_/2*bd(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),C=this.paint.get("line-offset").evaluate(r,s);return C&&(l=function(P,L){const O=[];for(let F=0;F=3){for(let H=0;H0?e+2*i:i}const jm=vi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),qm=vi([{name:"a_projected_pos",components:3,type:"Float32"}],4);vi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Gm=vi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);vi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const wd=vi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Zm=vi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Xm(i,e,r){return i.sections.forEach(s=>{s.text=function(l,p,f){const _=p.layout.get("text-transform").evaluate(f,{});return _==="uppercase"?l=l.toLocaleUpperCase():_==="lowercase"&&(l=l.toLocaleLowerCase()),Nr.applyArabicShaping&&(l=Nr.applyArabicShaping(l)),l}(s.text,e,r)}),i}vi([{name:"triangle",components:3,type:"Uint16"}]),vi([{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"}]),vi([{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"}]),vi([{type:"Float32",name:"offsetX"}]),vi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),vi([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Tl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Di=24,Td=jt,Ed=function(i,e,r,s,l){var p,f,_=8*l-s-1,x=(1<<_)-1,T=x>>1,C=-7,P=r?l-1:0,L=r?-1:1,O=i[e+P];for(P+=L,p=O&(1<<-C)-1,O>>=-C,C+=_;C>0;p=256*p+i[e+P],P+=L,C-=8);for(f=p&(1<<-C)-1,p>>=-C,C+=s;C>0;f=256*f+i[e+P],P+=L,C-=8);if(p===0)p=1-T;else{if(p===x)return f?NaN:1/0*(O?-1:1);f+=Math.pow(2,s),p-=T}return(O?-1:1)*f*Math.pow(2,p-s)},Sd=function(i,e,r,s,l,p){var f,_,x,T=8*p-l-1,C=(1<>1,L=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=s?0:p-1,F=s?1:-1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(_=isNaN(e)?1:0,f=C):(f=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-f))<1&&(f--,x*=2),(e+=f+P>=1?L/x:L*Math.pow(2,1-P))*x>=2&&(f++,x/=2),f+P>=C?(_=0,f=C):f+P>=1?(_=(e*x-1)*Math.pow(2,l),f+=P):(_=e*Math.pow(2,P-1)*Math.pow(2,l),f=0));l>=8;i[r+O]=255&_,O+=F,_/=256,l-=8);for(f=f<0;i[r+O]=255&f,O+=F,f/=256,T-=8);i[r+O-F]|=128*q};function jt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}jt.Varint=0,jt.Fixed64=1,jt.Bytes=2,jt.Fixed32=5;var Zu=4294967296,Id=1/Zu,Ad=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function as(i){return i.type===jt.Bytes?i.readVarint()+i.pos:i.pos+1}function ha(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Cd(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function Wm(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function kd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}jt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,p=this.pos;this.type=7&s,i(l,e,this),this.pos===p&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Ac(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=kd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Ac(this.buf,this.pos)+Ac(this.buf,this.pos+4)*Zu;return this.pos+=8,i},readSFixed64:function(){var i=Ac(this.buf,this.pos)+kd(this.buf,this.pos+4)*Zu;return this.pos+=8,i},readFloat:function(){var i=Ed(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Ed(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,p,f){var _,x,T=f.buf;if(_=(112&(x=T[f.pos++]))>>4,x<128||(_|=(127&(x=T[f.pos++]))<<3,x<128)||(_|=(127&(x=T[f.pos++]))<<10,x<128)||(_|=(127&(x=T[f.pos++]))<<17,x<128)||(_|=(127&(x=T[f.pos++]))<<24,x<128)||(_|=(1&(x=T[f.pos++]))<<31,x<128))return ha(l,_,p);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Ad?function(r,s,l){return Ad.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var p="",f=s;f239?4:C>223?3:C>191?2:1;if(f+L>l)break;L===1?C<128&&(P=C):L===2?(192&(_=r[f+1]))==128&&(P=(31&C)<<6|63&_)<=127&&(P=null):L===3?(x=r[f+2],(192&(_=r[f+1]))==128&&(192&x)==128&&((P=(15&C)<<12|(63&_)<<6|63&x)<=2047||P>=55296&&P<=57343)&&(P=null)):L===4&&(x=r[f+2],T=r[f+3],(192&(_=r[f+1]))==128&&(192&x)==128&&(192&T)==128&&((P=(15&C)<<18|(63&_)<<12|(63&x)<<6|63&T)<=65535||P>=1114112)&&(P=null)),P===null?(P=65533,L=1):P>65535&&(P-=65536,p+=String.fromCharCode(P>>>10&1023|55296),P=56320|1023&P),p+=String.fromCharCode(P),f+=L}return p}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==jt.Bytes)return i.push(this.readVarint(e));var r=as(this);for(i=i||[];this.pos127;);else if(e===jt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===jt.Fixed32)this.pos+=4;else{if(e!==jt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(p,f,_){_.buf[_.pos++]=127&p|128,p>>>=7,_.buf[_.pos++]=127&p|128,p>>>=7,_.buf[_.pos++]=127&p|128,p>>>=7,_.buf[_.pos++]=127&p|128,_.buf[_.pos]=127&(p>>>=7)}(s,0,r),function(p,f){var _=(7&p)<<4;f.buf[f.pos++]|=_|((p>>>=3)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p|((p>>>=7)?128:0),p&&(f.buf[f.pos++]=127&p)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,l,p){for(var f,_,x=0;x55295&&f<57344){if(!_){f>56319||x+1===l.length?(s[p++]=239,s[p++]=191,s[p++]=189):_=f;continue}if(f<56320){s[p++]=239,s[p++]=191,s[p++]=189,_=f;continue}f=_-55296<<10|f-56320|65536,_=null}else _&&(s[p++]=239,s[p++]=191,s[p++]=189,_=null);f<128?s[p++]=f:(f<2048?s[p++]=f>>6|192:(f<65536?s[p++]=f>>12|224:(s[p++]=f>>18|240,s[p++]=f>>12&63|128),s[p++]=f>>6&63|128),s[p++]=63&f|128)}return p}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Cd(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Sd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Sd(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Cd(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,jt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Wm,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Hm,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Km,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Ym,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Jm,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,$m,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Qm,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,eg,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,tg,e)},writeBytesField:function(i,e){this.writeTag(i,jt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,jt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,jt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,jt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,jt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,jt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,jt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,jt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,jt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,jt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Xu=U(Td);const Wu=3;function ig(i,e,r){i===1&&r.readMessage(rg,e)}function rg(i,e,r){if(i===3){const{id:s,bitmap:l,width:p,height:f,left:_,top:x,advance:T}=r.readMessage(ng,{});e.push({id:s,bitmap:new gl({width:p+2*Wu,height:f+2*Wu},l),metrics:{width:p,height:f,left:_,top:x,advance:T}})}}function ng(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const Md=Wu;function Pd(i){let e=0,r=0;for(const f of i)e+=f.w*f.h,r=Math.max(r,f.w);i.sort((f,_)=>_.h-f.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,p=0;for(const f of i)for(let _=s.length-1;_>=0;_--){const x=s[_];if(!(f.w>x.w||f.h>x.h)){if(f.x=x.x,f.y=x.y,p=Math.max(p,f.y+f.h),l=Math.max(l,f.x+f.w),f.w===x.w&&f.h===x.h){const T=s.pop();_=0&&s>=e&&kc[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new pa;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Sl.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Cc(i,e,r,s,l,p,f,_,x,T,C,P,L,O,F,q){const H=pa.fromFeature(i,l);let K;P===o.WritingMode.vertical&&H.verticalizePunctuation();const{processBidirectionalText:se,processStyledBidirectionalText:ie}=Nr;if(se&&H.sections.length===1){K=[];const xe=se(H.toString(),Yu(H,T,p,e,s,O,F));for(const Ue of xe){const Ye=new pa;Ye.text=Ue,Ye.sections=H.sections;for(let Ne=0;Ne0&&cs>Mr&&(Mr=cs)}else{const Jr=Ye[bt.fontStack],Pr=Jr&&Jr[Ji];if(Pr&&Pr.rect)In=Pr.rect,pn=Pr.metrics;else{const cs=Ue[bt.fontStack],Ml=cs&&cs[Ji];if(!Ml)continue;pn=Ml.metrics}pr=(Ri-bt.scale)*Di}fn?(xe.verticalizable=!0,kr.push({glyph:Ji,imageName:An,x:Kt,y:ei+pr,vertical:fn,scale:bt.scale,fontStack:bt.fontStack,sectionIndex:jr,metrics:pn,rect:In}),Kt+=ls*bt.scale+tt):(kr.push({glyph:Ji,imageName:An,x:Kt,y:ei+pr,vertical:fn,scale:bt.scale,fontStack:bt.fontStack,sectionIndex:jr,metrics:pn,rect:In}),Kt+=pn.advance*bt.scale+tt)}kr.length!==0&&(Li=Math.max(Kt-tt,Li),ag(kr,0,kr.length-1,ur,Mr)),Kt=0;const mi=Me*Ri+Mr;dr.lineOffset=Math.max(Mr,Qi),ei+=mi,Vr=Math.max(mi,Vr),++Ci}var Bi;const Hi=ei-El,{horizontalAlign:Cr,verticalAlign:hr}=Ju(Ge);(function(ki,Ri,Qi,dr,kr,Mr,mi,Yi,bt){const jr=(Ri-Qi)*kr;let Ji=0;Ji=Mr!==mi?-Yi*dr-El:(-dr*bt+.5)*mi;for(const pr of ki)for(const pn of pr.positionedGlyphs)pn.x+=jr,pn.y+=Ji})(xe.positionedLines,ur,Cr,hr,Li,Vr,Me,Hi,Re.length),xe.top+=-hr*Hi,xe.bottom=xe.top+Hi,xe.left+=-Cr*Li,xe.right=xe.left+Li}(ue,e,r,s,K,f,_,x,P,T,L,q),!function(xe){for(const Ue of xe)if(Ue.positionedGlyphs.length!==0)return!1;return!0}(le)&&ue}const kc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},sg={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Dd(i,e,r,s,l,p){if(e.imageName){const f=s[e.imageName];return f?f.displaySize[0]*e.scale*Di/p+l:0}{const f=r[e.fontStack],_=f&&f[i];return _?_.metrics.advance*e.scale+l:0}}function Ld(i,e,r,s){const l=Math.pow(i-e,2);return s?i=0;let C=0;for(let L=0;Lf.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Pu([]),this.placementViewportMatrix=Pu([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Fd(this.zoom,r["text-size"]),this.iconSizeData=Fd(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),p=s.get("symbol-z-order");this.canOverlap=Ku(s,"text-overlap","text-allow-overlap")!=="never"||Ku(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=p!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(p==="viewport-y"||p==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(f=>o.WritingMode[f])),this.stateDependentLayerIds=this.layers.filter(f=>f.isStateDependent()).map(f=>f.id),this.sourceID=e.sourceID}createArrays(){this.text=new Qu(new ss(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Qu(new ss(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new B,this.lineVertexArray=new G,this.symbolInstances=new M,this.textAnchorOffsets=new X}calculateGlyphDependencies(e,r,s,l,p){for(let f=0;f0)&&(f.value.kind!=="constant"||f.value.value.length>0),C=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,P=p.get("symbol-sort-key");if(this.features=[],!T&&!C)return;const L=r.iconDependencies,O=r.glyphDependencies,F=r.availableImages,q=new $t(this.zoom);for(const{feature:H,id:K,index:se,sourceLayerIndex:ie}of e){const le=l._featureFilter.needGeometry,ue=jn(H,le);if(!l._featureFilter.filter(q,ue,s))continue;let xe,Ue;if(le||(ue.geometry=Sn(H)),T){const Ne=l.getValueAndResolveTokens("text-field",ue,s,F),Re=gi.factory(Ne);hg(Re)&&(this.hasRTLText=!0),(!this.hasRTLText||ol()==="unavailable"||this.hasRTLText&&Nr.isParsed())&&(xe=Xm(Re,l,ue))}if(C){const Ne=l.getValueAndResolveTokens("icon-image",ue,s,F);Ue=Ne instanceof Or?Ne:Or.fromString(Ne)}if(!xe&&!Ue)continue;const Ye=this.sortFeaturesByKey?P.evaluate(ue,{},s):void 0;if(this.features.push({id:K,text:xe,icon:Ue,index:se,sourceLayerIndex:ie,geometry:ue.geometry,properties:H.properties,type:cg[H.type],sortKey:Ye}),Ue&&(L[Ue.name]=!0),xe){const Ne=f.evaluate(ue,{},s).join(","),Re=p.get("text-rotation-alignment")!=="viewport"&&p.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(o.WritingMode.vertical)>=0;for(const Me of xe.sections)if(Me.image)L[Me.image.name]=!0;else{const Ge=$o(xe.toString()),ze=Me.fontStack||Ne,Ce=O[ze]=O[ze]||{};this.calculateGlyphDependencies(Me.text,Ce,Re,this.allowVerticalPlacement,Ge)}}}p.get("symbol-placement")==="line"&&(this.features=function(H){const K={},se={},ie=[];let le=0;function ue(Ne){ie.push(H[Ne]),le++}function xe(Ne,Re,Me){const Ge=se[Ne];return delete se[Ne],se[Re]=Ge,ie[Ge].geometry[0].pop(),ie[Ge].geometry[0]=ie[Ge].geometry[0].concat(Me[0]),Ge}function Ue(Ne,Re,Me){const Ge=K[Re];return delete K[Re],K[Ne]=Ge,ie[Ge].geometry[0].shift(),ie[Ge].geometry[0]=Me[0].concat(ie[Ge].geometry[0]),Ge}function Ye(Ne,Re,Me){const Ge=Me?Re[0][Re[0].length-1]:Re[0][0];return`${Ne}:${Ge.x}:${Ge.y}`}for(let Ne=0;NeNe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((H,K)=>H.sortKey-K.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),p=e.dist(r[e.segment]);const f={};for(let _=e.segment+1;_=0;_--)f[_]={x:r[_].x,y:r[_].y,tileUnitDistanceFromAnchor:p},_>0&&(p+=r[_-1].dist(r[_]));for(let _=0;_0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let p=s.vertexStartIndex;pl[_]-l[x]||p[x]-p[_]),f}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,p,f)=>{l>=0&&f.indexOf(l)===p&&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 Nd,Ud;je("SymbolBucket",fa,{omit:["layers","collisionBoxArray","features","compareText"]}),fa.MAX_GLYPHS=65535,fa.addDynamicAttributes=$u;var th={get paint(){return Ud=Ud||new ar({"icon-opacity":new st(fe.paint_symbol["icon-opacity"]),"icon-color":new st(fe.paint_symbol["icon-color"]),"icon-halo-color":new st(fe.paint_symbol["icon-halo-color"]),"icon-halo-width":new st(fe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new st(fe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ke(fe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ke(fe.paint_symbol["icon-translate-anchor"]),"text-opacity":new st(fe.paint_symbol["text-opacity"]),"text-color":new st(fe.paint_symbol["text-color"],{runtimeType:ji,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new st(fe.paint_symbol["text-halo-color"]),"text-halo-width":new st(fe.paint_symbol["text-halo-width"]),"text-halo-blur":new st(fe.paint_symbol["text-halo-blur"]),"text-translate":new Ke(fe.paint_symbol["text-translate"]),"text-translate-anchor":new Ke(fe.paint_symbol["text-translate-anchor"])})},get layout(){return Nd=Nd||new ar({"symbol-placement":new Ke(fe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ke(fe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ke(fe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new st(fe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ke(fe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ke(fe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ke(fe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ke(fe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ke(fe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ke(fe.layout_symbol["icon-rotation-alignment"]),"icon-size":new st(fe.layout_symbol["icon-size"]),"icon-text-fit":new Ke(fe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ke(fe.layout_symbol["icon-text-fit-padding"]),"icon-image":new st(fe.layout_symbol["icon-image"]),"icon-rotate":new st(fe.layout_symbol["icon-rotate"]),"icon-padding":new st(fe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ke(fe.layout_symbol["icon-keep-upright"]),"icon-offset":new st(fe.layout_symbol["icon-offset"]),"icon-anchor":new st(fe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ke(fe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ke(fe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ke(fe.layout_symbol["text-rotation-alignment"]),"text-field":new st(fe.layout_symbol["text-field"]),"text-font":new st(fe.layout_symbol["text-font"]),"text-size":new st(fe.layout_symbol["text-size"]),"text-max-width":new st(fe.layout_symbol["text-max-width"]),"text-line-height":new Ke(fe.layout_symbol["text-line-height"]),"text-letter-spacing":new st(fe.layout_symbol["text-letter-spacing"]),"text-justify":new st(fe.layout_symbol["text-justify"]),"text-radial-offset":new st(fe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ke(fe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new st(fe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new st(fe.layout_symbol["text-anchor"]),"text-max-angle":new Ke(fe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ke(fe.layout_symbol["text-writing-mode"]),"text-rotate":new st(fe.layout_symbol["text-rotate"]),"text-padding":new Ke(fe.layout_symbol["text-padding"]),"text-keep-upright":new Ke(fe.layout_symbol["text-keep-upright"]),"text-transform":new st(fe.layout_symbol["text-transform"]),"text-offset":new st(fe.layout_symbol["text-offset"]),"text-allow-overlap":new Ke(fe.layout_symbol["text-allow-overlap"]),"text-overlap":new Ke(fe.layout_symbol["text-overlap"]),"text-ignore-placement":new Ke(fe.layout_symbol["text-ignore-placement"]),"text-optional":new Ke(fe.layout_symbol["text-optional"])})}};class Vd{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Dn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}je("FormatSectionOverride",Vd,{omit:["defaultValue"]});class Pc extends un{constructor(e){super(e,th)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const p of s)l.indexOf(p)<0&&l.push(p);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const p=this.layout.get(e).evaluate(r,{},s,l),f=this._unevaluatedLayout._values[e];return f.isDataDriven()||jo(f.value)||!p?p:function(_,x){return x.replace(/{([^{}]+)}/g,(T,C)=>C in _?String(_[C]):"")}(r.properties,p)}createBucket(e){return new fa(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of th.paint.overridableProperties){if(!Pc.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new Vd(r),l=new li(s,r.property.specification);let p=null;p=r.value.kind==="constant"||r.value.kind==="source"?new Zs("source",l):new Yt("composite",l,r.value.zoomStops),this.paint._values[e]=new Zr(r.property,p,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Pc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=th.paint.properties[r];let p=!1;const f=_=>{for(const x of _)if(l.overrides&&l.overrides.hasOverride(x))return void(p=!0)};if(s.value.kind==="constant"&&s.value.value instanceof gi)f(s.value.value.sections);else if(s.value.kind==="source"){const _=T=>{p||(T instanceof Hn&&_i(T.value)===on?f(T.value.sections):T instanceof Uo?f(T.sections):T.eachChild(_))},x=s.value;x._styleExpression&&_(x._styleExpression.expression)}return p}}let jd;var dg={get paint(){return jd=jd||new ar({"background-color":new Ke(fe.paint_background["background-color"]),"background-pattern":new al(fe.paint_background["background-pattern"]),"background-opacity":new Ke(fe.paint_background["background-opacity"])})}};class pg extends un{constructor(e){super(e,dg)}}let qd;var fg={get paint(){return qd=qd||new ar({"raster-opacity":new Ke(fe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ke(fe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ke(fe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ke(fe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ke(fe.paint_raster["raster-saturation"]),"raster-contrast":new Ke(fe.paint_raster["raster-contrast"]),"raster-resampling":new Ke(fe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ke(fe.paint_raster["raster-fade-duration"])})}};class mg extends un{constructor(e){super(e,fg)}}class gg extends un{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class _g{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const ih=63710088e-1;class Ms{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ms(Ae(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,p=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return ih*Math.acos(Math.min(p,1))}static convert(e){if(e instanceof Ms)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ms(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ms(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Gd=2*Math.PI*ih;function Zd(i){return Gd*Math.cos(i*Math.PI/180)}function Xd(i){return(180+i)/360}function Wd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Hd(i,e){return i/Zd(e)}function rh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class zc{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Ms.convert(e);return new zc(Xd(s.lng),Wd(s.lat),Hd(r,s.lat))}toLngLat(){return new Ms(360*this.x-180,rh(this.y))}toAltitude(){return this.z*Zd(rh(this.y))}meterInMercatorCoordinateUnits(){return 1/Gd*(e=rh(this.y),1/Math.cos(e*Math.PI/180));var e}}function Yd(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class nh{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=Al(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(f=this.y,_=this.z,x=Yd(256*(p=this.x),256*(f=Math.pow(2,_)-f-1),_),T=Yd(256*(p+1),256*(f+1),_),x[0]+","+x[1]+","+T[0]+","+T[1]);var p,f,_,x,T;const C=function(P,L,O){let F,q="";for(let H=P;H>0;H--)F=1<1?"@2x":"").replace(/{quadkey}/g,C).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new $((e.x*r-this.x)*ci,(e.y*r-this.y)*ci)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Jd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Al(e,r.z,r.z,r.x,r.y)}}class Yr{constructor(e,r,s,l,p){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new nh(s,+l,+p),this.key=Al(r,e,s,l,p)}clone(){return new Yr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Yr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?Al(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Al(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Yr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new Yr(r,this.wrap,r,s,l),new Yr(r,this.wrap,r,s+1,l),new Yr(r,this.wrap,r,s,l+1),new Yr(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=P),P=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,s){return e*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new Hr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,p=r*this.dim+this.dim,f=s*this.dim,_=s*this.dim+this.dim;switch(r){case-1:l=p-1;break;case 1:p=l+1}switch(s){case-1:f=_-1;break;case 1:_=f+1}const x=-r*this.dim,T=-s*this.dim;for(let C=f;C<_;C++)for(let P=l;P=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Qd{constructor(e,r,s,l,p){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=p}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class ep{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new io(ci,16,0),this.grid3D=new io(ci,16,0),this.featureIndexArray=new re,this.promoteId=r}insert(e,r,s,l,p,f){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,p);const x=f?this.grid3D:this.grid;for(let T=0;T=0&&P[3]>=0&&x.insert(_,P[0],P[1],P[2],P[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new As.VectorTile(new Xu(this.rawTileData)).layers,this.sourceLayerCoder=new $d(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const p=e.params||{},f=ci/e.tileSize/e.scale,_=Xa(p.filter),x=e.queryGeometry,T=e.queryPadding*f,C=ip(x),P=this.grid.query(C.minX-T,C.minY-T,C.maxX+T,C.maxY+T),L=ip(e.cameraQueryGeometry),O=this.grid3D.query(L.minX-T,L.minY-T,L.maxX+T,L.maxY+T,(H,K,se,ie)=>function(le,ue,xe,Ue,Ye){for(const Re of le)if(ue<=Re.x&&xe<=Re.y&&Ue>=Re.x&&Ye>=Re.y)return!0;const Ne=[new $(ue,xe),new $(ue,Ye),new $(Ue,Ye),new $(Ue,xe)];if(le.length>2){for(const Re of Ne)if(aa(le,Re))return!0}for(let Re=0;Re(ie||(ie=Sn(le)),ue.queryIntersectsFeature(x,le,xe,ie,this.z,e.transform,f,e.pixelPosMatrix)))}return F}loadMatchingFeature(e,r,s,l,p,f,_,x,T,C,P){const L=this.bucketLayerIDs[r];if(f&&!function(H,K){for(let se=0;se=0)return!0;return!1}(f,L))return;const O=this.sourceLayerCoder.decode(s),F=this.vtLayers[O].feature(l);if(p.needGeometry){const H=jn(F,!0);if(!p.filter(new $t(this.tileID.overscaledZ),H,this.tileID.canonical))return}else if(!p.filter(new $t(this.tileID.overscaledZ),F))return;const q=this.getId(F,O);for(let H=0;H{const _=e instanceof ao?e.get(f):null;return _&&_.evaluate?_.evaluate(r,s,l):_})}function ip(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const p of i)e=Math.min(e,p.x),r=Math.min(r,p.y),s=Math.max(s,p.x),l=Math.max(l,p.y);return{minX:e,minY:r,maxX:s,maxY:l}}function yg(i,e){return e-i}function rp(i,e,r,s,l){const p=[];for(let f=0;f=s&&P.x>=s||(C.x>=s?C=new $(s,C.y+(s-C.x)/(P.x-C.x)*(P.y-C.y))._round():P.x>=s&&(P=new $(s,C.y+(s-C.x)/(P.x-C.x)*(P.y-C.y))._round()),C.y>=l&&P.y>=l||(C.y>=l?C=new $(C.x+(l-C.y)/(P.y-C.y)*(P.x-C.x),l)._round():P.y>=l&&(P=new $(C.x+(l-C.y)/(P.y-C.y)*(P.x-C.x),l)._round()),x&&C.equals(x[x.length-1])||(x=[C],p.push(x)),x.push(P)))))}}return p}je("FeatureIndex",ep,{omit:["rawTileData","sourceLayerCoder"]});class Ps extends ${constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Ps(this.x,this.y,this.angle,this.segment)}}function np(i,e,r,s,l){if(e.segment===void 0||r===0)return!0;let p=e,f=e.segment+1,_=0;for(;_>-r/2;){if(f--,f<0)return!1;_-=i[f].dist(p),p=i[f]}_+=i[f].dist(i[f+1]),f++;const x=[];let T=0;for(;_s;)T-=x.shift().angleDelta;if(T>l)return!1;f++,_+=C.dist(P)}return!0}function sp(i){let e=0;for(let r=0;rT){const F=(T-x)/O,q=Tr.number(P.x,L.x,F),H=Tr.number(P.y,L.y,F),K=new Ps(q,H,L.angleTo(P),C);return K._round(),!f||np(i,K,_,f,e)?K:void 0}x+=O}}function xg(i,e,r,s,l,p,f,_,x){const T=op(s,p,f),C=ap(s,l),P=C*f,L=i[0].x===0||i[0].x===x||i[0].y===0||i[0].y===x;return e-P=0&&le=0&&ue=0&&L+T<=C){const xe=new Ps(le,ue,se,F);xe._round(),s&&!np(i,xe,p,s,l)||O.push(xe)}}P+=K}return _||O.length||f||(O=lp(i,P/2,r,s,l,p,f,!0,x)),O}je("Anchor",Ps);const ma=Ar;function cp(i,e,r,s){const l=[],p=i.image,f=p.pixelRatio,_=p.paddedRect.w-2*ma,x=p.paddedRect.h-2*ma,T=i.right-i.left,C=i.bottom-i.top,P=p.stretchX||[[0,_]],L=p.stretchY||[[0,x]],O=(Me,Ge)=>Me+Ge[1]-Ge[0],F=P.reduce(O,0),q=L.reduce(O,0),H=_-F,K=x-q;let se=0,ie=F,le=0,ue=q,xe=0,Ue=H,Ye=0,Ne=K;if(p.content&&s){const Me=p.content;se=Dc(P,0,Me[0]),le=Dc(L,0,Me[1]),ie=Dc(P,Me[0],Me[2]),ue=Dc(L,Me[1],Me[3]),xe=Me[0]-se,Ye=Me[1]-le,Ue=Me[2]-Me[0]-ie,Ne=Me[3]-Me[1]-ue}const Re=(Me,Ge,ze,Ce)=>{const tt=Lc(Me.stretch-se,ie,T,i.left),Je=Rc(Me.fixed-xe,Ue,Me.stretch,F),pt=Lc(Ge.stretch-le,ue,C,i.top),Kt=Rc(Ge.fixed-Ye,Ne,Ge.stretch,q),ei=Lc(ze.stretch-se,ie,T,i.left),Li=Rc(ze.fixed-xe,Ue,ze.stretch,F),Vr=Lc(Ce.stretch-le,ue,C,i.top),ur=Rc(Ce.fixed-Ye,Ne,Ce.stretch,q),Ci=new $(tt,pt),Bi=new $(ei,pt),Hi=new $(ei,Vr),Cr=new $(tt,Vr),hr=new $(Je/f,Kt/f),ki=new $(Li/f,ur/f),Ri=e*Math.PI/180;if(Ri){const kr=Math.sin(Ri),Mr=Math.cos(Ri),mi=[Mr,-kr,kr,Mr];Ci._matMult(mi),Bi._matMult(mi),Cr._matMult(mi),Hi._matMult(mi)}const Qi=Me.stretch+Me.fixed,dr=Ge.stretch+Ge.fixed;return{tl:Ci,tr:Bi,bl:Cr,br:Hi,tex:{x:p.paddedRect.x+ma+Qi,y:p.paddedRect.y+ma+dr,w:ze.stretch+ze.fixed-Qi,h:Ce.stretch+Ce.fixed-dr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:hr,pixelOffsetBR:ki,minFontScaleX:Ue/f/T,minFontScaleY:Ne/f/C,isSDF:r}};if(s&&(p.stretchX||p.stretchY)){const Me=up(P,H,F),Ge=up(L,K,q);for(let ze=0;ze0&&(F=Math.max(10,F),this.circleDiameter=F)}else{let P=f.top*_-x[0],L=f.bottom*_+x[2],O=f.left*_-x[3],F=f.right*_+x[1];const q=f.collisionPadding;if(q&&(O-=q[0]*_,P-=q[1]*_,F+=q[2]*_,L+=q[3]*_),C){const H=new $(O,P),K=new $(F,P),se=new $(O,L),ie=new $(F,L),le=C*Math.PI/180;H._rotate(le),K._rotate(le),se._rotate(le),ie._rotate(le),O=Math.min(H.x,K.x,se.x,ie.x),F=Math.max(H.x,K.x,se.x,ie.x),P=Math.min(H.y,K.y,se.y,ie.y),L=Math.max(H.y,K.y,se.y,ie.y)}e.emplaceBack(r.x,r.y,O,P,F,L,s,l,p)}this.boxEndIndex=e.length}}class bg{constructor(e=[],r=wg){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const p=e-1>>1,f=r[p];if(s(l,f)>=0)break;r[e]=f,e=p}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,p=r[e];for(;e=0)break;r[e]=_,e=f}r[e]=p}}function wg(i,e){return ie?1:0}function Tg(i,e=1,r=!1){let s=1/0,l=1/0,p=-1/0,f=-1/0;const _=i[0];for(let O=0;O<_.length;O++){const F=_[O];(!O||F.xp)&&(p=F.x),(!O||F.y>f)&&(f=F.y)}const x=Math.min(p-s,f-l);let T=x/2;const C=new bg([],Eg);if(x===0)return new $(s,l);for(let O=s;OP.d||!P.d)&&(P=O,r&&console.log("found best %d after %d probes",Math.round(1e4*O.d)/1e4,L)),O.max-P.d<=e||(T=O.h/2,C.push(new ga(O.p.x-T,O.p.y-T,T,i)),C.push(new ga(O.p.x+T,O.p.y-T,T,i)),C.push(new ga(O.p.x-T,O.p.y+T,T,i)),C.push(new ga(O.p.x+T,O.p.y+T,T,i)),L+=4)}return r&&(console.log(`num probes: ${L}`),console.log(`best distance: ${P.d}`)),P.p}function Eg(i,e){return e.max-i.max}function ga(i,e,r,s){this.p=new $(i,e),this.h=r,this.d=function(l,p){let f=!1,_=1/0;for(let x=0;xl.y!=F.y>l.y&&l.x<(F.x-O.x)*(l.y-O.y)/(F.y-O.y)+O.x&&(f=!f),_=Math.min(_,Wh(l,O,F))}}return(f?1:-1)*Math.sqrt(_)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var Wi;o.TextAnchorEnum=void 0,(Wi=o.TextAnchorEnum||(o.TextAnchorEnum={}))[Wi.center=1]="center",Wi[Wi.left=2]="left",Wi[Wi.right=3]="right",Wi[Wi.top=4]="top",Wi[Wi.bottom=5]="bottom",Wi[Wi["top-left"]=6]="top-left",Wi[Wi["top-right"]=7]="top-right",Wi[Wi["bottom-left"]=8]="bottom-left",Wi[Wi["bottom-right"]=9]="bottom-right";const zs=7,sh=Number.POSITIVE_INFINITY;function hp(i,e){return e[1]!==sh?function(r,s,l){let p=0,f=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":f=l-zs;break;case"bottom-right":case"bottom-left":case"bottom":f=-l+zs}switch(r){case"top-right":case"bottom-right":case"right":p=-s;break;case"top-left":case"bottom-left":case"left":p=s}return[p,f]}(i,e[0],e[1]):function(r,s){let l=0,p=0;s<0&&(s=0);const f=s/Math.SQRT2;switch(r){case"top-right":case"top-left":p=f-zs;break;case"bottom-right":case"bottom-left":p=-f+zs;break;case"bottom":p=-s+zs;break;case"top":p=s-zs}switch(r){case"top-right":case"bottom-right":l=-f;break;case"top-left":case"bottom-left":l=f;break;case"left":l=s;break;case"right":l=-s}return[l,p]}(i,e[0])}function dp(i,e,r){var s;const l=i.layout,p=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},r);if(p){const _=p.values,x=[];for(let T=0;T<_.length;T+=2){const C=x[T]=_[T],P=_[T+1].map(L=>L*Di);C.startsWith("top")?P[1]-=zs:C.startsWith("bottom")&&(P[1]+=zs),x[T+1]=P}return new qi(x)}const f=l.get("text-variable-anchor");if(f){let _;_=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*Di,sh]:l.get("text-offset").evaluate(e,{},r).map(T=>T*Di);const x=[];for(const T of f)x.push(T,hp(T,_));return new qi(x)}return null}function oh(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 Sg(i,e,r,s,l,p,f,_,x,T,C){let P=p.textMaxSize.evaluate(e,{});P===void 0&&(P=f);const L=i.layers[0].layout,O=L.get("icon-offset").evaluate(e,{},C),F=fp(r.horizontal),q=f/24,H=i.tilePixelRatio*q,K=i.tilePixelRatio*P/24,se=i.tilePixelRatio*_,ie=i.tilePixelRatio*L.get("symbol-spacing"),le=L.get("text-padding")*i.tilePixelRatio,ue=function(Ce,tt,Je,pt=1){const Kt=Ce.get("icon-padding").evaluate(tt,{},Je),ei=Kt&&Kt.values;return[ei[0]*pt,ei[1]*pt,ei[2]*pt,ei[3]*pt]}(L,e,C,i.tilePixelRatio),xe=L.get("text-max-angle")/180*Math.PI,Ue=L.get("text-rotation-alignment")!=="viewport"&&L.get("symbol-placement")!=="point",Ye=L.get("icon-rotation-alignment")==="map"&&L.get("symbol-placement")!=="point",Ne=L.get("symbol-placement"),Re=ie/2,Me=L.get("icon-text-fit");let Ge;s&&Me!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ge=Od(s,r.vertical,Me,L.get("icon-text-fit-padding"),O,q)),F&&(s=Od(s,F,Me,L.get("icon-text-fit-padding"),O,q)));const ze=(Ce,tt)=>{tt.x<0||tt.x>=ci||tt.y<0||tt.y>=ci||function(Je,pt,Kt,ei,Li,Vr,ur,Ci,Bi,Hi,Cr,hr,ki,Ri,Qi,dr,kr,Mr,mi,Yi,bt,jr,Ji,pr,pn){const In=Je.addToLineVertexArray(pt,Kt);let An,ls,fn,Jr,Pr=0,cs=0,Ml=0,yp=0,fh=-1,mh=-1;const us={};let vp=Xr("");if(Je.allowVerticalPlacement&&ei.vertical){const er=Ci.layout.get("text-rotate").evaluate(bt,{},pr)+90;fn=new Bc(Bi,pt,Hi,Cr,hr,ei.vertical,ki,Ri,Qi,er),ur&&(Jr=new Bc(Bi,pt,Hi,Cr,hr,ur,kr,Mr,Qi,er))}if(Li){const er=Ci.layout.get("icon-rotate").evaluate(bt,{}),Kr=Ci.layout.get("icon-text-fit")!=="none",mo=cp(Li,er,Ji,Kr),kn=ur?cp(ur,er,Ji,Kr):void 0;ls=new Bc(Bi,pt,Hi,Cr,hr,Li,kr,Mr,!1,er),Pr=4*mo.length;const go=Je.iconSizeData;let Gn=null;go.kind==="source"?(Gn=[qn*Ci.layout.get("icon-size").evaluate(bt,{})],Gn[0]>ks&&ft(`${Je.layerIds[0]}: Value for "icon-size" is >= ${Il}. Reduce your "icon-size".`)):go.kind==="composite"&&(Gn=[qn*jr.compositeIconSizes[0].evaluate(bt,{},pr),qn*jr.compositeIconSizes[1].evaluate(bt,{},pr)],(Gn[0]>ks||Gn[1]>ks)&&ft(`${Je.layerIds[0]}: Value for "icon-size" is >= ${Il}. Reduce your "icon-size".`)),Je.addSymbols(Je.icon,mo,Gn,Yi,mi,bt,o.WritingMode.none,pt,In.lineStartIndex,In.lineLength,-1,pr),fh=Je.icon.placedSymbolArray.length-1,kn&&(cs=4*kn.length,Je.addSymbols(Je.icon,kn,Gn,Yi,mi,bt,o.WritingMode.vertical,pt,In.lineStartIndex,In.lineLength,-1,pr),mh=Je.icon.placedSymbolArray.length-1)}const xp=Object.keys(ei.horizontal);for(const er of xp){const Kr=ei.horizontal[er];if(!An){vp=Xr(Kr.text);const kn=Ci.layout.get("text-rotate").evaluate(bt,{},pr);An=new Bc(Bi,pt,Hi,Cr,hr,Kr,ki,Ri,Qi,kn)}const mo=Kr.positionedLines.length===1;if(Ml+=pp(Je,pt,Kr,Vr,Ci,Qi,bt,dr,In,ei.vertical?o.WritingMode.horizontal:o.WritingMode.horizontalOnly,mo?xp:[er],us,fh,jr,pr),mo)break}ei.vertical&&(yp+=pp(Je,pt,ei.vertical,Vr,Ci,Qi,bt,dr,In,o.WritingMode.vertical,["vertical"],us,mh,jr,pr));const Cg=An?An.boxStartIndex:Je.collisionBoxArray.length,kg=An?An.boxEndIndex:Je.collisionBoxArray.length,Mg=fn?fn.boxStartIndex:Je.collisionBoxArray.length,Pg=fn?fn.boxEndIndex:Je.collisionBoxArray.length,zg=ls?ls.boxStartIndex:Je.collisionBoxArray.length,Dg=ls?ls.boxEndIndex:Je.collisionBoxArray.length,Lg=Jr?Jr.boxStartIndex:Je.collisionBoxArray.length,Rg=Jr?Jr.boxEndIndex:Je.collisionBoxArray.length;let Cn=-1;const Fc=(er,Kr)=>er&&er.circleDiameter?Math.max(er.circleDiameter,Kr):Kr;Cn=Fc(An,Cn),Cn=Fc(fn,Cn),Cn=Fc(ls,Cn),Cn=Fc(Jr,Cn);const bp=Cn>-1?1:0;bp&&(Cn*=pn/Di),Je.glyphOffsetArray.length>=fa.MAX_GLYPHS&&ft("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),bt.sortKey!==void 0&&Je.addToSortKeyRanges(Je.symbolInstances.length,bt.sortKey);const Bg=dp(Ci,bt,pr),[Og,Fg]=function(er,Kr){const mo=er.length,kn=Kr==null?void 0:Kr.values;if((kn==null?void 0:kn.length)>0)for(let go=0;go=0?us.right:-1,us.center>=0?us.center:-1,us.left>=0?us.left:-1,us.vertical||-1,fh,mh,vp,Cg,kg,Mg,Pg,zg,Dg,Lg,Rg,Hi,Ml,yp,Pr,cs,bp,0,ki,Cn,Og,Fg)}(i,tt,Ce,r,s,l,Ge,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,H,[le,le,le,le],Ue,x,se,ue,Ye,O,e,p,T,C,f)};if(Ne==="line")for(const Ce of rp(e.geometry,0,0,ci,ci)){const tt=xg(Ce,ie,xe,r.vertical||F,s,24,K,i.overscaling,ci);for(const Je of tt)F&&Ig(i,F.text,Re,Je)||ze(Ce,Je)}else if(Ne==="line-center"){for(const Ce of e.geometry)if(Ce.length>1){const tt=vg(Ce,xe,r.vertical||F,s,24,K);tt&&ze(Ce,tt)}}else if(e.type==="Polygon")for(const Ce of Fu(e.geometry,0)){const tt=Tg(Ce,16);ze(Ce[0],new Ps(tt.x,tt.y,0))}else if(e.type==="LineString")for(const Ce of e.geometry)ze(Ce,new Ps(Ce[0].x,Ce[0].y,0));else if(e.type==="Point")for(const Ce of e.geometry)for(const tt of Ce)ze([tt],new Ps(tt.x,tt.y,0))}function pp(i,e,r,s,l,p,f,_,x,T,C,P,L,O,F){const q=function(se,ie,le,ue,xe,Ue,Ye,Ne){const Re=ue.layout.get("text-rotate").evaluate(Ue,{})*Math.PI/180,Me=[];for(const Ge of ie.positionedLines)for(const ze of Ge.positionedGlyphs){if(!ze.rect)continue;const Ce=ze.rect||{};let tt=Md+1,Je=!0,pt=1,Kt=0;const ei=(xe||Ne)&&ze.vertical,Li=ze.metrics.advance*ze.scale/2;if(Ne&&ie.verticalizable&&(Kt=Ge.lineOffset/2-(ze.imageName?-(Di-ze.metrics.width*ze.scale)/2:(ze.scale-1)*Di)),ze.imageName){const mi=Ye[ze.imageName];Je=mi.sdf,pt=mi.pixelRatio,tt=Ar/pt}const Vr=xe?[ze.x+Li,ze.y]:[0,0];let ur=xe?[0,0]:[ze.x+Li+le[0],ze.y+le[1]-Kt],Ci=[0,0];ei&&(Ci=ur,ur=[0,0]);const Bi=(ze.metrics.left-tt)*ze.scale-Li+ur[0],Hi=(-ze.metrics.top-tt)*ze.scale+ur[1],Cr=Bi+Ce.w*ze.scale/pt,hr=Hi+Ce.h*ze.scale/pt,ki=new $(Bi,Hi),Ri=new $(Cr,Hi),Qi=new $(Bi,hr),dr=new $(Cr,hr);if(ei){const mi=new $(-Li,Li-El),Yi=-Math.PI/2,bt=Di/2-Li,jr=new $(5-El-bt,-(ze.imageName?bt:0)),Ji=new $(...Ci);ki._rotateAround(Yi,mi)._add(jr)._add(Ji),Ri._rotateAround(Yi,mi)._add(jr)._add(Ji),Qi._rotateAround(Yi,mi)._add(jr)._add(Ji),dr._rotateAround(Yi,mi)._add(jr)._add(Ji)}if(Re){const mi=Math.sin(Re),Yi=Math.cos(Re),bt=[Yi,-mi,mi,Yi];ki._matMult(bt),Ri._matMult(bt),Qi._matMult(bt),dr._matMult(bt)}const kr=new $(0,0),Mr=new $(0,0);Me.push({tl:ki,tr:Ri,bl:Qi,br:dr,tex:Ce,writingMode:ie.writingMode,glyphOffset:Vr,sectionIndex:ze.sectionIndex,isSDF:Je,pixelOffsetTL:kr,pixelOffsetBR:Mr,minFontScaleX:0,minFontScaleY:0})}return Me}(0,r,_,l,p,f,s,i.allowVerticalPlacement),H=i.textSizeData;let K=null;H.kind==="source"?(K=[qn*l.layout.get("text-size").evaluate(f,{})],K[0]>ks&&ft(`${i.layerIds[0]}: Value for "text-size" is >= ${Il}. Reduce your "text-size".`)):H.kind==="composite"&&(K=[qn*O.compositeTextSizes[0].evaluate(f,{},F),qn*O.compositeTextSizes[1].evaluate(f,{},F)],(K[0]>ks||K[1]>ks)&&ft(`${i.layerIds[0]}: Value for "text-size" is >= ${Il}. Reduce your "text-size".`)),i.addSymbols(i.text,q,K,_,p,f,T,e,x.lineStartIndex,x.lineLength,L,F);for(const se of C)P[se]=i.text.placedSymbolArray.length-1;return 4*q.length}function fp(i){for(const e in i)return i[e];return null}function Ig(i,e,r,s){const l=i.compareText;if(e in l){const p=l[e];for(let f=p.length-1;f>=0;f--)if(s.dist(p[f])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const p=mp[15&s];if(!p)throw new Error("Unrecognized array type.");const[f]=new Uint16Array(e,2,1),[_]=new Uint32Array(e,4,1);return new ah(_,f,p,e)}constructor(e,r=64,s=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const p=mp.indexOf(this.ArrayType),f=2*e*this.ArrayType.BYTES_PER_ELEMENT,_=e*this.IndexArrayType.BYTES_PER_ELEMENT,x=(8-_%8)%8;if(p<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+x,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+f+_+x),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+x,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+p]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return lh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:f,nodeSize:_}=this,x=[0,p.length-1,0],T=[];for(;x.length;){const C=x.pop()||0,P=x.pop()||0,L=x.pop()||0;if(P-L<=_){for(let H=L;H<=P;H++){const K=f[2*H],se=f[2*H+1];K>=e&&K<=s&&se>=r&&se<=l&&T.push(p[H])}continue}const O=L+P>>1,F=f[2*O],q=f[2*O+1];F>=e&&F<=s&&q>=r&&q<=l&&T.push(p[O]),(C===0?e<=F:r<=q)&&(x.push(L),x.push(O-1),x.push(1-C)),(C===0?s>=F:l>=q)&&(x.push(O+1),x.push(P),x.push(1-C))}return T}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:p,nodeSize:f}=this,_=[0,l.length-1,0],x=[],T=s*s;for(;_.length;){const C=_.pop()||0,P=_.pop()||0,L=_.pop()||0;if(P-L<=f){for(let H=L;H<=P;H++)_p(p[2*H],p[2*H+1],e,r)<=T&&x.push(l[H]);continue}const O=L+P>>1,F=p[2*O],q=p[2*O+1];_p(F,q,e,r)<=T&&x.push(l[O]),(C===0?e-s<=F:r-s<=q)&&(_.push(L),_.push(O-1),_.push(1-C)),(C===0?e+s>=F:r+s>=q)&&(_.push(O+1),_.push(P),_.push(1-C))}return x}}function lh(i,e,r,s,l,p){if(l-s<=r)return;const f=s+l>>1;gp(i,e,f,s,l,p),lh(i,e,r,s,f-1,1-p),lh(i,e,r,f+1,l,1-p)}function gp(i,e,r,s,l,p){for(;l>s;){if(l-s>600){const T=l-s+1,C=r-s+1,P=Math.log(T),L=.5*Math.exp(2*P/3),O=.5*Math.sqrt(P*L*(T-L)/T)*(C-T/2<0?-1:1);gp(i,e,r,Math.max(s,Math.floor(r-C*L/T+O)),Math.min(l,Math.floor(r+(T-C)*L/T+O)),p)}const f=e[2*r+p];let _=s,x=l;for(Cl(i,e,s,r),e[2*l+p]>f&&Cl(i,e,s,l);_f;)x--}e[2*s+p]===f?Cl(i,e,s,x):(x++,Cl(i,e,x,l)),x<=r&&(s=x+1),r<=x&&(l=x-1)}}function Cl(i,e,r,s){ch(i,r,s),ch(e,2*r,2*s),ch(e,2*r+1,2*s+1)}function ch(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function _p(i,e,r,s){const l=i-r,p=e-s;return l*l+p*p}var uh;o.PerformanceMarkers=void 0,(uh=o.PerformanceMarkers||(o.PerformanceMarkers={})).create="create",uh.load="load",uh.fullLoad="fullLoad";let Oc=null,kl=[];const hh=1e3/60,dh="loadTime",ph="fullLoadTime",Ag={mark(i){performance.mark(i)},frame(i){const e=i;Oc!=null&&kl.push(e-Oc),Oc=e},clearMetrics(){Oc=null,kl=[],performance.clearMeasures(dh),performance.clearMeasures(ph);for(const i in o.PerformanceMarkers)performance.clearMarks(o.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(dh,o.PerformanceMarkers.create,o.PerformanceMarkers.load),performance.measure(ph,o.PerformanceMarkers.create,o.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(dh)[0].duration,e=performance.getEntriesByName(ph)[0].duration,r=kl.length,s=1/(kl.reduce((p,f)=>p+f,0)/r/1e3),l=kl.filter(p=>p>hh).reduce((p,f)=>p+(f-hh)/hh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};o.AJAXError=hi,o.ARRAY_TYPE=la,o.Actor=class{constructor(i,e,r){this.receive=s=>{const l=s.data,p=l.id;if(p&&(!l.targetMapId||this.mapId===l.targetMapId))if(l.type===""){delete this.tasks[p];const f=this.cancelCallbacks[p];delete this.cancelCallbacks[p],f&&f()}else rt()||l.mustQueue?(this.tasks[p]=l,this.taskQueue.push(p),this.invoker.trigger()):this.processTask(p,l)},this.process=()=>{if(!this.taskQueue.length)return;const s=this.taskQueue.shift(),l=this.tasks[s];delete this.tasks[s],this.taskQueue.length&&this.invoker.trigger(),l&&this.processTask(s,l)},this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new _g(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=rt()?i:window}send(i,e,r,s,l=!1){const p=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[p]=r);const f=Mi(this.globalScope)?void 0:[];return this.target.postMessage({id:p,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:ro(e,f)},f),{cancel:()=>{r&&delete this.callbacks[p],this.target.postMessage({id:p,type:"",targetMapId:s,sourceMapId:this.mapId})}}}processTask(i,e){if(e.type===""){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(ts(e.error)):r(null,ts(e.data)))}else{let r=!1;const s=Mi(this.globalScope)?void 0:[],l=e.hasCallback?(_,x)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:_?ro(_):null,data:ro(x,s)},s)}:_=>{r=!0};let p=null;const f=ts(e.data);if(this.parent[e.type])p=this.parent[e.type](e.sourceMapId,f,l);else if(this.parent.getWorkerSource){const _=e.type.split(".");p=this.parent.getWorkerSource(e.sourceMapId,_[0],f.source)[_[1]](f,l)}else l(new Error(`Could not find function ${e.type}`));!r&&p&&p.cancel&&(this.cancelCallbacks[i]=p.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},o.AlphaImage=gl,o.CanonicalTileID=nh,o.CollisionBoxArray=v,o.CollisionCircleLayoutArray=class extends hl{},o.Color=at,o.DEMData=Kd,o.DataConstantProperty=Ke,o.DictionaryCoder=$d,o.EXTENT=ci,o.ErrorEvent=Rr,o.EvaluationParameters=$t,o.Event=rr,o.Evented=Oe,o.FeatureIndex=ep,o.FillBucket=Vu,o.FillExtrusionBucket=qu,o.GeoJSONFeature=Qd,o.ImageAtlas=zd,o.ImagePosition=Hu,o.KDBush=ah,o.LineBucket=Gu,o.LineStripIndexArray=class extends c{},o.LngLat=Ms,o.MercatorCoordinate=zc,o.ONE_EM=Di,o.OverscaledTileID=Yr,o.PerformanceUtils=Ag,o.Point=$,o.Pos3dArray=class extends co{},o.PosArray=ce,o.Properties=ar,o.Protobuf=Xu,o.QuadTriangleArray=class extends sa{},o.RGBAImage=Hr,o.RasterBoundsArray=class extends uo{},o.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},o.SegmentVector=et,o.SymbolBucket=fa,o.Transitionable=mc,o.TriangleIndexArray=Qe,o.Uniform1f=Pi,o.Uniform1i=class extends xi{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},o.Uniform2f=class extends xi{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},o.Uniform3f=class extends xi{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},o.Uniform4f=Zi,o.UniformColor=Ss,o.UniformMatrix4f=class extends xi{constructor(i,e){super(i,e),this.current=zi}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},o.UnwrappedTileID=Jd,o.ValidationError=Pe,o.ZoomHistory=$a,o.addDynamicAttributes=$u,o.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=xt})},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(s):xt},o.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(s=>{e(null,s)}).catch(s=>{e(new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},o.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let p=null;i.forEach((f,_)=>{e(f,(x,T)=>{x&&(p=x),l[_]=T,--s==0&&r(p,l)})})},o.bezier=Ze,o.browser=nn,o.clamp=Ve,o.clipLine=rp,o.clone=function(i){var e=new la(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},o.clone$1=wt,o.collisionCircleLayout=Zm,o.config=Ti,o.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},o.create=function(){var i=new la(16);return la!=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},o.createExpression=vt,o.createFilter=Xa,o.createLayout=vi,o.createStyleLayer=function(i){if(i.type==="custom")return new gg(i);switch(i.type){case"background":return new pg(i);case"circle":return new $f(i);case"fill":return new ym(i);case"fill-extrusion":return new Dm(i);case"heatmap":return new em(i);case"hillshade":return new im(i);case"line":return new Vm(i);case"raster":return new mg(i);case"symbol":return new Pc(i)}},o.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s{s[f.source]?r.push({command:Bt.removeLayer,args:[f.id]}):p.push(f)}),r=r.concat(l),function(f,_,x){_=_||[];const T=(f=f||[]).map(Bs),C=_.map(Bs),P=f.reduce(ps,{}),L=_.reduce(ps,{}),O=T.slice(),F=Object.create(null);let q,H,K,se,ie,le,ue;for(q=0,H=0;q{}}},o.groupByLayout=function(i,e){const r={};for(let l=0;l@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,p)=>{const f=l||p;return e[s]=!f||f.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},o.parseGlyphPbf=function(i){return new Xu(i).readFields(ig,[])},o.pbf=Td,o.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=ci/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,s=e._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new $t(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new $t(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new $t(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:T,maxZoom:C}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new $t(T),i.canonical),s["text-size"].possiblyEvaluate(new $t(C),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:T,maxZoom:C}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new $t(T),i.canonical),s["icon-size"].possiblyEvaluate(new $t(C),i.canonical)]}const p=r.get("text-line-height")*Di,f=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",_=r.get("text-keep-upright"),x=r.get("text-size");for(const T of i.bucket.features){const C=r.get("text-font").evaluate(T,{},i.canonical).join(","),P=x.evaluate(T,{},i.canonical),L=l.layoutTextSize.evaluate(T,{},i.canonical),O=l.layoutIconSize.evaluate(T,{},i.canonical),F={horizontal:{},vertical:void 0},q=T.text;let H,K=[0,0];if(q){const le=q.toString(),ue=r.get("text-letter-spacing").evaluate(T,{},i.canonical)*Di,xe=dc(le)?ue:0,Ue=r.get("text-anchor").evaluate(T,{},i.canonical),Ye=dp(e,T,i.canonical);if(!Ye){const ze=r.get("text-radial-offset").evaluate(T,{},i.canonical);K=ze?hp(Ue,[ze*Di,sh]):r.get("text-offset").evaluate(T,{},i.canonical).map(Ce=>Ce*Di)}let Ne=f?"center":r.get("text-justify").evaluate(T,{},i.canonical);const Re=r.get("symbol-placement"),Me=Re==="point"?r.get("text-max-width").evaluate(T,{},i.canonical)*Di:0,Ge=()=>{i.bucket.allowVerticalPlacement&&$o(le)&&(F.vertical=Cc(q,i.glyphMap,i.glyphPositions,i.imagePositions,C,Me,p,Ue,"left",xe,K,o.WritingMode.vertical,!0,Re,L,P))};if(!f&&Ye){const ze=new Set;if(Ne==="auto")for(let tt=0;ttthis._layers[be.id]),oe=Q[0];if(oe.visibility==="none")continue;const te=oe.source||"";let ee=this.familiesBySource[te];ee||(ee=this.familiesBySource[te]={});const ae=oe.sourceLayer||"_geojsonTileLayer";let ve=ee[ae];ve||(ve=ee[ae]=[]),ve.push(Q)}}}class k{constructor(z){const R={},N=[];for(const te in z){const ee=z[te],ae=R[te]={};for(const ve in ee){const be=ee[+ve];if(!be||be.bitmap.width===0||be.bitmap.height===0)continue;const we={x:0,y:0,w:be.bitmap.width+2,h:be.bitmap.height+2};N.push(we),ae[ve]={rect:we,metrics:be.metrics}}}const{w:Y,h:Q}=o.potpack(N),oe=new o.AlphaImage({width:Y||1,height:Q||1});for(const te in z){const ee=z[te];for(const ae in ee){const ve=ee[+ae];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const be=R[te][ae].rect;o.AlphaImage.copy(ve.bitmap,oe,{x:0,y:0},{x:be.x+1,y:be.y+1},ve.bitmap)}}this.image=oe,this.positions=R}}o.register("GlyphAtlas",k);class W{constructor(z){this.tileID=new o.OverscaledTileID(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(z,R,N,Y,Q){this.status="parsing",this.data=z,this.collisionBoxArray=new o.CollisionBoxArray;const oe=new o.DictionaryCoder(Object.keys(z.layers).sort()),te=new o.FeatureIndex(this.tileID,this.promoteId);te.bucketLayerIDs=[];const ee={},ae={featureIndex:te,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:N},ve=R.familiesBySource[this.source];for(const yt in ve){const It=z.layers[yt];if(!It)continue;It.version===1&&o.warnOnce(`Vector tile source "${this.source}" layer "${yt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const sr=oe.encode(yt),at=[];for(let Si=0;Si=Ni.maxzoom||Ni.visibility!=="none"&&($(Si,this.zoom,N),(ee[Ni.id]=Ni.createBucket({index:te.bucketLayerIDs.length,layers:Si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:sr,sourceID:this.source})).populate(at,ae,this.tileID.canonical),te.bucketLayerIDs.push(Si.map(gi=>gi.id)))}}let be,we,nt,ct;const We=o.mapObject(ae.glyphDependencies,yt=>Object.keys(yt).map(Number));this.inFlightDependencies.forEach(yt=>yt==null?void 0:yt.cancel()),this.inFlightDependencies=[];const $e=++this.dependencySentinel;Object.keys(We).length?this.inFlightDependencies.push(Y.send("getGlyphs",{uid:this.uid,stacks:We,source:this.source,tileID:this.tileID,type:"glyphs"},(yt,It)=>{$e===this.dependencySentinel&&(be||(be=yt,we=It,Vt.call(this)))})):we={};const lt=Object.keys(ae.iconDependencies);lt.length?this.inFlightDependencies.push(Y.send("getImages",{icons:lt,source:this.source,tileID:this.tileID,type:"icons"},(yt,It)=>{$e===this.dependencySentinel&&(be||(be=yt,nt=It,Vt.call(this)))})):nt={};const At=Object.keys(ae.patternDependencies);function Vt(){if(be)return Q(be);if(we&&nt&&ct){const yt=new k(we),It=new o.ImageAtlas(nt,ct);for(const sr in ee){const at=ee[sr];at instanceof o.SymbolBucket?($(at.layers,this.zoom,N),o.performSymbolLayout({bucket:at,glyphMap:we,glyphPositions:yt.positions,imageMap:nt,imagePositions:It.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):at.hasPattern&&(at instanceof o.LineBucket||at instanceof o.FillBucket||at instanceof o.FillExtrusionBucket)&&($(at.layers,this.zoom,N),at.addFeatures(ae,this.tileID.canonical,It.patternPositions))}this.status="done",Q(null,{buckets:Object.values(ee).filter(sr=>!sr.isEmpty()),featureIndex:te,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:yt.image,imageAtlas:It,glyphMap:this.returnDependencies?we:null,iconMap:this.returnDependencies?nt:null,glyphPositions:this.returnDependencies?yt.positions:null})}}At.length?this.inFlightDependencies.push(Y.send("getImages",{icons:At,source:this.source,tileID:this.tileID,type:"patterns"},(yt,It)=>{$e===this.dependencySentinel&&(be||(be=yt,ct=It,Vt.call(this)))})):ct={},Vt.call(this)}}function $(Z,z,R){const N=new o.EvaluationParameters(z);for(const Y of Z)Y.recalculate(N,R)}function he(Z,z){const R=o.getArrayBuffer(Z.request,(N,Y,Q,oe)=>{if(N)z(N);else if(Y)try{const te=new o.vectorTile.VectorTile(new o.Protobuf(Y));z(null,{vectorTile:te,rawData:Y,cacheControl:Q,expires:oe})}catch(te){const ee=new Uint8Array(Y);let ae=`Unable to parse the tile at ${Z.request.url}, `;ae+=ee[0]===31&&ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${te.messge}`,z(new Error(ae))}});return()=>{R.cancel(),z()}}class me{constructor(z,R,N,Y){this.actor=z,this.layerIndex=R,this.availableImages=N,this.loadVectorData=Y||he,this.fetching={},this.loading={},this.loaded={}}loadTile(z,R){const N=z.uid;this.loading||(this.loading={});const Y=!!(z&&z.request&&z.request.collectResourceTiming)&&new o.RequestPerformance(z.request),Q=this.loading[N]=new W(z);Q.abort=this.loadVectorData(z,(oe,te)=>{if(delete this.loading[N],oe||!te)return Q.status="done",this.loaded[N]=Q,R(oe);const ee=te.rawData,ae={};te.expires&&(ae.expires=te.expires),te.cacheControl&&(ae.cacheControl=te.cacheControl);const ve={};if(Y){const be=Y.finish();be&&(ve.resourceTiming=JSON.parse(JSON.stringify(be)))}Q.vectorTile=te.vectorTile,Q.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor,(be,we)=>{if(delete this.fetching[N],be||!we)return R(be);R(null,o.extend({rawTileData:ee.slice(0)},we,ae,ve))}),this.loaded=this.loaded||{},this.loaded[N]=Q,this.fetching[N]={rawTileData:ee,cacheControl:ae,resourceTiming:ve}})}reloadTile(z,R){const N=this.loaded,Y=z.uid;if(N&&N[Y]){const Q=N[Y];Q.showCollisionBoxes=z.showCollisionBoxes,Q.status==="parsing"?Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor,(oe,te)=>{if(oe||!te)return R(oe,te);let ee;if(this.fetching[Y]){const{rawTileData:ae,cacheControl:ve,resourceTiming:be}=this.fetching[Y];delete this.fetching[Y],ee=o.extend({rawTileData:ae.slice(0)},te,ve,be)}else ee=te;R(null,ee)}):Q.status==="done"&&(Q.vectorTile?Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor,R):R())}}abortTile(z,R){const N=this.loading,Y=z.uid;N&&N[Y]&&N[Y].abort&&(N[Y].abort(),delete N[Y]),R()}removeTile(z,R){const N=this.loaded,Y=z.uid;N&&N[Y]&&delete N[Y],R()}}class ge{constructor(){this.loaded={}}loadTile(z,R){const{uid:N,encoding:Y,rawImageData:Q,redFactor:oe,greenFactor:te,blueFactor:ee,baseShift:ae}=z,ve=o.isImageBitmap(Q)?this.getImageData(Q):Q,be=new o.DEMData(N,ve,Y,oe,te,ee,ae);this.loaded=this.loaded||{},this.loaded[N]=be,R(null,be)}getImageData(z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(z.width,z.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=z.width,this.offscreenCanvas.height=z.height,this.offscreenCanvasContext.drawImage(z,0,0,z.width,z.height);const R=this.offscreenCanvasContext.getImageData(-1,-1,z.width+2,z.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new o.RGBAImage({width:R.width,height:R.height},R.data)}removeTile(z){const R=this.loaded,N=z.uid;R&&R[N]&&delete R[N]}}function Ze(Z,z){if(Z.length!==0){Ee(Z[0],z);for(var R=1;R=Math.abs(te)?R-ee+te:te-ee+R,R=ee}R+N>=0!=!!z&&Z.reverse()}var Ve=o.getDefaultExportFromCjs(function Z(z,R){var N,Y=z&&z.type;if(Y==="FeatureCollection")for(N=0;N>31}function Vi(Z,z){for(var R=Z.loadGeometry(),N=Z.type,Y=0,Q=0,oe=R.length,te=0;teZ},hi=Math.fround||(di=new Float32Array(1),Z=>(di[0]=+Z,di[0]));var di;const ri=3,Zt=5,ir=6;class Be{constructor(z){this.options=Object.assign(Object.create(Ti),z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(z){const{log:R,minZoom:N,maxZoom:Y}=this.options;R&&console.time("total time");const Q=`prepare ${z.length} points`;R&&console.time(Q),this.points=z;const oe=[];for(let ee=0;ee=N;ee--){const ae=+Date.now();te=this.trees[ee]=this._createTree(this._cluster(te,ee)),R&&console.log("z%d: %d clusters in %dms",ee,te.numItems,+Date.now()-ae)}return R&&console.timeEnd("total time"),this}getClusters(z,R){let N=((z[0]+180)%360+360)%360-180;const Y=Math.max(-90,Math.min(90,z[1]));let Q=z[2]===180?180:((z[2]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)N=-180,Q=180;else if(N>Q){const be=this.getClusters([N,Y,180,oe],R),we=this.getClusters([-180,Y,Q,oe],R);return be.concat(we)}const te=this.trees[this._limitZoom(R)],ee=te.range(Ei(N),rr(oe),Ei(Q),rr(Y)),ae=te.data,ve=[];for(const be of ee){const we=this.stride*be;ve.push(ae[we+Zt]>1?ut(ae,we,this.clusterProps):this.points[ae[we+ri]])}return ve}getChildren(z){const R=this._getOriginId(z),N=this._getOriginZoom(z),Y="No cluster with the specified id.",Q=this.trees[N];if(!Q)throw new Error(Y);const oe=Q.data;if(R*this.stride>=oe.length)throw new Error(Y);const te=this.options.radius/(this.options.extent*Math.pow(2,N-1)),ee=Q.within(oe[R*this.stride],oe[R*this.stride+1],te),ae=[];for(const ve of ee){const be=ve*this.stride;oe[be+4]===z&&ae.push(oe[be+Zt]>1?ut(oe,be,this.clusterProps):this.points[oe[be+ri]])}if(ae.length===0)throw new Error(Y);return ae}getLeaves(z,R,N){const Y=[];return this._appendLeaves(Y,z,R=R||10,N=N||0,0),Y}getTile(z,R,N){const Y=this.trees[this._limitZoom(z)],Q=Math.pow(2,z),{extent:oe,radius:te}=this.options,ee=te/oe,ae=(N-ee)/Q,ve=(N+1+ee)/Q,be={features:[]};return this._addTileFeatures(Y.range((R-ee)/Q,ae,(R+1+ee)/Q,ve),Y.data,R,N,Q,be),R===0&&this._addTileFeatures(Y.range(1-ee/Q,ae,1,ve),Y.data,Q,N,Q,be),R===Q-1&&this._addTileFeatures(Y.range(0,ae,ee/Q,ve),Y.data,-1,N,Q,be),be.features.length?be:null}getClusterExpansionZoom(z){let R=this._getOriginZoom(z)-1;for(;R<=this.options.maxZoom;){const N=this.getChildren(z);if(R++,N.length!==1)break;z=N[0].properties.cluster_id}return R}_appendLeaves(z,R,N,Y,Q){const oe=this.getChildren(R);for(const te of oe){const ee=te.properties;if(ee&&ee.cluster?Q+ee.point_count<=Y?Q+=ee.point_count:Q=this._appendLeaves(z,ee.cluster_id,N,Y,Q):Q1;let ve,be,we;if(ae)ve=Xt(R,ee,this.clusterProps),be=R[ee],we=R[ee+1];else{const We=this.points[R[ee+ri]];ve=We.properties;const[$e,lt]=We.geometry.coordinates;be=Ei($e),we=rr(lt)}const nt={type:1,geometry:[[Math.round(this.options.extent*(be*Q-N)),Math.round(this.options.extent*(we*Q-Y))]],tags:ve};let ct;ct=ae||this.options.generateId?R[ee+ri]:this.points[R[ee+ri]].id,ct!==void 0&&(nt.id=ct),oe.features.push(nt)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,R){const{radius:N,extent:Y,reduce:Q,minPoints:oe}=this.options,te=N/(Y*Math.pow(2,R)),ee=z.data,ae=[],ve=this.stride;for(let be=0;beR&&($e+=ee[At+Zt])}if($e>We&&$e>=oe){let lt,At=we*We,Vt=nt*We,yt=-1;const It=((be/ve|0)<<5)+(R+1)+this.points.length;for(const sr of ct){const at=sr*ve;if(ee[at+2]<=R)continue;ee[at+2]=R;const Si=ee[at+Zt];At+=ee[at]*Si,Vt+=ee[at+1]*Si,ee[at+4]=It,Q&&(lt||(lt=this._map(ee,be,!0),yt=this.clusterProps.length,this.clusterProps.push(lt)),Q(lt,this._map(ee,at)))}ee[be+4]=It,ae.push(At/$e,Vt/$e,1/0,It,-1,$e),Q&&ae.push(yt)}else{for(let lt=0;lt1)for(const lt of ct){const At=lt*ve;if(!(ee[At+2]<=R)){ee[At+2]=R;for(let Vt=0;Vt>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,R,N){if(z[R+Zt]>1){const oe=this.clusterProps[z[R+ir]];return N?Object.assign({},oe):oe}const Y=this.points[z[R+ri]].properties,Q=this.options.map(Y);return N&&Q===Y?Object.assign({},Q):Q}}function ut(Z,z,R){return{type:"Feature",id:Z[z+ri],properties:Xt(Z,z,R),geometry:{type:"Point",coordinates:[(N=Z[z],360*(N-.5)),Rr(Z[z+1])]}};var N}function Xt(Z,z,R){const N=Z[z+Zt],Y=N>=1e4?`${Math.round(N/1e3)}k`:N>=1e3?Math.round(N/100)/10+"k":N,Q=Z[z+ir],oe=Q===-1?{}:Object.assign({},R[Q]);return Object.assign(oe,{cluster:!0,cluster_id:Z[z+ri],point_count:N,point_count_abbreviated:Y})}function Ei(Z){return Z/360+.5}function rr(Z){const z=Math.sin(Z*Math.PI/180),R=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return R<0?0:R>1?1:R}function Rr(Z){const z=(180-360*Z)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function Oe(Z,z,R,N){for(var Y,Q=N,oe=R-z>>1,te=R-z,ee=Z[z],ae=Z[z+1],ve=Z[R],be=Z[R+1],we=z+3;weQ)Y=we,Q=nt;else if(nt===Q){var ct=Math.abs(we-oe);ctN&&(Y-z>3&&Oe(Z,z,Y,N),Z[Y+2]=Q,R-Y>3&&Oe(Z,Y,R,N))}function fe(Z,z,R,N,Y,Q){var oe=Y-R,te=Q-N;if(oe!==0||te!==0){var ee=((Z-R)*oe+(z-N)*te)/(oe*oe+te*te);ee>1?(R=Y,N=Q):ee>0&&(R+=oe*ee,N+=te*ee)}return(oe=Z-R)*oe+(te=z-N)*te}function xr(Z,z,R,N){var Y={id:Z===void 0?null:Z,type:z,geometry:R,tags:N,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Q){var oe=Q.geometry,te=Q.type;if(te==="Point"||te==="MultiPoint"||te==="LineString")ds(Q,oe);else if(te==="Polygon"||te==="MultiLineString")for(var ee=0;ee0&&(oe+=N?(Y*ae-ee*Q)/2:Math.sqrt(Math.pow(ee-Y,2)+Math.pow(ae-Q,2))),Y=ee,Q=ae}var ve=z.length-3;z[2]=1,Oe(z,0,ve,R),z[ve+2]=1,z.size=Math.abs(oe),z.start=0,z.end=z.size}function Wn(Z,z,R,N){for(var Y=0;Y1?1:R}function ai(Z,z,R,N,Y,Q,oe,te){if(N/=z,Q>=(R/=z)&&oe=N)return null;for(var ee=[],ae=0;ae=R&&ct=N)){var We=[];if(we==="Point"||we==="MultiPoint")Bs(be,We,R,N,Y);else if(we==="LineString")ps(be,We,R,N,Y,!1,te.lineMetrics);else if(we==="MultiLineString")$i(be,We,R,N,Y,!1);else if(we==="Polygon")$i(be,We,R,N,Y,!0);else if(we==="MultiPolygon")for(var $e=0;$e=R&&oe<=N&&(z.push(Z[Q]),z.push(Z[Q+1]),z.push(Z[Q+2]))}}function ps(Z,z,R,N,Y,Q,oe){for(var te,ee,ae=Pe(Z),ve=Y===0?vn:Dn,be=Z.start,we=0;weR&&(ee=ve(ae,nt,ct,$e,lt,R),oe&&(ae.start=be+te*ee)):At>N?Vt=R&&(ee=ve(ae,nt,ct,$e,lt,R),yt=!0),Vt>N&&At<=N&&(ee=ve(ae,nt,ct,$e,lt,N),yt=!0),!Q&&yt&&(oe&&(ae.end=be+te*ee),z.push(ae),ae=Pe(Z)),oe&&(be+=te)}var It=Z.length-3;nt=Z[It],ct=Z[It+1],We=Z[It+2],(At=Y===0?nt:ct)>=R&&At<=N&&nr(ae,nt,ct,We),It=ae.length-3,Q&&It>=3&&(ae[It]!==ae[0]||ae[It+1]!==ae[1])&&nr(ae,ae[0],ae[1],ae[2]),ae.length&&z.push(ae)}function Pe(Z){var z=[];return z.size=Z.size,z.start=Z.start,z.end=Z.end,z}function $i(Z,z,R,N,Y,Q){for(var oe=0;oeoe.maxX&&(oe.maxX=ve),be>oe.maxY&&(oe.maxY=be)}return oe}function ot(Z,z,R,N){var Y=z.geometry,Q=z.type,oe=[];if(Q==="Point"||Q==="MultiPoint")for(var te=0;te0&&z.size<(Y?oe:N))R.numPoints+=z.length/3;else{for(var te=[],ee=0;eeoe)&&(R.numSimplified++,te.push(z[ee]),te.push(z[ee+1])),R.numPoints++;Y&&function(ae,ve){for(var be=0,we=0,nt=ae.length,ct=nt-2;we0===ve)for(we=0,nt=ae.length;we24)throw new Error("maxZoom should be in the 0-24 range");if(z.promoteId&&z.generateId)throw new Error("promoteId and generateId cannot be used together.");var N=function(Y,Q){var oe=[];if(Y.type==="FeatureCollection")for(var te=0;te1&&console.time("creation"),we=this.tiles[be]=xn(Z,z,R,N,ee),this.tileCoords.push({z,x:R,y:N}),ae)){ae>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",z,R,N,we.numFeatures,we.numPoints,we.numSimplified),console.timeEnd("creation"));var nt="z"+z;this.stats[nt]=(this.stats[nt]||0)+1,this.total++}if(we.source=Z,Y){if(z===ee.maxZoom||z===Y)continue;var ct=1<1&&console.time("clipping");var We,$e,lt,At,Vt,yt,It=.5*ee.buffer/ee.extent,sr=.5-It,at=.5+It,Si=1+It;We=$e=lt=At=null,Vt=ai(Z,ve,R-It,R+at,0,we.minX,we.maxX,ee),yt=ai(Z,ve,R+sr,R+Si,0,we.minX,we.maxX,ee),Z=null,Vt&&(We=ai(Vt,ve,N-It,N+at,1,we.minY,we.maxY,ee),$e=ai(Vt,ve,N+sr,N+Si,1,we.minY,we.maxY,ee),Vt=null),yt&&(lt=ai(yt,ve,N-It,N+at,1,we.minY,we.maxY,ee),At=ai(yt,ve,N+sr,N+Si,1,we.minY,we.maxY,ee),yt=null),ae>1&&console.timeEnd("clipping"),te.push(We||[],z+1,2*R,2*N),te.push($e||[],z+1,2*R,2*N+1),te.push(lt||[],z+1,2*R+1,2*N),te.push(At||[],z+1,2*R+1,2*N+1)}}},on.prototype.getTile=function(Z,z,R){var N=this.options,Y=N.extent,Q=N.debug;if(Z<0||Z>24)return null;var oe=1<1&&console.log("drilling down to z%d-%d-%d",Z,z,R);for(var ee,ae=Z,ve=z,be=R;!ee&&ae>0;)ae--,ve=Math.floor(ve/2),be=Math.floor(be/2),ee=this.tiles[Ln(ae,ve,be)];return ee&&ee.source?(Q>1&&console.log("found parent tile z%d-%d-%d",ae,ve,be),Q>1&&console.time("drilling down"),this.splitTile(ee.source,ae,ve,be,Z,z,R),Q>1&&console.timeEnd("drilling down"),this.tiles[te]?dt(this.tiles[te],Y):null):null};class Os extends me{constructor(z,R,N,Y){super(z,R,N,Wt),this._dataUpdateable=new Map,this.loadGeoJSON=(Q,oe)=>{const{promoteId:te}=Q;if(Q.request)return o.getJSON(Q.request,(ee,ae,ve,be)=>{this._dataUpdateable=Rn(ae,te)?Fi(ae,te):void 0,oe(ee,ae,ve,be)});if(typeof Q.data=="string")try{const ee=JSON.parse(Q.data);this._dataUpdateable=Rn(ee,te)?Fi(ee,te):void 0,oe(null,ee)}catch{oe(new Error(`Input data given to '${Q.source}' is not a valid GeoJSON object.`))}else Q.dataDiff?this._dataUpdateable?(function(ee,ae,ve){var be,we,nt,ct;if(ae.removeAll&&ee.clear(),ae.remove)for(const We of ae.remove)ee.delete(We);if(ae.add)for(const We of ae.add){const $e=Br(We,ve);$e!=null&&ee.set($e,We)}if(ae.update)for(const We of ae.update){let $e=ee.get(We.id);if($e==null)continue;const lt=!We.removeAllProperties&&(((be=We.removeProperties)===null||be===void 0?void 0:be.length)>0||((we=We.addOrUpdateProperties)===null||we===void 0?void 0:we.length)>0);if((We.newGeometry||We.removeAllProperties||lt)&&($e={...$e},ee.set(We.id,$e),lt&&($e.properties={...$e.properties})),We.newGeometry&&($e.geometry=We.newGeometry),We.removeAllProperties)$e.properties={};else if(((nt=We.removeProperties)===null||nt===void 0?void 0:nt.length)>0)for(const At of We.removeProperties)Object.prototype.hasOwnProperty.call($e.properties,At)&&delete $e.properties[At];if(((ct=We.addOrUpdateProperties)===null||ct===void 0?void 0:ct.length)>0)for(const{key:At,value:Vt}of We.addOrUpdateProperties)$e.properties[At]=Vt}}(this._dataUpdateable,Q.dataDiff,te),oe(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):oe(new Error(`Cannot update existing geojson data in ${Q.source}`)):oe(new Error(`Input data given to '${Q.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},Y&&(this.loadGeoJSON=Y)}loadData(z,R){var N;(N=this._pendingRequest)===null||N===void 0||N.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const Y=!!(z&&z.request&&z.request.collectResourceTiming)&&new o.RequestPerformance(z.request);this._pendingCallback=R,this._pendingRequest=this.loadGeoJSON(z,(Q,oe)=>{if(delete this._pendingCallback,delete this._pendingRequest,Q||!oe)return R(Q);if(typeof oe!="object")return R(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`));{Ve(oe,!0);try{if(z.filter){const ee=o.createExpression(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ee.result==="error")throw new Error(ee.value.map(ve=>`${ve.key}: ${ve.message}`).join(", "));oe={type:"FeatureCollection",features:oe.features.filter(ve=>ee.value.evaluate({zoom:0},ve))}}this._geoJSONIndex=z.cluster?new Be(function({superclusterOptions:ee,clusterProperties:ae}){if(!ae||!ee)return ee;const ve={},be={},we={accumulated:null,zoom:0},nt={properties:null},ct=Object.keys(ae);for(const We of ct){const[$e,lt]=ae[We],At=o.createExpression(lt),Vt=o.createExpression(typeof $e=="string"?[$e,["accumulated"],["get",We]]:$e);ve[We]=At.value,be[We]=Vt.value}return ee.map=We=>{nt.properties=We;const $e={};for(const lt of ct)$e[lt]=ve[lt].evaluate(we,nt);return $e},ee.reduce=(We,$e)=>{nt.properties=$e;for(const lt of ct)we.accumulated=We[lt],We[lt]=be[lt].evaluate(we,nt)},ee}(z)).load(oe.features):function(ee,ae){return new on(ee,ae)}(oe,z.geojsonVtOptions)}catch(ee){return R(ee)}this.loaded={};const te={};if(Y){const ee=Y.finish();ee&&(te.resourceTiming={},te.resourceTiming[z.source]=JSON.parse(JSON.stringify(ee)))}R(null,te)}})}reloadTile(z,R){const N=this.loaded;return N&&N[z.uid]?super.reloadTile(z,R):this.loadTile(z,R)}removeSource(z,R){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),R()}getClusterExpansionZoom(z,R){try{R(null,this._geoJSONIndex.getClusterExpansionZoom(z.clusterId))}catch(N){R(N)}}getClusterChildren(z,R){try{R(null,this._geoJSONIndex.getChildren(z.clusterId))}catch(N){R(N)}}getClusterLeaves(z,R){try{R(null,this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset))}catch(N){R(N)}}}class an{constructor(z){this.self=z,this.actor=new o.Actor(z,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:me,geojson:Os},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(R,N)=>{if(this.workerSourceTypes[R])throw new Error(`Worker source with name "${R}" already registered.`);this.workerSourceTypes[R]=N},this.self.registerRTLTextPlugin=R=>{if(o.plugin.isParsed())throw new Error("RTL text plugin already registered.");o.plugin.applyArabicShaping=R.applyArabicShaping,o.plugin.processBidirectionalText=R.processBidirectionalText,o.plugin.processStyledBidirectionalText=R.processStyledBidirectionalText}}setReferrer(z,R){this.referrer=R}setImages(z,R,N){this.availableImages[z]=R;for(const Y in this.workerSources[z]){const Q=this.workerSources[z][Y];for(const oe in Q)Q[oe].availableImages=R}N()}setLayers(z,R,N){this.getLayerIndex(z).replace(R),N()}updateLayers(z,R,N){this.getLayerIndex(z).update(R.layers,R.removedIds),N()}loadTile(z,R,N){this.getWorkerSource(z,R.type,R.source).loadTile(R,N)}loadDEMTile(z,R,N){this.getDEMWorkerSource(z,R.source).loadTile(R,N)}reloadTile(z,R,N){this.getWorkerSource(z,R.type,R.source).reloadTile(R,N)}abortTile(z,R,N){this.getWorkerSource(z,R.type,R.source).abortTile(R,N)}removeTile(z,R,N){this.getWorkerSource(z,R.type,R.source).removeTile(R,N)}removeDEMTile(z,R){this.getDEMWorkerSource(z,R.source).removeTile(R)}removeSource(z,R,N){if(!this.workerSources[z]||!this.workerSources[z][R.type]||!this.workerSources[z][R.type][R.source])return;const Y=this.workerSources[z][R.type][R.source];delete this.workerSources[z][R.type][R.source],Y.removeSource!==void 0?Y.removeSource(R,N):N()}loadWorkerSource(z,R,N){try{this.self.importScripts(R.url),N()}catch(Y){N(Y.toString())}}syncRTLPluginState(z,R,N){try{o.plugin.setState(R);const Y=o.plugin.getPluginURL();if(o.plugin.isLoaded()&&!o.plugin.isParsed()&&Y!=null){this.self.importScripts(Y);const Q=o.plugin.isParsed();N(Q?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Y}`),Q)}}catch(Y){N(Y.toString())}}getAvailableImages(z){let R=this.availableImages[z];return R||(R=[]),R}getLayerIndex(z){let R=this.layerIndexes[z];return R||(R=this.layerIndexes[z]=new U),R}getWorkerSource(z,R,N){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][R]||(this.workerSources[z][R]={}),!this.workerSources[z][R][N]){const Y={send:(Q,oe,te)=>{this.actor.send(Q,oe,te,z)}};this.workerSources[z][R][N]=new this.workerSourceTypes[R](Y,this.getLayerIndex(z),this.getAvailableImages(z))}return this.workerSources[z][R][N]}getDEMWorkerSource(z,R){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][R]||(this.demWorkerSources[z][R]=new ge),this.demWorkerSources[z][R]}}return o.isWorker()&&(self.worker=new an(self)),an}),I(["./shared"],function(o){var U="3.4.0";class k{static testProp(t){if(!k.docStyle)return t[0];for(let n=0;n{window.removeEventListener("click",k.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new o.Point(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),c=[];for(let d=0;d{t=[],n=0,a=0,c={}},u.addThrottleControl=E=>{const A=a++;return c[A]=E,A},u.removeThrottleControl=E=>{delete c[E],v()},u.getImage=(E,A,M=!0)=>{W.supported&&(E.headers||(E.headers={}),E.headers.accept="image/webp,*/*");const B={requestParameters:E,supportImageRefresh:M,callback:A,cancelled:!1,completed:!1,cancel:()=>{B.completed||B.cancelled||(B.cancelled=!0,B.innerRequest&&(B.innerRequest.cancel(),n--),v())}};return t.push(B),v(),B};const d=E=>{const{requestParameters:A,supportImageRefresh:M,callback:B}=E;return o.extend(A,{type:"image"}),(M!==!1||o.isWorker()||o.getProtocolAction(A.url)||A.headers&&!Object.keys(A.headers).reduce((G,j)=>G&&j==="accept",!0)?o.makeRequest:b)(A,(G,j,X,V)=>{y(E,B,G,j,X,V)})},y=(E,A,M,B,G,j)=>{M?A(M):B instanceof HTMLImageElement||o.isImageBitmap(B)?A(null,B):B&&((X,V)=>{typeof createImageBitmap=="function"?o.arrayBufferToImageBitmap(X,V):o.arrayBufferToImage(X,V)})(B,(X,V)=>{X!=null?A(X):V!=null&&A(null,V,{cacheControl:G,expires:j})}),E.cancelled||(E.completed=!0,n--,v())},v=()=>{const E=(()=>{const A=Object.keys(c);let M=!1;if(A.length>0){for(const B of A)if(M=c[B](),M)break}return M})()?o.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let A=n;A0;A++){const M=t.shift();if(M.cancelled){A--;continue}const B=d(M);n++,M.innerRequest=B}},b=(E,A)=>{const M=new Image,B=E.url;let G=!1;const j=E.credentials;return j&&j==="include"?M.crossOrigin="use-credentials":(j&&j==="same-origin"||!o.sameOrigin(B))&&(M.crossOrigin="anonymous"),M.fetchPriority="high",M.onload=()=>{A(null,M),M.onerror=M.onload=null},M.onerror=()=>{G||A(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),M.onerror=M.onload=null},M.src=B,{cancel:()=>{G=!0,M.src=""}}}}(Ee||(Ee={})),Ee.resetRequestQueue(),function(u){u.Glyphs="Glyphs",u.Image="Image",u.Source="Source",u.SpriteImage="SpriteImage",u.SpriteJSON="SpriteJSON",u.Style="Style",u.Tile="Tile",u.Unknown="Unknown"}(Ve||(Ve={}));class Ae{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const c=function(d){const y=d.match(Se);if(!y)throw new Error(`Unable to parse URL "${d}"`);return{protocol:y[1],authority:y[2],path:y[3]||"/",params:y[4]?y[4].split("&"):[]}}(t);return c.path+=`${n}${a}`,function(d){const y=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${y}`}(c)}setTransformRequest(t){this._transformRequestFn=t}}const Se=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ye(u){var t=new o.ARRAY_TYPE(3);return t[0]=u[0],t[1]=u[1],t[2]=u[2],t}var qe,Gt=function(u,t,n){return u[0]=t[0]-n[0],u[1]=t[1]-n[1],u[2]=t[2]-n[2],u};qe=new o.ARRAY_TYPE(3),o.ARRAY_TYPE!=Float32Array&&(qe[0]=0,qe[1]=0,qe[2]=0);var wt=function(u){var t=u[0],n=u[1];return t*t+n*n};function ti(u){const t=[];if(typeof u=="string")t.push({id:"default",url:u});else if(u&&u.length>0){const n=[];for(const{id:a,url:c}of u){const d=`${a}${c}`;n.indexOf(d)===-1&&(n.push(d),t.push({id:a,url:c}))}}return t}function ft(u,t,n,a,c){if(a)return void u(a);if(c!==Object.values(t).length||c!==Object.values(n).length)return;const d={};for(const y in t){d[y]={};const v=o.browser.getImageCanvasContext(n[y]),b=t[y];for(const E in b){const{width:A,height:M,x:B,y:G,sdf:j,pixelRatio:X,stretchX:V,stretchY:re,content:ce}=b[E];d[y][E]={data:null,pixelRatio:X,sdf:j,stretchX:V,stretchY:re,content:ce,spriteData:{width:A,height:M,x:B,y:G,context:v}}}}u(null,d)}(function(){var u=new o.ARRAY_TYPE(2);o.ARRAY_TYPE!=Float32Array&&(u[0]=0,u[1]=0)})();class Tt{constructor(t,n,a,c){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,c)}update(t,n,a){const{width:c,height:d}=t,y=!(this.size&&this.size[0]===c&&this.size[1]===d||a),{context:v}=this,{gl:b}=v;if(this.useMipmap=!!(n&&n.useMipmap),b.bindTexture(b.TEXTURE_2D,this.texture),v.pixelStoreUnpackFlipY.set(!1),v.pixelStoreUnpack.set(1),v.pixelStoreUnpackPremultiplyAlpha.set(this.format===b.RGBA&&(!n||n.premultiply!==!1)),y)this.size=[c,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||o.isImageBitmap(t)?b.texImage2D(b.TEXTURE_2D,0,this.format,this.format,b.UNSIGNED_BYTE,t):b.texImage2D(b.TEXTURE_2D,0,this.format,c,d,0,this.format,b.UNSIGNED_BYTE,t.data);else{const{x:E,y:A}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||o.isImageBitmap(t)?b.texSubImage2D(b.TEXTURE_2D,0,E,A,b.RGBA,b.UNSIGNED_BYTE,t):b.texSubImage2D(b.TEXTURE_2D,0,E,A,c,d,b.RGBA,b.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&b.generateMipmap(b.TEXTURE_2D)}bind(t,n,a){const{context:c}=this,{gl:d}=c;d.bindTexture(d.TEXTURE_2D,this.texture),a!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Ki(u){const{userImage:t}=u;return!!(t&&t.render&&t.render())&&(u.data.replace(new Uint8Array(t.data.buffer)),!0)}class rt extends o.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new o.RGBAImage({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new o.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new o.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new o.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]-1);b++,d[b]=v,y[b]=E,y[b+1]=ii}for(let v=0,b=0;v{let v=this.entries[c];v||(v=this.entries[c]={glyphs:{},requests:{},ranges:{}});let b=v.glyphs[d];if(b!==void 0)return void y(null,{stack:c,id:d,glyph:b});if(b=this._tinySDF(v,c,d),b)return v.glyphs[d]=b,void y(null,{stack:c,id:d,glyph:b});const E=Math.floor(d/256);if(256*E>65535)return void y(new Error("glyphs > 65535 not supported"));if(v.ranges[E])return void y(null,{stack:c,id:d,glyph:b});if(!this.url)return void y(new Error("glyphsUrl is not set"));let A=v.requests[E];A||(A=v.requests[E]=[],xt.loadGlyphRange(c,E,this.url,this.requestManager,(M,B)=>{if(B){for(const G in B)this._doesCharSupportLocalGlyph(+G)||(v.glyphs[+G]=B[+G]);v.ranges[E]=!0}for(const G of A)G(M,B);delete v.requests[E]})),A.push((M,B)=>{M?y(M):B&&y(null,{stack:c,id:d,glyph:B[d]||null})})},(c,d)=>{if(c)n(c);else if(d){const y={};for(const{stack:v,id:b,glyph:E}of d)(y[v]||(y[v]={}))[b]=E&&{id:E.id,bitmap:E.bitmap.clone(),metrics:E.metrics};n(null,y)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(o.unicodeBlockLookup["CJK Unified Ideographs"](t)||o.unicodeBlockLookup["Hangul Syllables"](t)||o.unicodeBlockLookup.Hiragana(t)||o.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(a))return;let d=t.tinySDF;if(!d){let v="400";/bold/i.test(n)?v="900":/medium/i.test(n)?v="500":/light/i.test(n)&&(v="200"),d=t.tinySDF=new xt.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:c,fontWeight:v})}const y=d.draw(String.fromCharCode(a));return{id:a,bitmap:new o.AlphaImage({width:y.width||30,height:y.height||30},y.data),metrics:{width:y.glyphWidth||24,height:y.glyphHeight||24,left:y.glyphLeft||0,top:y.glyphTop-27||-8,advance:y.glyphAdvance||24}}}}xt.loadGlyphRange=function(u,t,n,a,c){const d=256*t,y=d+255,v=a.transformRequest(n.replace("{fontstack}",u).replace("{range}",`${d}-${y}`),Ve.Glyphs);o.getArrayBuffer(v,(b,E)=>{if(b)c(b);else if(E){const A={};for(const M of o.parseGlyphPbf(E))A[M.id]=M;c(null,A)}})},xt.TinySDF=class{constructor({fontSize:u=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:d="normal",fontStyle:y="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const v=this.size=u+4*t,b=this._createCanvas(v),E=this.ctx=b.getContext("2d",{willReadFrequently:!0});E.font=`${y} ${d} ${u}px ${c}`,E.textBaseline="alphabetic",E.textAlign="left",E.fillStyle="black",this.gridOuter=new Float64Array(v*v),this.gridInner=new Float64Array(v*v),this.f=new Float64Array(v),this.z=new Float64Array(v+1),this.v=new Uint16Array(v)}_createCanvas(u){const t=document.createElement("canvas");return t.width=t.height=u,t}draw(u){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:d}=this.ctx.measureText(u),y=Math.ceil(n),v=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(d-c))),b=Math.min(this.size-this.buffer,y+Math.ceil(a)),E=v+2*this.buffer,A=b+2*this.buffer,M=Math.max(E*A,0),B=new Uint8ClampedArray(M),G={data:B,width:E,height:A,glyphWidth:v,glyphHeight:b,glyphTop:y,glyphLeft:0,glyphAdvance:t};if(v===0||b===0)return G;const{ctx:j,buffer:X,gridInner:V,gridOuter:re}=this;j.clearRect(X,X,v,b),j.fillText(u,X,X+y);const ce=j.getImageData(X,X,v,b);re.fill(ii,0,M),V.fill(0,0,M);for(let J=0;J0?_e*_e:0,V[pe]=_e<0?_e*_e:0}}Mi(re,0,0,E,A,E,this.f,this.v,this.z),Mi(V,X,X,v,b,E,this.f,this.v,this.z);for(let J=0;J1&&(b=t[++v]);const A=Math.abs(E-b.left),M=Math.abs(E-b.right),B=Math.min(A,M);let G;const j=d/a*(c+1);if(b.isDash){const X=c-Math.abs(j);G=Math.sqrt(B*B+X*X)}else G=c-Math.sqrt(B*B+j*j);this.data[y+E]=Math.max(0,Math.min(255,G+128))}}}addRegularDash(t){for(let v=t.length-1;v>=0;--v){const b=t[v],E=t[v+1];b.zeroLength?t.splice(v,1):E&&E.isDash===b.isDash&&(E.left=b.left,t.splice(v,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let d=0,y=t[d];for(let v=0;v1&&(y=t[++d]);const b=Math.abs(v-y.left),E=Math.abs(v-y.right),A=Math.min(b,E);this.data[c+v]=Math.max(0,Math.min(255,(y.isDash?A:-A)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return o.warnOnce("LineAtlas out of space"),null;let d=0;for(let v=0;v{c.send(t,n,d)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function ri(u,t,n){const a=function(c,d){if(c)return n(c);if(d){const y=o.pick(o.extend(d,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(y.vectorLayers=d.vector_layers,y.vectorLayerIds=y.vectorLayers.map(v=>v.id)),n(null,y)}};return u.url?o.getJSON(t.transformRequest(u.url,Ve.Source),a):o.browser.frame(()=>a(null,u))}di.Actor=o.Actor;class Zt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof o.LngLat?new o.LngLat(t.lng,t.lat):o.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof o.LngLat?new o.LngLat(t.lng,t.lat):o.LngLat.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,d;if(t instanceof o.LngLat)c=t,d=t;else{if(!(t instanceof Zt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Zt.convert(t)):this.extend(o.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(o.LngLat.convert(t)):this;if(c=t._sw,d=t._ne,!c||!d)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(d.lng,a.lng),a.lat=Math.max(d.lat,a.lat)):(this._sw=new o.LngLat(c.lng,c.lat),this._ne=new o.LngLat(d.lng,d.lat)),this}getCenter(){return new o.LngLat((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 o.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new o.LngLat(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:a}=o.LngLat.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}static convert(t){return t instanceof Zt?t:t&&new Zt(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new Zt(new o.LngLat(t.lng-c,t.lat-a),new o.LngLat(t.lng+c,t.lat+a))}}class ir{constructor(t,n,a){this.bounds=Zt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(o.mercatorXfromLng(this.bounds.getWest())*n),c=Math.floor(o.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(o.mercatorXfromLng(this.bounds.getEast())*n),y=Math.ceil(o.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x=c&&t.y{this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ri(this._options,this.map._requestManager,(d,y)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),d?this.fire(new o.ErrorEvent(d)):y&&(o.extend(this,y),y.bounds&&(this.tileBounds=new ir(y.bounds,this.minzoom,this.maxzoom)),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>o.extend({},this._options),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.extend(this,o.pick(n,["url","scheme","tileSize","promoteId"])),this._options=o.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(a,Ve.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function d(y,v){return delete t.request,t.aborted?n(null):y&&y.status!==404?n(y):(v&&v.resourceTiming&&(t.resourceTiming=v.resourceTiming),this.map._refreshExpiredTiles&&v&&t.setExpiryData(v),t.loadVectorData(v,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class ut extends o.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.extend({type:"raster"},n),o.extend(this,o.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ri(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new o.ErrorEvent(t)):n&&(o.extend(this,n),n.bounds&&(this.tileBounds=new ir(n.bounds,this.minzoom,this.maxzoom)),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return o.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=Ee.getImage(this.map._requestManager.transformRequest(a,Ve.Tile),(c,d,y)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(d){this.map._refreshExpiredTiles&&y&&t.setExpiryData(y);const v=this.map.painter.context,b=v.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new Tt(v,d,b.RGBA,{useMipmap:!0}),t.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST),v.extTextureFilterAnisotropic&&b.texParameterf(b.TEXTURE_2D,v.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,v.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class Xt extends ut{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=o.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function c(d,y){d&&(t.state="errored",n(d)),y&&(t.dem=y,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=Ee.getImage(this.map._requestManager.transformRequest(a,Ve.Tile),(function(d,y){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(y){this.map._refreshExpiredTiles&&t.setExpiryData(y),delete y.cacheControl,delete y.expires;const v=o.isImageBitmap(y)&&(nn==null&&(nn=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),nn)?y:o.browser.getImageData(y,1),b={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:v,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",b,c.bind(this)))}}).bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,d=n.x===0?t.wrap-1:t.wrap,y=(n.x+1+a)%a,v=n.x+1===a?t.wrap+1:t.wrap,b={};return b[new o.OverscaledTileID(t.overscaledZ,d,n.z,c,n.y).key]={backfilled:!1},b[new o.OverscaledTileID(t.overscaledZ,v,n.z,y,n.y).key]={backfilled:!1},n.y>0&&(b[new o.OverscaledTileID(t.overscaledZ,d,n.z,c,n.y-1).key]={backfilled:!1},b[new o.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},b[new o.OverscaledTileID(t.overscaledZ,v,n.z,y,n.y-1).key]={backfilled:!1}),n.y+1{this._updateWorkerData()},this.serialize=()=>o.extend({},this._options,{type:this.type,data:this._data}),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(c),this._data=n.data,this._options=o.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=o.EXTENT/this.tileSize;this.workerOptions=o.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:o.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:o.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,a,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:a},c),this}_updateWorkerData(t){const n=o.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(o.browser.resolveURL(this._data),Ve.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(a,c)=>{if(this._pendingLoads--,this._removed||c&&c.abandoned)return void this.fire(new o.Event("dataabort",{dataType:"source"}));let d=null;if(c&&c.resourceTiming&&c.resourceTiming[this.id]&&(d=c.resourceTiming[this.id].slice(0)),a)return void this.fire(new o.ErrorEvent(a));const y={dataType:"source"};this._collectResourceTiming&&d&&d.length>0&&o.extend(y,{resourceTiming:d}),this.fire(new o.Event("data",{...y,sourceDataType:"metadata"})),this.fire(new o.Event("data",{...y,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(a,c,(d,y)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(y,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var rr=o.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Rr extends o.Evented{constructor(t,n,a,c){super(),this.load=(d,y)=>{this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=Ee.getImage(this.map._requestManager.transformRequest(this.url,Ve.Image),(v,b)=>{this._request=null,this._loaded=!0,v?this.fire(new o.ErrorEvent(v)):b&&(this.image=b,d&&(this.coordinates=d),y&&y(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const d=this.map.painter.context,y=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,rr.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Tt(d,this.image,y.RGBA),this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE));let v=!1;for(const b in this.tiles){const E=this.tiles[b];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture,v=!0)}v&&this.fire(new o.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(o.MercatorCoordinate.fromLngLat);this.tileID=function(c){let d=1/0,y=1/0,v=-1/0,b=-1/0;for(const B of c)d=Math.min(d,B.x),y=Math.min(y,B.y),v=Math.max(v,B.x),b=Math.max(b,B.y);const E=Math.max(v-d,b-y),A=Math.max(0,Math.floor(-Math.log(E)/Math.LN2)),M=Math.pow(2,A);return new o.CanonicalTileID(A,Math.floor((d+v)/2*M),Math.floor((y+b)/2*M))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new o.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,o.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,o.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,o.EXTENT,o.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}hasTransition(){return!1}}class Oe extends Rr{constructor(t,n,a,c){super(t,n,a,c),this.load=()=>{this._loaded=!1;const d=this.options;this.urls=[];for(const y of d.urls)this.urls.push(this.map._requestManager.transformRequest(y,Ve.Source).url);o.getVideo(this.urls,(y,v)=>{this._loaded=!0,y?this.fire(new o.ErrorEvent(y)):v&&(this.video=v,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const d=this.map.painter.context,y=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,rr.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE),y.texSubImage2D(y.TEXTURE_2D,0,0,0,y.RGBA,y.UNSIGNED_BYTE,this.video)):(this.texture=new Tt(d,this.video,y.RGBA),this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE));let v=!1;for(const b in this.tiles){const E=this.tiles[b];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture,v=!0)}v&&this.fire(new o.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=n}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class fe extends Rr{constructor(t,n,a,c){super(t,n,a,c),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let d=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,d=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,d=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const y=this.map.painter.context,v=y.gl;this.boundsBuffer||(this.boundsBuffer=y.createVertexBuffer(this._boundsArray,rr.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(d||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Tt(y,this.canvas,v.RGBA,{premultiply:!0});let b=!1;for(const E in this.tiles){const A=this.tiles[E];A.state!=="loaded"&&(A.state="loaded",A.texture=this.texture,b=!0)}b&&this.fire(new o.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(y=>typeof y!="number"))||this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const xr={},ds=u=>{switch(u){case"geojson":return Ei;case"image":return Rr;case"raster":return ut;case"raster-dem":return Xt;case"vector":return Be;case"video":return Oe;case"canvas":return fe}return xr[u]};function Ut(u,t){const n=o.create();return o.translate(n,n,[1,1,0]),o.scale(n,n,[.5*u.width,.5*u.height,1]),o.multiply(n,n,u.calculatePosMatrix(t.toUnwrapped()))}function Bt(u,t,n,a,c,d){const y=function(M,B,G){if(M)for(const j of M){const X=B[j];if(X&&X.source===G&&X.type==="fill-extrusion")return!0}else for(const j in B){const X=B[j];if(X.source===G&&X.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,u.id),v=d.maxPitchScaleFactor(),b=u.tilesIn(a,v,y);b.sort(Xn);const E=[];for(const M of b)E.push({wrappedTileID:M.tileID.wrapped().key,queryResults:M.tile.queryRenderedFeatures(t,n,u._state,M.queryGeometry,M.cameraQueryGeometry,M.scale,c,d,v,Ut(u.transform,M.tileID))});const A=function(M){const B={},G={};for(const j of M){const X=j.queryResults,V=j.wrappedTileID,re=G[V]=G[V]||{};for(const ce in X){const J=X[ce],ne=re[ce]=re[ce]||{},de=B[ce]=B[ce]||[];for(const pe of J)ne[pe.featureIndex]||(ne[pe.featureIndex]=!0,de.push(pe))}}return B}(E);for(const M in A)A[M].forEach(B=>{const G=B.feature,j=u.getFeatureState(G.layer["source-layer"],G.id);G.source=G.layer.source,G.layer["source-layer"]&&(G.sourceLayer=G.layer["source-layer"]),G.state=j});return A}function Xn(u,t){const n=u.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class Wn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=o.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;nd.getLayer(E)).filter(Boolean);if(b.length!==0){v.layers=b,v.stateDependentLayerIds&&(v.stateDependentLayers=v.stateDependentLayerIds.map(E=>b.filter(A=>A.id===E)[0]));for(const E of b)y[E.id]=v}}return y}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const d=this.buckets[c];if(d instanceof o.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const d=this.buckets[c];if(d instanceof o.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,o.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const c in this.buckets){const d=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new o.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Tt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Tt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,d,y,v,b,E,A){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:d,scale:y,tileSize:this.tileSize,pixelPosMatrix:A,transform:b,params:v,queryPadding:this.queryPadding*E},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const c=a.loadVTLayers(),d=n&&n.sourceLayer?n.sourceLayer:"",y=c._geojsonTileLayer||c[d];if(!y)return;const v=o.createFilter(n&&n.filter),{z:b,x:E,y:A}=this.tileID.canonical,M={z:b,x:E,y:A};for(let B=0;Ba)c=!1;else if(n)if(this.expirationTime{this.remove(t,d)},a)),this.data[c].push(d),this.order.push(c),this.order.length>this.max){const y=this._getAndRemoveByKey(this.order[0]);y&&this.onRemove(y)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,c=n===void 0?0:this.data[a].indexOf(n),d=this.data[a][c];return this.data[a].splice(c,1),d.timeout&&clearTimeout(d.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(d.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const c of this.data[a])t(c.value)||n.push(c);for(const a of n)this.remove(a.value.tileID,a)}}class So{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},o.extend(this.stateChanges[t][c],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==c&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const d in this.state[t][c])a[d]||(this.deletedStates[t][c][d]=null)}else for(const d in a)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][d]===null&&delete this.deletedStates[t][c][d]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(a in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][a]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=o.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const y in d)delete c[y]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const d={};for(const y in this.stateChanges[c])this.state[c][y]||(this.state[c][y]={}),o.extend(this.state[c][y],this.stateChanges[c][y]),d[y]=this.state[c][y];a[c]=d}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const d={};if(this.deletedStates[c]===null)for(const y in this.state[c])d[y]={},this.state[c][y]={};else for(const y in this.deletedStates[c]){if(this.deletedStates[c][y]===null)this.state[c][y]={};else for(const v of Object.keys(this.deletedStates[c][y]))delete this.state[c][y][v];d[y]=this.state[c][y]}a[c]=a[c]||{},o.extend(a[c],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const c in t)t[c].setFeatureState(a,n)}}class ai extends o.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((c,d,y,v)=>{const b=new(ds(d.type))(c,d,y,v);if(b.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${b.id}`);return b})(t,n,a,this),this._tiles={},this._cache=new Eo(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new So,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new o.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Bs).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,c)=>{const d=a.tileID,y=c.tileID,v=new o.Point(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),b=new o.Point(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-y.overscaledZ||b.y-v.y||b.x-v.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(Bs).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new o.ErrorEvent(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=o.browser.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new o.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c1||(Math.abs(y)>1&&(Math.abs(y+b)===1?y+=b:Math.abs(y-b)===1&&(y-=b)),d.dem&&c.dem&&(c.dem.backfillBorder(d.dem,y,v),c.neighboringTiles&&c.neighboringTiles[E]&&(c.neighboringTiles[E].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,c){for(const d in this._tiles){let y=this._tiles[d];if(c[d]||!y.hasData()||y.tileID.overscaledZ<=n||y.tileID.overscaledZ>a)continue;let v=y.tileID;for(;y&&y.tileID.overscaledZ>n+1;){const E=y.tileID.scaledTo(y.tileID.overscaledZ-1);y=this._tiles[E.key],y&&y.hasData()&&(v=E)}let b=v;for(;b.overscaledZ>n;)if(b=b.scaledTo(b.overscaledZ-1),t[b.key]){c[v.key]=v;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const c=t.scaledTo(a),d=this._getLoadedTile(c);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?o.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const c in this._tiles){const d=this._tiles[c];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),a[d.tileID.key]=d}this._tiles=a;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(A=>new o.OverscaledTileID(A.canonical.z,A.wrap,A.canonical.z,A.canonical.x,A.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(A=>this._source.hasTile(A)))):a=[];const c=t.coveringZoomLevel(this._source),d=Math.max(c-ai.maxOverzooming,this._source.minzoom),y=Math.max(c+ai.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const A={};for(const M of a)if(M.canonical.z>this._source.minzoom){const B=M.scaledTo(M.canonical.z-1);A[B.key]=B;const G=M.scaledTo(Math.max(this._source.minzoom,Math.min(M.canonical.z,5)));A[G.key]=G}a=a.concat(Object.values(A))}const v=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,v&&this.fire(new o.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const b=this._updateRetainedTiles(a,c);if(ps(this._source.type)){const A={},M={},B=Object.keys(b),G=o.browser.now();for(const j of B){const X=b[j],V=this._tiles[j];if(!V||V.fadeEndTime!==0&&V.fadeEndTime<=G)continue;const re=this.findLoadedParent(X,d);re&&(this._addTile(re.tileID),A[re.tileID.key]=re.tileID),M[j]=X}this._retainLoadedChildren(M,c,y,b);for(const j in A)b[j]||(this._coveredTiles[j]=!0,b[j]=A[j]);if(n){const j={},X={};for(const V of a)this._tiles[V.key].hasData()?j[V.key]=V:X[V.key]=V;for(const V in X){const re=X[V].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(j[re[0].key]=b[re[0].key]=re[0],j[re[1].key]=b[re[1].key]=re[1],j[re[2].key]=b[re[2].key]=re[2],j[re[3].key]=b[re[3].key]=re[3],delete X[V])}for(const V in X){const re=this.findLoadedParent(X[V],this._source.minzoom);if(re){j[re.tileID.key]=b[re.tileID.key]=re.tileID;for(const ce in j)j[ce].isChildOf(re.tileID)&&delete j[ce]}}for(const V in this._tiles)j[V]||(this._coveredTiles[V]=!0)}}for(const A in b)this._tiles[A].clearFadeHold();const E=o.keysDifference(this._tiles,b);for(const A of E){const M=this._tiles[A];M.hasSymbolBuckets&&!M.holdingForFade()?M.setHoldDuration(this.map._fadeDuration):M.hasSymbolBuckets&&!M.symbolFadeFinished()||this._removeTile(A)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},c={},d=Math.max(n-ai.maxOverzooming,this._source.minzoom),y=Math.max(n+ai.maxUnderzooming,this._source.minzoom),v={};for(const b of t){const E=this._addTile(b);a[b.key]=b,E.hasData()||nthis._source.maxzoom){const M=b.children(this._source.maxzoom)[0],B=this.getTile(M);if(B&&B.hasData()){a[M.key]=M;continue}}else{const M=b.children(this._source.maxzoom);if(a[M[0].key]&&a[M[1].key]&&a[M[2].key]&&a[M[3].key])continue}let A=E.wasRequested();for(let M=b.overscaledZ-1;M>=d;--M){const B=b.scaledTo(M);if(c[B.key])break;if(c[B.key]=!0,E=this.getTile(B),!E&&A&&(E=this._addTile(B)),E){const G=E.hasData();if((A||G)&&(a[B.key]=B),A=E.wasRequested(),G)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){a=this._loadedParentTiles[c.key];break}n.push(c.key);const d=c.scaledTo(c.overscaledZ-1);if(a=this._getLoadedTile(d),a)break;c=d}for(const d of n)this._loadedParentTiles[d]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new Wn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new o.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const c=[],d=this.transform;if(!d)return c;const y=a?d.getCameraQueryGeometry(t):t,v=t.map(j=>d.pointCoordinate(j,this.terrain)),b=y.map(j=>d.pointCoordinate(j,this.terrain)),E=this.getIds();let A=1/0,M=1/0,B=-1/0,G=-1/0;for(const j of b)A=Math.min(A,j.x),M=Math.min(M,j.y),B=Math.max(B,j.x),G=Math.max(G,j.y);for(let j=0;j=0&&J[1].y+ce>=0){const ne=v.map(pe=>V.getTilePoint(pe)),de=b.map(pe=>V.getTilePoint(pe));c.push({tile:X,tileID:V,queryGeometry:ne,cameraQueryGeometry:de,scale:re})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(ps(this._source.type)){const t=o.browser.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const c=this._tiles[t];c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function Bs(u,t){const n=Math.abs(2*u.wrap)-+(u.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return u.overscaledZ-t.overscaledZ||a-n||t.canonical.y-u.canonical.y||t.canonical.x-u.canonical.x}function ps(u){return u==="raster"||u==="image"||u==="video"}ai.maxOverzooming=10,ai.maxUnderzooming=3;const Pe="mapboxgl_preloaded_worker_pool";class $i{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<$i.workerCount;)this.workers.push(new Worker(o.config.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Pe]}numActive(){return Object.keys(this.active).length}}const nr=Math.floor(o.browser.hardwareConcurrency/2);let vn;function Dn(){return vn||(vn=new $i),vn}$i.workerCount=o.isSafari(globalThis)?Math.max(Math.min(nr,3),1):1;class De{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a0?(c-y)/v:0;return this.points[d].mult(1-b).add(this.points[n].mult(b))}}function ht(u,t){let n=!0;return u==="always"||u!=="never"&&t!=="never"||(n=!1),n}class dt{constructor(t,n,a){const c=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let y=0;ythis.width||c<0||n>this.height)return[];const b=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(d)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let E=0;E0}hitTestCircle(t,n,a,c,d){const y=t-a,v=t+a,b=n-a,E=n+a;if(v<0||y>this.width||E<0||b>this.height)return!1;const A=[];return this._forEachCell(y,b,v,E,this._queryCellCircle,A,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},d),A.length>0}_queryCell(t,n,a,c,d,y,v,b){const{seenUids:E,hitTest:A,overlapMode:M}=v,B=this.boxCells[d];if(B!==null){const j=this.bboxes;for(const X of B)if(!E.box[X]){E.box[X]=!0;const V=4*X,re=this.boxKeys[X];if(t<=j[V+2]&&n<=j[V+3]&&a>=j[V+0]&&c>=j[V+1]&&(!b||b(re))&&(!A||!ht(M,re.overlapMode))&&(y.push({key:re,x1:j[V],y1:j[V+1],x2:j[V+2],y2:j[V+3]}),A))return!0}}const G=this.circleCells[d];if(G!==null){const j=this.circles;for(const X of G)if(!E.circle[X]){E.circle[X]=!0;const V=3*X,re=this.circleKeys[X];if(this._circleAndRectCollide(j[V],j[V+1],j[V+2],t,n,a,c)&&(!b||b(re))&&(!A||!ht(M,re.overlapMode))){const ce=j[V],J=j[V+1],ne=j[V+2];if(y.push({key:re,x1:ce-ne,y1:J-ne,x2:ce+ne,y2:J+ne}),A)return!0}}}return!1}_queryCellCircle(t,n,a,c,d,y,v,b){const{circle:E,seenUids:A,overlapMode:M}=v,B=this.boxCells[d];if(B!==null){const j=this.bboxes;for(const X of B)if(!A.box[X]){A.box[X]=!0;const V=4*X,re=this.boxKeys[X];if(this._circleAndRectCollide(E.x,E.y,E.radius,j[V+0],j[V+1],j[V+2],j[V+3])&&(!b||b(re))&&!ht(M,re.overlapMode))return y.push(!0),!0}}const G=this.circleCells[d];if(G!==null){const j=this.circles;for(const X of G)if(!A.circle[X]){A.circle[X]=!0;const V=3*X,re=this.circleKeys[X];if(this._circlesCollide(j[V],j[V+1],j[V+2],E.x,E.y,E.radius)&&(!b||b(re))&&!ht(M,re.overlapMode))return y.push(!0),!0}}}_forEachCell(t,n,a,c,d,y,v,b){const E=this._convertToXCellCoord(t),A=this._convertToYCellCoord(n),M=this._convertToXCellCoord(a),B=this._convertToYCellCoord(c);for(let G=E;G<=M;G++)for(let j=A;j<=B;j++)if(d.call(this,t,n,a,c,this.xCellCount*j+G,y,v,b))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,c,d,y){const v=c-t,b=d-n,E=a+y;return E*E>v*v+b*b}_circleAndRectCollide(t,n,a,c,d,y,v){const b=(y-c)/2,E=Math.abs(t-(c+b));if(E>b+a)return!1;const A=(v-d)/2,M=Math.abs(n-(d+A));if(M>A+a)return!1;if(E<=b||M<=A)return!0;const B=E-b,G=M-A;return B*B+G*G<=a*a}}function ji(u,t,n,a,c){const d=o.create();return t?(o.scale(d,d,[1/c,1/c,1]),n||o.rotateZ(d,d,a.angle)):o.multiply(d,a.labelPlaneMatrix,u),d}function xn(u,t,n,a,c){if(t){const d=o.clone(u);return o.scale(d,d,[c,c,1]),n||o.rotateZ(d,d,-a.angle),d}return a.glCoordMatrix}function ot(u,t,n){let a;n?(a=[u.x,u.y,n(u.x,u.y),1],o.transformMat4(a,a,t)):(a=[u.x,u.y,0,1],Y(a,a,t));const c=a[3];return{point:new o.Point(a[0]/c,a[1]/c),signedDistanceFromCamera:c}}function sn(u,t){return .5+u/t*.5}function on(u,t){const n=u[0]/u[3],a=u[1]/u[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function Ln(u,t,n,a,c,d,y,v,b,E){const A=a?u.textSizeData:u.iconSizeData,M=o.evaluateSizeForZoom(A,n.transform.zoom),B=[256/n.width*2+1,256/n.height*2+1],G=a?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;G.clear();const j=u.lineVertexArray,X=a?u.text.placedSymbolArray:u.icon.placedSymbolArray,V=n.transform.width/n.transform.height;let re=!1;for(let ce=0;ceMath.abs(n.x-t.x)*a?{useVertical:!0}:(u===o.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function Fi(u,t,n,a,c,d,y,v,b,E,A,M,B,G,j,X){const V=t/24,re=u.lineOffsetX*V,ce=u.lineOffsetY*V;let J;if(u.numGlyphs>1){const ne=u.glyphStartIndex+u.numGlyphs,de=u.lineStartIndex,pe=u.lineStartIndex+u.lineLength,_e=Br(V,v,re,ce,n,A,M,u,b,d,B,j,X);if(!_e)return{notEnoughRoom:!0};const Ie=ot(_e.first.point,y,X).point,Te=ot(_e.last.point,y,X).point;if(a&&!n){const ke=Rn(u.writingMode,Ie,Te,G);if(ke)return ke}J=[_e.first];for(let ke=u.glyphStartIndex+1;ke0?Ie.point:Wt(M,_e,de,1,c,X),ke=Rn(u.writingMode,de,Te,G);if(ke)return ke}const ne=z(V*v.getoffsetX(u.glyphStartIndex),re,ce,n,A,M,u.segment,u.lineStartIndex,u.lineStartIndex+u.lineLength,b,d,B,j,X);if(!ne)return{notEnoughRoom:!0};J=[ne]}for(const ne of J)o.addDynamicAttributes(E,ne.point,ne.angle);return{}}function Wt(u,t,n,a,c,d){const y=ot(u.add(u.sub(t)._unit()),c,d).point,v=n.sub(y);return n.add(v._mult(a/v.mag()))}function Os(u,t){const{projectionCache:n,lineVertexArray:a,labelPlaneMatrix:c,tileAnchorPoint:d,distanceFromAnchor:y,getElevation:v,previousVertex:b,direction:E,absOffsetX:A}=t;if(n.projections[u])return n.projections[u];const M=new o.Point(a.getx(u),a.gety(u)),B=ot(M,c,v);if(B.signedDistanceFromCamera>0)return n.projections[u]=B.point,B.point;const G=u-E;return Wt(y===0?d:new o.Point(a.getx(G),a.gety(G)),M,b,A-y+1,c,v)}function an(u,t,n){return u._unit()._perp()._mult(t*n)}function Z(u,t,n,a,c,d,y,v){const{projectionCache:b,direction:E}=v;if(b.offsets[u])return b.offsets[u];const A=n.add(t);if(u+E=c)return b.offsets[u]=A,A;const M=Os(u+E,v),B=an(M.sub(n),y,E),G=n.add(B),j=M.add(B);return b.offsets[u]=o.findLineIntersection(d,A,G,j)||A,b.offsets[u]}function z(u,t,n,a,c,d,y,v,b,E,A,M,B,G){const j=a?u-t:u+t;let X=j>0?1:-1,V=0;a&&(X*=-1,V=Math.PI),X<0&&(V+=Math.PI);let re,ce,J=X>0?v+y:v+y+1,ne=c,de=c,pe=0,_e=0;const Ie=Math.abs(j),Te=[];let ke;for(;pe+_e<=Ie;){if(J+=X,J=b)return null;pe+=_e,de=ne,ce=re;const Le={projectionCache:M,lineVertexArray:E,labelPlaneMatrix:A,tileAnchorPoint:d,distanceFromAnchor:pe,getElevation:G,previousVertex:de,direction:X,absOffsetX:Ie};if(ne=Os(J,Le),n===0)Te.push(de),ke=ne.sub(de);else{let Qe;const Xe=ne.sub(de);Qe=Xe.mag()===0?an(Os(J+X,Le).sub(ne),n,X):an(Xe,n,X),ce||(ce=de.add(Qe)),re=Z(J,Qe,ne,v,b,ce,n,Le),Te.push(ce),ke=re.sub(ce)}_e=ke.mag()}const He=ke._mult((Ie-pe)/_e)._add(ce||de),mt=V+Math.atan2(ne.y-de.y,ne.x-de.x);return Te.push(He),{point:He,angle:B?mt:0,path:Te}}const R=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function N(u,t){for(let n=0;n=1;et--)Xe.push(Le.path[et]);for(let et=1;etot(_t,b,j));Xe=et.some(_t=>_t.signedDistanceFromCamera<=0)?[]:et.map(_t=>_t.point)}let gt=[];if(Xe.length>0){const et=Xe[0].clone(),_t=Xe[0].clone();for(let si=1;si=ke.x&&_t.x<=He.x&&et.y>=ke.y&&_t.y<=He.y?[Xe]:_t.xHe.x||_t.yHe.y?[]:o.clipLine([Xe],ke.x,ke.y,He.x,He.y)}for(const et of gt){mt.reset(et,.25*Te);let _t=0;_t=mt.length<=.5*Te?1:Math.ceil(mt.paddedLength/Qt)+1;for(let si=0;si<_t;si++){const Nt=si/Math.max(_t-1,1),Ir=mt.lerp(Nt),Ui=Ir.x+Q,fi=Ir.y+Q;X.push(Ui,fi,Te,0);const lr=Ui-Te,hn=fi-Te,Xr=Ui+Te,dn=fi+Te;if(Ie=Ie&&this.isOffscreen(lr,hn,Xr,dn),_e=_e||this.isInsideGrid(lr,hn,Xr,dn),t!=="always"&&this.grid.hitTestCircle(Ui,fi,Te,t,M)&&(pe=!0,!E))return{circles:[],offscreen:!1,collisionDetected:pe}}}}return{circles:!E&&pe||!_e||ce=this.screenRightBoundary||cthis.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function ct(u,t,n,a,c){const{horizontalAlign:d,verticalAlign:y}=o.getAnchorAlignment(u);return new o.Point(-(d-.5)*t+a[0]*c,-(y-.5)*n+a[1]*c)}function We(u,t,n,a,c,d){const{x1:y,x2:v,y1:b,y2:E,anchorPointX:A,anchorPointY:M}=u,B=new o.Point(t,n);return a&&B._rotate(c?d:-d),{x1:y+B.x,y1:b+B.y,x2:v+B.x,y2:E+B.y,anchorPointX:A,anchorPointY:M}}class $e{constructor(t,n,a,c,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new oe(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new nt(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,c){const d=a.getBucket(n),y=a.latestFeatureIndex;if(!d||!y||n.id!==d.layerIds[0])return;const v=a.collisionBoxArray,b=d.layers[0].layout,E=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),A=a.tileSize/o.EXTENT,M=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),B=b.get("text-pitch-alignment")==="map",G=b.get("text-rotation-alignment")==="map",j=te(a,1,this.transform.zoom),X=ji(M,B,G,this.transform,j);let V=null;if(B){const ce=xn(M,B,G,this.transform,j);V=o.multiply([],this.transform.labelPlaneMatrix,ce)}this.retainedQueryData[d.bucketInstanceId]=new we(d.bucketInstanceId,y,d.sourceLayerIndex,d.index,a.tileID);const re={bucket:d,layout:b,posMatrix:M,textLabelPlaneMatrix:X,labelToScreenMatrix:V,scale:E,textPixelRatio:A,holdingForFade:a.holdingForFade(),collisionBoxArray:v,partiallyEvaluatedTextSize:o.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(c)for(const ce of d.sortKeyRanges){const{sortKey:J,symbolInstanceStart:ne,symbolInstanceEnd:de}=ce;t.push({sortKey:J,symbolInstanceStart:ne,symbolInstanceEnd:de,parameters:re})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:re})}attemptAnchorPlacement(t,n,a,c,d,y,v,b,E,A,M,B,G,j,X,V){const re=o.TextAnchorEnum[t.textAnchor],ce=[t.textOffset0,t.textOffset1],J=ct(re,a,c,ce,d),ne=this.collisionIndex.placeCollisionBox(We(n,J.x,J.y,y,v,this.transform.angle),M,b,E,A.predicate,V);if((!X||this.collisionIndex.placeCollisionBox(We(X,J.x,J.y,y,v,this.transform.angle),M,b,E,A.predicate,V).box.length!==0)&&ne.box.length>0){let de;if(this.prevPlacement&&this.prevPlacement.variableOffsets[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID].text&&(de=this.prevPlacement.variableOffsets[B.crossTileID].anchor),B.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[B.crossTileID]={textOffset:ce,width:a,height:c,anchor:re,textBoxScale:d,prevAnchor:de},this.markUsedJustification(G,re,B,j),G.allowVerticalPlacement&&(this.markUsedOrientation(G,j,B),this.placedOrientations[B.crossTileID]=j),{shift:J,placedGlyphBoxes:ne}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:d,posMatrix:y,textLabelPlaneMatrix:v,labelToScreenMatrix:b,textPixelRatio:E,holdingForFade:A,collisionBoxArray:M,partiallyEvaluatedTextSize:B,collisionGroup:G}=t.parameters,j=d.get("text-optional"),X=d.get("icon-optional"),V=o.getOverlapMode(d,"text-overlap","text-allow-overlap"),re=V==="always",ce=o.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),J=ce==="always",ne=d.get("text-rotation-alignment")==="map",de=d.get("text-pitch-alignment")==="map",pe=d.get("icon-text-fit")!=="none",_e=d.get("symbol-z-order")==="viewport-y",Ie=re&&(J||!c.hasIconData()||X),Te=J&&(re||!c.hasTextData()||j);!c.collisionArrays&&M&&c.deserializeCollisionBoxes(M);const ke=this.retainedQueryData[c.bucketInstanceId].tileID,He=this.terrain?(Le,Qe)=>this.terrain.getElevation(ke,Le,Qe):null,mt=(Le,Qe)=>{var Xe,Qt;if(n[Le.crossTileID])return;if(A)return void(this.placements[Le.crossTileID]=new ve(!1,!1,!1));let gt=!1,et=!1,_t=!0,si=null,Nt={box:null,offscreen:null},Ir={box:null,offscreen:null},Ui=null,fi=null,lr=null,hn=0,Xr=0,dn=0;Qe.textFeatureIndex?hn=Qe.textFeatureIndex:Le.useRuntimeCollisionCircles&&(hn=Le.featureIndex),Qe.verticalTextFeatureIndex&&(Xr=Qe.verticalTextFeatureIndex);const Es=Qe.textBox;if(Es){const xi=zi=>{let Ai=o.WritingMode.horizontal;if(c.allowVerticalPlacement&&!zi&&this.prevPlacement){const Xi=this.prevPlacement.placedOrientations[Le.crossTileID];Xi&&(this.placedOrientations[Le.crossTileID]=Xi,Ai=Xi,this.markUsedOrientation(c,Ai,Le))}return Ai},Pi=(zi,Ai)=>{if(c.allowVerticalPlacement&&Le.numVerticalGlyphVertices>0&&Qe.verticalTextBox){for(const Xi of c.writingModes)if(Xi===o.WritingMode.vertical?(Nt=Ai(),Ir=Nt):Nt=zi(),Nt&&Nt.box&&Nt.box.length)break}else Nt=zi()},Zi=Le.textAnchorOffsetStartIndex,Ss=Le.textAnchorOffsetEndIndex;if(Ss===Zi){const zi=(Ai,Xi)=>{const oi=this.collisionIndex.placeCollisionBox(Ai,V,E,y,G.predicate,He);return oi&&oi.box&&oi.box.length&&(this.markUsedOrientation(c,Xi,Le),this.placedOrientations[Le.crossTileID]=Xi),oi};Pi(()=>zi(Es,o.WritingMode.horizontal),()=>{const Ai=Qe.verticalTextBox;return c.allowVerticalPlacement&&Le.numVerticalGlyphVertices>0&&Ai?zi(Ai,o.WritingMode.vertical):{box:null,offscreen:null}}),xi(Nt&&Nt.box&&Nt.box.length)}else{let zi=o.TextAnchorEnum[(Qt=(Xe=this.prevPlacement)===null||Xe===void 0?void 0:Xe.variableOffsets[Le.crossTileID])===null||Qt===void 0?void 0:Qt.anchor];const Ai=(oi,En,Wr)=>{const Vn=oi.x2-oi.x1,yc=oi.y2-oi.y1,ss=Le.textBoxScale,Au=pe&&ce==="never"?En:null;let os={box:[],offscreen:!1},ci=V==="never"?1:2,oa="never";zi&&ci++;for(let pl=0;plAi(Es,Qe.iconBox,o.WritingMode.horizontal),()=>{const oi=Qe.verticalTextBox;return c.allowVerticalPlacement&&!(Nt&&Nt.box&&Nt.box.length)&&Le.numVerticalGlyphVertices>0&&oi?Ai(oi,Qe.verticalIconBox,o.WritingMode.vertical):{box:null,offscreen:null}}),Nt&&(gt=Nt.box,_t=Nt.offscreen);const Xi=xi(Nt&&Nt.box);if(!gt&&this.prevPlacement){const oi=this.prevPlacement.variableOffsets[Le.crossTileID];oi&&(this.variableOffsets[Le.crossTileID]=oi,this.markUsedJustification(c,oi.anchor,Le,Xi))}}}if(Ui=Nt,gt=Ui&&Ui.box&&Ui.box.length>0,_t=Ui&&Ui.offscreen,Le.useRuntimeCollisionCircles){const xi=c.text.placedSymbolArray.get(Le.centerJustifiedTextSymbolIndex),Pi=o.evaluateSizeForFeature(c.textSizeData,B,xi),Zi=d.get("text-padding");fi=this.collisionIndex.placeCollisionCircles(V,xi,c.lineVertexArray,c.glyphOffsetArray,Pi,y,v,b,a,de,G.predicate,Le.collisionCircleDiameter,Zi,He),fi.circles.length&&fi.collisionDetected&&!a&&o.warnOnce("Collisions detected, but collision boxes are not shown"),gt=re||fi.circles.length>0&&!fi.collisionDetected,_t=_t&&fi.offscreen}if(Qe.iconFeatureIndex&&(dn=Qe.iconFeatureIndex),Qe.iconBox){const xi=Pi=>{const Zi=pe&&si?We(Pi,si.x,si.y,ne,de,this.transform.angle):Pi;return this.collisionIndex.placeCollisionBox(Zi,ce,E,y,G.predicate,He)};Ir&&Ir.box&&Ir.box.length&&Qe.verticalIconBox?(lr=xi(Qe.verticalIconBox),et=lr.box.length>0):(lr=xi(Qe.iconBox),et=lr.box.length>0),_t=_t&&lr.offscreen}const Un=j||Le.numHorizontalGlyphVertices===0&&Le.numVerticalGlyphVertices===0,Tn=X||Le.numIconVertices===0;if(Un||Tn?Tn?Un||(et=et&>):gt=et&>:et=gt=et&>,gt&&Ui&&Ui.box&&this.collisionIndex.insertCollisionBox(Ui.box,V,d.get("text-ignore-placement"),c.bucketInstanceId,Ir&&Ir.box&&Xr?Xr:hn,G.ID),et&&lr&&this.collisionIndex.insertCollisionBox(lr.box,ce,d.get("icon-ignore-placement"),c.bucketInstanceId,dn,G.ID),fi&&(gt&&this.collisionIndex.insertCollisionCircles(fi.circles,V,d.get("text-ignore-placement"),c.bucketInstanceId,hn,G.ID),a)){const xi=c.bucketInstanceId;let Pi=this.collisionCircleArrays[xi];Pi===void 0&&(Pi=this.collisionCircleArrays[xi]=new be);for(let Zi=0;Zi=0;--Qe){const Xe=Le[Qe];mt(c.symbolInstances.get(Xe),c.collisionArrays[Xe])}}else for(let Le=t.symbolInstanceStart;Le=0&&(t.text.placedSymbolArray.get(v).crossTileID=d>=0&&v!==d?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===o.WritingMode.horizontal||n===o.WritingMode.horizontalOnly?n:0,d=n===o.WritingMode.vertical?n:0,y=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const v of y)t.text.placedSymbolArray.get(v).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},y=n?n.variableOffsets:{},v=n?n.placedOrientations:{};for(const b in this.placements){const E=this.placements[b],A=d[b];A?(this.opacities[b]=new ae(A,c,E.text,E.icon),a=a||E.text!==A.text.placed||E.icon!==A.icon.placed):(this.opacities[b]=new ae(null,c,E.text,E.icon,E.skipFade),a=a||E.text||E.icon)}for(const b in d){const E=d[b];if(!this.opacities[b]){const A=new ae(E,c,!1,!1);A.isHidden()||(this.opacities[b]=A,a=a||E.text.placed||E.icon.placed)}}for(const b in y)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=y[b]);for(const b in v)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=v[b]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const d=c.getBucket(t);d&&c.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0],d=c.layout,y=new ae(null,0,!1,!1,!0),v=d.get("text-allow-overlap"),b=d.get("icon-allow-overlap"),E=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=d.get("text-rotation-alignment")==="map",M=d.get("text-pitch-alignment")==="map",B=d.get("icon-text-fit")!=="none",G=new ae(null,0,v&&(b||!t.hasIconData()||d.get("icon-optional")),b&&(v||!t.hasTextData()||d.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const j=(X,V,re)=>{for(let ce=0;ce0,pe=this.placedOrientations[V.crossTileID],_e=pe===o.WritingMode.vertical,Ie=pe===o.WritingMode.horizontal||pe===o.WritingMode.horizontalOnly;if(re>0||ce>0){const Te=Ni(ne.text);j(t.text,re,_e?gi:Te),j(t.text,ce,Ie?gi:Te);const ke=ne.text.isHidden();[V.rightJustifiedTextSymbolIndex,V.centerJustifiedTextSymbolIndex,V.leftJustifiedTextSymbolIndex].forEach(Le=>{Le>=0&&(t.text.placedSymbolArray.get(Le).hidden=ke||_e?1:0)}),V.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(V.verticalPlacedTextSymbolIndex).hidden=ke||Ie?1:0);const He=this.variableOffsets[V.crossTileID];He&&this.markUsedJustification(t,He.anchor,V,pe);const mt=this.placedOrientations[V.crossTileID];mt&&(this.markUsedJustification(t,"left",V,mt),this.markUsedOrientation(t,mt,V))}if(de){const Te=Ni(ne.icon),ke=!(B&&V.verticalPlacedIconSymbolIndex&&_e);V.placedIconSymbolIndex>=0&&(j(t.icon,V.numIconVertices,ke?Te:gi),t.icon.placedSymbolArray.get(V.placedIconSymbolIndex).hidden=ne.icon.isHidden()),V.verticalPlacedIconSymbolIndex>=0&&(j(t.icon,V.numVerticalIconVertices,ke?gi:Te),t.icon.placedSymbolArray.get(V.verticalPlacedIconSymbolIndex).hidden=ne.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Te=t.collisionArrays[X];if(Te){let ke=new o.Point(0,0);if(Te.textBox||Te.verticalTextBox){let mt=!0;if(E){const Le=this.variableOffsets[J];Le?(ke=ct(Le.anchor,Le.width,Le.height,Le.textOffset,Le.textBoxScale),A&&ke._rotate(M?this.transform.angle:-this.transform.angle)):mt=!1}Te.textBox&<(t.textCollisionBox.collisionVertexArray,ne.text.placed,!mt||_e,ke.x,ke.y),Te.verticalTextBox&<(t.textCollisionBox.collisionVertexArray,ne.text.placed,!mt||Ie,ke.x,ke.y)}const He=!!(!Ie&&Te.verticalIconBox);Te.iconBox&<(t.iconCollisionBox.collisionVertexArray,ne.icon.placed,He,B?ke.x:0,B?ke.y:0),Te.verticalIconBox&<(t.iconCollisionBox.collisionVertexArray,ne.icon.placed,!He,B?ke.x:0,B?ke.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const X=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=X.invProjMatrix,t.placementViewportMatrix=X.viewportMatrix,t.collisionCircleArray=X.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function lt(u,t,n,a,c){u.emplaceBack(t?1:0,n?1:0,a||0,c||0),u.emplaceBack(t?1:0,n?1:0,a||0,c||0),u.emplaceBack(t?1:0,n?1:0,a||0,c||0),u.emplaceBack(t?1:0,n?1:0,a||0,c||0)}const At=Math.pow(2,25),Vt=Math.pow(2,24),yt=Math.pow(2,17),It=Math.pow(2,16),sr=Math.pow(2,9),at=Math.pow(2,8),Si=Math.pow(2,1);function Ni(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const t=u.placed?1:0,n=Math.floor(127*u.opacity);return n*At+t*Vt+n*yt+t*It+n*sr+t*at+n*Si+t}const gi=0;class br{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,d){const y=this._bucketParts;for(;this._currentTileIndexv.sortKey-b.sortKey));this._currentPartIndex!this._forceFullPlacement&&o.browser.now()-c>2;for(;this._currentPlacementIndex>=0;){const y=n[t[this._currentPlacementIndex]],v=this.placement.collisionIndex.transform.zoom;if(y.type==="symbol"&&(!y.minzoom||y.minzoom<=v)&&(!y.maxzoom||y.maxzoom>v)){if(this._inProgressLayer||(this._inProgressLayer=new br(y)),this._inProgressLayer.continuePlacement(a[y.source],this.placement,this._showCollisionBoxes,y,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const qi=512/o.EXTENT/2;class Or{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let d=0;d({x:Math.floor(b.anchorX*qi),y:Math.floor(b.anchorY*qi)})),crossTileIDs:y.map(b=>b.crossTileID)};if(v.positions.length>128){const b=new o.KDBush(v.positions.length,16,Uint16Array);for(const{x:E,y:A}of v.positions)b.add(E,A);b.finish(),delete v.positions,v.index=b}this._symbolsByKey[d]=v}}getScaledCoordinates(t,n){const{x:a,y:c,z:d}=this.tileID.canonical,{x:y,y:v,z:b}=n.canonical,E=qi/Math.pow(2,b-d),A=(v*o.EXTENT+t.anchorY)*E,M=c*o.EXTENT*qi;return{x:Math.floor((y*o.EXTENT+t.anchorX)*E-a*o.EXTENT*qi),y:Math.floor(A-M)}}findMatches(t,n,a){const c=this.tileID.canonical.zt)}}class ql{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Io{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],d={};for(const y in c){const v=c[y];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+n),d[v.tileID.key]=v}this.indexes[a]=d}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;dt.overscaledZ)for(const v in y){const b=y[v];b.tileID.isChildOf(t)&&b.findMatches(n.symbolInstances,t,c)}else{const v=y[t.scaledTo(Number(d)).key];v&&v.findMatches(n.symbolInstances,t,c)}}for(let d=0;d{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const Bn=(u,t)=>o.emitValidationErrors(u,t&&t.filter(n=>n.identifier!=="source.canvas")),Hn=o.pick(o.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),yi=o.pick(o.operations,["setCenter","setZoom","setBearing","setPitch"]),Ao=o.emptyStyle();class Gi extends o.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new di(Dn(),this,t._getMapId()),this.imageManager=new rt,this.imageManager.setEventedParent(this),this.glyphManager=new xt(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new hi(256,512),this.crossTileSymbolIndex=new _i,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new o.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",o.getReferrer());const a=this;this._rtlTextPluginCallback=Gi.registerForPluginStateChange(c=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(d,y)=>{if(o.triggerPluginCompletionEvent(d),y&&y.every(v=>v))for(const v in a.sourceCaches){const b=a.sourceCaches[v].getSource().type;b!=="vector"&&b!=="geojson"||a.sourceCaches[v].reload()}})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const d=this.sourceCaches[c.sourceId];if(!d)return;const y=d.getSource();if(y&&y.vectorLayerIds)for(const v in this._layers){const b=this._layers[v];b.source===y.id&&this._validateLayer(b)}})}loadURL(t,n={},a){this.fire(new o.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,Ve.Style);this._request=o.getJSON(c,(d,y)=>{this._request=null,d?this.fire(new o.ErrorEvent(d)):y&&this._load(y,n,a)})}loadJSON(t,n={},a){this.fire(new o.Event("dataloading",{dataType:"style"})),this._request=o.browser.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new o.Event("dataloading",{dataType:"style"})),this._load(Ao,{validate:!1})}_load(t,n,a){var c;const d=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Bn(this,o.validateStyle(d))){this._loaded=!0,this.stylesheet=d;for(const y in d.sources)this.addSource(y,d.sources[y],{validate:!1});d.sprite?this._loadSprite(d.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(d.glyphs),this._createLayers(),this.light=new Ti(this.stylesheet.light),this.map.setTerrain((c=this.stylesheet.terrain)!==null&&c!==void 0?c:null),this.fire(new o.Event("data",{dataType:"style"})),this.fire(new o.Event("style.load"))}}_createLayers(){const t=o.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const a=o.createStyleLayer(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(c,d,y,v){const b=ti(c),E=b.length,A=y>1?"@2x":"",M={},B={},G={};for(const{id:j,url:X}of b){const V=d.transformRequest(d.normalizeSpriteURL(X,A,".json"),Ve.SpriteJSON),re=`${j}_${V.url}`;M[re]=o.getJSON(V,(ne,de)=>{delete M[re],B[j]=de,ft(v,B,G,ne,E)});const ce=d.transformRequest(d.normalizeSpriteURL(X,A,".png"),Ve.SpriteImage),J=`${j}_${ce.url}`;M[J]=Ee.getImage(ce,(ne,de)=>{delete M[J],G[j]=de,ft(v,B,G,ne,E)})}return{cancel(){for(const j of Object.values(M))j.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(c,d)=>{if(this._spriteRequest=null,c)this.fire(new o.ErrorEvent(c));else if(d)for(const y in d){this._spritesImagesIds[y]=[];const v=this._spritesImagesIds[y]?this._spritesImagesIds[y].filter(b=>!(b in d)):[];for(const b of v)this.imageManager.removeImage(b),this._changedImages[b]=!0;for(const b in d[y]){const E=y==="default"?b:`${y}:${b}`;this._spritesImagesIds[y].push(E),E in this.imageManager.images?this.imageManager.updateImage(E,d[y][b],!1):this.imageManager.addImage(E,d[y][b]),n&&(this._changedImages[E]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new o.Event("data",{dataType:"style"})),a&&a(c)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new o.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(a)===-1)&&this.fire(new o.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const a=[];for(const c of t)n[c]&&a.push(n[c]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const c=this._layers[a];c.type!=="custom"&&(t[a]=c.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(c.length||d.length)&&this._updateWorkerLayers(c,d);for(const y in this._updatedSources){const v=this._updatedSources[y];if(v==="reload")this._reloadSource(y);else{if(v!=="clear")throw new Error(`Invalid action ${v}`);this._clearSource(y)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const y in this._updatedPaintProps)this._layers[y].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const c in this.sourceCaches){const d=this.sourceCaches[c];a[c]=d.used,d.used=!1}for(const c of this._order){const d=this._layers[c];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const c in a){const d=this.sourceCaches[c];a[c]!==d.used&&d.fire(new o.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new o.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,Bn(this,o.validateStyle(t)))return!1;(t=o.clone$1(t)).layers=o.derefLayers(t.layers);const c=o.diffStyles(a,t).filter(y=>!(y.command in yi));if(c.length===0)return!1;const d=c.filter(y=>!(y.command in Hn));if(d.length>0)throw new Error(`Unimplemented: ${d.map(y=>y.command).join(", ")}.`);for(const y of c)y.command!=="setTransition"&&this[y.command].apply(this,y.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new o.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new o.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new o.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(o.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new ai(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new o.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new o.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new o.ErrorEvent(new Error(`Layer "${c}" already exists on this map.`)));let d;if(t.type==="custom"){if(Bn(this,o.validateCustomStyleLayer(t)))return;d=o.createStyleLayer(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(c,t.source),t=o.clone$1(t),t=o.extend(t,{source:c})),this._validate(o.validateStyle.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;d=o.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:c}})}const y=n?this._order.indexOf(n):this._order.length;if(n&&y===-1)this.fire(new o.ErrorEvent(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(y,0,c),this._layerOrderChanged=!0,this._layers[c]=d,this._removedLayers[c]&&d.source&&d.type!=="custom"){const v=this._removedLayers[c];delete this._removedLayers[c],v.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new o.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new o.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new o.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new o.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!o.deepEqual(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(o.validateStyle.filter,`layers.${c.id}.filter`,n,null,a)||(c.filter=o.clone$1(n),this._updateLayer(c)))}else this.fire(new o.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return o.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const d=this.getLayer(t);d?o.deepEqual(d.getLayoutProperty(n),a)||(d.setLayoutProperty(n,a,c),this._updateLayer(d)):this.fire(new o.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new o.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const d=this.getLayer(t);d?o.deepEqual(d.getPaintProperty(n),a)||(d.setPaintProperty(n,a,c)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new o.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,c=t.sourceLayer,d=this.sourceCaches[a];if(d===void 0)return void this.fire(new o.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const y=d.getSource().type;y==="geojson"&&c?this.fire(new o.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):y!=="vector"||c?(t.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(c,t.id,n)):this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new o.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const d=c.getSource().type,y=d==="vector"?t.sourceLayer:void 0;d!=="vector"||y?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new o.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(y,t.id,n):this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new o.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return o.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=o.mapObject(this.sourceCaches,c=>c.serialize()),n=this._serializeByIds(this._order),a=this.stylesheet;return o.filterObject({version:a.version,name:a.name,metadata:a.metadata,light:a.light,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n},c=>c!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=y=>this._layers[y].type==="fill-extrusion",a={},c=[];for(let y=this._order.length-1;y>=0;y--){const v=this._order[y];if(n(v)){a[v]=y;for(const b of t){const E=b[v];if(E)for(const A of E)c.push(A)}}}c.sort((y,v)=>v.intersectionZ-y.intersectionZ);const d=[];for(let y=this._order.length-1;y>=0;y--){const v=this._order[y];if(n(v))for(let b=c.length-1;b>=0;b--){const E=c[b].feature;if(a[E.layer.id]{const Ie=re.featureSortOrder;if(Ie){const Te=Ie.indexOf(pe.featureIndex);return Ie.indexOf(_e.featureIndex)-Te}return _e.featureIndex-pe.featureIndex});for(const pe of de)ne.push(pe)}}for(const re in j)j[re].forEach(ce=>{const J=ce.feature,ne=E[v[re].source].getFeatureState(J.layer["source-layer"],J.id);J.source=J.layer.source,J.layer["source-layer"]&&(J.sourceLayer=J.layer["source-layer"]),J.state=ne});return j}(this._layers,y,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(o.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(c,d){const y=c.getRenderableIds().map(E=>c.getTileByID(E)),v=[],b={};for(let E=0;E{xr[c]=d})(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},a):a(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let c=!1;for(const y in t)if(!o.deepEqual(t[y],a[y])){c=!0;break}if(!c)return;const d={now:o.browser.now(),transition:o.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,a,c,d={}){return(!d||d.validate!==!1)&&Bn(this,t.call(o.validateStyle,o.extend({key:n,style:this.serialize(),value:a,styleSpec:o.v8Spec},c)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const a=this.sourceCaches[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,a,c,d=!1){let y=!1,v=!1;const b={};for(const E of this._order){const A=this._layers[E];if(A.type!=="symbol")continue;if(!b[A.source]){const B=this.sourceCaches[A.source];b[A.source]=B.getRenderableIds(!0).map(G=>B.getTileByID(G)).sort((G,j)=>j.tileID.overscaledZ-G.tileID.overscaledZ||(G.tileID.isLessThan(j.tileID)?-1:1))}const M=this.crossTileSymbolIndex.addLayer(A,b[A.source],t.center.lng);y=y||M}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.browser.now(),t.zoom))&&(this.pauseablePlacement=new nu(t,this.map.terrain,this._order,d,n,a,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,b),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.browser.now()),v=!0),y&&this.pauseablePlacement.placement.setStale()),v||y)for(const E of this._order){const A=this._layers[E];A.type==="symbol"&&this.placement.updateLayerOpacities(A,b[A.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.browser.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return o.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(o.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},c){this._checkLoaded();const d=[{id:t,url:n}],y=[...ti(this.stylesheet.sprite),...d];this._validate(o.validateStyle.sprite,"sprite",y,null,a)||(this.stylesheet.sprite=y,this._loadSprite(d,!0,c))}removeSprite(t){this._checkLoaded();const n=ti(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new o.Event("data",{dataType:"style"}))}else this.fire(new o.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return ti(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(o.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}Gi.registerForPluginStateChange=o.registerForPluginStateChange;var Co=o.createLayout([{name:"a_pos",type:"Int16",components:2}]),ln="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Fs={prelude:Ft(`#ifdef GL_ES +precision mediump float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +`,`#ifdef GL_ES +precision highp float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +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 +);}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;} +#ifdef TERRAIN3D +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; +#endif +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) { +#ifdef TERRAIN3D +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)); +#else +return 1.0; +#endif +}float calculate_visibility(vec4 pos) { +#ifdef TERRAIN3D +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; +#else +return 1.0; +#endif +}float ele(vec2 pos) { +#ifdef TERRAIN3D +vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; +#else +return 0.0; +#endif +}float get_elevation(vec2 pos) { +#ifdef TERRAIN3D +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; +#else +return 0.0; +#endif +}`),background:Ft(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Ft(`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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"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:Ft(`varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main(void) { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Ft("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:Ft(`uniform highp float u_intensity;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#define GAUSS_COEF 0.3989422804014327 +void main() { +#pragma mapbox: initialize highp float weight +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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#pragma mapbox: define highp float weight +#pragma mapbox: define mediump float radius +const highp float ZERO=1.0/255.0/16.0; +#define GAUSS_COEF 0.3989422804014327 +void main(void) { +#pragma mapbox: initialize highp float weight +#pragma mapbox: initialize mediump float radius +vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Ft(`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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(0.0); +#endif +}`,"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:Ft("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Ft("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:Ft("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:Ft(`#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_FragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Ft(`varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Ft(`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; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +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:Ft(`#ifdef GL_ES +precision highp float; +#endif +uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +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:Ft(`varying vec4 v_color;void main() {gl_FragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec4 v_color; +#pragma mapbox: define highp float base +#pragma mapbox: define highp float height +#pragma mapbox: define highp vec4 color +void main() { +#pragma mapbox: initialize highp float base +#pragma mapbox: initialize highp float height +#pragma mapbox: initialize highp vec4 color +vec3 normal=a_normal_ed.xyz; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +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:Ft(`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; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +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; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +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 +? a_pos +: 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:Ft(`#ifdef GL_ES +precision highp float; +#endif +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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"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:Ft(`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; +#define PI 3.141592653589793 +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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"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:Ft(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +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; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +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; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +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; +#endif +v_width2=vec2(outset,inset);}`),lineGradient:Ft(`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; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +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; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +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; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +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; +#endif +v_width2=vec2(outset,inset);}`),linePattern:Ft(`#ifdef GL_ES +precision highp float; +#endif +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; +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +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; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +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; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +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; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ft(`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; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +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; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +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; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +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; +#endif +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:Ft(`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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"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:Ft(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;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;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Ft(`#define SDF_PX 8.0 +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; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;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 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;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Ft(`#define SDF_PX 8.0 +#define SDF 1.0 +#define ICON 0.0 +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; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +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; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +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); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;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;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Ft("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",ln),terrainDepth:Ft("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);}",ln),terrainCoords:Ft("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);}",ln)};function Ft(u,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),c=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),d=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=d?d.concat(c):c,v={};return{fragmentSource:u=u.replace(n,(b,E,A,M,B)=>(v[B]=!0,E==="define"?` +#ifndef HAS_UNIFORM_u_${B} +varying ${A} ${M} ${B}; +#else +uniform ${A} ${M} u_${B}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${B} + ${A} ${M} ${B} = u_${B}; +#endif +`)),vertexSource:t=t.replace(n,(b,E,A,M,B)=>{const G=M==="float"?"vec2":"vec4",j=B.match(/color/)?"color":G;return v[B]?E==="define"?` +#ifndef HAS_UNIFORM_u_${B} +uniform lowp float u_${B}_t; +attribute ${A} ${G} a_${B}; +varying ${A} ${M} ${B}; +#else +uniform ${A} ${M} u_${B}; +#endif +`:j==="vec4"?` +#ifndef HAS_UNIFORM_u_${B} + ${B} = a_${B}; +#else + ${A} ${M} ${B} = u_${B}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${B} + ${B} = unpack_mix_${j}(a_${B}, u_${B}_t); +#else + ${A} ${M} ${B} = u_${B}; +#endif +`:E==="define"?` +#ifndef HAS_UNIFORM_u_${B} +uniform lowp float u_${B}_t; +attribute ${A} ${G} a_${B}; +#else +uniform ${A} ${M} u_${B}; +#endif +`:j==="vec4"?` +#ifndef HAS_UNIFORM_u_${B} + ${A} ${M} ${B} = a_${B}; +#else + ${A} ${M} ${B} = u_${B}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${B} + ${A} ${M} ${B} = unpack_mix_${j}(a_${B}, u_${B}_t); +#else + ${A} ${M} ${B} = u_${B}; +#endif +`}),staticAttributes:a,staticUniforms:y}}class ko{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,c,d,y,v,b,E){this.context=t;let A=this.boundPaintVertexBuffers.length!==c.length;for(let M=0;!A&&M({u_depth:new o.Uniform1i(pe,_e.u_depth),u_terrain:new o.Uniform1i(pe,_e.u_terrain),u_terrain_dim:new o.Uniform1f(pe,_e.u_terrain_dim),u_terrain_matrix:new o.UniformMatrix4f(pe,_e.u_terrain_matrix),u_terrain_unpack:new o.Uniform4f(pe,_e.u_terrain_unpack),u_terrain_exaggeration:new o.Uniform1f(pe,_e.u_terrain_exaggeration)}))(t,de),this.binderUniforms=a?a.getUniforms(t,de):[]}draw(t,n,a,c,d,y,v,b,E,A,M,B,G,j,X,V,re,ce){const J=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(c),t.setColorMode(d),t.setCullFace(y),b){t.activeTexture.set(J.TEXTURE2),J.bindTexture(J.TEXTURE_2D,b.depthTexture),t.activeTexture.set(J.TEXTURE3),J.bindTexture(J.TEXTURE_2D,b.texture);for(const de in this.terrainUniforms)this.terrainUniforms[de].set(b[de])}for(const de in this.fixedUniforms)this.fixedUniforms[de].set(v[de]);X&&X.setUniforms(t,this.binderUniforms,G,{zoom:j});let ne=0;switch(n){case J.LINES:ne=2;break;case J.TRIANGLES:ne=3;break;case J.LINE_STRIP:ne=1}for(const de of B.get()){const pe=de.vaos||(de.vaos={});(pe[E]||(pe[E]=new ko)).bind(t,this,A,X?X.getPaintVertexBuffers():[],M,de.vertexOffset,V,re,ce),J.drawElements(n,de.primitiveLength*ne,J.UNSIGNED_SHORT,de.primitiveOffset*ne*2)}}}function Mo(u,t,n){const a=1/te(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,y=d*(n.tileID.canonical.x+n.tileID.wrap*c),v=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[y>>16,v>>16],u_pixel_coord_lower:[65535&y,65535&v]}}const Ns=(u,t,n,a)=>{const c=t.style.light,d=c.properties.get("position"),y=[d.x,d.y,d.z],v=function(){var E=new o.ARRAY_TYPE(9);return o.ARRAY_TYPE!=Float32Array&&(E[1]=0,E[2]=0,E[3]=0,E[5]=0,E[6]=0,E[7]=0),E[0]=1,E[4]=1,E[8]=1,E}();c.properties.get("anchor")==="viewport"&&function(E,A){var M=Math.sin(A),B=Math.cos(A);E[0]=B,E[1]=M,E[2]=0,E[3]=-M,E[4]=B,E[5]=0,E[6]=0,E[7]=0,E[8]=1}(v,-t.transform.angle),function(E,A,M){var B=A[0],G=A[1],j=A[2];E[0]=B*M[0]+G*M[3]+j*M[6],E[1]=B*M[1]+G*M[4]+j*M[7],E[2]=B*M[2]+G*M[5]+j*M[8]}(y,y,v);const b=c.properties.get("color");return{u_matrix:u,u_lightpos:y,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+n,u_opacity:a}},su=(u,t,n,a,c,d,y)=>o.extend(Ns(u,t,n,a),Mo(d,t,y),{u_height_factor:-Math.pow(2,c.overscaledZ)/y.tileSize/8}),Gl=u=>({u_matrix:u}),Po=(u,t,n,a)=>o.extend(Gl(u),Mo(n,t,a)),ou=(u,t)=>({u_matrix:u,u_world:t}),Zl=(u,t,n,a,c)=>o.extend(Po(u,t,n,a),{u_world:c}),au=(u,t,n,a)=>{const c=u.transform;let d,y;if(a.paint.get("circle-pitch-alignment")==="map"){const v=te(n,1,c.zoom);d=!0,y=[v,v]}else d=!1,y=c.pixelsToGLUnits;return{u_camera_to_center_distance:c.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:y}},Xl=(u,t,n)=>{const a=te(n,1,t.zoom),c=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:u,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*c),t.pixelsToGLUnits[1]/(a*c)],u_overscale_factor:d}},Wl=(u,t,n=1)=>({u_matrix:u,u_color:t,u_overlay:0,u_overlay_scale:n}),zo=u=>({u_matrix:u}),Hl=(u,t,n,a)=>({u_matrix:u,u_extrude_scale:te(t,1,n),u_intensity:a});function Yl(u,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new o.MercatorCoordinate(0,a/n).toLngLat().lat,new o.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Do=(u,t,n,a)=>{const c=u.transform;return{u_matrix:Us(u,t,n,a),u_ratio:1/te(t,1,c.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Jl=(u,t,n,a,c)=>o.extend(Do(u,t,n,c),{u_image:0,u_image_height:a}),Yn=(u,t,n,a,c)=>{const d=u.transform,y=wr(t,d);return{u_matrix:Us(u,t,n,c),u_texsize:t.imageAtlasTexture.size,u_ratio:1/te(t,1,d.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[y,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Lo=(u,t,n,a,c,d)=>{const y=u.lineAtlas,v=wr(t,u.transform),b=n.layout.get("line-cap")==="round",E=y.getDash(a.from,b),A=y.getDash(a.to,b),M=E.width*c.fromScale,B=A.width*c.toScale;return o.extend(Do(u,t,n,d),{u_patternscale_a:[v/M,-E.height/2],u_patternscale_b:[v/B,-A.height/2],u_sdfgamma:y.width/(256*Math.min(M,B)*u.pixelRatio)/2,u_image:0,u_tex_y_a:E.y,u_tex_y_b:A.y,u_mix:c.t})};function wr(u,t){return 1/te(u,1,t.tileZoom)}function Us(u,t,n,a){return u.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Ro=(u,t,n,a,c)=>{return{u_matrix:u,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(y=c.paint.get("raster-saturation"),y>0?1-1/(1.001-y):-y),u_contrast_factor:(d=c.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:Vs(c.paint.get("raster-hue-rotate"))};var d,y};function Vs(u){u*=Math.PI/180;const t=Math.sin(u),n=Math.cos(u);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const js=(u,t,n,a,c,d,y,v,b,E)=>{const A=c.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:A.cameraToCenterDistance,u_pitch:A.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:A.width/A.height,u_fade_change:c.options.fadeDuration?c.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:y,u_coord_matrix:v,u_is_text:+b,u_pitch_with_map:+a,u_texsize:E,u_texture:0}},qs=(u,t,n,a,c,d,y,v,b,E,A)=>{const M=c.transform;return o.extend(js(u,t,n,a,c,d,y,v,b,E),{u_gamma_scale:a?Math.cos(M._pitch)*M.cameraToCenterDistance:1,u_device_pixel_ratio:c.pixelRatio,u_is_halo:+A})},Gs=(u,t,n,a,c,d,y,v,b,E)=>o.extend(qs(u,t,n,a,c,d,y,v,!0,b,!0),{u_texsize_icon:E,u_texture_icon:1}),Jn=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),Bo=(u,t,n,a,c,d)=>o.extend(function(y,v,b,E){const A=b.imageManager.getPattern(y.from.toString()),M=b.imageManager.getPattern(y.to.toString()),{width:B,height:G}=b.imageManager.getPixelSize(),j=Math.pow(2,E.tileID.overscaledZ),X=E.tileSize*Math.pow(2,b.transform.tileZoom)/j,V=X*(E.tileID.canonical.x+E.tileID.wrap*j),re=X*E.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:A.tl,u_pattern_br_a:A.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[B,G],u_mix:v.t,u_pattern_size_a:A.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:v.fromScale,u_scale_b:v.toScale,u_tile_units_to_pixels:1/te(E,1,b.transform.tileZoom),u_pixel_coord_upper:[V>>16,re>>16],u_pixel_coord_lower:[65535&V,65535&re]}}(a,d,n,c),{u_matrix:u,u_opacity:t}),Tr={fillExtrusion:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_lightpos:new o.Uniform3f(u,t.u_lightpos),u_lightintensity:new o.Uniform1f(u,t.u_lightintensity),u_lightcolor:new o.Uniform3f(u,t.u_lightcolor),u_vertical_gradient:new o.Uniform1f(u,t.u_vertical_gradient),u_opacity:new o.Uniform1f(u,t.u_opacity)}),fillExtrusionPattern:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_lightpos:new o.Uniform3f(u,t.u_lightpos),u_lightintensity:new o.Uniform1f(u,t.u_lightintensity),u_lightcolor:new o.Uniform3f(u,t.u_lightcolor),u_vertical_gradient:new o.Uniform1f(u,t.u_vertical_gradient),u_height_factor:new o.Uniform1f(u,t.u_height_factor),u_image:new o.Uniform1i(u,t.u_image),u_texsize:new o.Uniform2f(u,t.u_texsize),u_pixel_coord_upper:new o.Uniform2f(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(u,t.u_pixel_coord_lower),u_scale:new o.Uniform3f(u,t.u_scale),u_fade:new o.Uniform1f(u,t.u_fade),u_opacity:new o.Uniform1f(u,t.u_opacity)}),fill:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix)}),fillPattern:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_image:new o.Uniform1i(u,t.u_image),u_texsize:new o.Uniform2f(u,t.u_texsize),u_pixel_coord_upper:new o.Uniform2f(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(u,t.u_pixel_coord_lower),u_scale:new o.Uniform3f(u,t.u_scale),u_fade:new o.Uniform1f(u,t.u_fade)}),fillOutline:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_world:new o.Uniform2f(u,t.u_world)}),fillOutlinePattern:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_world:new o.Uniform2f(u,t.u_world),u_image:new o.Uniform1i(u,t.u_image),u_texsize:new o.Uniform2f(u,t.u_texsize),u_pixel_coord_upper:new o.Uniform2f(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(u,t.u_pixel_coord_lower),u_scale:new o.Uniform3f(u,t.u_scale),u_fade:new o.Uniform1f(u,t.u_fade)}),circle:(u,t)=>({u_camera_to_center_distance:new o.Uniform1f(u,t.u_camera_to_center_distance),u_scale_with_map:new o.Uniform1i(u,t.u_scale_with_map),u_pitch_with_map:new o.Uniform1i(u,t.u_pitch_with_map),u_extrude_scale:new o.Uniform2f(u,t.u_extrude_scale),u_device_pixel_ratio:new o.Uniform1f(u,t.u_device_pixel_ratio),u_matrix:new o.UniformMatrix4f(u,t.u_matrix)}),collisionBox:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_camera_to_center_distance:new o.Uniform1f(u,t.u_camera_to_center_distance),u_pixels_to_tile_units:new o.Uniform1f(u,t.u_pixels_to_tile_units),u_extrude_scale:new o.Uniform2f(u,t.u_extrude_scale),u_overscale_factor:new o.Uniform1f(u,t.u_overscale_factor)}),collisionCircle:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_inv_matrix:new o.UniformMatrix4f(u,t.u_inv_matrix),u_camera_to_center_distance:new o.Uniform1f(u,t.u_camera_to_center_distance),u_viewport_size:new o.Uniform2f(u,t.u_viewport_size)}),debug:(u,t)=>({u_color:new o.UniformColor(u,t.u_color),u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_overlay:new o.Uniform1i(u,t.u_overlay),u_overlay_scale:new o.Uniform1f(u,t.u_overlay_scale)}),clippingMask:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix)}),heatmap:(u,t)=>({u_extrude_scale:new o.Uniform1f(u,t.u_extrude_scale),u_intensity:new o.Uniform1f(u,t.u_intensity),u_matrix:new o.UniformMatrix4f(u,t.u_matrix)}),heatmapTexture:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_world:new o.Uniform2f(u,t.u_world),u_image:new o.Uniform1i(u,t.u_image),u_color_ramp:new o.Uniform1i(u,t.u_color_ramp),u_opacity:new o.Uniform1f(u,t.u_opacity)}),hillshade:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_image:new o.Uniform1i(u,t.u_image),u_latrange:new o.Uniform2f(u,t.u_latrange),u_light:new o.Uniform2f(u,t.u_light),u_shadow:new o.UniformColor(u,t.u_shadow),u_highlight:new o.UniformColor(u,t.u_highlight),u_accent:new o.UniformColor(u,t.u_accent)}),hillshadePrepare:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_image:new o.Uniform1i(u,t.u_image),u_dimension:new o.Uniform2f(u,t.u_dimension),u_zoom:new o.Uniform1f(u,t.u_zoom),u_unpack:new o.Uniform4f(u,t.u_unpack)}),line:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_ratio:new o.Uniform1f(u,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(u,t.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(u,t.u_units_to_pixels)}),lineGradient:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_ratio:new o.Uniform1f(u,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(u,t.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(u,t.u_units_to_pixels),u_image:new o.Uniform1i(u,t.u_image),u_image_height:new o.Uniform1f(u,t.u_image_height)}),linePattern:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_texsize:new o.Uniform2f(u,t.u_texsize),u_ratio:new o.Uniform1f(u,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(u,t.u_device_pixel_ratio),u_image:new o.Uniform1i(u,t.u_image),u_units_to_pixels:new o.Uniform2f(u,t.u_units_to_pixels),u_scale:new o.Uniform3f(u,t.u_scale),u_fade:new o.Uniform1f(u,t.u_fade)}),lineSDF:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_ratio:new o.Uniform1f(u,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(u,t.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(u,t.u_units_to_pixels),u_patternscale_a:new o.Uniform2f(u,t.u_patternscale_a),u_patternscale_b:new o.Uniform2f(u,t.u_patternscale_b),u_sdfgamma:new o.Uniform1f(u,t.u_sdfgamma),u_image:new o.Uniform1i(u,t.u_image),u_tex_y_a:new o.Uniform1f(u,t.u_tex_y_a),u_tex_y_b:new o.Uniform1f(u,t.u_tex_y_b),u_mix:new o.Uniform1f(u,t.u_mix)}),raster:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_tl_parent:new o.Uniform2f(u,t.u_tl_parent),u_scale_parent:new o.Uniform1f(u,t.u_scale_parent),u_buffer_scale:new o.Uniform1f(u,t.u_buffer_scale),u_fade_t:new o.Uniform1f(u,t.u_fade_t),u_opacity:new o.Uniform1f(u,t.u_opacity),u_image0:new o.Uniform1i(u,t.u_image0),u_image1:new o.Uniform1i(u,t.u_image1),u_brightness_low:new o.Uniform1f(u,t.u_brightness_low),u_brightness_high:new o.Uniform1f(u,t.u_brightness_high),u_saturation_factor:new o.Uniform1f(u,t.u_saturation_factor),u_contrast_factor:new o.Uniform1f(u,t.u_contrast_factor),u_spin_weights:new o.Uniform3f(u,t.u_spin_weights)}),symbolIcon:(u,t)=>({u_is_size_zoom_constant:new o.Uniform1i(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(u,t.u_is_size_feature_constant),u_size_t:new o.Uniform1f(u,t.u_size_t),u_size:new o.Uniform1f(u,t.u_size),u_camera_to_center_distance:new o.Uniform1f(u,t.u_camera_to_center_distance),u_pitch:new o.Uniform1f(u,t.u_pitch),u_rotate_symbol:new o.Uniform1i(u,t.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(u,t.u_aspect_ratio),u_fade_change:new o.Uniform1f(u,t.u_fade_change),u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(u,t.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(u,t.u_coord_matrix),u_is_text:new o.Uniform1i(u,t.u_is_text),u_pitch_with_map:new o.Uniform1i(u,t.u_pitch_with_map),u_texsize:new o.Uniform2f(u,t.u_texsize),u_texture:new o.Uniform1i(u,t.u_texture)}),symbolSDF:(u,t)=>({u_is_size_zoom_constant:new o.Uniform1i(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(u,t.u_is_size_feature_constant),u_size_t:new o.Uniform1f(u,t.u_size_t),u_size:new o.Uniform1f(u,t.u_size),u_camera_to_center_distance:new o.Uniform1f(u,t.u_camera_to_center_distance),u_pitch:new o.Uniform1f(u,t.u_pitch),u_rotate_symbol:new o.Uniform1i(u,t.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(u,t.u_aspect_ratio),u_fade_change:new o.Uniform1f(u,t.u_fade_change),u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(u,t.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(u,t.u_coord_matrix),u_is_text:new o.Uniform1i(u,t.u_is_text),u_pitch_with_map:new o.Uniform1i(u,t.u_pitch_with_map),u_texsize:new o.Uniform2f(u,t.u_texsize),u_texture:new o.Uniform1i(u,t.u_texture),u_gamma_scale:new o.Uniform1f(u,t.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(u,t.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(u,t.u_is_halo)}),symbolTextAndIcon:(u,t)=>({u_is_size_zoom_constant:new o.Uniform1i(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(u,t.u_is_size_feature_constant),u_size_t:new o.Uniform1f(u,t.u_size_t),u_size:new o.Uniform1f(u,t.u_size),u_camera_to_center_distance:new o.Uniform1f(u,t.u_camera_to_center_distance),u_pitch:new o.Uniform1f(u,t.u_pitch),u_rotate_symbol:new o.Uniform1i(u,t.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(u,t.u_aspect_ratio),u_fade_change:new o.Uniform1f(u,t.u_fade_change),u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(u,t.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(u,t.u_coord_matrix),u_is_text:new o.Uniform1i(u,t.u_is_text),u_pitch_with_map:new o.Uniform1i(u,t.u_pitch_with_map),u_texsize:new o.Uniform2f(u,t.u_texsize),u_texsize_icon:new o.Uniform2f(u,t.u_texsize_icon),u_texture:new o.Uniform1i(u,t.u_texture),u_texture_icon:new o.Uniform1i(u,t.u_texture_icon),u_gamma_scale:new o.Uniform1f(u,t.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(u,t.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(u,t.u_is_halo)}),background:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_opacity:new o.Uniform1f(u,t.u_opacity),u_color:new o.UniformColor(u,t.u_color)}),backgroundPattern:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_opacity:new o.Uniform1f(u,t.u_opacity),u_image:new o.Uniform1i(u,t.u_image),u_pattern_tl_a:new o.Uniform2f(u,t.u_pattern_tl_a),u_pattern_br_a:new o.Uniform2f(u,t.u_pattern_br_a),u_pattern_tl_b:new o.Uniform2f(u,t.u_pattern_tl_b),u_pattern_br_b:new o.Uniform2f(u,t.u_pattern_br_b),u_texsize:new o.Uniform2f(u,t.u_texsize),u_mix:new o.Uniform1f(u,t.u_mix),u_pattern_size_a:new o.Uniform2f(u,t.u_pattern_size_a),u_pattern_size_b:new o.Uniform2f(u,t.u_pattern_size_b),u_scale_a:new o.Uniform1f(u,t.u_scale_a),u_scale_b:new o.Uniform1f(u,t.u_scale_b),u_pixel_coord_upper:new o.Uniform2f(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(u,t.u_pixel_coord_lower),u_tile_units_to_pixels:new o.Uniform1f(u,t.u_tile_units_to_pixels)}),terrain:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_texture:new o.Uniform1i(u,t.u_texture),u_ele_delta:new o.Uniform1f(u,t.u_ele_delta)}),terrainDepth:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_ele_delta:new o.Uniform1f(u,t.u_ele_delta)}),terrainCoords:(u,t)=>({u_matrix:new o.UniformMatrix4f(u,t.u_matrix),u_texture:new o.Uniform1i(u,t.u_texture),u_terrain_coords_id:new o.Uniform1f(u,t.u_terrain_coords_id),u_ele_delta:new o.Uniform1f(u,t.u_ele_delta)})};class Er{constructor(t,n,a){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Oa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Oo{constructor(t,n,a,c){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a0){const ke=o.create(),He=_e;o.mul(ke,pe.placementInvProjMatrix,u.transform.glCoordMatrix),o.mul(ke,ke,pe.placementViewportMatrix),A.push({circleArray:Te,circleOffset:B,transform:He,invTransform:ke,coord:ne}),M+=Te.length/4,B=M}Ie&&E.draw(v,b.LINES,vt.disabled,Yt.disabled,u.colorModeForRenderPass(),Jt.disabled,Xl(_e,u.transform,de),u.style.map.terrain&&u.style.map.terrain.getTerrainData(ne),n.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,null,u.transform.zoom,null,null,Ie.collisionVertexBuffer)}if(!y||!A.length)return;const G=u.useProgram("collisionCircle"),j=new o.CollisionCircleLayoutArray;j.resize(4*M),j._trim();let X=0;for(const J of A)for(let ne=0;ne=0&&(j[V.associatedIconIndex]={shiftedAnchor:mt,angle:Le})}else N(V.numGlyphs,B)}if(E){G.clear();const X=u.icon.placedSymbolArray;for(let V=0;Vu.style.map.terrain.getElevation(Ie,Xi,oi):null,Ai=n.layout.get("text-rotation-alignment")==="map";Ln(ke,Ie.posMatrix,u,c,hn,Xr,V,E,Ai,zi)}const Un=u.translatePosMatrix(Ie.posMatrix,Te,d,y),Tn=re||c&&pe||Es?Za:hn,xi=u.translatePosMatrix(Xr,Te,d,y,!0),Pi=Le&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Zi;Zi=Le?ke.iconsInText?Gs(Qe.kind,gt,ce,V,u,Un,Tn,xi,_t,Ui):qs(Qe.kind,gt,ce,V,u,Un,Tn,xi,c,_t,!0):js(Qe.kind,gt,ce,V,u,Un,Tn,xi,c,_t);const Ss={program:Qt,buffers:He,uniformValues:Zi,atlasTexture:si,atlasTextureIcon:fi,atlasInterpolation:Nt,atlasInterpolationIcon:Ir,isSDF:Le,hasHalo:Pi};if(J&&ke.canOverlap){ne=!0;const zi=He.segments.get();for(const Ai of zi)_e.push({segments:new o.SegmentVector([Ai]),sortKey:Ai.sortKey,state:Ss,terrainData:et})}else _e.push({segments:He.segments,sortKey:0,state:Ss,terrainData:et})}ne&&_e.sort((Ie,Te)=>Ie.sortKey-Te.sortKey);for(const Ie of _e){const Te=Ie.state;if(B.activeTexture.set(G.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,G.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(B.activeTexture.set(G.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,G.CLAMP_TO_EDGE)),Te.isSDF){const ke=Te.uniformValues;Te.hasHalo&&(ke.u_is_halo=1,Ws(Te.buffers,Ie.segments,n,u,Te.program,de,A,M,ke,Ie.terrainData)),ke.u_is_halo=0}Ws(Te.buffers,Ie.segments,n,u,Te.program,de,A,M,Te.uniformValues,Ie.terrainData)}}function Ws(u,t,n,a,c,d,y,v,b,E){const A=a.context;c.draw(A,A.gl.TRIANGLES,d,y,v,Jt.disabled,b,E,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,a.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function qo(u,t,n,a,c){if(!n||!a||!a.imageAtlas)return;const d=a.imageAtlas.patternPositions;let y=d[n.to.toString()],v=d[n.from.toString()];if(!y||!v){const b=c.getPaintProperty(t);y=d[b],v=d[b]}y&&v&&u.setConstantPatternPositions(y,v)}function Ha(u,t,n,a,c,d,y){const v=u.context.gl,b="fill-pattern",E=n.paint.get(b),A=E&&E.constantOr(1),M=n.getCrossfadeParameters();let B,G,j,X,V;y?(G=A&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",B=v.LINES):(G=A?"fillPattern":"fill",B=v.TRIANGLES);const re=E.constantOr(null);for(const ce of a){const J=t.getTile(ce);if(A&&!J.patternsLoaded())continue;const ne=J.getBucket(n);if(!ne)continue;const de=ne.programConfigurations.get(n.id),pe=u.useProgram(G,de),_e=u.style.map.terrain&&u.style.map.terrain.getTerrainData(ce);A&&(u.context.activeTexture.set(v.TEXTURE0),J.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),de.updatePaintBuffers(M)),qo(de,b,re,J,n);const Ie=_e?ce:null,Te=u.translatePosMatrix(Ie?Ie.posMatrix:ce.posMatrix,J,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(y){X=ne.indexBuffer2,V=ne.segments2;const ke=[v.drawingBufferWidth,v.drawingBufferHeight];j=G==="fillOutlinePattern"&&A?Zl(Te,u,M,J,ke):ou(Te,ke)}else X=ne.indexBuffer,V=ne.segments,j=A?Po(Te,u,M,J):Gl(Te);pe.draw(u.context,B,c,u.stencilModeForClipping(ce),d,Jt.disabled,j,_e,n.id,ne.layoutVertexBuffer,X,V,n.paint,u.transform.zoom,de)}}function Go(u,t,n,a,c,d,y){const v=u.context,b=v.gl,E="fill-extrusion-pattern",A=n.paint.get(E),M=A.constantOr(1),B=n.getCrossfadeParameters(),G=n.paint.get("fill-extrusion-opacity"),j=A.constantOr(null);for(const X of a){const V=t.getTile(X),re=V.getBucket(n);if(!re)continue;const ce=u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),J=re.programConfigurations.get(n.id),ne=u.useProgram(M?"fillExtrusionPattern":"fillExtrusion",J);M&&(u.context.activeTexture.set(b.TEXTURE0),V.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),J.updatePaintBuffers(B)),qo(J,E,j,V,n);const de=u.translatePosMatrix(X.posMatrix,V,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),pe=n.paint.get("fill-extrusion-vertical-gradient"),_e=M?su(de,u,pe,G,X,B,V):Ns(de,u,pe,G);ne.draw(v,v.gl.TRIANGLES,c,d,y,Jt.backCCW,_e,ce,n.id,re.layoutVertexBuffer,re.indexBuffer,re.segments,n.paint,u.transform.zoom,J,u.style.map.terrain&&re.centroidVertexBuffer)}}function Zo(u,t,n,a,c,d,y){const v=u.context,b=v.gl,E=n.fbo;if(!E)return;const A=u.useProgram("hillshade"),M=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);v.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,E.colorAttachment.get()),A.draw(v,b.TRIANGLES,c,d,y,Jt.disabled,((B,G,j,X)=>{const V=j.paint.get("hillshade-shadow-color"),re=j.paint.get("hillshade-highlight-color"),ce=j.paint.get("hillshade-accent-color");let J=j.paint.get("hillshade-illumination-direction")*(Math.PI/180);j.paint.get("hillshade-illumination-anchor")==="viewport"&&(J-=B.transform.angle);const ne=!B.options.moving;return{u_matrix:X?X.posMatrix:B.transform.calculatePosMatrix(G.tileID.toUnwrapped(),ne),u_image:0,u_latrange:Yl(0,G.tileID),u_light:[j.paint.get("hillshade-exaggeration"),J],u_shadow:V,u_highlight:re,u_accent:ce}})(u,n,a,M?t:null),M,a.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function Ya(u,t,n,a,c,d){const y=u.context,v=y.gl,b=t.dem;if(b&&b.data){const E=b.dim,A=b.stride,M=b.getPixels();if(y.activeTexture.set(v.TEXTURE1),y.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(A),t.demTexture){const G=t.demTexture;G.update(M,{premultiply:!1}),G.bind(v.NEAREST,v.CLAMP_TO_EDGE)}else t.demTexture=new Tt(y,M,v.RGBA,{premultiply:!1}),t.demTexture.bind(v.NEAREST,v.CLAMP_TO_EDGE);y.activeTexture.set(v.TEXTURE0);let B=t.fbo;if(!B){const G=new Tt(y,{width:E,height:E,data:null},v.RGBA);G.bind(v.LINEAR,v.CLAMP_TO_EDGE),B=t.fbo=y.createFramebuffer(E,E,!0,!1),B.colorAttachment.set(G.texture)}y.bindFramebuffer.set(B.framebuffer),y.viewport.set([0,0,E,E]),u.useProgram("hillshadePrepare").draw(y,v.TRIANGLES,a,c,d,Jt.disabled,((G,j)=>{const X=j.stride,V=o.create();return o.ortho(V,0,o.EXTENT,-o.EXTENT,0,0,1),o.translate(V,V,[0,-o.EXTENT,0]),{u_matrix:V,u_image:1,u_dimension:[X,X],u_zoom:G.overscaledZ,u_unpack:j.getUnpackVector()}})(t.tileID,b),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function xu(u,t,n,a,c,d){const y=a.paint.get("raster-fade-duration");if(!d&&y>0){const v=o.browser.now(),b=(v-u.timeAdded)/y,E=t?(v-t.timeAdded)/y:-1,A=n.getSource(),M=c.coveringZoomLevel({tileSize:A.tileSize,roundZoom:A.roundZoom}),B=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(u.tileID.overscaledZ-M),G=B&&u.refreshedUponExpiration?1:o.clamp(B?b:1-E,0,1);return u.refreshedUponExpiration&&b>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-G}:{opacity:G,mix:0}}return{opacity:1,mix:0}}const sc=new o.Color(1,0,0,1),pi=new o.Color(0,1,0,1),es=new o.Color(0,0,1,1),Fr=new o.Color(1,0,1,1),Ja=new o.Color(0,1,1,1);function Xo(u,t,n,a){bn(u,0,t+n/2,u.transform.width,n,a)}function Ka(u,t,n,a){bn(u,t-n/2,0,n,u.transform.height,a)}function bn(u,t,n,a,c,d){const y=u.context,v=y.gl;v.enable(v.SCISSOR_TEST),v.scissor(t*u.pixelRatio,n*u.pixelRatio,a*u.pixelRatio,c*u.pixelRatio),y.clear({color:d}),v.disable(v.SCISSOR_TEST)}function Hs(u,t,n){const a=u.context,c=a.gl,d=n.posMatrix,y=u.useProgram("debug"),v=vt.disabled,b=Yt.disabled,E=u.colorModeForRenderPass(),A="$debug",M=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);a.activeTexture.set(c.TEXTURE0);const B=t.getTileByID(n.key).latestRawTileData,G=Math.floor((B&&B.byteLength||0)/1024),j=t.getTile(n).tileSize,X=512/Math.min(j,512)*(n.overscaledZ/u.transform.zoom)*.5;let V=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(V+=` => ${n.overscaledZ}`),function(re,ce){re.initDebugOverlayCanvas();const J=re.debugOverlayCanvas,ne=re.context.gl,de=re.debugOverlayCanvas.getContext("2d");de.clearRect(0,0,J.width,J.height),de.shadowColor="white",de.shadowBlur=2,de.lineWidth=1.5,de.strokeStyle="white",de.textBaseline="top",de.font="bold 36px Open Sans, sans-serif",de.fillText(ce,5,5),de.strokeText(ce,5,5),re.debugOverlayTexture.update(J),re.debugOverlayTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE)}(u,`${V} ${G}kB`),y.draw(a,c.TRIANGLES,v,b,li.alphaBlended,Jt.disabled,Wl(d,o.Color.transparent,X),null,A,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),y.draw(a,c.LINE_STRIP,v,b,E,Jt.disabled,Wl(d,o.Color.red),M,A,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Wo(u,t,n){const a=u.context,c=a.gl,d=u.colorModeForRenderPass(),y=new vt(c.LEQUAL,vt.ReadWrite,u.depthRangeFor3D),v=u.useProgram("terrain"),b=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,u.width,u.height]);for(const E of n){const A=u.renderToTexture.getTexture(E),M=t.getTerrainData(E.tileID);a.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,A.texture);const B={u_matrix:u.transform.calculatePosMatrix(E.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(u.transform.zoom)};v.draw(a,c.TRIANGLES,y,Yt.disabled,d,Jt.backCCW,B,M,"terrain",b.vertexBuffer,b.indexBuffer,b.segments)}}class oc{constructor(t,n){this.context=new jo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.create(),renderTime:0},this.setup(),this.numSublayers=ai.maxUnderzooming+ai.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new _i}resize(t,n,a){if(this.width=Math.floor(t*a),this.height=Math.floor(n*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style._order)this.style._layers[c].resize()}setup(){const t=this.context,n=new o.PosArray;n.emplaceBack(0,0),n.emplaceBack(o.EXTENT,0),n.emplaceBack(0,o.EXTENT),n.emplaceBack(o.EXTENT,o.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Co.members),this.tileExtentSegments=o.SegmentVector.simpleSegment(0,0,4,2);const a=new o.PosArray;a.emplaceBack(0,0),a.emplaceBack(o.EXTENT,0),a.emplaceBack(0,o.EXTENT),a.emplaceBack(o.EXTENT,o.EXTENT),this.debugBuffer=t.createVertexBuffer(a,Co.members),this.debugSegments=o.SegmentVector.simpleSegment(0,0,4,5);const c=new o.RasterBoundsArray;c.emplaceBack(0,0,0,0),c.emplaceBack(o.EXTENT,0,o.EXTENT,0),c.emplaceBack(0,o.EXTENT,0,o.EXTENT),c.emplaceBack(o.EXTENT,o.EXTENT,o.EXTENT,o.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(c,rr.members),this.rasterBoundsSegments=o.SegmentVector.simpleSegment(0,0,4,2);const d=new o.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,Co.members),this.viewportSegments=o.SegmentVector.simpleSegment(0,0,4,2);const y=new o.LineStripIndexArray;y.emplaceBack(0),y.emplaceBack(1),y.emplaceBack(3),y.emplaceBack(2),y.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(y);const v=new o.TriangleIndexArray;v.emplaceBack(0,1,2),v.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(v);const b=this.context.gl;this.stencilClearMode=new Yt({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=o.create();o.ortho(a,0,this.width,this.height,0,0,1),o.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,vt.disabled,this.stencilClearMode,li.disabled,Jt.disabled,zo(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const a=this.context,c=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(li.disabled),a.setDepthMode(vt.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of n){const v=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(y);d.draw(a,c.TRIANGLES,vt.disabled,new Yt({func:c.ALWAYS,mask:0},v,255,c.KEEP,c.KEEP,c.REPLACE),li.disabled,Jt.disabled,zo(y.posMatrix),b,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Yt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Yt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((y,v)=>v.overscaledZ-y.overscaledZ),c=a[a.length-1].overscaledZ,d=a[0].overscaledZ-c+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const y={};for(let v=0;v=0;this.currentLayer--){const b=this.style._layers[a[this.currentLayer]],E=c[b.source],A=d[b.source];this._renderTileClippingMasks(b,A),this.renderLayer(this,E,b,A)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerV.source&&!V.isHidden(A)?[E.sourceCaches[V.source]]:[]),G=B.filter(V=>V.getSource().type==="vector"),j=B.filter(V=>V.getSource().type!=="vector"),X=V=>{(!M||M.getSource().maxzoomX(V)),M||j.forEach(V=>X(V)),M}(this.style,this.transform.zoom);b&&function(E,A,M){for(let B=0;BG.style.map.terrain.getElevation(pe,Qe,Xe):null)}}}(b,d,v,y,v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),E),v.paint.get("icon-opacity").constantOr(1)!==0&&Wa(d,y,v,b,!1,v.paint.get("icon-translate"),v.paint.get("icon-translate-anchor"),v.layout.get("icon-rotation-alignment"),v.layout.get("icon-pitch-alignment"),v.layout.get("icon-keep-upright"),A,M),v.paint.get("text-opacity").constantOr(1)!==0&&Wa(d,y,v,b,!0,v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.layout.get("text-keep-upright"),A,M),y.map.showCollisionBoxes&&(Xs(d,y,v,b,v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),!0),Xs(d,y,v,b,v.paint.get("icon-translate"),v.paint.get("icon-translate-anchor"),!1))})(t,n,a,c,this.style.placement.variableOffsets);break;case"circle":(function(d,y,v,b){if(d.renderPass!=="translucent")return;const E=v.paint.get("circle-opacity"),A=v.paint.get("circle-stroke-width"),M=v.paint.get("circle-stroke-opacity"),B=!v.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(A.constantOr(1)===0||M.constantOr(1)===0))return;const G=d.context,j=G.gl,X=d.depthModeForSublayer(0,vt.ReadOnly),V=Yt.disabled,re=d.colorModeForRenderPass(),ce=[];for(let J=0;JJ.sortKey-ne.sortKey);for(const J of ce){const{programConfiguration:ne,program:de,layoutVertexBuffer:pe,indexBuffer:_e,uniformValues:Ie,terrainData:Te}=J.state;de.draw(G,j.TRIANGLES,X,V,re,Jt.disabled,Ie,Te,v.id,pe,_e,J.segments,v.paint,d.transform.zoom,ne)}})(t,n,a,c);break;case"heatmap":(function(d,y,v,b){if(v.paint.get("heatmap-opacity")!==0)if(d.renderPass==="offscreen"){const E=d.context,A=E.gl,M=Yt.disabled,B=new li([A.ONE,A.ONE],o.Color.transparent,[!0,!0,!0,!0]);(function(G,j,X){const V=G.gl;G.activeTexture.set(V.TEXTURE1),G.viewport.set([0,0,j.width/4,j.height/4]);let re=X.heatmapFbo;if(re)V.bindTexture(V.TEXTURE_2D,re.colorAttachment.get()),G.bindFramebuffer.set(re.framebuffer);else{const ce=V.createTexture();V.bindTexture(V.TEXTURE_2D,ce),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_WRAP_S,V.CLAMP_TO_EDGE),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_WRAP_T,V.CLAMP_TO_EDGE),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_MIN_FILTER,V.LINEAR),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_MAG_FILTER,V.LINEAR),re=X.heatmapFbo=G.createFramebuffer(j.width/4,j.height/4,!1,!1),function(J,ne,de,pe){var _e,Ie;const Te=J.gl,ke=(_e=J.HALF_FLOAT)!==null&&_e!==void 0?_e:Te.UNSIGNED_BYTE,He=(Ie=J.RGBA16F)!==null&&Ie!==void 0?Ie:Te.RGBA;Te.texImage2D(Te.TEXTURE_2D,0,He,ne.width/4,ne.height/4,0,Te.RGBA,ke,null),pe.colorAttachment.set(de)}(G,j,ce,re)}})(E,d,v),E.clear({color:o.Color.transparent});for(let G=0;G{const J=o.create();o.ortho(J,0,X.width,X.height,0,0,1);const ne=X.context.gl;return{u_matrix:J,u_world:[ne.drawingBufferWidth,ne.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:V.paint.get("heatmap-opacity")}})(E,A),null,A.id,E.viewportBuffer,E.quadTriangleIndexBuffer,E.viewportSegments,A.paint,E.transform.zoom)}(d,v))})(t,n,a,c);break;case"line":(function(d,y,v,b){if(d.renderPass!=="translucent")return;const E=v.paint.get("line-opacity"),A=v.paint.get("line-width");if(E.constantOr(1)===0||A.constantOr(1)===0)return;const M=d.depthModeForSublayer(0,vt.ReadOnly),B=d.colorModeForRenderPass(),G=v.paint.get("line-dasharray"),j=v.paint.get("line-pattern"),X=j.constantOr(1),V=v.paint.get("line-gradient"),re=v.getCrossfadeParameters(),ce=X?"linePattern":G?"lineSDF":V?"lineGradient":"line",J=d.context,ne=J.gl;let de=!0;for(const pe of b){const _e=y.getTile(pe);if(X&&!_e.patternsLoaded())continue;const Ie=_e.getBucket(v);if(!Ie)continue;const Te=Ie.programConfigurations.get(v.id),ke=d.context.program.get(),He=d.useProgram(ce,Te),mt=de||He.program!==ke,Le=d.style.map.terrain&&d.style.map.terrain.getTerrainData(pe),Qe=j.constantOr(null);if(Qe&&_e.imageAtlas){const gt=_e.imageAtlas,et=gt.patternPositions[Qe.to.toString()],_t=gt.patternPositions[Qe.from.toString()];et&&_t&&Te.setConstantPatternPositions(et,_t)}const Xe=Le?pe:null,Qt=X?Yn(d,_e,v,re,Xe):G?Lo(d,_e,v,G,re,Xe):V?Jl(d,_e,v,Ie.lineClipsArray.length,Xe):Do(d,_e,v,Xe);if(X)J.activeTexture.set(ne.TEXTURE0),_e.imageAtlasTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE),Te.updatePaintBuffers(re);else if(G&&(mt||d.lineAtlas.dirty))J.activeTexture.set(ne.TEXTURE0),d.lineAtlas.bind(J);else if(V){const gt=Ie.gradients[v.id];let et=gt.texture;if(v.gradientVersion!==gt.version){let _t=256;if(v.stepInterpolant){const si=y.getSource().maxzoom,Nt=pe.canonical.z===si?Math.ceil(1<0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new On(this.context,Fs[t],n,Tr[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Tt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class Ho{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const c=Math.pow(2,a),d=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(v=>{const b=1/(v=o.transformMat4([],v,t))[3]/n*c;return o.mul$1(v,v,[b,b,1/v[3],b])}),y=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(v=>{const b=function(B,G){var j=G[0],X=G[1],V=G[2],re=j*j+X*X+V*V;return re>0&&(re=1/Math.sqrt(re)),B[0]=G[0]*re,B[1]=G[1]*re,B[2]=G[2]*re,B}([],function(B,G,j){var X=G[0],V=G[1],re=G[2],ce=j[0],J=j[1],ne=j[2];return B[0]=V*ne-re*J,B[1]=re*ce-X*ne,B[2]=X*J-V*ce,B}([],Gt([],d[v[0]],d[v[1]]),Gt([],d[v[2]],d[v[1]]))),E=-((A=b)[0]*(M=d[v[1]])[0]+A[1]*M[1]+A[2]*M[2]);var A,M;return b.concat(E)});return new Ho(d,y)}}class Ys{constructor(t,n){this.min=t,this.max=n,this.center=function(a,c,d){return a[0]=.5*c[0],a[1]=.5*c[1],a[2]=.5*c[2],a}([],function(a,c,d){return a[0]=c[0]+d[0],a[1]=c[1]+d[1],a[2]=c[2]+d[2],a}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],a=ye(this.min),c=ye(this.max);for(let d=0;d=0&&y++;if(y===0)return 0;y!==n.length&&(a=!1)}if(a)return 2;for(let c=0;c<3;c++){let d=Number.MAX_VALUE,y=-Number.MAX_VALUE;for(let v=0;vthis.max[c]-this.min[c])return 0}return 1}}class Yo{constructor(t=0,n=0,a=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=c}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=o.interpolate.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=o.interpolate.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=o.interpolate.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=o.interpolate.number(t.right,n.right,a)),this}getCenter(t,n){const a=o.clamp((this.left+t-this.right)/2,0,t),c=o.clamp((this.top+n-this.bottom)/2,0,n);return new o.Point(a,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Yo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Jo{constructor(t,n,a,c,d){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new o.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Yo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new Jo(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-o.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new o.ARRAY_TYPE(4);return o.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,c,d){var y=c[0],v=c[1],b=c[2],E=c[3],A=Math.sin(d),M=Math.cos(d);a[0]=y*M+b*A,a[1]=v*M+E*A,a[2]=y*-A+b*M,a[3]=v*-A+E*M}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=o.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new o.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new o.Point(0,0)),c=this.pointCoordinate(new o.Point(this.width,0)),d=this.pointCoordinate(new o.Point(this.width,this.height)),y=this.pointCoordinate(new o.Point(0,this.height)),v=Math.floor(Math.min(a.x,c.x,d.x,y.x)),b=Math.floor(Math.max(a.x,c.x,d.x,y.x)),E=1;for(let A=v-E;A<=b+E;A++)A!==0&&n.push(new o.UnwrappedTileID(A,t))}return n}coveringTiles(t){var n,a;let c=this.coveringZoomLevel(t);const d=c;if(t.minzoom!==void 0&&ct.maxzoom&&(c=t.maxzoom);const y=this.pointCoordinate(this.getCameraPoint()),v=o.MercatorCoordinate.fromLngLat(this.center),b=Math.pow(2,c),E=[b*y.x,b*y.y,0],A=[b*v.x,b*v.y,0],M=Ho.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,c);let B=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(B=c);const G=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,j=J=>({aabb:new Ys([J*b,0,0],[(J+1)*b,b,0]),zoom:0,x:0,y:0,wrap:J,fullyVisible:!1}),X=[],V=[],re=c,ce=t.reparseOverscaled?d:c;if(this._renderWorldCopies)for(let J=1;J<=3;J++)X.push(j(-J)),X.push(j(J));for(X.push(j(0));X.length>0;){const J=X.pop(),ne=J.x,de=J.y;let pe=J.fullyVisible;if(!pe){const He=J.aabb.intersects(M);if(He===0)continue;pe=He===2}const _e=t.terrain?E:A,Ie=J.aabb.distanceX(_e),Te=J.aabb.distanceY(_e),ke=Math.max(Math.abs(Ie),Math.abs(Te));if(J.zoom===re||ke>G+(1<=B){const He=re-J.zoom,mt=E[0]-.5-(ne<>1),Qe=J.zoom+1;let Xe=J.aabb.quadrant(He);if(t.terrain){const Qt=new o.OverscaledTileID(Qe,J.wrap,Qe,mt,Le),gt=t.terrain.getMinMaxElevation(Qt),et=(n=gt.minElevation)!==null&&n!==void 0?n:this.elevation,_t=(a=gt.maxElevation)!==null&&a!==void 0?a:this.elevation;Xe=new Ys([Xe.min[0],Xe.min[1],et],[Xe.max[0],Xe.max[1],_t])}X.push({aabb:Xe,zoom:Qe,x:mt,y:Le,wrap:J.wrap,fullyVisible:pe})}}return V.sort((J,ne)=>J.distanceSq-ne.distanceSq).map(J=>J.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=o.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new o.Point(o.mercatorXfromLng(t.lng)*this.worldSize,o.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new o.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=t.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-a))return;const c=this.getCameraPosition(),d=o.MercatorCoordinate.fromLngLat(c.lngLat,c.altitude),y=o.MercatorCoordinate.fromLngLat(n,a),v=d.x-y.x,b=d.y-y.y,E=d.z-y.z,A=Math.sqrt(v*v+b*b+E*E),M=this.scaleZoom(this.cameraToCenterDistance/A/this.tileSize);this._elevation=a,this._center=n,this.zoom=M}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),c=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),y=new o.MercatorCoordinate(d.x-(a.x-c.x),d.y-(a.y-c.y));this.center=this.coordinateLocation(y),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return o.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const B=n.pointCoordinate(t);if(B!=null)return B}const a=[t.x,t.y,0,1],c=[t.x,t.y,1,1];o.transformMat4(a,a,this.pixelMatrixInverse),o.transformMat4(c,c,this.pixelMatrixInverse);const d=a[3],y=c[3],v=a[1]/d,b=c[1]/y,E=a[2]/d,A=c[2]/y,M=E===A?0:(0-E)/(A-E);return new o.MercatorCoordinate(o.interpolate.number(a[0]/d,c[0]/y,M)/this.worldSize,o.interpolate.number(v,b,M)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return o.transformMat4(c,c,a),new o.Point(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Zt().extend(this.pointLocation(new o.Point(0,t))).extend(this.pointLocation(new o.Point(this.width,t))).extend(this.pointLocation(new o.Point(this.width,this.height))).extend(this.pointLocation(new o.Point(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Zt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,c=n?this._alignedPosMatrixCache:this._posMatrixCache;if(c[a])return c[a];const d=t.canonical,y=this.worldSize/this.zoomScale(d.z),v=d.x+Math.pow(2,d.z)*t.wrap,b=o.identity(new Float64Array(16));return o.translate(b,b,[v*y,d.y*y,0]),o.scale(b,b,[y/o.EXTENT,y/o.EXTENT,1]),o.multiply(b,n?this.alignedProjMatrix:this.projMatrix,b),c[a]=new Float32Array(b),c[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,c,d=-90,y=90,v=-180,b=180;const E=this.size,A=this._unmodified;if(this.latRange){const G=this.latRange;d=o.mercatorYfromLat(G[1])*this.worldSize,y=o.mercatorYfromLat(G[0])*this.worldSize,t=y-dy&&(c=y-j)}if(this.lngRange){const G=(v+b)/2,j=o.wrap(M.x,G-this.worldSize/2,G+this.worldSize/2),X=E.x/2;j-Xb&&(a=b-X)}a===void 0&&c===void 0||(this.center=this.unproject(new o.Point(a!==void 0?a:M.x,c!==void 0?c:M.y)).wrap()),this._unmodified=A,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=o.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let c=o.identity(new Float64Array(16));o.scale(c,c,[this.width/2,-this.height/2,1]),o.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=o.identity(new Float64Array(16)),o.scale(c,c,[1,-1,1]),o.translate(c,c,[-1,-1,0]),o.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c;const d=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),y=Math.min(this.elevation,this._minEleveationForCurrentTile),v=d-y*this._pixelPerMeter/Math.cos(this._pitch),b=y<0?v:d,E=Math.PI/2+this._pitch,A=this._fov*(.5+t.y/this.height),M=Math.sin(A)*b/Math.sin(o.clamp(Math.PI-E-A,.01,Math.PI-.01)),B=this.getHorizon(),G=2*Math.atan(B/this.cameraToCenterDistance)*(.5+t.y/(2*B)),j=Math.sin(G)*b/Math.sin(o.clamp(Math.PI-E-G,.01,Math.PI-.01)),X=Math.min(M,j),V=1.01*(Math.cos(Math.PI/2-this._pitch)*X+b),re=this.height/50;c=new Float64Array(16),o.perspective(c,this._fov,this.width/this.height,re,V),c[8]=2*-t.x/this.width,c[9]=2*t.y/this.height,o.scale(c,c,[1,-1,1]),o.translate(c,c,[0,0,-this.cameraToCenterDistance]),o.rotateX(c,c,this._pitch),o.rotateZ(c,c,this.angle),o.translate(c,c,[-n,-a,0]),this.mercatorMatrix=o.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),o.scale(c,c,[1,1,this._pixelPerMeter]),this.pixelMatrix=o.multiply(new Float64Array(16),this.labelPlaneMatrix,c),o.translate(c,c,[0,0,-this.elevation]),this.projMatrix=c,this.invProjMatrix=o.invert([],c),this.pixelMatrix3D=o.multiply(new Float64Array(16),this.labelPlaneMatrix,c);const ce=this.width%2/2,J=this.height%2/2,ne=Math.cos(this.angle),de=Math.sin(this.angle),pe=n-Math.round(n)+ne*ce+de*J,_e=a-Math.round(a)+ne*J+de*ce,Ie=new Float64Array(c);if(o.translate(Ie,Ie,[pe>.5?pe-1:pe,_e>.5?_e-1:_e,0]),this.alignedProjMatrix=Ie,c=o.invert(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new o.Point(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return o.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.Point(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,c=n.y,d=n.x,y=n.y;for(const v of t)a=Math.min(a,v.x),c=Math.min(c,v.y),d=Math.max(d,v.x),y=Math.max(y,v.y);return[new o.Point(a,c),new o.Point(d,c),new o.Point(d,y),new o.Point(a,y),new o.Point(a,c)]}}}function Fn(u,t){let n,a=!1,c=null,d=null;const y=()=>{c=null,a&&(u.apply(d,n),c=setTimeout(y,t),a=!1)};return(...v)=>(a=!0,d=this,n=v,c||y(),c)}class ac{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let a;return n.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(a=c)}),(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(a=>isNaN(a))){const a=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:a,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,n)}catch{}},this._updateHash=Fn(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,c=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,c),y=Math.round(n.lng*d)/d,v=Math.round(n.lat*d)/d,b=this._map.getBearing(),E=this._map.getPitch();let A="";if(A+=t?`/${y}/${v}/${a}`:`${a}/${v}/${y}`,(b||E)&&(A+="/"+Math.round(10*b)/10),E&&(A+=`/${Math.round(E)}`),this._hashName){const M=this._hashName;let B=!1;const G=window.location.hash.slice(1).split("&").map(j=>{const X=j.split("=")[0];return X===M?(B=!0,`${X}=${A}`):j}).filter(j=>j);return B||G.push(`${M}=${A}`),`#${G.join("&")}`}return`#${A}`}}const Js={linearity:.3,easing:o.bezier(0,0,.3,1)},lc=o.extend({deceleration:2500,maxSpeed:1400},Js),cc=o.extend({deceleration:20,maxSpeed:1400},Js),uc=o.extend({deceleration:1e3,maxSpeed:360},Js),hc=o.extend({deceleration:1e3,maxSpeed:90},Js);class Ks{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.browser.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=o.browser.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new o.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const d=Sr(n.pan.mag(),a,o.extend({},lc,t||{}));c.offset=n.pan.mult(d.amount/n.pan.mag()),c.center=this._map.transform.center,$s(c,d)}if(n.zoom){const d=Sr(n.zoom,a,cc);c.zoom=this._map.transform.zoom+d.amount,$s(c,d)}if(n.bearing){const d=Sr(n.bearing,a,uc);c.bearing=this._map.transform.bearing+o.clamp(d.amount,-179,179),$s(c,d)}if(n.pitch){const d=Sr(n.pitch,a,hc);c.pitch=this._map.transform.pitch+d.amount,$s(c,d)}if(c.zoom||c.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;c.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),o.extend(c,{noMoveStart:!0})}}function $s(u,t){(!u.duration||u.durationn.unproject(b)),v=d.reduce((b,E,A,M)=>b.add(E.div(M.length)),new o.Point(0,0));super(t,{points:d,point:v,lngLats:y,lngLat:n.unproject(v),originalEvent:a}),this._defaultPrevented=!1}}class wn extends o.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class eo{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new wn(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ii(t.type,this._map,t))}mouseup(t){this._map.fire(new Ii(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ii(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ii(t.type,this._map,t))}mouseover(t){this._map.fire(new Ii(t.type,this._map,t))}mouseout(t){this._map.fire(new Ii(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Qs(t.type,this._map,t))}touchmove(t){this._map.fire(new Qs(t.type,this._map,t))}touchend(t){this._map.fire(new Qs(t.type,this._map,t))}touchcancel(t){this._map.fire(new Qs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bu{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ii(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ii("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ii(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class to{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(o.Point.convert(t),this._map.terrain)}}class wu{constructor(t,n){this._map=t,this._tr=new to(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(k.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)d.fitScreenCoordinates(a,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(k.remove(this._box),this._box=null),k.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new o.Event(t,{originalEvent:n}))}}function Ko(u,t){if(u.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${t.length}`);const n={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(c){const d=new o.Point(0,0);for(const y of c)d._add(y);return d.div(c.length)}(n),this.touches=Ko(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=Ko(a,n);for(const d in this.touches){const y=c[d];(!y||y.dist(this.touches[d])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class cn{constructor(t){this.singleTap=new io(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const c=this.singleTap.touchend(t,n,a);if(c){const d=t.timeStamp-this.lastTime<500,y=!this.lastTap||this.lastTap.dist(c)<30;if(d&&y||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class je{constructor(t){this._tr=new to(t),this._zoomIn=new cn({numTouches:1,numTaps:2}),this._zoomOut=new cn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const c=this._zoomIn.touchend(t,n,a),d=this._zoomOut.touchend(t,n,a),y=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:y.zoom+1,around:y.unproject(c)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:y.zoom-1,around:y.unproject(d)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bs{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=n.length?n[0]:n;return!this._moved&&c.dist(a){u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=function(t){t.preventDefault()}},$o=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new ts({checkCorrectEvent:c=>k.mouseButton(c)===0&&c.ctrlKey||k.mouseButton(c)===2});return new bs({clickTolerance:t,move:(c,d)=>({bearingDelta:(d.x-c.x)*n}),moveStateManager:a,enable:u,assignEvents:Fe})},dc=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new ts({checkCorrectEvent:c=>k.mouseButton(c)===0&&c.ctrlKey||k.mouseButton(c)===2});return new bs({clickTolerance:t,move:(c,d)=>({pitchDelta:(d.y-c.y)*n}),moveStateManager:a,enable:u,assignEvents:Fe})};class Tu{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length0&&(this._active=!0);const c=Ko(a,n),d=new o.Point(0,0),y=new o.Point(0,0);let v=0;for(const E in c){const A=c[E],M=this._touches[E];M&&(d._add(A),y._add(A.sub(M)),v++,c[E]=A)}if(this._touches=c,vMath.abs(u.x)}class tl extends no{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,oo(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,d,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,d=n.mag()>=2;if(!c&&!d)return;if(!c||!d)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const y=t.y>0==n.y>0;return oo(t)&&oo(n)&&y}}const il={panStep:100,bearingStep:15,pitchStep:10};class or{constructor(t){this._tr=new to(t);const n=il;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,c=0,d=0,y=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),y=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),y=1);break;default:return}return this._rotationDisabled&&(a=0,c=0),{cameraAnimation:v=>{const b=this._tr;v.easeTo({duration:300,easeId:"keyboardHandler",easing:Nn,zoom:n?Math.round(b.zoom)+n*(t.shiftKey?2:1):b.zoom,bearing:b.bearing+a*this._bearingStep,pitch:b.pitch+c*this._pitchStep,offset:[-d*this._panStep,-y*this._panStep],center:b.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Nn(u){return u*(2-u)}const rl=4.000244140625;class nl{constructor(t,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new to(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=o.browser.now(),c=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%rl==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=k.mousePos(this._el,t),a=this._tr;this._around=o.LngLat.convert(this._aroundCenter?a.center:a.unproject(n)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const v=this._type==="wheel"&&Math.abs(this._delta)>rl?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&b!==0&&(b=1/b);const E=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(E*b))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,c=this._easing;let d,y=!1;if(this._type==="wheel"&&a&&c){const v=Math.min((o.browser.now()-this._lastWheelEventTime)/200,1),b=c(v);d=o.interpolate.number(a,n,b),v<1?this._frameId||(this._frameId=!0):y=!0}else d=n,y=!0;return this._active=!0,y&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!y,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=o.defaultEasing;if(this._prevEase){const a=this._prevEase,c=(o.browser.now()-a.start)/a.duration,d=a.easing(c+.01)-a.easing(c),y=.27/Math.sqrt(d*d+1e-4)*.01,v=Math.sqrt(.0729-y*y);n=o.bezier(y,v,.25,1)}return this._prevEase={start:o.browser.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class sl{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ol{constructor(t){this._tr=new to(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fc{constructor(){this._tap=new cn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,a){if(!this._swipePoint)if(this._tapTime){const c=n[0],d=t.timeStamp-this._tapTime<500,y=this._tapPoint.dist(c)<30;d&&y?a.length>0&&(this._swipePoint=c,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,n,a)}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const c=n[0],d=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const c=this._tap.touchend(t,n,a);c&&(this._tapTime=t.timeStamp,this._tapPoint=c)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nr{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class $t{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Qo{constructor(t,n,a,c){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const ws=u=>u.zoom||u.drag||u.pitch||u.rotate;class mc extends o.Event{}function ea(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class gc{constructor(t,n){this.handleWindowEvent=c=>{this.handleEvent(c,`${c.type}Window`)},this.handleEvent=(c,d)=>{if(c.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const y=c.type==="renderFrame"?void 0:c,v={needsRenderFrame:!1},b={},E={},A=c.touches,M=A?this._getMapTouches(A):void 0,B=M?k.touchPos(this._el,M):k.mousePos(this._el,c);for(const{handlerName:X,handler:V,allowed:re}of this._handlers){if(!V.isEnabled())continue;let ce;this._blockedByActive(E,re,X)?V.reset():V[d||c.type]&&(ce=V[d||c.type](c,B,M),this.mergeHandlerResult(v,b,ce,X,y),ce&&ce.needsRenderFrame&&this._triggerRenderFrame()),(ce||V.isActive())&&(E[X]=V)}const G={};for(const X in this._previousActiveHandlers)E[X]||(G[X]=y);this._previousActiveHandlers=E,(Object.keys(G).length||ea(v))&&(this._changes.push([v,b,G]),this._triggerRenderFrame()),(Object.keys(E).length||ea(v))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:j}=v;j&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],j(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ks(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,d,y]of this._listeners)k.addEventListener(c,d,c===document?this.handleWindowEvent:this.handleEvent,y)}destroy(){for(const[t,n,a]of this._listeners)k.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new eo(n,t));const c=n.boxZoom=new wu(n,t);this._add("boxZoom",c),t.interactive&&t.boxZoom&&c.enable();const d=new je(n),y=new ol(n);n.doubleClickZoom=new sl(y,d),this._add("tapZoom",d),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new fc;this._add("tapDragZoom",v);const b=n.touchPitch=new tl(n);this._add("touchPitch",b),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const E=$o(t),A=dc(t);n.dragRotate=new $t(t,E,A),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",A,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const M=(({enable:re,clickTolerance:ce})=>{const J=new ts({checkCorrectEvent:ne=>k.mouseButton(ne)===0&&!ne.ctrlKey});return new bs({clickTolerance:ce,move:(ne,de)=>({around:de,panDelta:de.sub(ne)}),activateOnStart:!0,moveStateManager:J,enable:re,assignEvents:Fe})})(t),B=new Tu(t,n);n.dragPan=new Nr(a,M,B),this._add("mousePan",M),this._add("touchPan",B,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const G=new el,j=new Eu;n.touchZoomRotate=new Qo(a,j,G,v),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",j,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const X=n.scrollZoom=new nl(n,()=>this._triggerRenderFrame());this._add("scrollZoom",X,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const V=n.keyboard=new or(n);this._add("keyboard",V),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new bu(n))}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ws(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const c in t)if(c!==a&&(!n||n.indexOf(c)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(t,n,a,c,d){if(!a)return;o.extend(t,a);const y={handlerName:c,originalEvent:a.originalEvent||d};a.zoomDelta!==void 0&&(n.zoom=y),a.panDelta!==void 0&&(n.drag=y),a.pitchDelta!==void 0&&(n.pitch=y),a.bearingDelta!==void 0&&(n.rotate=y)}_applyChanges(){const t={},n={},a={};for(const[c,d,y]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new o.Point(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),o.extend(n,d),o.extend(a,y);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const c=this._map,d=c._getTransformForUpdate(),y=c.terrain;if(!(ea(t)||y&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:v,zoomDelta:b,bearingDelta:E,pitchDelta:A,around:M,pinchAround:B}=t;B!==void 0&&(M=B),c._stop(!0),M=M||c.transform.centerPoint;const G=d.pointLocation(v?M.sub(v):M);E&&(d.bearing+=E),A&&(d.pitch+=A),b&&(d.zoom+=b),y?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?d.center=d.pointLocation(d.centerPoint.sub(v)):d.setLocationAtPoint(G,M):(this._terrainMovement=!0,this._map._elevationFreeze=!0,d.setLocationAtPoint(G,M),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,d.recalculateZoom(c.terrain)})):d.setLocationAtPoint(G,M),c._applyUpdatedTransform(d),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const c=ws(this._eventsInProgress),d=ws(t),y={};for(const A in t){const{originalEvent:M}=t[A];this._eventsInProgress[A]||(y[`${A}start`]=M),this._eventsInProgress[A]=t[A]}!c&&d&&this._fireEvent("movestart",d.originalEvent);for(const A in y)this._fireEvent(A,y[A]);d&&this._fireEvent("move",d.originalEvent);for(const A in t){const{originalEvent:M}=t[A];this._fireEvent(A,M)}const v={};let b;for(const A in this._eventsInProgress){const{handlerName:M,originalEvent:B}=this._eventsInProgress[A];this._handlersById[M].isActive()||(delete this._eventsInProgress[A],b=n[M]||B,v[`${A}end`]=b)}for(const A in v)this._fireEvent(A,v[A]);const E=ws(this._eventsInProgress);if(a&&(c||d)&&!E){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=B=>B!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new mc("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Su extends o.Evented{constructor(t,n){super(),this._renderFrameCallback=()=>{const a=Math.min((o.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new o.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=o.Point.convert(t).mult(-1),this.panTo(this.transform.center,o.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(o.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(o.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(o.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,o.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(o.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing()){if(this._zooming&&(a.zoom=o.interpolate.number(c,b,pe)),this._rotating&&(a.bearing=o.interpolate.number(d,E,pe)),this._pitching&&(a.pitch=o.interpolate.number(y,A,pe)),this._padding&&(a.interpolatePadding(v,M,pe),G=a.centerPoint.add(B)),this.terrain&&!t.freezeElevation&&this._updateElevation(pe),J)a.setLocationAtPoint(J,ne);else{const _e=a.zoomScale(a.zoom-c),Ie=b>c?Math.min(2,ce):Math.max(.5,ce),Te=Math.pow(Ie,1-pe),ke=a.unproject(V.add(re.mult(pe*Te)).mult(_e));a.setLocationAtPoint(a.renderWorldCopies?ke.wrap():ke,G)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},pe=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,pe)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new o.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new o.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new o.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new o.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=o.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:a,zoom:c,pitch:d,bearing:y,elevation:v}=this.transformCameraUpdate(n);a&&(n.center=a),c!==void 0&&(n.zoom=c),d!==void 0&&(n.pitch=d),y!==void 0&&(n.bearing=y),v!==void 0&&(n.elevation=v),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new o.Event("move",t)),this._zooming&&this.fire(new o.Event("zoom",t)),this._rotating&&this.fire(new o.Event("rotate",t)),this._pitching&&this.fire(new o.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,c=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new o.Event("zoomend",t)),c&&this.fire(new o.Event("rotateend",t)),d&&this.fire(new o.Event("pitchend",t)),this.fire(new o.Event("moveend",t))}flyTo(t,n){if(!t.essential&&o.browser.prefersReducedMotion){const Xe=o.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Xe,n)}this.stop(),t=o.extend({offset:[0,0],speed:1.2,curve:1.42,easing:o.defaultEasing},t);const a=this._getTransformForUpdate(),c=this.getZoom(),d=this.getBearing(),y=this.getPitch(),v=this.getPadding(),b="zoom"in t?o.clamp(+t.zoom,a.minZoom,a.maxZoom):c,E="bearing"in t?this._normalizeBearing(t.bearing,d):d,A="pitch"in t?+t.pitch:y,M="padding"in t?t.padding:a.padding,B=a.zoomScale(b-c),G=o.Point.convert(t.offset);let j=a.centerPoint.add(G);const X=a.pointLocation(j),V=o.LngLat.convert(t.center||X);this._normalizeCenter(V);const re=a.project(X),ce=a.project(V).sub(re);let J=t.curve;const ne=Math.max(a.width,a.height),de=ne/B,pe=ce.mag();if("minZoom"in t){const Xe=o.clamp(Math.min(t.minZoom,c,b),a.minZoom,a.maxZoom),Qt=ne/a.zoomScale(Xe-c);J=Math.sqrt(Qt/pe*2)}const _e=J*J;function Ie(Xe){const Qt=(de*de-ne*ne+(Xe?-1:1)*_e*_e*pe*pe)/(2*(Xe?de:ne)*_e*pe);return Math.log(Math.sqrt(Qt*Qt+1)-Qt)}function Te(Xe){return(Math.exp(Xe)-Math.exp(-Xe))/2}function ke(Xe){return(Math.exp(Xe)+Math.exp(-Xe))/2}const He=Ie(!1);let mt=function(Xe){return ke(He)/ke(He+J*Xe)},Le=function(Xe){return ne*((ke(He)*(Te(Qt=He+J*Xe)/ke(Qt))-Te(He))/_e)/pe;var Qt},Qe=(Ie(!0)-He)/J;if(Math.abs(pe)<1e-6||!isFinite(Qe)){if(Math.abs(ne-de)<1e-6)return this.easeTo(t,n);const Xe=det.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==E,this._pitching=A!==y,this._padding=!a.isPaddingEqual(M),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(V),this._ease(Xe=>{const Qt=Xe*Qe,gt=1/mt(Qt);a.zoom=Xe===1?b:c+a.scaleZoom(gt),this._rotating&&(a.bearing=o.interpolate.number(d,E,Xe)),this._pitching&&(a.pitch=o.interpolate.number(y,A,Xe)),this._padding&&(a.interpolatePadding(v,M,Xe),j=a.centerPoint.add(G)),this.terrain&&!t.freezeElevation&&this._updateElevation(Xe);const et=Xe===1?V:a.unproject(re.add(ce.mult(Le(Qt))).mult(gt));a.setLocationAtPoint(a.renderWorldCopies?et.wrap():et,j),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=o.browser.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=o.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(o.LngLat.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class Zr{constructor(t={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=k.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=k.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=k.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){k.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.sourceCaches;for(const c in n){const d=n[c];if(d.used||d.usedForTerrain){const y=d.getSource();y.attribution&&t.indexOf(y.attribution)<0&&t.push(y.attribution)}}t=t.filter(c=>String(c).trim()),t.sort((c,d)=>c.length-d.length),t=t.filter((c,d)=>{for(let y=d+1;y=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ao{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=k.create("div","maplibregl-ctrl");const n=k.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){k.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ke{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const c of a)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const st={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var ta=o.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class al extends o.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const c of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.posMatrix=new Float64Array(16),o.ortho(c.posMatrix,0,o.EXTENT,0,o.EXTENT,0,1),this._tiles[c.key]=new Wn(c,this.tileSize));for(const c in this._tiles)a[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const c=this._tiles[a].tileID;if(c.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),o.ortho(d.posMatrix,0,o.EXTENT,0,o.EXTENT,0,1),n[a]=d}else if(c.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const y=c.canonical.z-t.canonical.z,v=c.canonical.x-(c.canonical.x>>y<>y<>y;o.ortho(d.posMatrix,0,E,0,E,0,1),o.translate(d.posMatrix,d.posMatrix,[-v*E,-b*E,0]),n[a]=d}else if(t.canonical.isChildOf(c.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const y=t.canonical.z-c.canonical.z,v=t.canonical.x-(t.canonical.x>>y<>y<>y;o.ortho(d.posMatrix,0,o.EXTENT,0,o.EXTENT,0,1),o.translate(d.posMatrix,d.posMatrix,[v*E,b*E,0]),o.scale(d.posMatrix,d.posMatrix,[1/2**y,1/2**y,0]),n[a]=d}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>a.maxzoom&&(c=a.maxzoom),c=a.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(c--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class ll{constructor(t,n,a){this.painter=t,this.sourceCache=new al(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,c=o.EXTENT){var d;if(!(n>=0&&n=0&&at.canonical.z&&(t.canonical.z>=c?d=t.canonical.z-c:o.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const y=t.canonical.x-(t.canonical.x>>d<>d<>8<<4|d>>8,n[y+3]=0;const a=new o.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new Tt(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,c=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const d=n[0]+(n[2]>>4<<8),y=n[1]+((15&n[2])<<8),v=this.coordsIndex[255-n[3]],b=v&&this.sourceCache.getTileByID(v);if(!b)return null;const E=this._coordsTextureSize,A=(1<t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const is={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class un{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new ar(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const c=t.sourceCaches[a].getVisibleCoordinates();for(const d of c){const y=this.terrain.sourceCache.getTerrainCoords(d);for(const v in y)this._coordsDescendingInv[a][v]||(this._coordsDescendingInv[a][v]=[]),this._coordsDescendingInv[a][v].push(y[v])}}this._coordsDescendingInvStr={};for(const a of t._order){const c=t._layers[a],d=c.source;if(is[c.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const y in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][y]=this._coordsDescendingInv[d][y].map(v=>v.key).sort().join()}}for(const a of this._renderableTiles)for(const c in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[c][a.tileID.key];d&&d!==a.rttCoords[c]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,c=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(is[n]&&(this._prevType&&is[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(is[this._prevType]||is[n]&&c){this._prevType=n;const d=this._stacks.length-1,y=this._stacks[d]||[];for(const v of this._renderableTiles){if(this.pool.isFull()&&(Wo(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(v),v.rtt[d]){const E=this.pool.getObjectForId(v.rtt[d].id);if(E.stamp===v.rtt[d].stamp){this.pool.useObject(E);continue}}const b=this.pool.getOrCreateFreeObject();this.pool.useObject(b),this.pool.stampObject(b),v.rtt[d]={id:b.id,stamp:b.stamp},a.context.bindFramebuffer.set(b.fbo.framebuffer),a.context.clear({color:o.Color.transparent,stencil:0}),a.currentStencilSource=void 0;for(let E=0;E{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},vi={showCompass:!0,showZoom:!0,visualizePitch:!1};class _c{constructor(t,n,a=!1){this.mousedown=y=>{this.startMouse(o.extend({},y,{ctrlKey:!0,preventDefault:()=>y.preventDefault()}),k.mousePos(this.element,y)),k.addEventListener(window,"mousemove",this.mousemove),k.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=y=>{this.moveMouse(y,k.mousePos(this.element,y))},this.mouseup=y=>{this.mouseRotate.dragEnd(y),this.mousePitch&&this.mousePitch.dragEnd(y),this.offTemp()},this.touchstart=y=>{y.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=k.touchPos(this.element,y.targetTouches)[0],this.startTouch(y,this._startPos),k.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.addEventListener(window,"touchend",this.touchend))},this.touchmove=y=>{y.targetTouches.length!==1?this.reset():(this._lastPos=k.touchPos(this.element,y.targetTouches)[0],this.moveTouch(y,this._lastPos))},this.touchend=y=>{y.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const c=t.dragRotate._mouseRotate.getClickTolerance(),d=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=$o({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:y,clickTolerance:v,bearingDegreesPerPixelMoved:b=.8})=>{const E=new $a;return new bs({clickTolerance:v,move:(A,M)=>({bearingDelta:(M.x-A.x)*b}),moveStateManager:E,enable:y,assignEvents:ni})})({clickTolerance:c,enable:!0}),this.map=t,a&&(this.mousePitch=dc({clickTolerance:d,enable:!0}),this.touchPitch=(({enable:y,clickTolerance:v,pitchDegreesPerPixelMoved:b=-.5})=>{const E=new $a;return new bs({clickTolerance:v,move:(A,M)=>({pitchDelta:(M.y-A.y)*b}),moveStateManager:E,enable:y,assignEvents:ni})})({clickTolerance:d,enable:!0})),k.addEventListener(n,"mousedown",this.mousedown),k.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),k.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),k.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),k.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:c}=this.mouseRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.mousePitch){const{pitchDelta:d}=this.mousePitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}moveTouch(t,n){const a=this.map,{bearingDelta:c}=this.touchRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.touchPitch){const{pitchDelta:d}=this.touchPitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}off(){const t=this.element;k.removeEventListener(t,"mousedown",this.mousedown),k.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend),k.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){k.enableDrag(),k.removeEventListener(window,"mousemove",this.mousemove),k.removeEventListener(window,"mouseup",this.mouseup),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend)}}let Ur;function co(u,t,n){if(u=new o.LngLat(u.lng,u.lat),t){const a=new o.LngLat(u.lng-360,u.lat),c=new o.LngLat(u.lng+360,u.lat),d=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)180;){const a=n.locationPoint(u);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;u.lng>n.center.lng?u.lng-=360:u.lng+=360}return u}const uo={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 ia(u,t,n){const a=u.classList;for(const c in uo)a.remove(`maplibregl-${n}-anchor-${c}`);a.add(`maplibregl-${n}-anchor-${t}`)}class ho extends o.Evented{constructor(t){if(super(),this._onKeyPress=n=>{const a=n.code,c=n.charCode||n.keyCode;a!=="Space"&&a!=="Enter"&&c!==32&&c!==13||this.togglePopup()},this._onMapClick=n=>{const a=n.originalEvent.target,c=this._element;this._popup&&(a===c||c.contains(a))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=co(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(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 d="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?d="rotateX(0deg)":this._pitchAlignment==="map"&&(d=`rotateX(${this._map.getPitch()}deg)`),n&&n.type!=="moveend"||(this._pos=this._pos.round()),k.setTransform(this._element,`${uo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${d} ${c}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const y=this._map.unproject(this._pos),v=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=y.distanceTo(this._lngLat)>20*v?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=n=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}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 o.Event("dragstart"))),this.fire(new o.Event("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 o.Event("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=o.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=k.create("div"),this._element.setAttribute("aria-label","Map marker");const n=k.createNS("http://www.w3.org/2000/svg","svg"),a=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${a}`);const d=k.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"stroke","none"),d.setAttributeNS(null,"stroke-width","1"),d.setAttributeNS(null,"fill","none"),d.setAttributeNS(null,"fill-rule","evenodd");const y=k.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const v=k.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"transform","translate(3.0, 29.0)"),v.setAttributeNS(null,"fill","#000000");const b=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const re of b){const ce=k.createNS("http://www.w3.org/2000/svg","ellipse");ce.setAttributeNS(null,"opacity","0.04"),ce.setAttributeNS(null,"cx","10.5"),ce.setAttributeNS(null,"cy","5.80029008"),ce.setAttributeNS(null,"rx",re.rx),ce.setAttributeNS(null,"ry",re.ry),v.appendChild(ce)}const E=k.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill",this._color);const A=k.createNS("http://www.w3.org/2000/svg","path");A.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),E.appendChild(A);const M=k.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"opacity","0.25"),M.setAttributeNS(null,"fill","#000000");const B=k.createNS("http://www.w3.org/2000/svg","path");B.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),M.appendChild(B);const G=k.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(6.0, 7.0)"),G.setAttributeNS(null,"fill","#FFFFFF");const j=k.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"transform","translate(8.0, 8.0)");const X=k.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#000000"),X.setAttributeNS(null,"opacity","0.25"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962");const V=k.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#FFFFFF"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962"),j.appendChild(X),j.appendChild(V),y.appendChild(v),y.appendChild(E),y.appendChild(M),y.appendChild(G),y.appendChild(j),n.appendChild(y),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=o.Point.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),ia(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),k.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=o.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const c=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=o.Point.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const po={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ts=0,rs=!1;const cl={maxWidth:100,unit:"metric"};function ra(u,t,n){const a=n&&n.maxWidth||100,c=u._container.clientHeight/2,d=u.unproject([0,c]),y=u.unproject([a,c]),v=d.distanceTo(y);if(n&&n.unit==="imperial"){const b=3.2808*v;b>5280?ns(t,a,b/5280,u._getUIString("ScaleControl.Miles")):ns(t,a,b,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?ns(t,a,v/1852,u._getUIString("ScaleControl.NauticalMiles")):v>=1e3?ns(t,a,v/1e3,u._getUIString("ScaleControl.Kilometers")):ns(t,a,v,u._getUIString("ScaleControl.Meters"))}function ns(u,t,n,a){const c=function(d){const y=Math.pow(10,`${Math.floor(d)}`.length-1);let v=d/y;return v=v>=10?10:v>=5?5:v>=3?3:v>=2?2:v>=1?1:function(b){const E=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*E)/E}(v),y*v}(n);u.style.width=t*(c/n)+"px",u.innerHTML=`${c} ${a}`}const ul={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},hl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function na(u){if(u){if(typeof u=="number"){const t=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.Point(0,0),top:new o.Point(0,u),"top-left":new o.Point(t,t),"top-right":new o.Point(-t,t),bottom:new o.Point(0,-u),"bottom-left":new o.Point(t,-t),"bottom-right":new o.Point(-t,-t),left:new o.Point(u,0),right:new o.Point(-u,0)}}if(u instanceof o.Point||Array.isArray(u)){const t=o.Point.convert(u);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:o.Point.convert(u.center||[0,0]),top:o.Point.convert(u.top||[0,0]),"top-left":o.Point.convert(u["top-left"]||[0,0]),"top-right":o.Point.convert(u["top-right"]||[0,0]),bottom:o.Point.convert(u.bottom||[0,0]),"bottom-left":o.Point.convert(u["bottom-left"]||[0,0]),"bottom-right":o.Point.convert(u["bottom-right"]||[0,0]),left:o.Point.convert(u.left||[0,0]),right:o.Point.convert(u.right||[0,0])}}return na(new o.Point(0,0))}const sa={extend:(u,...t)=>o.extend(u,...t),run(u){u()},logToElement(u,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`
${u}`)}},dl=U;class Lt{static get version(){return dl}static get workerCount(){return $i.workerCount}static set workerCount(t){$i.workerCount=t}static get maxParallelImageRequests(){return o.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){o.config.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return o.config.WORKER_URL}static set workerUrl(t){o.config.WORKER_URL=t}static addProtocol(t,n){o.config.REGISTERED_PROTOCOLS[t]=n}static removeProtocol(t){delete o.config.REGISTERED_PROTOCOLS[t]}}return Lt.Map=class extends Su{constructor(u){if(o.PerformanceUtils.mark(o.PerformanceMarkers.create),(u=o.extend({},lo,u)).minZoom!=null&&u.maxZoom!=null&&u.minZoom>u.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(u.minPitch!=null&&u.maxPitch!=null&&u.minPitch>u.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(u.minPitch!=null&&u.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(u.maxPitch!=null&&u.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Jo(u.minZoom,u.maxZoom,u.minPitch,u.maxPitch,u.renderWorldCopies),{bearingSnap:u.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.Event("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.Event("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=u.interactive,this._cooperativeGestures=u.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=u.maxTileCacheSize,this._maxTileCacheZoomLevels=u.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=u.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=u.preserveDrawingBuffer,this._antialias=u.antialias,this._trackResize=u.trackResize,this._bearingSnap=u.bearingSnap,this._refreshExpiredTiles=u.refreshExpiredTiles,this._fadeDuration=u.fadeDuration,this._crossSourceCollisions=u.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=u.collectResourceTiming,this._renderTaskQueue=new Ke,this._controls=[],this._mapId=o.uniqueId(),this._locale=o.extend({},st,u.locale),this._clickTolerance=u.clickTolerance,this._overridePixelRatio=u.pixelRatio,this._maxCanvasSize=u.maxCanvasSize,this.transformCameraUpdate=u.transformCameraUpdate,this._imageQueueHandle=Ee.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ae(u.transformRequest),typeof u.container=="string"){if(this._container=document.getElementById(u.container),!this._container)throw new Error(`Container '${u.container}' not found.`)}else{if(!(u.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=u.container}if(u.maxBounds&&this.setMaxBounds(u.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let t=!1;const n=Fn(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{t?n(a):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new gc(this,u),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=u.hash&&new ac(typeof u.hash=="string"&&u.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch}),u.bounds&&(this.resize(),this.fitBounds(u.bounds,o.extend({},u.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=u.localIdeographFontFamily,this._validateStyle=u.validateStyle,u.style&&this.setStyle(u.style,{localIdeographFontFamily:u.localIdeographFontFamily}),u.attributionControl&&this.addControl(new Zr({customAttribution:u.customAttribution})),u.maplibreLogo&&this.addControl(new ao,u.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new o.Event(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new o.Event(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new o.Event("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,a)}resize(u){var t;const n=this._containerDimensions(),a=n[0],c=n[1],d=this._getClampedPixelRatio(a,c);if(this._resizeCanvas(a,c,d),this.painter.resize(a,c,d),this.painter.overLimit()){const v=this.painter.context.gl;this._maxCanvasSize=[v.drawingBufferWidth,v.drawingBufferHeight];const b=this._getClampedPixelRatio(a,c);this._resizeCanvas(a,c,b),this.painter.resize(a,c,b)}this.transform.resize(a,c),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,c);const y=!this._moving;return y&&(this.stop(),this.fire(new o.Event("movestart",u)).fire(new o.Event("move",u))),this.fire(new o.Event("resize",u)),y&&this.fire(new o.Event("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:a}=this._maxCanvasSize,c=this.getPixelRatio(),d=u*c,y=t*c;return Math.min(d>n?n/d:1,y>a?a/y:1)*c}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Zt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(u){return this._cooperativeGestures=u,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(u){return this.transform.locationPoint(o.LngLat.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(o.Point.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,t,n){if(u==="mouseenter"||u==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const y=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];y.length?a||(a=!0,n.call(this,new Ii(u,this,d.originalEvent,{features:y}))):a=!1},mouseout:()=>{a=!1}}}}if(u==="mouseleave"||u==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:y=>{(this.getLayer(t)?this.queryRenderedFeatures(y.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new Ii(u,this,y.originalEvent)))},mouseout:y=>{a&&(a=!1,n.call(this,new Ii(u,this,y.originalEvent)))}}}}{const a=c=>{const d=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];d.length&&(c.features=d,n.call(this,c),delete c.features)};return{layer:t,listener:n,delegates:{[u]:a}}}}on(u,t,n){if(n===void 0)return super.on(u,t);const a=this._createDelegatedListener(u,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(a);for(const c in a.delegates)this.on(c,a.delegates[c]);return this}once(u,t,n){if(n===void 0)return super.once(u,t);const a=this._createDelegatedListener(u,t,n);for(const c in a.delegates)this.once(c,a.delegates[c]);return this}off(u,t,n){return n===void 0?super.off(u,t):(this._delegatedListeners&&this._delegatedListeners[u]&&(a=>{const c=this._delegatedListeners[u];for(let d=0;dthis._updateStyle(u,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Gi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,t,n):this.style.loadJSON(u,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Gi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,t){if(typeof u=="string"){const n=this._requestManager.transformRequest(u,Ve.Style);o.getJSON(n,(a,c)=>{a?this.fire(new o.ErrorEvent(a)):c&&this._updateDiff(c,t)})}else typeof u=="object"&&this._updateDiff(u,t)}_updateDiff(u,t){try{this.style.setState(u,t)&&this._update(!0)}catch(n){o.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(u,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.warnOnce("There is no style added to the map.")}addSource(u,t){return this._lazyInitEmptyStyle(),this.style.addSource(u,t),this._update(!0)}isSourceLoaded(u){const t=this.style&&this.style.sourceCaches[u];if(t!==void 0)return t.loaded();this.fire(new o.ErrorEvent(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const t=this.style.sourceCaches[u.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===u.source&&o.warnOnce("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 ll(this.painter,t,u),this.painter.renderToTexture=new un(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==u.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new o.Event("terrain",{terrain:u})),this}getTerrain(){var u,t;return(t=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const t in u){const n=u[t]._tiles;for(const a in n){const c=n[a];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}addSourceType(u,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(u,t,n)}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,t,n={}){const{pixelRatio:a=1,sdf:c=!1,stretchX:d,stretchY:y,content:v}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||o.isImageBitmap(t))){if(t.width===void 0||t.height===void 0)return this.fire(new o.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:b,height:E,data:A}=t,M=t;return this.style.addImage(u,{data:new o.RGBAImage({width:b,height:E},new Uint8Array(A)),pixelRatio:a,stretchX:d,stretchY:y,content:v,sdf:c,version:0,userImage:M}),M.onAdd&&M.onAdd(this,u),this}}{const{width:b,height:E,data:A}=o.browser.getImageData(t);this.style.addImage(u,{data:new o.RGBAImage({width:b,height:E},A),pixelRatio:a,stretchX:d,stretchY:y,content:v,sdf:c,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new o.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||o.isImageBitmap(t)?o.browser.getImageData(t):t,{width:c,height:d,data:y}=a;if(c===void 0||d===void 0)return this.fire(new o.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||d!==n.data.height)return this.fire(new o.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const v=!(t instanceof HTMLImageElement||o.isImageBitmap(t));return n.data.replace(y,v),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u,t){Ee.getImage(this._requestManager.transformRequest(u,Ve.Image),t)}listImages(){return this.style.listImages()}addLayer(u,t){return this._lazyInitEmptyStyle(),this.style.addLayer(u,t),this._update(!0)}moveLayer(u,t){return this.style.moveLayer(u,t),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}setLayerZoomRange(u,t,n){return this.style.setLayerZoomRange(u,t,n),this._update(!0)}setFilter(u,t,n={}){return this.style.setFilter(u,t,n),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,t,n,a={}){return this.style.setPaintProperty(u,t,n,a),this._update(!0)}getPaintProperty(u,t){return this.style.getPaintProperty(u,t)}setLayoutProperty(u,t,n,a={}){return this.style.setLayoutProperty(u,t,n,a),this._update(!0)}getLayoutProperty(u,t){return this.style.getLayoutProperty(u,t)}setGlyphs(u,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,t,n,a=>{a||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,t,n=>{n||this._update(!0)}),this}setLight(u,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(u,t){return this.style.setFeatureState(u,t),this._update()}removeFeatureState(u,t){return this.style.removeFeatureState(u,t),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,t=0;return this._container&&(u=this._container.clientWidth||400,t=this._container.clientHeight||300),[u,t]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const t=this._canvasContainer=k.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=k.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);const c=this._controlContainer=k.create("div","maplibregl-control-container",u),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(y=>{d[y]=k.create("div",`maplibregl-ctrl-${y} `,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=k.create("div","maplibregl-cooperative-gesture-screen",this._container);let u=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(u=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=` +
${u}
+
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
+ `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){k.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(u,t,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:u},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new oc(n,this.transform),W.testSupport(n)}_onCooperativeGesture(u,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,d=o.browser.now();this.style.zoomHistory.update(c,d);const y=new o.EvaluationParameters(c,{now:d,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(n=!0,this._crossFadingFactor=v),this.style.update(y)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new o.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.PerformanceUtils.mark(o.PerformanceMarkers.load),this.fire(new o.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,o.PerformanceUtils.mark(o.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ee.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),k.remove(this._canvasContainer),k.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),o.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new o.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=o.browser.frame(u=>{o.PerformanceUtils.frame(u),this._frame=null,this._render(u)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return Iu}getCameraTargetElevation(){return this.transform.elevation}},Lt.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const a=this._map._getUIString(`NavigationControl.${n}`);t.title=a,t.setAttribute("aria-label",a)},this.options=o.extend({},vi,u),this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),k.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),k.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=k.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new _c(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(u,t){const n=k.create("button",u,this._container);return n.type="button",n.addEventListener("click",t),n}},Lt.GeolocateControl=class extends o.Evented{constructor(u){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new o.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.Event("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new o.LngLat(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,c=this._map.getBearing(),d=o.extend({bearing:c},this.options.fitBoundsOptions),y=Zt.fromLngLat(n,a);this._map.fitBounds(y,d,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new o.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&rs)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.Event("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",n=>n.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",t===!1){o.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.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 ho({element:this._dotElement}),this._circleElement=k.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ho({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",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 o.Event("trackuserlocationend")))})}},this.options=o.extend({},po,u)}onAdd(u){return this._map=u,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){Ur===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{Ur=a.state!=="denied",t(Ur)}).catch(()=>{Ur=!!window.navigator.geolocation,t(Ur)}):(Ur=!!window.navigator.geolocation,t(Ur)):t(Ur)}(this._setupUI),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,Ts=0,rs=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),n=u.coords;return t&&(n.longitudet.getEast()||n.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),t=u.getSouthEast(),n=u.getNorthEast(),a=t.distanceTo(n),c=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}trigger(){if(!this._setup)return o.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ts--,rs=!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 o.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ts++,Ts>1?(u={maximumAge:6e5,timeout:0},rs=!0):(u=this.options.positionOptions,rs=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Lt.AttributionControl=Zr,Lt.LogoControl=ao,Lt.ScaleControl=class{constructor(u){this._onMove=()=>{ra(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ra(this._map,this._container,this.options)},this.options=o.extend({},cl,u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.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}},Lt.FullscreenControl=class extends o.Evented{constructor(u={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){k.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=k.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);k.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new o.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},Lt.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=u}onAdd(u){return this._map=u,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}},Lt.Popup=class extends o.Evented{constructor(u){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),delete this._map),this.fire(new o.Event("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{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(const y of this.options.className.split(" "))this._container.classList.add(y);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=co(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const n=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let a=this.options.anchor;const c=na(this.options.offset);if(!a){const y=this._container.offsetWidth,v=this._container.offsetHeight;let b;b=n.y+c.bottom.ythis._map.transform.height-v?["bottom"]:[],n.xthis._map.transform.width-y/2&&b.push("right"),a=b.length===0?"bottom":b.join("-")}const d=n.add(c[a]).round();k.setTransform(this._container,`${uo[a]} translate(${d.x}px,${d.y}px)`),ia(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=o.extend(Object.create(ul),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.LngLat.convert(u),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=u;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=k.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){this._container&&this._container.classList.add(u)}removeClassName(u){this._container&&this._container.classList.remove(u)}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}_createCloseButton(){this.options.closeButton&&(this._closeButton=k.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(hl);u&&u.focus()}},Lt.Marker=ho,Lt.Style=Gi,Lt.LngLat=o.LngLat,Lt.LngLatBounds=Zt,Lt.Point=o.Point,Lt.MercatorCoordinate=o.MercatorCoordinate,Lt.Evented=o.Evented,Lt.AJAXError=o.AJAXError,Lt.config=o.config,Lt.CanvasSource=fe,Lt.GeoJSONSource=Ei,Lt.ImageSource=Rr,Lt.RasterDEMTileSource=Xt,Lt.RasterTileSource=ut,Lt.VectorTileSource=Be,Lt.VideoSource=Oe,Lt.setRTLTextPlugin=o.setRTLTextPlugin,Lt.getRTLTextPluginStatus=o.getRTLTextPluginStatus,Lt.prewarm=function(){Dn().acquire(Pe)},Lt.clearPrewarmedResources=function(){const u=vn;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Pe),vn=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()"))},sa.extend(Lt,{isSafari:o.isSafari,getPerformanceMetrics:o.PerformanceUtils.getPerformanceMetrics}),Lt});var D=S;return D})})(pf);var a_=pf.exports;const _n=o_(a_);var l_=c_;function c_(h){var m,g,w;if(h){if(Array.isArray(h)){for(m=[],g=h.length,w=0;wg(5,w=me));let W,$={onAdd(){return W},onRemove(){var me;(me=W==null?void 0:W.parentNode)==null||me.removeChild(W)}};Ul(()=>{w==null||w.removeControl($)});function he(me){Xc[me?"unshift":"push"](()=>{W=me,g(2,W)})}return h.$$set=me=>{"defaultStyling"in me&&g(0,D=me.defaultStyling),"position"in me&&g(4,o=me.position),"class"in me&&g(1,U=me.class),"$$scope"in me&&g(6,I=me.$$scope)},h.$$.update=()=>{h.$$.dirty&52&&w&&W&&w.addControl($,o)},[D,U,W,k,o,w,I,S,he]}class d_ extends tn{constructor(m){super(),en(this,m,h_,u_,Gr,{defaultStyling:0,position:4,class:1})}}function p_(h){let m,g,w,S,I,D;const o=h[4].default,U=ka(o,h,h[3],null);return{c(){m=yn("button"),g=yn("div"),U&&U.c(),Ct(g,"class",w=Zc(h[2])+" svelte-1s83zbq"),Rs(g,"maplibregl-ctrl-icon",h[0]),Rs(g,"ctrl-btn-center",h[1]),Ct(m,"type","button")},m(k,W){Rt(k,m,W),$r(m,g),U&&U.m(g,null),S=!0,I||(D=Ds(m,"click",h[5]),I=!0)},p(k,[W]){U&&U.p&&(!S||W&8)&&Pa(U,o,k,k[3],S?Ma(o,k[3],W,null):za(k[3]),null),(!S||W&4&&w!==(w=Zc(k[2])+" svelte-1s83zbq"))&&Ct(g,"class",w),(!S||W&5)&&Rs(g,"maplibregl-ctrl-icon",k[0]),(!S||W&6)&&Rs(g,"ctrl-btn-center",k[1])},i(k){S||(St(U,k),S=!0)},o(k){Ot(U,k),S=!1},d(k){k&&zt(m),U&&U.d(k),I=!1,D()}}}function f_(h,m,g){let{$$slots:w={},$$scope:S}=m,{icon:I=!0}=m,{center:D=!0}=m,{class:o=void 0}=m;function U(k){Yg.call(this,h,k)}return h.$$set=k=>{"icon"in k&&g(0,I=k.icon),"center"in k&&g(1,D=k.center),"class"in k&&g(2,o=k.class),"$$scope"in k&&g(3,S=k.$$scope)},[I,D,o,S,w,U]}class yh extends tn{constructor(m){super(),en(this,m,f_,p_,Gr,{icon:0,center:1,class:2})}}function m_(h){let m,g,w;const S=h[2].default,I=ka(S,h,h[1],null);return{c(){m=yn("div"),I&&I.c(),Ct(m,"class",g="maplibregl-ctrl-group "+h[0])},m(D,o){Rt(D,m,o),I&&I.m(m,null),w=!0},p(D,[o]){I&&I.p&&(!w||o&2)&&Pa(I,S,D,D[1],w?Ma(S,D[1],o,null):za(D[1]),null),(!w||o&1&&g!==(g="maplibregl-ctrl-group "+D[0]))&&Ct(m,"class",g)},i(D){w||(St(I,D),w=!0)},o(D){Ot(I,D),w=!1},d(D){D&&zt(m),I&&I.d(D)}}}function g_(h,m,g){let{$$slots:w={},$$scope:S}=m,{class:I=""}=m;return h.$$set=D=>{"class"in D&&g(0,I=D.class),"$$scope"in D&&g(1,S=D.$$scope)},[I,S,w]}class __ extends tn{constructor(m){super(),en(this,m,g_,m_,Gr,{class:0})}}function y_(h,m,g){let w;const{map:S}=To();gr(h,S,U=>g(4,w=U));let{position:I="top-left"}=m,{container:D=void 0}=m,o=null;return Ul(()=>{w!=null&&w.loaded()&&o&&w.removeControl(o)}),h.$$set=U=>{"position"in U&&g(1,I=U.position),"container"in U&&g(2,D=U.container)},h.$$.update=()=>{if(h.$$.dirty&30&&w&&!o){let U;typeof D=="string"?U=document.querySelector(D)??void 0:U=D,g(3,o=new _n.FullscreenControl({container:U})),w.addControl(o,I)}},[S,I,D,o,w]}class v_ extends tn{constructor(m){super(),en(this,m,y_,null,Gr,{position:1,container:2})}}function x_(h,m,g){let w;const{map:S}=To();gr(h,S,he=>g(8,w=he));let{position:I="top-left"}=m,{positionOptions:D=void 0}=m,{fitBoundsOptions:o=void 0}=m,{trackUserLocation:U=!1}=m,{showAccuracyCircle:k=!0}=m,{showUserLocation:W=!0}=m,$=null;return Ul(()=>{w!=null&&w.loaded()&&$&&w.removeControl($)}),h.$$set=he=>{"position"in he&&g(1,I=he.position),"positionOptions"in he&&g(2,D=he.positionOptions),"fitBoundsOptions"in he&&g(3,o=he.fitBoundsOptions),"trackUserLocation"in he&&g(4,U=he.trackUserLocation),"showAccuracyCircle"in he&&g(5,k=he.showAccuracyCircle),"showUserLocation"in he&&g(6,W=he.showUserLocation)},h.$$.update=()=>{h.$$.dirty&510&&w&&!$&&(g(7,$=new _n.GeolocateControl({positionOptions:D,fitBoundsOptions:o,trackUserLocation:U,showAccuracyCircle:k,showUserLocation:W})),w.addControl($,I))},[S,I,D,o,U,k,W,$,w]}class b_ extends tn{constructor(m){super(),en(this,m,x_,null,Gr,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function w_(h){let m=h.getCenter(),g=Math.round(h.getZoom()*100)/100,w=Math.ceil((g*Math.LN2+Math.log(512/360/.5))/Math.LN10),S=Math.pow(10,w),I=Math.round(m.lat*S)/S,D=Math.round(m.lng*S)/S,o=`${g}/${I}/${D}`,U=h.getBearing(),k=h.getPitch();return(U||k)&&(o+=`/${Math.round(U*10)/10}`),k&&(o+=`/${Math.round(k)}`),`#${o}`}function T_(h){return h.replace("#","").split("/").map(parseFloat)}var Nc=Bh;function Bh(h,m){return h===m||h!==h&&m!==m?!0:typeof h!=typeof m||{}.toString.call(h)!={}.toString.call(m)||h!==Object(h)||!h?!1:Array.isArray(h)?Ip(h,m):{}.toString.call(h)=="[object Set]"?Ip(Array.from(h),Array.from(m)):{}.toString.call(h)=="[object Object]"?S_(h,m):E_(h,m)}function E_(h,m){return h.toString()===m.toString()}function Ip(h,m){var g=h.length;if(g!=m.length)return!1;for(var w=0;wg(6,w=W));let{position:I="top-left"}=m,{showCompass:D=!0}=m,{showZoom:o=!0}=m,{visualizePitch:U=!1}=m,k=null;return Ul(()=>{w!=null&&w.loaded()&&k&&w.removeControl(k)}),h.$$set=W=>{"position"in W&&g(1,I=W.position),"showCompass"in W&&g(2,D=W.showCompass),"showZoom"in W&&g(3,o=W.showZoom),"visualizePitch"in W&&g(4,U=W.visualizePitch)},h.$$.update=()=>{h.$$.dirty&126&&w&&!k&&(g(5,k=new _n.NavigationControl({showCompass:D,showZoom:o,visualizePitch:U})),w.addControl(k,I))},[S,I,D,o,U,k,w]}class mf extends tn{constructor(m){super(),en(this,m,I_,null,Gr,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function A_(h,m,g){let w;const{map:S}=To();gr(h,S,k=>g(5,w=k));let{position:I="bottom-left"}=m,{maxWidth:D=void 0}=m,{unit:o="metric"}=m,U=null;return Ul(()=>{w!=null&&w.loaded()&&U&&w.removeControl(U)}),h.$$set=k=>{"position"in k&&g(1,I=k.position),"maxWidth"in k&&g(2,D=k.maxWidth),"unit"in k&&g(3,o=k.unit)},h.$$.update=()=>{h.$$.dirty&62&&w&&!U&&(g(4,U=new _n.ScaleControl({maxWidth:D,unit:o})),w.addControl(U,I))},[S,I,D,o,U,w]}class C_ extends tn{constructor(m){super(),en(this,m,A_,null,Gr,{position:1,maxWidth:2,unit:3})}}const k_=h=>({map:h[0]&8,loadedImages:h[0]&16,allImagesLoaded:h[0]&32}),Ap=h=>({map:h[3],loadedImages:h[4],allImagesLoaded:h[5]});function Cp(h){let m,g,w=h[2]&&kp(h);const S=h[33].default,I=ka(S,h,h[32],Ap);return{c(){w&&w.c(),m=qr(),I&&I.c()},m(D,o){w&&w.m(D,o),Rt(D,m,o),I&&I.m(D,o),g=!0},p(D,o){D[2]?w?(w.p(D,o),o[0]&4&&St(w,1)):(w=kp(D),w.c(),St(w,1),w.m(m.parentNode,m)):w&&(Da(),Ot(w,1,1,()=>{w=null}),La()),I&&I.p&&(!g||o[0]&56|o[1]&2)&&Pa(I,S,D,D[32],g?Ma(S,D[32],o,k_):za(D[32]),Ap)},i(D){g||(St(w),St(I,D),g=!0)},o(D){Ot(w),Ot(I,D),g=!1},d(D){D&&zt(m),w&&w.d(D),I&&I.d(D)}}}function kp(h){let m,g,w,S,I,D,o,U;return m=new mf({props:{position:h[6]}}),w=new b_({props:{position:h[6],fitBoundsOptions:{maxZoom:12}}}),I=new v_({props:{position:h[6]}}),o=new C_({props:{position:h[6]}}),{c(){Lr(m.$$.fragment),g=qr(),Lr(w.$$.fragment),S=qr(),Lr(I.$$.fragment),D=qr(),Lr(o.$$.fragment)},m(k,W){_r(m,k,W),Rt(k,g,W),_r(w,k,W),Rt(k,S,W),_r(I,k,W),Rt(k,D,W),_r(o,k,W),U=!0},p(k,W){const $={};W[0]&64&&($.position=k[6]),m.$set($);const he={};W[0]&64&&(he.position=k[6]),w.$set(he);const me={};W[0]&64&&(me.position=k[6]),I.$set(me);const ge={};W[0]&64&&(ge.position=k[6]),o.$set(ge)},i(k){U||(St(m.$$.fragment,k),St(w.$$.fragment,k),St(I.$$.fragment,k),St(o.$$.fragment,k),U=!0)},o(k){Ot(m.$$.fragment,k),Ot(w.$$.fragment,k),Ot(I.$$.fragment,k),Ot(o.$$.fragment,k),U=!1},d(k){k&&(zt(g),zt(S),zt(D)),yr(m,k),yr(w,k),yr(I,k),yr(o,k)}}}function M_(h){let m,g,w,S,I,D=h[3]&&h[0]&&Cp(h);return{c(){m=yn("div"),D&&D.c(),Ct(m,"class",g=Zc(h[1])+" svelte-p00lfq"),Rs(m,"expand-map",!h[1])},m(o,U){Rt(o,m,U),D&&D.m(m,null),w=!0,S||(I=xh(h[9].call(null,m)),S=!0)},p(o,U){o[3]&&o[0]?D?(D.p(o,U),U[0]&9&&St(D,1)):(D=Cp(o),D.c(),St(D,1),D.m(m,null)):D&&(Da(),Ot(D,1,1,()=>{D=null}),La()),(!w||U[0]&2&&g!==(g=Zc(o[1])+" svelte-p00lfq"))&&Ct(m,"class",g),(!w||U[0]&2)&&Rs(m,"expand-map",!o[1])},i(o){w||(St(D),w=!0)},o(o){Ot(D),w=!1},d(o){o&&zt(m),D&&D.d(),S=!1,I()}}}function P_(h,m,g){let w,S,I,D,{$$slots:o={},$$scope:U}=m,{map:k=null}=m,{class:W=void 0}=m,{style:$}=m,{diffStyleUpdates:he=!1}=m,{center:me=void 0}=m,{zoom:ge=void 0}=m,{pitch:Ze=0}=m,{bearing:Ee=0}=m,{bounds:Ve=void 0}=m,{hash:Ae=!1}=m,{loaded:Se=!1}=m,{minZoom:ye=0}=m,{maxZoom:qe=22}=m,{zoomOnDoubleClick:Gt=!0}=m,{interactive:wt=!0}=m,{attributionControl:ti=!0}=m,{preserveDrawingBuffer:ft=!1}=m,{maxBounds:Tt=void 0}=m,{images:Ki=[]}=m,{standardControls:rt=!1}=m,{filterLayers:ii=void 0}=m,{transformRequest:Mi=void 0}=m;const Ht=cf(),{map:xt,loadedImages:Vi}=r_();gr(h,xt,Be=>g(3,I=Be)),gr(h,Vi,Be=>g(4,D=Be));let wi=new Set;function nn(Be){I!=null&&I.loaded()&&("url"in Be?(wi.add(Be.id),I.loadImage(Be.url,(ut,Xt)=>{wi.delete(Be.id),ut?Ht("error",ut):Xt&&(I==null||I.addImage(Be.id,Xt,Be.options),D.add(Be.id),Vi.set(D))})):(I.addImage(Be.id,Be.data,Be.options),D.add(Be.id),Vi.set(D)))}let Ti,hi,di,ri;function Zt(Be){if(Ae){let ut=T_(window.location.hash);ut.length>=3&&(g(11,ge=ut[0]),g(10,me=[ut[2],ut[1]])),ut.length==5&&(g(15,Ee=ut[3]),g(14,Ze=ut[4]))}return Ll(xt,I=new _n.Map(l_({container:Be,style:$,center:me,zoom:ge,pitch:Ze,bearing:Ee,minZoom:ye,maxZoom:qe,interactive:wt,preserveDrawingBuffer:ft,maxBounds:Tt,bounds:Ve,attributionControl:ti,transformRequest:Mi})),I),I.on("load",ut=>{g(0,Se=!0),Ht("load",I)}),I.on("error",ut=>Ht("error",{...ut,map:I})),I.on("movestart",ut=>Ht("movestart",{...ut,map:I})),I.on("moveend",ut=>{if(g(10,me=ut.target.getCenter()),g(11,ge=ut.target.getZoom()),g(12,Ve=ut.target.getBounds()),Ht("moveend",{...ut,map:I}),Ae){let Xt=window.location.href.replace(/(#.+)?$/,w_(I));window.history.replaceState(window.history.state,"",Xt)}}),I.on("zoomstart",ut=>Ht("zoomstart",{...ut,map:I})),I.on("zoom",ut=>{g(11,ge=ut.target.getZoom()),Ht("zoom",{...ut,map:I})}),I.on("zoomend",ut=>{g(11,ge=ut.target.getZoom()),Ht("zoomend",{...ut,map:I})}),I.on("style.load",()=>{if(I){const ut=I.getStyle();if(g(29,Ti=ut.layers.map(Xt=>Xt.id)),g(30,hi=Object.keys(ut.sources)),ri)for(const[Xt,Ei]of Object.entries(ri))I.addSource(Xt,Ei);if(di)for(const Xt of di)I.addLayer(Xt)}}),I.on("styledata",ut=>{if(I&&ii){const Xt=I.getStyle().layers;if(Xt)for(let Ei of Xt)ii(Ei)||I.setLayoutProperty(Ei.id,"visibility","none")}Ht("styledata",{...ut,map:I})}),{destroy(){g(0,Se=!1),I==null||I.remove(),Ll(xt,I=null,I)}}}let ir=$;return h.$$set=Be=>{"map"in Be&&g(13,k=Be.map),"class"in Be&&g(1,W=Be.class),"style"in Be&&g(16,$=Be.style),"diffStyleUpdates"in Be&&g(17,he=Be.diffStyleUpdates),"center"in Be&&g(10,me=Be.center),"zoom"in Be&&g(11,ge=Be.zoom),"pitch"in Be&&g(14,Ze=Be.pitch),"bearing"in Be&&g(15,Ee=Be.bearing),"bounds"in Be&&g(12,Ve=Be.bounds),"hash"in Be&&g(18,Ae=Be.hash),"loaded"in Be&&g(0,Se=Be.loaded),"minZoom"in Be&&g(19,ye=Be.minZoom),"maxZoom"in Be&&g(20,qe=Be.maxZoom),"zoomOnDoubleClick"in Be&&g(21,Gt=Be.zoomOnDoubleClick),"interactive"in Be&&g(22,wt=Be.interactive),"attributionControl"in Be&&g(23,ti=Be.attributionControl),"preserveDrawingBuffer"in Be&&g(24,ft=Be.preserveDrawingBuffer),"maxBounds"in Be&&g(25,Tt=Be.maxBounds),"images"in Be&&g(26,Ki=Be.images),"standardControls"in Be&&g(2,rt=Be.standardControls),"filterLayers"in Be&&g(27,ii=Be.filterLayers),"transformRequest"in Be&&g(28,Mi=Be.transformRequest),"$$scope"in Be&&g(32,U=Be.$$scope)},h.$$.update=()=>{if(h.$$.dirty[0]&4&&g(6,w=typeof rt=="boolean"?void 0:rt),h.$$.dirty[0]&8&&g(13,k=I),h.$$.dirty[0]&67108873&&Se&&I!=null&&I.loaded())for(let Be of Ki)!wi.has(Be.id)&&!I.hasImage(Be.id)&&nn(Be);if(h.$$.dirty[0]&67108880&&g(5,S=Ki.every(Be=>D.has(Be.id))),h.$$.dirty[0]&1610809352|h.$$.dirty[1]&1&&I&&!Nc($,ir)){const Be=I.getStyle();if(Ti&&(di=Be.layers.filter(ut=>!Ti.includes(ut.id))),hi){const ut=Object.keys(Be.sources).filter(Xt=>!hi.includes(Xt));ri={};for(const Xt of ut)ri[Xt]=Be.sources[Xt]}g(31,ir=$),I.setStyle($,{diff:he})}h.$$.dirty[0]&1032&&me&&!Nc(me,I==null?void 0:I.getCenter())&&(I==null||I.panTo(me)),h.$$.dirty[0]&2056&&ge&&!Nc(ge,I==null?void 0:I.getZoom())&&(I==null||I.zoomTo(ge)),h.$$.dirty[0]&4104&&Ve&&!Nc(Ve,I==null?void 0:I.getBounds())&&(I==null||I.fitBounds(Ve)),h.$$.dirty[0]&2097160&&(Gt?I==null||I.doubleClickZoom.enable():I==null||I.doubleClickZoom.disable())},[Se,W,rt,I,D,S,w,xt,Vi,Zt,me,ge,Ve,k,Ze,Ee,$,he,Ae,ye,qe,Gt,wt,ti,ft,Tt,Ki,ii,Mi,Ti,hi,ir,U,o]}class z_ extends tn{constructor(m){super(),en(this,m,P_,M_,Gr,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,interactive:22,attributionControl:23,preserveDrawingBuffer:24,maxBounds:25,images:26,standardControls:2,filterLayers:27,transformRequest:28},null,[-1,-1])}}function D_(h){let m,g,w,S,I,D,o;const U=h[14].default,k=ka(U,h,h[13],null);return{c(){m=yn("div"),k&&k.c(),Ct(m,"tabindex",g=h[1]?0:void 0),Ct(m,"role",w=h[1]?"button":void 0)},m(W,$){Rt(W,m,$),k&&k.m(m,null),I=!0,D||(o=[xh(h[5].call(null,m)),xh(S=L_.call(null,m,h[0])),Ds(m,"click",h[15]),Ds(m,"dblclick",h[16]),Ds(m,"contextmenu",h[17]),Ds(m,"mouseenter",h[18]),Ds(m,"mouseleave",h[19]),Ds(m,"mousemove",h[20]),Ds(m,"keydown",h[6])],D=!0)},p(W,[$]){k&&k.p&&(!I||$&8192)&&Pa(k,U,W,W[13],I?Ma(U,W[13],$,null):za(W[13]),null),(!I||$&2&&g!==(g=W[1]?0:void 0))&&Ct(m,"tabindex",g),(!I||$&2&&w!==(w=W[1]?"button":void 0))&&Ct(m,"role",w),S&&Fl(S.update)&&$&1&&S.update.call(null,W[0])},i(W){I||(St(k,W),I=!0)},o(W){Ot(k,W),I=!1},d(W){W&&zt(m),k&&k.d(W),D=!1,wo(o)}}}function L_(h,m){const g=h.className;function w(S){S?h.className=`${g} ${S}`:h.className=g}return w(m),{update:w}}function R_(h,m,g){let w,S,I,{$$slots:D={},$$scope:o}=m,{lngLat:U}=m,{class:k=void 0}=m,{interactive:W=!0}=m,{draggable:$=!1}=m,{feature:he=null}=m,{offset:me=void 0}=m;const ge=cf(),{map:Ze,layerEvent:Ee,self:Ve}=s_();gr(h,Ze,rt=>g(22,I=rt)),gr(h,Ee,rt=>g(21,w=rt)),gr(h,Ve,rt=>g(12,S=rt));function Ae(rt){Ll(Ve,S=new _n.Marker({element:rt,draggable:$,offset:me}).setLngLat(U).addTo(I),S);const ii=()=>qe("dragstart"),Mi=()=>{Se(),qe("drag")},Ht=()=>{Se(),qe("dragend")};return $&&(S.on("dragstart",ii),S.on("drag",Mi),S.on("dragend",Ht)),{destroy(){$&&(S==null||S.off("dragstart",ii),S==null||S.off("drag",Mi),S==null||S.off("dragend",Ht)),S==null||S.remove()}}}function Se(){let rt=S==null?void 0:S.getLngLat();rt&&(Array.isArray(U)?g(8,U=[rt.lng,rt.lat]):U&&"lon"in U?g(8,U={lon:rt.lng,lat:rt.lat}):g(8,U=rt))}function ye(rt){rt.key===" "&&(rt.preventDefault(),rt.stopPropagation(),qe("click"))}function qe(rt){let ii=S==null?void 0:S.getLngLat();if(!ii)return;const Mi=[ii.lng,ii.lat];let Ht={map:I,marker:S,lngLat:Mi,features:[{type:"Feature",properties:(he==null?void 0:he.properties)??{},geometry:{type:"Point",coordinates:Mi}}]};Ll(Ee,w={...Ht,layerType:"marker",type:rt},w),ge(rt,Ht)}const Gt=()=>qe("click"),wt=()=>qe("dblclick"),ti=()=>qe("contextmenu"),ft=rt=>{qe("mouseenter")},Tt=()=>{qe("mouseleave")},Ki=()=>qe("mousemove");return h.$$set=rt=>{"lngLat"in rt&&g(8,U=rt.lngLat),"class"in rt&&g(0,k=rt.class),"interactive"in rt&&g(1,W=rt.interactive),"draggable"in rt&&g(9,$=rt.draggable),"feature"in rt&&g(10,he=rt.feature),"offset"in rt&&g(11,me=rt.offset),"$$scope"in rt&&g(13,o=rt.$$scope)},h.$$.update=()=>{h.$$.dirty&4352&&(S==null||S.setLngLat(U)),h.$$.dirty&6144&&(S==null||S.setOffset(me??[0,0]))},[k,W,Ze,Ee,Ve,Ae,ye,qe,U,$,he,me,S,o,D,Gt,wt,ti,ft,Tt,Ki]}class B_ extends tn{constructor(m){super(),en(this,m,R_,D_,Gr,{lngLat:8,class:0,interactive:1,draggable:9,feature:10,offset:11})}}var Vl=Uint8Array,gf=Uint16Array,O_=Int32Array,F_=new Vl([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),N_=new Vl([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_f=function(h,m){for(var g=new gf(31),w=0;w<31;++w)g[w]=m+=1<>1|(qt&21845)<<1,hs=(hs&52428)>>2|(hs&13107)<<2,hs=(hs&61680)>>4|(hs&3855)<<4,j_[qt]=((hs&65280)>>8|(hs&255)<<8)>>1;var hs,qt,eu=new Vl(288);for(qt=0;qt<144;++qt)eu[qt]=8;var qt;for(qt=144;qt<256;++qt)eu[qt]=9;var qt;for(qt=256;qt<280;++qt)eu[qt]=7;var qt;for(qt=280;qt<288;++qt)eu[qt]=8;var qt,q_=new Vl(32);for(qt=0;qt<32;++qt)q_[qt]=5;var qt,G_=new Vl(0),Z_=typeof TextDecoder<"u"&&new TextDecoder,X_=0;try{Z_.decode(G_,{stream:!0}),X_=1}catch{}const W_=h=>({features:h[0]&16,data:h[0]&16,map:h[0]&4,close:h[0]&1}),Mp=h=>{var m;return{features:h[4],data:(m=h[4])==null?void 0:m[0],map:h[2],close:h[31]}};function Pp(h){let m,g,w=(h[4]||h[3]instanceof _n.Marker)&&zp(h);return{c(){m=yn("div"),w&&w.c()},m(S,I){Rt(S,m,I),w&&w.m(m,null),h[32](m),g=!0},p(S,I){S[4]||S[3]instanceof _n.Marker?w?(w.p(S,I),I[0]&24&&St(w,1)):(w=zp(S),w.c(),St(w,1),w.m(m,null)):w&&(Da(),Ot(w,1,1,()=>{w=null}),La())},i(S){g||(St(w),g=!0)},o(S){Ot(w),g=!1},d(S){S&&zt(m),w&&w.d(),h[32](null)}}}function zp(h){let m;const g=h[30].default,w=ka(g,h,h[29],Mp);return{c(){w&&w.c()},m(S,I){w&&w.m(S,I),m=!0},p(S,I){w&&w.p&&(!m||I[0]&536870933)&&Pa(w,g,S,S[29],m?Ma(g,S[29],I,W_):za(S[29]),Mp)},i(S){m||(St(w,S),m=!0)},o(S){Ot(w,S),m=!1},d(S){w&&w.d(S)}}}function H_(h){let m,g,w=h[9].default&&Pp(h);return{c(){w&&w.c(),m=zh()},m(S,I){w&&w.m(S,I),Rt(S,m,I),g=!0},p(S,I){S[9].default?w?(w.p(S,I),I[0]&512&&St(w,1)):(w=Pp(S),w.c(),St(w,1),w.m(m.parentNode,m)):w&&(Da(),Ot(w,1,1,()=>{w=null}),La())},i(S){g||(St(w),g=!0)},o(S){Ot(w),g=!1},d(S){S&&zt(m),w&&w.d(S)}}}function Y_(h,m,g){let w,S,I,D,o,U,{$$slots:k={},$$scope:W}=m;const $=Gg(k);let{closeButton:he=void 0}=m,{closeOnClickOutside:me=!0}=m,{closeOnClickInside:ge=!1}=m,{closeOnMove:Ze=!1}=m,{openOn:Ee="click"}=m,{openIfTopMost:Ve=!0}=m,{focusAfterOpen:Ae=!0}=m,{anchor:Se=void 0}=m,{offset:ye=void 0}=m,{popupClass:qe=void 0}=m,{maxWidth:Gt=void 0}=m,{lngLat:wt=void 0}=m,{html:ti=void 0}=m,{open:ft=!1}=m;const{map:Tt,popupTarget:Ki,layerEvent:rt,layer:ii,eventTopMost:Mi}=To();gr(h,Tt,Oe=>g(2,I=Oe)),gr(h,Ki,Oe=>g(3,o=Oe)),gr(h,rt,Oe=>g(28,D=Oe)),gr(h,ii,Oe=>g(35,U=Oe));const Ht=["click","dblclick","contextmenu"];let xt,Vi=!1,wi;function nn(){if(!xt)return;let Oe=xt.getElement();!Oe||Oe===wi||(wi=Oe,Ee==="hover"&&(wi.style.pointerEvents="none"),wi.addEventListener("mouseenter",()=>{g(24,Vi=!0)},{passive:!0}),wi.addEventListener("mouseleave",()=>{g(24,Vi=!1)},{passive:!0}),wi.addEventListener("click",()=>{ge&&g(0,ft=!1)},{passive:!0}))}Hg(()=>{if(I)return I.on("click",Xt),typeof o=="string"&&(I.on("click",o,di),I.on("dblclick",o,di),I.on("contextmenu",o,di),I.on("mousemove",o,ut),I.on("mouseleave",o,Be),I.on("touchstart",o,Zt),I.on("touchend",o,ir)),()=>{I!=null&&I.loaded()&&(xt==null||xt.remove(),I.off("click",Xt),o instanceof _n.Marker?o.getPopup()===xt&&o.setPopup(void 0):typeof o=="string"&&(I.off("click",o,di),I.off("dblclick",o,di),I.off("contextmenu",o,di),I.off("mousemove",o,ut),I.off("mouseleave",o,Be),I.off("touchstart",o,Zt),I.off("touchend",o,ir)))}});let Ti=null,hi="normal";function di(Oe){Oe.type===Ee&&(Ve&&Mi(Oe)!==U||("layerType"in Oe?Oe.layerType==="deckgl"?(g(10,wt=Oe.coordinate),g(4,Ti=Oe.object?[Oe.object]:null)):(g(10,wt=Oe.lngLat),g(4,Ti=Oe.features??[])):(g(10,wt=Oe.lngLat),g(4,Ti=Oe.features??[])),setTimeout(()=>g(0,ft=!0))))}let ri=null;function Zt(Oe){ri=Oe.point}function ir(Oe){if(!ri||Ee!=="hover")return;let fe=ri.dist(Oe.point);ri=null,fe<3&&(g(10,wt=Oe.lngLat),g(4,Ti=Oe.features??[]),xt.isOpen()?g(25,hi="justOpened"):(g(25,hi="opening"),g(0,ft=!0)))}function Be(Oe){Ee!=="hover"||ri||hi!=="normal"||(g(0,ft=!1),g(4,Ti=null))}function ut(Oe){if(!(Ee!=="hover"||ri||hi!=="normal")){if(Ve&&Mi(Oe)!==U){g(0,ft=!1),g(4,Ti=null);return}g(0,ft=!0),g(4,Ti=Oe.features??[]),g(10,wt=Oe.lngLat)}}function Xt(Oe){if(hi==="justOpened"){g(25,hi="normal");return}if(!me)return;let fe=[wi,o instanceof _n.Marker?o==null?void 0:o.getElement():null];ft&&xt.isOpen()&&!fe.some(xr=>xr==null?void 0:xr.contains(Oe.originalEvent.target))&&g(0,ft=!1)}let Ei;const rr=()=>g(0,ft=!1);function Rr(Oe){Xc[Oe?"unshift":"push"](()=>{Ei=Oe,g(1,Ei)})}return h.$$set=Oe=>{"closeButton"in Oe&&g(11,he=Oe.closeButton),"closeOnClickOutside"in Oe&&g(12,me=Oe.closeOnClickOutside),"closeOnClickInside"in Oe&&g(13,ge=Oe.closeOnClickInside),"closeOnMove"in Oe&&g(14,Ze=Oe.closeOnMove),"openOn"in Oe&&g(15,Ee=Oe.openOn),"openIfTopMost"in Oe&&g(16,Ve=Oe.openIfTopMost),"focusAfterOpen"in Oe&&g(17,Ae=Oe.focusAfterOpen),"anchor"in Oe&&g(18,Se=Oe.anchor),"offset"in Oe&&g(19,ye=Oe.offset),"popupClass"in Oe&&g(20,qe=Oe.popupClass),"maxWidth"in Oe&&g(21,Gt=Oe.maxWidth),"lngLat"in Oe&&g(10,wt=Oe.lngLat),"html"in Oe&&g(22,ti=Oe.html),"open"in Oe&&g(0,ft=Oe.open),"$$scope"in Oe&&g(29,W=Oe.$$scope)},h.$$.update=()=>{if(h.$$.dirty[0]&14336&&g(27,w=he??(!me&&!ge)),h.$$.dirty[0]&146685952&&(xt||(g(23,xt=new _n.Popup({closeButton:w,closeOnClick:!1,closeOnMove:Ze,focusAfterOpen:Ae,maxWidth:Gt,className:qe,anchor:Se,offset:ye})),wi=xt.getElement(),xt.on("open",()=>{g(0,ft=!0),nn()}),xt.on("close",Oe=>{g(0,ft=!1)}))),h.$$.dirty[0]&8421384&&xt&&o instanceof _n.Marker&&(Ee==="click"?o.setPopup(xt):o.getPopup()===xt&&o.setPopup(void 0)),h.$$.dirty[0]&268468224&&Ht.includes(Ee)&&(D==null?void 0:D.type)===Ee&&(di(D),Ll(rt,D=null,D)),h.$$.dirty[0]&268468224&&g(26,S=Ee==="hover"&&((D==null?void 0:D.type)==="mousemove"||(D==null?void 0:D.type)==="mouseenter")),h.$$.dirty[0]&352354304&&Ee==="hover"&&rt&&(S&&D&&(D.layerType==="deckgl"?(g(10,wt=D.coordinate),g(4,Ti=D.object?[D.object]:null)):(g(10,wt=D.lngLat),g(4,Ti=D.features??[]))),g(0,ft=(S||Vi)??!1)),h.$$.dirty[0]&12582914&&(Ei?xt.setDOMContent(Ei):ti&&xt.setHTML(ti)),h.$$.dirty[0]&8389632&&wt&&xt.setLngLat(wt),h.$$.dirty[0]&41943045&&I){let Oe=xt.isOpen();ft&&!Oe?(xt.addTo(I),hi==="opening"&&g(25,hi="justOpened")):!ft&&Oe&&xt.remove()}},[ft,Ei,I,o,Ti,Tt,Ki,rt,ii,$,wt,he,me,ge,Ze,Ee,Ve,Ae,Se,ye,qe,Gt,ti,xt,Vi,hi,S,w,D,W,k,rr,Rr]}class J_ extends tn{constructor(m){super(),en(this,m,Y_,H_,Gr,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}function K_(h){let m,g,w,S,I,D,o,U,k,W,$,he;return{c(){m=yn("h4"),g=mr(h[1]),w=mr(": "),S=mr(h[2]),I=qr(),D=yn("p"),o=mr("From: "),U=mr(h[4]),k=qr(),W=yn("p"),$=mr("Destination: "),he=mr(h[5])},m(me,ge){Rt(me,m,ge),$r(m,g),$r(m,w),$r(m,S),Rt(me,I,ge),Rt(me,D,ge),$r(D,o),$r(D,U),Rt(me,k,ge),Rt(me,W,ge),$r(W,$),$r(W,he)},p(me,ge){ge&2&&Ls(g,me[1]),ge&4&&Ls(S,me[2]),ge&16&&Ls(U,me[4]),ge&32&&Ls(he,me[5])},d(me){me&&(zt(m),zt(I),zt(D),zt(k),zt(W))}}}function $_(h){let m,g,w,S,I,D,o=(h[1]??"🚍")+"",U,k,W,$;return W=new J_({props:{openOn:"hover",offset:[0,-10],$$slots:{default:[K_]},$$scope:{ctx:h}}}),{c(){m=Pl("svg"),g=Pl("g"),w=Pl("circle"),S=Pl("circle"),D=Pl("text"),U=mr(o),k=qr(),Lr(W.$$.fragment),Ct(w,"cx","25"),Ct(w,"cy","25"),Ct(w,"r","24"),Ct(w,"stroke","black"),Ct(w,"stroke-width","3"),Ct(w,"fill","red"),Ct(S,"cx","25"),Ct(S,"cy","5"),Ct(S,"r","5"),Ct(S,"stroke","black"),Ct(S,"stroke-width","1.5"),Ct(S,"fill","white"),Ct(g,"transform",I="rotate("+h[3]+", 25, 25)"),Ct(D,"x","25"),Ct(D,"y","32.5"),Ct(D,"text-anchor","middle"),Ct(D,"class","svelte-1x5h1k7"),Ct(m,"width",h[6]),Ct(m,"height",h[6]),Ct(m,"viewBox","0 0 50 50"),Ct(m,"class","svelte-1x5h1k7")},m(he,me){Rt(he,m,me),$r(m,g),$r(g,w),$r(g,S),$r(m,D),$r(D,U),Rt(he,k,me),_r(W,he,me),$=!0},p(he,me){(!$||me&8&&I!==(I="rotate("+he[3]+", 25, 25)"))&&Ct(g,"transform",I),(!$||me&2)&&o!==(o=(he[1]??"🚍")+"")&&Ls(U,o),(!$||me&64)&&Ct(m,"width",he[6]),(!$||me&64)&&Ct(m,"height",he[6]);const ge={};me&182&&(ge.$$scope={dirty:me,ctx:he}),W.$set(ge)},i(he){$||(St(W.$$.fragment,he),$=!0)},o(he){Ot(W.$$.fragment,he),$=!1},d(he){he&&(zt(m),zt(k)),yr(W,he)}}}function Q_(h){let m,g;return m=new B_({props:{lngLat:h[0],$$slots:{default:[$_]},$$scope:{ctx:h}}}),{c(){Lr(m.$$.fragment)},m(w,S){_r(m,w,S),g=!0},p(w,[S]){const I={};S&1&&(I.lngLat=w[0]),S&254&&(I.$$scope={dirty:S,ctx:w}),m.$set(I)},i(w){g||(St(m.$$.fragment,w),g=!0)},o(w){Ot(m.$$.fragment,w),g=!1},d(w){yr(m,w)}}}function ey(h,m,g){let{lngLat:w}=m,{lineNumber:S}=m,{lineName:I="N/A"}=m,{bearing:D=0}=m,{origin:o="N/A"}=m,{destination:U="N/A"}=m,{iconSize:k=30}=m;return console.log("lineNumber: %s",S),h.$$set=W=>{"lngLat"in W&&g(0,w=W.lngLat),"lineNumber"in W&&g(1,S=W.lineNumber),"lineName"in W&&g(2,I=W.lineName),"bearing"in W&&g(3,D=W.bearing),"origin"in W&&g(4,o=W.origin),"destination"in W&&g(5,U=W.destination),"iconSize"in W&&g(6,k=W.iconSize)},[w,S,I,D,o,U,k]}class ty extends tn{constructor(m){super(),en(this,m,ey,Q_,Gr,{lngLat:0,lineNumber:1,lineName:2,bearing:3,origin:4,destination:5,iconSize:6})}}var yo={NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType"};class Th extends Error{constructor(m,g,w,S,I,D,o){super(m),this.name="GraphQLError",this.message=m,I&&(this.path=I),g&&(this.nodes=Array.isArray(g)?g:[g]),w&&(this.source=w),S&&(this.positions=S),D&&(this.originalError=D);var U=o;if(!U&&D){var k=D.extensions;k&&typeof k=="object"&&(U=k)}this.extensions=U||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}var ui,Et;function Oi(h){return new Th(`Syntax Error: Unexpected token at ${Et} in ${h}`)}function Qr(h){if(h.lastIndex=Et,h.test(ui))return ui.slice(Et,Et=h.lastIndex)}var Uc=/ +(?=[^\s])/y;function iy(h){for(var m=h.split(` +`),g="",w=0,S=0,I=m.length-1,D=0;D!(!h||!h.length),fr={OperationDefinition(h){if(h.operation==="query"&&!h.name&&!mn(h.variableDefinitions)&&!mn(h.directives))return fr.SelectionSet(h.selectionSet);var m=h.operation;return h.name&&(m+=" "+h.name.value),mn(h.variableDefinitions)&&(h.name||(m+=" "),m+="("+h.variableDefinitions.map(fr.VariableDefinition).join(", ")+")"),mn(h.directives)&&(m+=" "+h.directives.map(fr.Directive).join(" ")),m+" "+fr.SelectionSet(h.selectionSet)},VariableDefinition(h){var m=fr.Variable(h.variable)+": "+gn(h.type);return h.defaultValue&&(m+=" = "+gn(h.defaultValue)),mn(h.directives)&&(m+=" "+h.directives.map(fr.Directive).join(" ")),m},Field(h){var m=(h.alias?h.alias.value+": ":"")+h.name.value;if(mn(h.arguments)){var g=h.arguments.map(fr.Argument),w=m+"("+g.join(", ")+")";m=w.length>80?m+`( + `+g.join(` +`).replace(/\n/g,` + `)+` +)`:w}return mn(h.directives)&&(m+=" "+h.directives.map(fr.Directive).join(" ")),h.selectionSet?m+" "+fr.SelectionSet(h.selectionSet):m},StringValue:h=>h.block?vy(h.value):yy(h.value),BooleanValue:h=>""+h.value,NullValue:h=>"null",IntValue:h=>h.value,FloatValue:h=>h.value,EnumValue:h=>h.value,Name:h=>h.value,Variable:h=>"$"+h.name.value,ListValue:h=>"["+h.values.map(gn).join(", ")+"]",ObjectValue:h=>"{"+h.fields.map(fr.ObjectField).join(", ")+"}",ObjectField:h=>h.name.value+": "+gn(h.value),Document:h=>mn(h.definitions)?h.definitions.map(gn).join(` + +`):"",SelectionSet:h=>`{ + `+h.selections.map(gn).join(` +`).replace(/\n/g,` + `)+` +}`,Argument:h=>h.name.value+": "+gn(h.value),FragmentSpread(h){var m="..."+h.name.value;return mn(h.directives)&&(m+=" "+h.directives.map(fr.Directive).join(" ")),m},InlineFragment(h){var m="...";return h.typeCondition&&(m+=" on "+h.typeCondition.name.value),mn(h.directives)&&(m+=" "+h.directives.map(fr.Directive).join(" ")),m+" "+gn(h.selectionSet)},FragmentDefinition(h){var m="fragment "+h.name.value;return m+=" on "+h.typeCondition.name.value,mn(h.directives)&&(m+=" "+h.directives.map(fr.Directive).join(" ")),m+" "+gn(h.selectionSet)},Directive(h){var m="@"+h.name.value;return mn(h.arguments)&&(m+="("+h.arguments.map(fr.Argument).join(", ")+")"),m},NamedType:h=>h.name.value,ListType:h=>"["+gn(h.type)+"]",NonNullType:h=>gn(h.type)+"!"};function gn(h){return fr[h.kind]?fr[h.kind](h):""}var Ef=()=>{},vr=Ef;function rn(h){return{tag:0,0:h}}function Ra(h){return{tag:1,0:h}}var Dp=()=>typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator",Sf=h=>h;function xy(h){return m=>g=>{var w=[],S=vr,I=vr,D=!1,o=!1,U=!1,k=!1;function W($){U=!0,$(he=>{he===0?U&&(U=!1,w.length?W(h(w.shift())):k?g(0):D||(D=!0,S(0))):he.tag===0?(o=!1,(I=he[0])(0)):U&&(g(he),o?o=!1:I(0))})}m($=>{k||($===0?(k=!0,!U&&!w.length&&g(0)):$.tag===0?S=$[0]:(D=!1,U?w.push($[0]):W(h($[0]))))}),g(rn($=>{$===1?(k||(k=!0,S(1)),U&&(U=!1,I(1))):(!k&&!D&&(D=!0,S(0)),U&&!o&&(o=!0,I(0)))}))}}function by(h){return xy(Sf)(h)}function If(h){return by(zf(h))}function tr(h){return m=>g=>{var w=vr;m(S=>{S===0?g(0):S.tag===0?(w=S[0],g(S)):h(S[0])?g(S):w(0)})}}function vo(h){return m=>g=>m(w=>{w===0||w.tag===0?g(w):g(Ra(h(w[0])))})}function Oh(h){return m=>g=>{var w=[],S=vr,I=!1,D=!1;m(o=>{D||(o===0?(D=!0,w.length||g(0)):o.tag===0?S=o[0]:(I=!1,function(k){var W=vr;k($=>{if($===0){if(w.length){var he=w.indexOf(W);he>-1&&(w=w.slice()).splice(he,1),w.length||(D?g(0):I||(I=!0,S(0)))}}else $.tag===0?(w.push(W=$[0]),W(0)):w.length&&(g($),W(0))})}(h(o[0])),I||(I=!0,S(0))))}),g(rn(o=>{if(o===1){D||(D=!0,S(1));for(var U=0,k=w,W=w.length;Ug=>{var w=!1;m(S=>{if(!w)if(S===0)w=!0,g(0),h();else if(S.tag===0){var I=S[0];g(rn(D=>{D===1?(w=!0,I(1),h()):I(D)}))}else g(S)})}}function Cf(h){return m=>g=>{var w=!1;m(S=>{if(!w)if(S===0)w=!0,g(0);else if(S.tag===0){var I=S[0];g(rn(D=>{D===1&&(w=!0),I(D)}))}else h(S[0]),g(S)})}}function Lp(h){return m=>g=>m(w=>{w===0?g(0):w.tag===0?(g(w),h()):g(w)})}function kf(h,m){return g=>w=>{var S=m;g(I=>{I===0?w(0):I.tag===0?w(I):w(Ra(S=h(S,I[0])))})}}function Bl(h){var m=[],g=vr,w=!1;return S=>{m.push(S),m.length===1&&h(I=>{if(I===0){for(var D=0,o=m,U=m.length;D{if(I===1){var D=m.indexOf(S);D>-1&&(m=m.slice()).splice(D,1),m.length||g(1)}else w||(w=!0,g(0))}))}}function Hc(h){return m=>g=>{var w=vr,S=vr,I=!1,D=!1,o=!1,U=!1;m(k=>{U||(k===0?(U=!0,o||g(0)):k.tag===0?w=k[0]:(o&&(S(1),S=vr),I?I=!1:(I=!0,w(0)),function($){o=!0,$(he=>{o&&(he===0?(o=!1,U?g(0):I||(I=!0,w(0))):he.tag===0?(D=!1,(S=he[0])(0)):(g(he),D?D=!1:S(0)))})}(h(k[0]))))}),g(rn(k=>{k===1?(U||(U=!0,w(1)),o&&(o=!1,S(1))):(!U&&!I&&(I=!0,w(0)),o&&!D&&(D=!0,S(0)))}))}}function Mf(h){return m=>g=>{var w=vr,S=!1,I=0;m(D=>{S||(D===0?(S=!0,g(0)):D.tag===0?h<=0?(S=!0,g(0),D[0](1)):w=D[0]:I++=h&&(S=!0,g(0),w(1))):g(D))}),g(rn(D=>{D===1&&!S?(S=!0,w(1)):D===0&&!S&&Ig=>{var w=vr,S=vr,I=!1;m(D=>{I||(D===0?(I=!0,S(1),g(0)):D.tag===0?(w=D[0],h(o=>{o===0||(o.tag===0?(S=o[0])(0):(I=!0,S(1),w(1),g(0)))})):g(D))}),g(rn(D=>{D===1&&!I?(I=!0,w(1),S(1)):I||w(0)}))}}function Ty(h,m){return g=>w=>{var S=vr,I=!1;g(D=>{I||(D===0?(I=!0,w(0)):D.tag===0?(S=D[0],w(D)):h(D[0])?w(D):(I=!0,m&&w(D),w(0),S(1)))})}}function Ey(h){return m=>h()(m)}function Pf(h){return m=>{var g=h[Dp()]&&h[Dp()]()||h,w=!1,S=!1,I=!1,D;m(rn(async o=>{if(o===1)w=!0,g.return&&g.return();else if(S)I=!0;else{for(I=S=!0;I&&!w;)if((D=await g.next()).done)w=!0,g.return&&await g.return(),m(0);else try{I=!1,m(Ra(D.value))}catch(U){if(g.throw)(w=!!(await g.throw(U)).done)&&m(0);else throw U}S=!1}}))}}function Sy(h){return h[Symbol.asyncIterator]?Pf(h):m=>{var g=h[Symbol.iterator](),w=!1,S=!1,I=!1,D;m(rn(o=>{if(o===1)w=!0,g.return&&g.return();else if(S)I=!0;else{for(I=S=!0;I&&!w;)if((D=g.next()).done)w=!0,g.return&&g.return(),m(0);else try{I=!1,m(Ra(D.value))}catch(U){if(g.throw)(w=!!g.throw(U).done)&&m(0);else throw U}S=!1}}))}}var zf=Sy;function xo(h){return m=>{var g=!1;m(rn(w=>{w===1?g=!0:g||(g=!0,m(Ra(h)),m(0))}))}}function Nh(h){return m=>{var g=!1,w=h({next(S){g||m(Ra(S))},complete(){g||(g=!0,m(0))}});m(rn(S=>{S===1&&!g&&(g=!0,w())}))}}function Iy(){var h,m;return{source:Bl(Nh(g=>(h=g.next,m=g.complete,Ef))),next(g){h&&h(g)},complete(){m&&m()}}}var Df=h=>{h(rn(vr))};function jl(h){return m=>{var g=vr,w=!1;return m(S=>{S===0?w=!0:S.tag===0?(g=S[0])(0):w||(h(S[0]),g(0))}),{unsubscribe(){w||(w=!0,g(1))}}}}function Ay(h){jl(m=>{})(h)}function Cy(h){return new Promise(m=>{var g=vr,w;h(S=>{S===0?Promise.resolve(w).then(m):S.tag===0?(g=S[0])(0):(w=S[0],g(0))})})}var ky=h=>h&&h.message&&(h.extensions||h.name==="GraphQLError")?h:typeof h=="object"&&h.message?new Th(h.message,h.nodes,h.source,h.positions,h.path,h,h.extensions||{}):new Th(h);class Uh extends Error{constructor(m){var g=(m.graphQLErrors||[]).map(ky),w=((S,I)=>{var D="";if(S)return`[Network] ${S.message}`;if(I)for(var o of I)D&&(D+=` +`),D+=`[GraphQL] ${o.message}`;return D})(m.networkError,g);super(w),this.name="CombinedError",this.message=w,this.graphQLErrors=g,this.networkError=m.networkError,this.response=m.response}toString(){return this.message}}var Eh=(h,m)=>{for(var g=0|(m||5381),w=0,S=0|h.length;w{if(h===null||bo.has(h))return"null";if(typeof h!="object")return JSON.stringify(h)||"";if(h.toJSON)return xa(h.toJSON());if(Array.isArray(h)){var m="[";for(var g of h)m.length>1&&(m+=","),m+=xa(g)||"null";return m+="]"}else if(Jc!==Ia&&h instanceof Jc||Kc!==Ia&&h instanceof Kc)return"null";var w=Object.keys(h).sort();if(!w.length&&h.constructor&&h.constructor!==Object){var S=Rp.get(h)||Math.random().toString(36).slice(2);return Rp.set(h,S),xa({__key:S})}bo.add(h);var I="{";for(var D of w){var o=xa(h[D]);o&&(I.length>1&&(I+=","),I+=xa(D)+":"+o)}return bo.delete(h),I+="}"},Sh=(h,m,g)=>{if(!(g==null||typeof g!="object"||g.toJSON||bo.has(g)))if(Array.isArray(g))for(var w=0,S=g.length;w(bo.clear(),xa(h));class Ia{}var Jc=typeof File<"u"?File:Ia,Kc=typeof Blob<"u"?Blob:Ia,My=/("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g,Py=/(?:#[^\n\r]+)?(?:[\r\n]+|$)/g,zy=(h,m)=>m%2==0?h.replace(Py,` +`):h,Bp=h=>h.split(My).map(zy).join("").trim(),Op=new Map,qc=new Map,iu=h=>{var m;return typeof h=="string"?m=Bp(h):h.loc&&qc.get(h.__key)===h?m=h.loc.source.body:(m=Op.get(h)||Bp(gn(h)),Op.set(h,m)),typeof h!="string"&&!h.loc&&(h.loc={start:0,end:m.length,source:{body:m,name:"gql",locationOffset:{line:1,column:1}}}),m},Fp=h=>{var m=Eh(iu(h));if(h.definitions){var g=Lf(h);g&&(m=Eh(` +# ${g}`,m))}return m},$c=h=>{var m,g;return typeof h=="string"?(m=Fp(h),g=qc.get(m)||_y(h)):(m=h.__key||Fp(h),g=qc.get(m)||h),g.loc||iu(g),g.__key=m,qc.set(m,g),g},Dl=(h,m,g)=>{var w=m||{},S=$c(h),I=Yc(w),D=S.__key;return I!=="{}"&&(D=Eh(I,D)),{key:D,query:S,variables:w,extensions:g}},Lf=h=>{for(var m of h.definitions)if(m.kind===yo.OPERATION_DEFINITION)return m.name?m.name.value:void 0},Ih=(h,m,g)=>{if(!("data"in m)&&!("errors"in m))throw new Error("No Content");var w=h.kind==="subscription";return{operation:h,data:m.data,error:Array.isArray(m.errors)?new Uh({graphQLErrors:m.errors,response:g}):void 0,extensions:m.extensions?{...m.extensions}:void 0,hasNext:m.hasNext==null?w:m.hasNext,stale:!1}},Ah=(h,m)=>{if(typeof h=="object"&&h!=null&&(!h.constructor||h.constructor===Object||Array.isArray(h))){h=Array.isArray(h)?[...h]:{...h};for(var g of Object.keys(m))h[g]=Ah(h[g],m[g]);return h}return m},Rf=(h,m,g)=>{var w=h.error?h.error.graphQLErrors:[],S=!!h.extensions||!!m.extensions,I={...h.extensions,...m.extensions},D=m.incremental;"path"in m&&(D=[m]);var o={data:h.data};if(D)for(var U of D){Array.isArray(U.errors)&&w.push(...U.errors),U.extensions&&(Object.assign(I,U.extensions),S=!0);for(var k="data",W=o,$=0,he=U.path.length;$=0?k:0,ge=0,Ze=U.items.length;ge({operation:h,data:void 0,error:new Uh({networkError:m,response:g}),extensions:void 0,hasNext:!1,stale:!1});function Of(h){return{query:h.extensions&&h.extensions.persistedQuery&&!h.extensions.persistedQuery.miss?void 0:iu(h.query),operationName:Lf(h.query),variables:h.variables||void 0,extensions:h.extensions}}var Dy=(h,m)=>{var g=h.kind==="query"&&h.context.preferGetMethod;if(!g||!m)return h.context.url;var w=new URL(h.context.url);for(var S in m){var I=m[S];I&&w.searchParams.set(S,typeof I=="object"?Yc(I):I)}var D=w.toString();return D.length>2047&&g!=="force"?(h.context.preferGetMethod=!1,h.context.url):D},Ly=(h,m)=>{if(m&&!(h.kind==="query"&&h.context.preferGetMethod)){var g=Yc(m),w=(o=>{var U=new Map;return(Jc!==Ia||Kc!==Ia)&&(bo.clear(),Sh(U,"variables",o)),U})(m.variables);if(w.size){var S=new FormData;S.append("operations",g),S.append("map",Yc({...[...w.keys()].map(o=>[o])}));var I=0;for(var D of w.values())S.append(""+I++,D);return S}return g}},Ry=(h,m)=>{var g={accept:h.kind==="subscription"?"text/event-stream, multipart/mixed":"application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed"},w=(typeof h.context.fetchOptions=="function"?h.context.fetchOptions():h.context.fetchOptions)||{};if(w.headers)for(var S in w.headers)g[S.toLowerCase()]=w.headers[S];var I=Ly(h,m);return typeof I=="string"&&!g["content-type"]&&(g["content-type"]="application/json"),{...w,method:I?"POST":"GET",body:I,headers:g}},By=typeof TextDecoder<"u"?new TextDecoder:null,Oy=/boundary="?([^=";]+)"?/i,Fy=/data: ?([^\n]+)/,Np=h=>h.constructor.name==="Buffer"?h.toString():By.decode(h);async function*Up(h){if(h.body[Symbol.asyncIterator])for await(var m of h.body)yield Np(m);else{var g=h.body.getReader(),w;try{for(;!(w=await g.read()).done;)yield Np(w.value)}finally{g.cancel()}}}async function*Vp(h,m){var g="",w;for await(var S of h)for(g+=S;(w=g.indexOf(m))>-1;)yield g.slice(0,w),g=g.slice(w+m.length)}async function*Ny(h,m,g){var w=!0,S=null,I;try{yield await Promise.resolve();var D=(I=await(h.context.fetch||fetch)(m,g)).headers.get("Content-Type")||"",o;if(/multipart\/mixed/i.test(D))o=async function*(W,$){var he=W.match(Oy),me="--"+(he?he[1]:"-"),ge=!0,Ze;for await(var Ee of Vp(Up($),`\r +`+me)){if(ge){ge=!1;var Ve=Ee.indexOf(me);if(Ve>-1)Ee=Ee.slice(Ve+me.length);else continue}try{yield Ze=JSON.parse(Ee.slice(Ee.indexOf(`\r +\r +`)+4))}catch(Ae){if(!Ze)throw Ae}if(Ze&&Ze.hasNext===!1)break}Ze&&Ze.hasNext!==!1&&(yield{hasNext:!1})}(D,I);else if(/text\/event-stream/i.test(D))o=async function*(W){var $;for await(var he of Vp(Up(W),` + +`)){var me=he.match(Fy);if(me){var ge=me[1];try{yield $=JSON.parse(ge)}catch(Ze){if(!$)throw Ze}if($&&$.hasNext===!1)break}}$&&$.hasNext!==!1&&(yield{hasNext:!1})}(I);else if(!/text\//i.test(D))o=async function*(W){yield JSON.parse(await W.text())}(I);else throw new Error(await I.text());for await(var U of o)S=S?Rf(S,U,I):Ih(h,U,I),w=!1,yield S,w=!0;S||(yield S=Ih(h,{},I))}catch(k){if(!w)throw k;yield Bf(h,I&&(I.status<200||I.status>=300)&&I.statusText?new Error(I.statusText):k,I)}}function Uy(h,m,g){var w;return typeof AbortController<"u"&&(g.signal=(w=new AbortController).signal),Af(()=>{w&&w.abort()})(tr(S=>!!S)(Pf(Ny(h,m,g))))}var Ch=(h,m)=>{if(Array.isArray(h))for(var g of h)Ch(g,m);else if(typeof h=="object"&&h!==null)for(var w in h)w==="__typename"&&typeof h[w]=="string"?m.add(h[w]):Ch(h[w],m);return m},kh=h=>{if("definitions"in h){var m=[];for(var g of h.definitions){var w=kh(g);m.push(w)}return{...h,definitions:m}}if("directives"in h&&h.directives&&h.directives.length){var S=[],I={};for(var D of h.directives){var o=D.name.value;o[0]!=="_"?S.push(D):o=o.slice(1),I[o]=D}h={...h,directives:S,_directives:I}}if("selectionSet"in h){var U=[],k=h.kind===yo.OPERATION_DEFINITION;if(h.selectionSet){for(var W of h.selectionSet.selections||[]){k=k||W.kind===yo.FIELD&&W.name.value==="__typename"&&!W.alias;var $=kh(W);U.push($)}return k||U.push({kind:yo.FIELD,name:{kind:yo.NAME,value:"__typename"},_generated:!0}),{...h,selectionSet:{...h.selectionSet,selections:U}}}}return h},jp=new Map,Vy=h=>{var m=$c(h),g=jp.get(m.__key);return g||(jp.set(m.__key,g=kh(m)),Object.defineProperty(g,"__key",{value:m.__key,enumerable:!1})),g},Mh=(h,m)=>{if(!h||typeof h!="object")return h;if(Array.isArray(h))return h.map(S=>Mh(S));if(h&&typeof h=="object"&&(m||"__typename"in h)){var g={};for(var w in h)w==="__typename"?Object.defineProperty(g,"__typename",{enumerable:!1,value:h.__typename}):g[w]=Mh(h[w]);return g}else return h};function qp(h){var m=g=>h(g);return m.toPromise=()=>Cy(Mf(1)(tr(g=>!g.stale&&!g.hasNext)(m))),m.then=(g,w)=>m.toPromise().then(g,w),m.subscribe=g=>jl(g)(m),m}function Ol(h,m,g){return{...m,kind:h,context:m.context?{...m.context,...g}:g||m.context}}var jy=()=>{};function Gp(h){for(var m=new Map,g=[],w=[],S=Array.isArray(h)?h[0]:h||"",I=1;Ih!=="mutation"&&h!=="query",qy=h=>{var m=Vy(h.query);if(m!==h.query){var g=Ol(h.kind,h);return g.query=m,g}else return h},Gy=({forward:h,client:m,dispatchDebug:g})=>{var w=new Map,S=new Map,I=D=>D.kind==="query"&&D.context.requestPolicy!=="network-only"&&(D.context.requestPolicy==="cache-only"||w.has(D.key));return D=>{var o=vo(k=>{var W=w.get(k.key),$=W;return k.context.requestPolicy==="cache-and-network"&&($.stale=!0,Zp(m,k)),$})(tr(k=>!vh(k)&&I(k))(D)),U=Cf(k=>{var{operation:W}=k;if(W){var $=W.context.additionalTypenames||[];if(k.operation.kind!=="subscription"&&($=(qe=>[...Ch(qe,new Set)])(k.data).concat($)),k.operation.kind==="mutation"||k.operation.kind==="subscription"){for(var he=new Set,me=0;me<$.length;me++){var ge=$[me],Ze=S.get(ge);Ze||S.set(ge,Ze=new Set);for(var Ee of Ze.values())he.add(Ee);Ze.clear()}for(var Ve of he.values())w.has(Ve)&&(W=w.get(Ve).operation,w.delete(Ve),Zp(m,W))}else if(W.kind==="query"&&k.data){w.set(W.key,k);for(var Ae=0;Ae<$.length;Ae++){var Se=$[Ae],ye=S.get(Se);ye||S.set(Se,ye=new Set),ye.add(W.key)}}}})(h(tr(k=>k.kind!=="query"||k.context.requestPolicy!=="cache-only")(vo(k=>k)(Sa([vo(qy)(tr(k=>!vh(k)&&!I(k))(D)),tr(k=>vh(k))(D)])))));return Sa([o,U])}},Zp=(h,m)=>h.reexecuteOperation(Ol(m.kind,m,{requestPolicy:"network-only"})),Zy=({forwardSubscription:h,enableAllOperations:m,isSubscriptionOperation:g})=>({client:w,forward:S})=>{var I=g||(D=>D.kind==="subscription"||!!m&&(D.kind==="query"||D.kind==="mutation"));return D=>{var o=Oh(k=>{var{key:W}=k,$=tr(he=>he.kind==="teardown"&&he.key===W)(D);return Fh($)((he=>{var me=h(Of(he),he);return Nh(ge=>{var Ze=!1,Ee,Ve;function Ae(Se){ge.next(Ve=Ve?Rf(Ve,Se):Ih(he,Se))}return Promise.resolve().then(()=>{Ze||(Ee=me.subscribe({next:Ae,error(Se){Array.isArray(Se)?Ae({errors:Se}):ge.next(Bf(he,Se)),ge.complete()},complete(){Ze||(Ze=!0,he.kind==="subscription"&&w.reexecuteOperation(Ol("teardown",he,he.context)),Ve&&Ve.hasNext&&Ae({hasNext:!1}),ge.complete())}}))}),()=>{Ze=!0,Ee&&Ee.unsubscribe()}})})(k))})(tr(k=>k.kind!=="teardown"&&I(k))(D)),U=S(tr(k=>k.kind==="teardown"||!I(k))(D));return Sa([o,U])}},Xy=({forward:h,dispatchDebug:m})=>g=>{var w=Oh(I=>{var D=Of(I),o=Dy(I,D),U=Ry(I,D),k=Fh(tr(W=>W.kind==="teardown"&&W.key===I.key)(g))(Uy(I,o,U));return k})(tr(I=>I.kind!=="teardown"&&(I.kind!=="subscription"||!!I.context.fetchSubscriptions))(g)),S=h(tr(I=>I.kind==="teardown"||I.kind==="subscription"&&!I.context.fetchSubscriptions)(g));return Sa([w,S])},Wy=h=>({client:m,forward:g,dispatchDebug:w})=>h.reduceRight((S,I)=>I({client:m,forward(D){return Bl(S(Bl(D)))},dispatchDebug(D){}}),g),Hy=({dispatchDebug:h})=>m=>tr(g=>!1)(m),Yy=function h(m){var g=0,w=new Map,S=new Map,I=new Set,D=[],o={url:m.url,fetchSubscriptions:m.fetchSubscriptions,fetchOptions:m.fetchOptions,fetch:m.fetch,preferGetMethod:!!m.preferGetMethod,requestPolicy:m.requestPolicy||"cache-first"},U=Iy();function k(Ae){(Ae.kind==="mutation"||Ae.kind==="teardown"||!I.has(Ae.key))&&(Ae.kind==="teardown"?I.delete(Ae.key):Ae.kind!=="mutation"&&I.add(Ae.key),U.next(Ae))}var W=!1;function $(Ae){if(Ae&&k(Ae),!W){for(W=!0;W&&(Ae=D.shift());)k(Ae);W=!1}}var he=Ae=>{var Se=Fh(tr(ye=>ye.kind==="teardown"&&ye.key===Ae.key)(U.source))(tr(ye=>ye.operation.kind===Ae.kind&&ye.operation.key===Ae.key&&(!ye.operation.context._instance||ye.operation.context._instance===Ae.context._instance))(Ve));return m.maskTypename&&(Se=vo(ye=>({...ye,data:Mh(ye.data,!0)}))(Se)),Ae.kind!=="query"?Se=Ty(ye=>!!ye.hasNext,!0)(Se):Se=Hc(ye=>{var qe=xo(ye);return ye.stale||ye.hasNext?qe:Sa([qe,vo(()=>(ye.stale=!0,ye))(Mf(1)(tr(Gt=>Gt.key===Ae.key)(U.source)))])})(Se),Ae.kind!=="mutation"?Se=Af(()=>{I.delete(Ae.key),w.delete(Ae.key),S.delete(Ae.key),W=!1;for(var ye=D.length-1;ye>=0;ye--)D[ye].key===Ae.key&&D.splice(ye,1);k(Ol("teardown",Ae,Ae.context))})(Cf(ye=>{if(ye.stale){for(var qe of D)if(qe.key===ye.operation.key){I.delete(qe.key);break}}else ye.hasNext||I.delete(Ae.key);w.set(Ae.key,ye)})(Se)):Se=Lp(()=>{k(Ae)})(Se),Bl(Se)},me=this instanceof h?this:Object.create(h.prototype),ge=Object.assign(me,{suspense:!!m.suspense,operations$:U.source,reexecuteOperation(Ae){if(Ae.kind==="teardown")$(Ae);else if(Ae.kind==="mutation"||S.has(Ae.key)){for(var Se=!1,ye=0;ye{var Se=S.get(Ae.key);Se||S.set(Ae.key,Se=he(Ae)),Se=Lp(()=>{$(Ae)})(Se);var ye=w.get(Ae.key);return Ae.kind==="query"&&ye&&(ye.stale||ye.hasNext)?Hc(xo)(Sa([Se,tr(qe=>qe===w.get(Ae.key))(xo(ye))])):Se}))},executeQuery(Ae,Se){var ye=ge.createRequestOperation("query",Ae,Se);return ge.executeRequestOperation(ye)},executeSubscription(Ae,Se){var ye=ge.createRequestOperation("subscription",Ae,Se);return ge.executeRequestOperation(ye)},executeMutation(Ae,Se){var ye=ge.createRequestOperation("mutation",Ae,Se);return ge.executeRequestOperation(ye)},readQuery(Ae,Se,ye){var qe=null;return jl(Gt=>{qe=Gt})(ge.query(Ae,Se,ye)).unsubscribe(),qe},query:(Ae,Se,ye)=>ge.executeQuery(Dl(Ae,Se),ye),subscription:(Ae,Se,ye)=>ge.executeSubscription(Dl(Ae,Se),ye),mutation:(Ae,Se,ye)=>ge.executeMutation(Dl(Ae,Se),ye)}),Ze=jy,Ee=Wy(m.exchanges),Ve=Bl(Ee({client:ge,dispatchDebug:Ze,forward:Hy({dispatchDebug:Ze})})(U.source));return Ay(Ve),ge},Ff=h=>Nh(m=>h.subscribe(m.next)),Nf={operation:void 0,fetching:!1,data:void 0,error:void 0,extensions:void 0,hasNext:!1,stale:!1},Uf=h=>({isPaused$:h,pause(){h.set(!0)},resume(){h.set(!1)}});function Jy(h){var m=Dl(h.query,h.variables),g={requestPolicy:h.requestPolicy,...h.context},w=h.client.createRequestOperation("query",m,g),S={...Nf,operation:w},I=Dr(!!h.pause),D=Dr(S,()=>jl(o=>{D.set(o)})(kf((o,U)=>({...o,...U}),S)(Hc(o=>o?Df:If([xo({fetching:!0,stale:!1}),vo(({stale:U,data:k,error:W,extensions:$,operation:he})=>({fetching:!1,stale:!!U,data:k,error:W,operation:he,extensions:$}))(h.client.executeRequestOperation(w)),xo({fetching:!1})]))(Ff(I)))).unsubscribe);return{...df(D,(o,U)=>{U(o)}),...Uf(I)}}function Ky(h,m){var g=Dl(h.query,h.variables),w=h.client.createRequestOperation("subscription",g,h.context),S={...Nf,operation:w,fetching:!0},I=Dr(!!h.pause),D=Dr(S,()=>jl(o=>{D.set(o)})(kf((o,U)=>{var k=U.data!==void 0?typeof m=="function"?m(o.data,U.data):U.data:o.data;return{...o,...U,data:k}},S)(Hc(o=>o?Df:If([xo({fetching:!0,stale:!1}),vo(({stale:U,data:k,error:W,extensions:$,operation:he})=>({fetching:!0,stale:!!U,data:k,error:W,operation:he,extensions:$}))(h.client.executeRequestOperation(w)),xo({fetching:!1})]))(Ff(I)))).unsubscribe);return{...df(D,(o,U)=>{U(o)}),...Uf(I)}}var Vf="$$_urql",Xp=()=>{var h=uf(Vf);return h},$y=h=>{Dh(Vf,h)};function Wp(h,m,g){const w=h.slice();return w[11]=m[g][0],w[12]=m[g][1],w}function Qy(h){let m;return{c(){m=mr("L")},m(g,w){Rt(g,m,w)},d(g){g&&zt(m)}}}function ev(h){let m;return{c(){m=mr("M")},m(g,w){Rt(g,m,w)},d(g){g&&zt(m)}}}function tv(h){let m;return{c(){m=mr("S")},m(g,w){Rt(g,m,w)},d(g){g&&zt(m)}}}function iv(h){let m,g,w,S,I,D;return m=new yh({props:{$$slots:{default:[Qy]},$$scope:{ctx:h}}}),m.$on("click",h[5]),w=new yh({props:{$$slots:{default:[ev]},$$scope:{ctx:h}}}),w.$on("click",h[6]),I=new yh({props:{$$slots:{default:[tv]},$$scope:{ctx:h}}}),I.$on("click",h[7]),{c(){Lr(m.$$.fragment),g=qr(),Lr(w.$$.fragment),S=qr(),Lr(I.$$.fragment)},m(o,U){_r(m,o,U),Rt(o,g,U),_r(w,o,U),Rt(o,S,U),_r(I,o,U),D=!0},p(o,U){const k={};U&32768&&(k.$$scope={dirty:U,ctx:o}),m.$set(k);const W={};U&32768&&(W.$$scope={dirty:U,ctx:o}),w.$set(W);const $={};U&32768&&($.$$scope={dirty:U,ctx:o}),I.$set($)},i(o){D||(St(m.$$.fragment,o),St(w.$$.fragment,o),St(I.$$.fragment,o),D=!0)},o(o){Ot(m.$$.fragment,o),Ot(w.$$.fragment,o),Ot(I.$$.fragment,o),D=!1},d(o){o&&(zt(g),zt(S)),yr(m,o),yr(w,o),yr(I,o)}}}function rv(h){let m,g;return m=new __({props:{$$slots:{default:[iv]},$$scope:{ctx:h}}}),{c(){Lr(m.$$.fragment)},m(w,S){_r(m,w,S),g=!0},p(w,S){const I={};S&32769&&(I.$$scope={dirty:S,ctx:w}),m.$set(I)},i(w){g||(St(m.$$.fragment,w),g=!0)},o(w){Ot(m.$$.fragment,w),g=!1},d(w){yr(m,w)}}}function Hp(h){let m,g,w=Ep(Object.entries(h[2])),S=[];for(let D=0;DOt(S[D],1,1,()=>{S[D]=null});return{c(){for(let D=0;D{Ee=null}),La())},i(ye){Ze||(St(W.$$.fragment,ye),St(he.$$.fragment,ye),St(Ee),Ze=!0)},o(ye){Ot(W.$$.fragment,ye),Ot(he.$$.fragment,ye),Ot(Ee),Ze=!1},d(ye){ye&&(zt(g),zt(w),zt(I),zt(D),zt(U),zt(k),zt($),zt(me),zt(ge)),yr(W,ye),yr(he,ye),Ee&&Ee.d(ye)}}}function sv(h){let m,g,w;return g=new z_({props:{style:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",attributionControl:!1,zoomOnDoubleClick:!1,zoom:14,center:[5.325,60.391],interactive:!0,$$slots:{default:[nv,({map:S})=>({10:S}),({map:S})=>S?1024:0]},$$scope:{ctx:h}}}),{c(){m=yn("div"),Lr(g.$$.fragment)},m(S,I){Rt(S,m,I),_r(g,m,null),w=!0},p(S,[I]){const D={};I&33799&&(D.$$scope={dirty:I,ctx:S}),g.$set(D)},i(S){w||(St(g.$$.fragment,S),w=!0)},o(S){Ot(g.$$.fragment,S),w=!1},d(S){S&&zt(m),yr(g)}}}function ov(h,m,g){let w,S,I;setInterval(()=>0,100);let D=Dr({});gr(h,D,he=>g(2,I=he)),Jy({client:Xp(),query:Gp` + query { + vehicles(codespaceId:"SKY") { + vehicleId + line { + lineRef + lineName + publicCode + } + lastUpdated + location { + latitude + longitude + } + bearing + occupancy + originName + destinationName + vehicleStatus + + } + } + `}).subscribe(he=>{if(he.data)for(const me of he.data.vehicles.filter(ge=>["AT_ORIGIN","IN_PROGRESS","OFF_ROUTE"].includes(ge.vehicleStatus)))D.update(ge=>(ge[me.vehicleId]=me,ge))});const U=Ky({client:Xp(),query:Gp` + subscription { + vehicles(codespaceId:"SKY") { + vehicleId + line { + lineRef + lineName + publicCode + } + lastUpdated + location { + latitude + longitude + } + bearing + occupancy + originName + destinationName + vehicleStatus + } + } + `},(he,me)=>{for(const ge of me.vehicles)D.update(Ze=>(Ze[ge.vehicleId]=ge,Ze))});gr(h,U,he=>g(1,S=he));const k=()=>g(0,w=50),W=()=>g(0,w=35),$=()=>g(0,w=20);return g(0,w=30),[w,S,I,D,U,k,W,$]}let av=class extends tn{constructor(m){super(),en(this,m,ov,sv,Gr,{})}};function lv(h,m){if(!!!h)throw new Error(m)}const jf={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},cv=new Set(Object.keys(jf));function Jp(h){const m=h==null?void 0:h.kind;return typeof m=="string"&&cv.has(m)}var Kp;(function(h){h.QUERY="query",h.MUTATION="mutation",h.SUBSCRIPTION="subscription"})(Kp||(Kp={}));var Qc;(function(h){h.NAME="Name",h.DOCUMENT="Document",h.OPERATION_DEFINITION="OperationDefinition",h.VARIABLE_DEFINITION="VariableDefinition",h.SELECTION_SET="SelectionSet",h.FIELD="Field",h.ARGUMENT="Argument",h.FRAGMENT_SPREAD="FragmentSpread",h.INLINE_FRAGMENT="InlineFragment",h.FRAGMENT_DEFINITION="FragmentDefinition",h.VARIABLE="Variable",h.INT="IntValue",h.FLOAT="FloatValue",h.STRING="StringValue",h.BOOLEAN="BooleanValue",h.NULL="NullValue",h.ENUM="EnumValue",h.LIST="ListValue",h.OBJECT="ObjectValue",h.OBJECT_FIELD="ObjectField",h.DIRECTIVE="Directive",h.NAMED_TYPE="NamedType",h.LIST_TYPE="ListType",h.NON_NULL_TYPE="NonNullType",h.SCHEMA_DEFINITION="SchemaDefinition",h.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",h.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",h.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",h.FIELD_DEFINITION="FieldDefinition",h.INPUT_VALUE_DEFINITION="InputValueDefinition",h.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",h.UNION_TYPE_DEFINITION="UnionTypeDefinition",h.ENUM_TYPE_DEFINITION="EnumTypeDefinition",h.ENUM_VALUE_DEFINITION="EnumValueDefinition",h.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",h.DIRECTIVE_DEFINITION="DirectiveDefinition",h.SCHEMA_EXTENSION="SchemaExtension",h.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",h.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",h.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",h.UNION_TYPE_EXTENSION="UnionTypeExtension",h.ENUM_TYPE_EXTENSION="EnumTypeExtension",h.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(Qc||(Qc={}));function $p(h){return h===9||h===32}function uv(h,m){const g=h.replace(/"""/g,'\\"""'),w=g.split(/\r\n|[\n\r]/g),S=w.length===1,I=w.length>1&&w.slice(1).every(me=>me.length===0||$p(me.charCodeAt(0))),D=g.endsWith('\\"""'),o=h.endsWith('"')&&!D,U=h.endsWith("\\"),k=o||U,W=!(m!=null&&m.minimize)&&(!S||h.length>70||k||I||D);let $="";const he=S&&$p(h.charCodeAt(0));return(W&&!he||I)&&($+=` +`),$+=g,(W||k)&&($+=` +`),'"""'+$+'"""'}const hv=10,qf=2;function dv(h){return ru(h,[])}function ru(h,m){switch(typeof h){case"string":return JSON.stringify(h);case"function":return h.name?`[function ${h.name}]`:"[function]";case"object":return pv(h,m);default:return String(h)}}function pv(h,m){if(h===null)return"null";if(m.includes(h))return"[Circular]";const g=[...m,h];if(fv(h)){const w=h.toJSON();if(w!==h)return typeof w=="string"?w:ru(w,g)}else if(Array.isArray(h))return gv(h,g);return mv(h,g)}function fv(h){return typeof h.toJSON=="function"}function mv(h,m){const g=Object.entries(h);return g.length===0?"{}":m.length>qf?"["+_v(h)+"]":"{ "+g.map(([S,I])=>S+": "+ru(I,m)).join(", ")+" }"}function gv(h,m){if(h.length===0)return"[]";if(m.length>qf)return"[Array]";const g=Math.min(hv,h.length),w=h.length-g,S=[];for(let I=0;I1&&S.push(`... ${w} more items`),"["+S.join(", ")+"]"}function _v(h){const m=Object.prototype.toString.call(h).replace(/^\[object /,"").replace(/]$/,"");if(m==="Object"&&typeof h.constructor=="function"){const g=h.constructor.name;if(typeof g=="string"&&g!=="")return g}return m}function yv(h){return`"${h.replace(vv,xv)}"`}const vv=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function xv(h){return bv[h.charCodeAt(0)]}const bv=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],wv=Object.freeze({});function Tv(h,m,g=jf){const w=new Map;for(const Ve of Object.values(Qc))w.set(Ve,Ev(m,Ve));let S,I=Array.isArray(h),D=[h],o=-1,U=[],k=h,W,$;const he=[],me=[];do{o++;const Ve=o===D.length,Ae=Ve&&U.length!==0;if(Ve){if(W=me.length===0?void 0:he[he.length-1],k=$,$=me.pop(),Ae)if(I){k=k.slice();let ye=0;for(const[qe,Gt]of U){const wt=qe-ye;Gt===null?(k.splice(wt,1),ye++):k[wt]=Gt}}else{k=Object.defineProperties({},Object.getOwnPropertyDescriptors(k));for(const[ye,qe]of U)k[ye]=qe}o=S.index,D=S.keys,U=S.edits,I=S.inArray,S=S.prev}else if($){if(W=I?o:D[o],k=$[W],k==null)continue;he.push(W)}let Se;if(!Array.isArray(k)){var ge,Ze;Jp(k)||lv(!1,`Invalid AST Node: ${dv(k)}.`);const ye=Ve?(ge=w.get(k.kind))===null||ge===void 0?void 0:ge.leave:(Ze=w.get(k.kind))===null||Ze===void 0?void 0:Ze.enter;if(Se=ye==null?void 0:ye.call(m,k,W,$,he,me),Se===wv)break;if(Se===!1){if(!Ve){he.pop();continue}}else if(Se!==void 0&&(U.push([W,Se]),!Ve))if(Jp(Se))k=Se;else{he.pop();continue}}if(Se===void 0&&Ae&&U.push([W,k]),Ve)he.pop();else{var Ee;S={inArray:I,index:o,keys:D,edits:U,prev:S},I=Array.isArray(k),D=I?k:(Ee=g[k.kind])!==null&&Ee!==void 0?Ee:[],o=-1,U=[],$&&me.push($),$=k}}while(S!==void 0);return U.length!==0?U[U.length-1][1]:h}function Ev(h,m){const g=h[m];return typeof g=="object"?g:typeof g=="function"?{enter:g,leave:void 0}:{enter:h.enter,leave:h.leave}}function Sv(h){return Tv(h,Av)}const Iv=80,Av={Name:{leave:h=>h.value},Variable:{leave:h=>"$"+h.name},Document:{leave:h=>it(h.definitions,` + +`)},OperationDefinition:{leave(h){const m=Pt("(",it(h.variableDefinitions,", "),")"),g=it([h.operation,it([h.name,m]),it(h.directives," ")]," ");return(g==="query"?"":g+" ")+h.selectionSet}},VariableDefinition:{leave:({variable:h,type:m,defaultValue:g,directives:w})=>h+": "+m+Pt(" = ",g)+Pt(" ",it(w," "))},SelectionSet:{leave:({selections:h})=>Mn(h)},Field:{leave({alias:h,name:m,arguments:g,directives:w,selectionSet:S}){const I=Pt("",h,": ")+m;let D=I+Pt("(",it(g,", "),")");return D.length>Iv&&(D=I+Pt(`( +`,Gc(it(g,` +`)),` +)`)),it([D,it(w," "),S]," ")}},Argument:{leave:({name:h,value:m})=>h+": "+m},FragmentSpread:{leave:({name:h,directives:m})=>"..."+h+Pt(" ",it(m," "))},InlineFragment:{leave:({typeCondition:h,directives:m,selectionSet:g})=>it(["...",Pt("on ",h),it(m," "),g]," ")},FragmentDefinition:{leave:({name:h,typeCondition:m,variableDefinitions:g,directives:w,selectionSet:S})=>`fragment ${h}${Pt("(",it(g,", "),")")} on ${m} ${Pt("",it(w," ")," ")}`+S},IntValue:{leave:({value:h})=>h},FloatValue:{leave:({value:h})=>h},StringValue:{leave:({value:h,block:m})=>m?uv(h):yv(h)},BooleanValue:{leave:({value:h})=>h?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:h})=>h},ListValue:{leave:({values:h})=>"["+it(h,", ")+"]"},ObjectValue:{leave:({fields:h})=>"{"+it(h,", ")+"}"},ObjectField:{leave:({name:h,value:m})=>h+": "+m},Directive:{leave:({name:h,arguments:m})=>"@"+h+Pt("(",it(m,", "),")")},NamedType:{leave:({name:h})=>h},ListType:{leave:({type:h})=>"["+h+"]"},NonNullType:{leave:({type:h})=>h+"!"},SchemaDefinition:{leave:({description:h,directives:m,operationTypes:g})=>Pt("",h,` +`)+it(["schema",it(m," "),Mn(g)]," ")},OperationTypeDefinition:{leave:({operation:h,type:m})=>h+": "+m},ScalarTypeDefinition:{leave:({description:h,name:m,directives:g})=>Pt("",h,` +`)+it(["scalar",m,it(g," ")]," ")},ObjectTypeDefinition:{leave:({description:h,name:m,interfaces:g,directives:w,fields:S})=>Pt("",h,` +`)+it(["type",m,Pt("implements ",it(g," & ")),it(w," "),Mn(S)]," ")},FieldDefinition:{leave:({description:h,name:m,arguments:g,type:w,directives:S})=>Pt("",h,` +`)+m+(Qp(g)?Pt(`( +`,Gc(it(g,` +`)),` +)`):Pt("(",it(g,", "),")"))+": "+w+Pt(" ",it(S," "))},InputValueDefinition:{leave:({description:h,name:m,type:g,defaultValue:w,directives:S})=>Pt("",h,` +`)+it([m+": "+g,Pt("= ",w),it(S," ")]," ")},InterfaceTypeDefinition:{leave:({description:h,name:m,interfaces:g,directives:w,fields:S})=>Pt("",h,` +`)+it(["interface",m,Pt("implements ",it(g," & ")),it(w," "),Mn(S)]," ")},UnionTypeDefinition:{leave:({description:h,name:m,directives:g,types:w})=>Pt("",h,` +`)+it(["union",m,it(g," "),Pt("= ",it(w," | "))]," ")},EnumTypeDefinition:{leave:({description:h,name:m,directives:g,values:w})=>Pt("",h,` +`)+it(["enum",m,it(g," "),Mn(w)]," ")},EnumValueDefinition:{leave:({description:h,name:m,directives:g})=>Pt("",h,` +`)+it([m,it(g," ")]," ")},InputObjectTypeDefinition:{leave:({description:h,name:m,directives:g,fields:w})=>Pt("",h,` +`)+it(["input",m,it(g," "),Mn(w)]," ")},DirectiveDefinition:{leave:({description:h,name:m,arguments:g,repeatable:w,locations:S})=>Pt("",h,` +`)+"directive @"+m+(Qp(g)?Pt(`( +`,Gc(it(g,` +`)),` +)`):Pt("(",it(g,", "),")"))+(w?" repeatable":"")+" on "+it(S," | ")},SchemaExtension:{leave:({directives:h,operationTypes:m})=>it(["extend schema",it(h," "),Mn(m)]," ")},ScalarTypeExtension:{leave:({name:h,directives:m})=>it(["extend scalar",h,it(m," ")]," ")},ObjectTypeExtension:{leave:({name:h,interfaces:m,directives:g,fields:w})=>it(["extend type",h,Pt("implements ",it(m," & ")),it(g," "),Mn(w)]," ")},InterfaceTypeExtension:{leave:({name:h,interfaces:m,directives:g,fields:w})=>it(["extend interface",h,Pt("implements ",it(m," & ")),it(g," "),Mn(w)]," ")},UnionTypeExtension:{leave:({name:h,directives:m,types:g})=>it(["extend union",h,it(m," "),Pt("= ",it(g," | "))]," ")},EnumTypeExtension:{leave:({name:h,directives:m,values:g})=>it(["extend enum",h,it(m," "),Mn(g)]," ")},InputObjectTypeExtension:{leave:({name:h,directives:m,fields:g})=>it(["extend input",h,it(m," "),Mn(g)]," ")}};function it(h,m=""){var g;return(g=h==null?void 0:h.filter(w=>w).join(m))!==null&&g!==void 0?g:""}function Mn(h){return Pt(`{ +`,Gc(it(h,` +`)),` +}`)}function Pt(h,m,g=""){return m!=null&&m!==""?h+m+g:""}function Gc(h){return Pt(" ",h.replace(/\n/g,` + `))}function Qp(h){var m;return(m=h==null?void 0:h.some(g=>g.includes(` +`)))!==null&&m!==void 0?m:!1}const Cv=Object.freeze(Object.defineProperty({__proto__:null,print:Sv},Symbol.toStringTag,{value:"Module"}));function kv(h,m){let g=null;for(const S of h.definitions)if(S.kind===Qc.OPERATION_DEFINITION){var w;if(m==null){if(g)return null;g=S}else if(((w=S.name)===null||w===void 0?void 0:w.value)===m)return S}return g}const Mv=Object.freeze(Object.defineProperty({__proto__:null,getOperationAST:kv},Symbol.toStringTag,{value:"Module"}));var Vh={},Pv=Ba;function Ba(h){h=h||{},this.ms=h.min||100,this.max=h.max||1e4,this.factor=h.factor||2,this.jitter=h.jitter>0&&h.jitter<=1?h.jitter:0,this.attempts=0}Ba.prototype.duration=function(){var h=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var m=Math.random(),g=Math.floor(m*this.jitter*h);h=Math.floor(m*10)&1?h+g:h-g}return Math.min(h,this.max)|0};Ba.prototype.reset=function(){this.attempts=0};Ba.prototype.setMin=function(h){this.ms=h};Ba.prototype.setMax=function(h){this.max=h};Ba.prototype.setJitter=function(h){this.jitter=h};var Gf={exports:{}};(function(h){var m=Object.prototype.hasOwnProperty,g="~";function w(){}Object.create&&(w.prototype=Object.create(null),new w().__proto__||(g=!1));function S(U,k,W){this.fn=U,this.context=k,this.once=W||!1}function I(U,k,W,$,he){if(typeof W!="function")throw new TypeError("The listener must be a function");var me=new S(W,$||U,he),ge=g?g+k:k;return U._events[ge]?U._events[ge].fn?U._events[ge]=[U._events[ge],me]:U._events[ge].push(me):(U._events[ge]=me,U._eventsCount++),U}function D(U,k){--U._eventsCount===0?U._events=new w:delete U._events[k]}function o(){this._events=new w,this._eventsCount=0}o.prototype.eventNames=function(){var k=[],W,$;if(this._eventsCount===0)return k;for($ in W=this._events)m.call(W,$)&&k.push(g?$.slice(1):$);return Object.getOwnPropertySymbols?k.concat(Object.getOwnPropertySymbols(W)):k},o.prototype.listeners=function(k){var W=g?g+k:k,$=this._events[W];if(!$)return[];if($.fn)return[$.fn];for(var he=0,me=$.length,ge=new Array(me);he0&&I[I.length-1])&&(k[0]===6||k[0]===2)){g=0;continue}if(k[0]===3&&(!I||k[1]>I[0]&&k[1]0){var W=D.shift();W&&W.applyMiddleware.apply(o,[m,U])}else w(m)};U()};I(ef([],g.middlewares,!0),g)})},h.prototype.use=function(m){var g=this;return m.map(function(w){if(typeof w.applyMiddleware=="function")g.middlewares.push(w);else throw new Error("Middleware must implement the applyMiddleware function.")}),this},h.prototype.getConnectionParams=function(m){return function(){return new Promise(function(g,w){if(typeof m=="function")try{return g(m.call(null))}catch(S){return w(S)}g(m)})}},h.prototype.executeOperation=function(m,g){var w=this;this.client===null&&this.connect();var S=this.generateOperationId();return this.operations[S]={options:m,handler:g},this.applyMiddlewares(m).then(function(I){w.checkOperationOptions(I,g),w.operations[S]&&(w.operations[S]={options:I,handler:g},w.sendMessage(S,zr.default.GQL_START,I))}).catch(function(I){w.unsubscribe(S),g(w.formatErrors(I))}),S},h.prototype.getObserver=function(m,g,w){return typeof m=="function"?{next:function(S){return m(S)},error:function(S){return g&&g(S)},complete:function(){return w&&w()}}:m},h.prototype.createMaxConnectTimeGenerator=function(){var m=this.minWsTimeout,g=this.wsTimeout;return new rf({min:m,max:g,factor:1.2})},h.prototype.clearCheckConnectionInterval=function(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)},h.prototype.clearMaxConnectTimeout=function(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)},h.prototype.clearTryReconnectTimeout=function(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)},h.prototype.clearInactivityTimeout=function(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)},h.prototype.setInactivityTimeout=function(){var m=this;this.inactivityTimeout>0&&Object.keys(this.operations).length===0&&(this.inactivityTimeoutId=setTimeout(function(){Object.keys(m.operations).length===0&&m.close()},this.inactivityTimeout))},h.prototype.checkOperationOptions=function(m,g){var w=m.query,S=m.variables,I=m.operationName;if(!w)throw new Error("Must provide a query.");if(!g)throw new Error("Must provide an handler.");if(!(0,nf.default)(w)&&!(0,$v.getOperationAST)(w,I)||I&&!(0,nf.default)(I)||S&&!(0,Jv.default)(S))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")},h.prototype.buildMessage=function(m,g,w){var S=w&&w.query?wa(wa({},w),{query:typeof w.query=="string"?w.query:(0,Kv.print)(w.query)}):w;return{id:m,type:g,payload:S}},h.prototype.formatErrors=function(m){return Array.isArray(m)?m:m&&m.errors?this.formatErrors(m.errors):m&&m.message?[m]:[{name:"FormatedError",message:"Unknown error",originalError:m}]},h.prototype.sendMessage=function(m,g,w){this.sendMessageRaw(this.buildMessage(m,g,w))},h.prototype.sendMessageRaw=function(m){switch(this.status){case this.wsImpl.OPEN:var g=JSON.stringify(m);try{JSON.parse(g)}catch{this.eventEmitter.emit("error",new Error("Message must be JSON-serializable. Got: "+m))}this.client.send(g);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(m);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(m)))}},h.prototype.generateOperationId=function(){return String(++this.nextOperationId)},h.prototype.tryReconnect=function(){var m=this;if(!(!this.reconnect||this.backoff.attempts>=this.reconnectionAttempts)){this.reconnecting||(Object.keys(this.operations).forEach(function(w){m.unsentMessagesQueue.push(m.buildMessage(w,zr.default.GQL_START,m.operations[w].options))}),this.reconnecting=!0),this.clearTryReconnectTimeout();var g=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout(function(){m.connect()},g)}},h.prototype.flushUnsentMessagesQueue=function(){var m=this;this.unsentMessagesQueue.forEach(function(g){m.sendMessageRaw(g)}),this.unsentMessagesQueue=[]},h.prototype.checkConnection=function(){if(this.wasKeepAliveReceived){this.wasKeepAliveReceived=!1;return}this.reconnecting||this.close(!1,!0)},h.prototype.checkMaxConnectTimeout=function(){var m=this;this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout(function(){m.status!==m.wsImpl.OPEN&&(m.reconnecting=!0,m.close(!1,!0))},this.maxConnectTimeGenerator.duration())},h.prototype.connect=function(){var m,g=this;this.client=new((m=this.wsImpl).bind.apply(m,ef([void 0,this.url,this.wsProtocols],this.wsOptionArguments,!1))),this.checkMaxConnectTimeout(),this.client.onopen=function(){return Xv(g,void 0,void 0,function(){var w,S;return Wv(this,function(I){switch(I.label){case 0:if(this.status!==this.wsImpl.OPEN)return[3,4];this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting"),I.label=1;case 1:return I.trys.push([1,3,,4]),[4,this.connectionParams()];case 2:return w=I.sent(),this.sendMessage(void 0,zr.default.GQL_CONNECTION_INIT,w),this.flushUnsentMessagesQueue(),[3,4];case 3:return S=I.sent(),this.sendMessage(void 0,zr.default.GQL_CONNECTION_ERROR,S),this.flushUnsentMessagesQueue(),[3,4];case 4:return[2]}})})},this.client.onclose=function(){g.closedByUser||g.close(!1,!1)},this.client.onerror=function(w){g.eventEmitter.emit("error",w)},this.client.onmessage=function(w){var S=w.data;g.processReceivedData(S)}},h.prototype.processReceivedData=function(m){var g,w;try{g=JSON.parse(m),w=g.id}catch{throw new Error("Message must be JSON-parseable. Got: "+m)}if([zr.default.GQL_DATA,zr.default.GQL_COMPLETE,zr.default.GQL_ERROR].indexOf(g.type)!==-1&&!this.operations[w]){this.unsubscribe(w);return}switch(g.type){case zr.default.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(g.payload);break;case zr.default.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected",g.payload),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case zr.default.GQL_COMPLETE:var S=this.operations[w].handler;delete this.operations[w],S.call(this,null,null);break;case zr.default.GQL_ERROR:this.operations[w].handler(this.formatErrors(g.payload),null),delete this.operations[w];break;case zr.default.GQL_DATA:var I=g.payload.errors?wa(wa({},g.payload),{errors:this.formatErrors(g.payload.errors)}):g.payload;this.operations[w].handler(null,I);break;case zr.default.GQL_CONNECTION_KEEP_ALIVE:var D=typeof this.wasKeepAliveReceived>"u";this.wasKeepAliveReceived=!0,D&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}},h.prototype.unsubscribe=function(m){this.operations[m]&&(delete this.operations[m],this.setInactivityTimeout(),this.sendMessage(m,zr.default.GQL_STOP,void 0))},h}();Zf=Vh.SubscriptionClient=tx;function ix(h){let m,g,w;return g=new av({}),{c(){m=yn("main"),Lr(g.$$.fragment)},m(S,I){Rt(S,m,I),_r(g,m,null),w=!0},p:Pn,i(S){w||(St(g.$$.fragment,S),w=!0)},o(S){Ot(g.$$.fragment,S),w=!1},d(S){S&&zt(m),yr(g)}}}function rx(h){let m=new Zf("wss://api.entur.io/realtime/v1/vehicles/subscriptions",{reconnect:!0}),g=new Yy({url:"https://api.entur.io/realtime/v1/vehicles/graphql",exchanges:[Xy,Gy,Zy({forwardSubscription(w){return m.request(w)}})]});return $y(g),[]}class nx extends tn{constructor(m){super(),en(this,m,rx,ix,Gr,{})}}new nx({target:document.getElementById("app")})});export default sx(); diff --git a/skyss/index.html b/skyss/index.html index f7ae250..a98ab6a 100644 --- a/skyss/index.html +++ b/skyss/index.html @@ -5,8 +5,8 @@ Skyss Live Map - - + +