vendor: 4,261 bytes, line 1
1import{S as Z_,i as $_,s as q_,l as df,a as X_,U as W_,m as ff,h as Ol,c as H_,n as Y_,p as yu,G as K_,b as mf,N as Nh,V as J_,o as Q_,ai as eg}from"./index-01b7e0e5.js";import{v as tg,i as ig}from"./helpers-4812d57d.js";import{m as rg}from"./map-b48775aa.js";var yf={exports:{}};(function(yr,wt){(function(ri,xi){yr.exports=xi()})(tg,function(){var ri,xi,Qt;function zi(a,Se){if(!ri)ri=Se;else if(!xi)xi=Se;else{var or="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+ri+")(sharedChunk); ("+xi+")(sharedChunk); self.onerror = null;",di={};ri(di),Qt=Se(di),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Qt.workerUrl=window.URL.createObjectURL(new Blob([or],{type:"text/javascript"})))}}zi(["exports"],function(a){var Se=typeof self<"u"?self:{},or=di;function di(i,e,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=n,this.p2x=r,this.p2y=n}di.prototype.sampleCurveX=function(i){return((this.ax*i+this.bx)*i+this.cx)*i},di.prototype.sampleCurveY=function(i){return((this.ay*i+this.by)*i+this.cy)*i},di.prototype.sampleCurveDerivativeX=function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},di.prototype.solveCurveX=function(i,e){var r,n,s,c,h;for(e===void 0&&(e=1e-6),s=i,h=0;h<8;h++){if(c=this.sampleCurveX(s)-i,Math.abs(c)<e)return s;var d=this.sampleCurveDerivativeX(s);if(Math.abs(d)<1e-6)break;s-=c/d}if((s=i)<(r=0))return r;if(s>(n=1))return n;for(;r<n;){if(c=this.sampleCurveX(s),Math.abs(c-i)<e)return s;i>c?r=s:n=s,s=.5*(n-r)+r}return s},di.prototype.solve=function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))};var Me=Xe;function Xe(i,e){this.x=i,this.y=e}Xe.prototype={clone:function(){return new Xe(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(i,e){var r=Math.cos(i),n=Math.sin(i),s=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Xe.convert=function(i){return i instanceof Xe?i:Array.isArray(i)?new Xe(i[0],i[1]):i};const kt=Math.PI/180,Lt=180/Math.PI;function Ye(i){return i*kt}function ni(i){return i*Lt}const en=[[0,0],[1,0],[1,1],[0,1]];function mo(i){if(i<=0)return 0;if(i>=1)return 1;const e=i*i,r=e*i;
1return 4*(i<.5?r:3*(i-e)+r-.75)}function tn(i,e,r,n){const s=new or(i,e,r,n);return function(c){return s.solve(c)}}const In=tn(.25,.1,.25,1);function Qe(i,e,r){return Math.min(r,Math.max(e,i))}function sr(i,e,r){return(r=Qe((r-i)/(e-i),0,1))*r*(3-2*r)}function Fr(i,e,r){const n=r-e,s=((i-e)%n+n)%n+e;return s===e?r:s}function Or(i,e,r){if(!i.length)return r(null,[]);let n=i.length;const s=new Array(i.length);let c=null;i.forEach((h,d)=>{e(h,(m,_)=>{m&&(c=m),s[d]=_,--n==0&&r(c,s)})})}function An(i){const e=[];for(const r in i)e.push(i[r]);return e}function oi(i,...e){for(const r of e)for(const n in r)i[n]=r[n];return i}let wa=1;function Cn(){return wa++}function zn(){return function i(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function us(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function hs(i){return!!i&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i)}function Ur(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function kn(i,e){return i.indexOf(e,i.length-e.length)!==-1}function ar(i,e,r){const n={};for(const s in i)n[s]=e.call(r||this,i[s],s,i);return n}function rn(i,e,r){const n={};for(const s in i)e.call(r||this,i[s],s,i)&&(n[s]=i[s]);return n}function Oi(i){return Array.isArray(i)?i.map(Oi):typeof i=="object"&&i?ar(i,Oi):i}const _o={};function Nt(i){_o[i]||(typeof console<"u"&&console.warn(i),_o[i]=!0)}function fi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function xr(i){let e=0;for(let r,n,s=0,c=i.length,h=c-1;s<c;h=s++)r=i[s],n=i[h],e+=(n.x-r.x)*(r.y+n.y);return e}function ki(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function vr(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,n,s,c)=>{const h=s||c;return e[n]=!h||h.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let br=null;function Pn(i){if(br==null){const e=i.navigator?i.navigator.userAgent:null;br=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return br}function go(i){try{const e=Se[i];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}function wr(i,e){return[i[4*e],i[4*e+1],i[4*e+2],i[4*e+3]]}const ps=Se.performance;function nn(i){const e=i?i.url.toString():void 0;return ps.getEntriesByName(e)}var on="2.9.2";let pt,Tr,sn,lr;const Ui={now:()=>sn!==void 0?sn:Se.performance.now(),setNow(i){sn=i},restoreNow(){sn=void 0},frame(i){const e=Se.requestAnimationFrame(i);return{cancel:()=>Se.cancelAnimationFrame(e)}},getImageData(i,e=0){const{width:r,height:n}=i;lr||(lr=Se.document.createElement("canvas"));const s=lr.getContext("2d");if(!s)throw new Error("failed to create canvas 2d context");return(r>lr.width||n>lr.height)&&(lr.width=r,lr.height=n),s.clearRect(-e,-e,r+2*e,n+2*e),s.drawImage(i,0,0,r,n),s.getImageData(-e,-e,r+2*e,n+2*e)},resolveURL:i=>(pt||(pt=Se.document.createElement("a")),pt.href=i,pt.href),get devicePixelRatio(){return Se.devicePixelRatio},get prefersReducedMotion(){return!!Se.matchMedia&&(Tr==null&&(Tr=Se.matchMedia("(prefers-reduced-motion: reduce)")),Tr.matches)}};let Dn;const ut={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(Dn==null){const i=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Dn=process.env.API_URL_REGEX!=null?new RegExp(process.env.API_URL_REGEX):i}catch{Dn=i}}return Dn},get EVENTS_URL(){return this.API_URL?this.API_URL.indexOf("https://api.mapbox.cn")===0?"https://events.mapbox.cn/events/v2":this.API_URL.indexOf("https://api.mapbox.com")===0?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},Vr={supported:!1,testSupport:function(i){!an&&Sr&&(Ln?yo(i):Er=i)}};let Er,Sr,an=!1,Ln=!1;function yo(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Sr),i.isContextLost())return;Vr.supported=!0}
1catch{}i.deleteTexture(e),an=!0}Se.document&&(Sr=Se.document.createElement("img"),Sr.onload=function(){Er&&yo(Er),Er=null,Ln=!0},Sr.onerror=function(){an=!0,Er=null},Sr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const xo="01",Pi="NO_ACCESS_TOKEN";function cr(i){return i.indexOf("mapbox:")===0}function ln(i){return ut.API_URL_REGEX.test(i)}const ds=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Di(i){const e=i.match(ds);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Mr(i){const e=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${e}`}function fs(i){if(!i)return null;const e=i.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(Se.atob(e[1]).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class vo{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const r=fs(ut.ACCESS_TOKEN);let n="";return n=r&&r.u?Se.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(s,c)=>String.fromCharCode(Number("0x"+c)))):ut.ACCESS_TOKEN||"",e?`mapbox.eventData.${e}:${n}`:`mapbox.eventData:${n}`}fetchEventData(){const e=go("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const s=Se.localStorage.getItem(r);s&&(this.eventData=JSON.parse(s));const c=Se.localStorage.getItem(n);c&&(this.anonId=c)}catch{Nt("Unable to read from LocalStorage")}}saveEventData(){const e=go("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{Se.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&Se.localStorage.setItem(r,JSON.stringify(this.eventData))}catch{Nt("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,r,n,s){if(!ut.EVENTS_URL)return;const c=Di(ut.EVENTS_URL);c.params.push(`access_token=${s||ut.ACCESS_TOKEN||""}`);const h={event:this.type,created:new Date(e).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:on,skuId:xo,userId:this.anonId},d=r?oi(h,r):h,m={url:Mr(c),headers:{"Content-Type":"text/plain"},body:JSON.stringify([d])};this.pendingRequest=oe(m,_=>{this.pendingRequest=null,n(_),this.saveEventData(),this.processRequests(s)})}queueRequest(e,r){this.queue.push(e),this.processRequests(r)}}const bo=new class extends vo{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,e){ut.EVENTS_URL&&ut.ACCESS_TOKEN&&Array.isArray(i)&&i.some(r=>cr(r)||ln(r))&&this.queueRequest(Date.now(),e)}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=fs(ut.ACCESS_TOKEN),r=e?e.u:ut.ACCESS_TOKEN;let n=r!==this.eventData.tokenU;hs(this.anonId)||(this.anonId=zn(),n=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const c=new Date(this.eventData.lastSuccess),h=new Date(s),d=(s-this.eventData.lastSuccess)/864e5;n=n||d>=1||d<-1||c.getDate()!==h.getDate()}else n=!0;n?this.postEvent(s,{"enabled.telemetry":!1},c=>{c||(this.eventData.lastSuccess=s,this.eventData.tokenU=r)},i):this.processRequests()}},wo=bo.postTurnstileEvent.bind(bo),To=new class extends vo{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,e,r,n){this.skuToken=e,this.errorCb=n,ut.EVENTS_URL&&(r||ut.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},r):this.errorCb(new Error(Pi)))}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:r}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),hs(this.anonId)||(this.anonId=zn()),this.postEvent(r,{skuToken:this.skuToken},n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},i))}},ms=To.postMapLoadEvent.bind(To),_s=new class extends vo{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,e,r,n){if(!ut.API_URL||!ut.SESSION_PATH)return;const s=Di(ut.API_URL+ut.SESSION_PATH);s.params.push(`sku=${e||""}`),s.params.push(`access_token=${n||ut.ACCESS_TOKEN||""}`);const c={url:Mr(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=ye(c,h=>{this.pendingRequest=null,r(h),this.saveEventData(),this.processRequests(n)})}getSessionAPI(i,e,r,n){this.skuToken=e,this.errorCb=n,ut.SESSION_PATH&&ut.API_URL&&(r||ut.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},r):this.errorCb(new Error(Pi)))}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:r}=this.queue.shift();
1e&&this.success[e]||this.getSession(r,this.skuToken,n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},i)}},Ta=_s.getSessionAPI.bind(_s),jr=new Set;let Ir,Bn=500,gs=50,wi={};function Eo(i){const e=I(i);let r,n;e&&e.forEach(c=>{const h=c.split("=");h[0]==="language"?r=h[1]:h[0]==="worldview"&&(n=h[1])});let s="mapbox-tiles";return r&&(s+=`-${r}`),n&&(s+=`-${n}`),s}function V(i){Se.caches&&!wi[i]&&(wi[i]=Se.caches.open(i))}function I(i){const e=i.indexOf("?");return e>0?i.slice(e+1).split("&"):[]}function C(i){const e=i.indexOf("?");if(e<0)return i;const r=I(i).filter(n=>{const s=n.split("=");return s[0]==="language"||s[0]==="worldview"});return r.length?`${i.slice(0,e)}?${r.join("&")}`:i.slice(0,e)}let U=1/0;const $={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze($);class J extends Error{constructor(e,r,n){r===401&&ln(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(e),this.status=r,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const ne=ki()?()=>self.worker&&self.worker.referrer:()=>(Se.location.protocol==="blob:"?Se.parent:Se).location.href,ie=function(i,e){if(!(/^file:/.test(r=i.url)||/^file:/.test(ne())&&!/^\w+:/.test(r))){if(Se.fetch&&Se.Request&&Se.AbortController&&Se.Request.prototype.hasOwnProperty("signal"))return function(n,s){const c=new Se.AbortController,h=new Se.Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:ne(),signal:c.signal});let d=!1,m=!1;const _=(x=h.url).indexOf("sku=")>0&&ln(x);var x;n.type==="json"&&h.headers.set("Accept","application/json");const b=(E,M,z)=>{if(m)return;if(E&&E.message!=="SecurityError"&&Nt(E),M&&z)return w(M);const R=Date.now();Se.fetch(h).then(j=>{if(j.ok){const H=_?j.clone():null;return w(j,H,R)}return s(new J(j.statusText,j.status,n.url))}).catch(j=>{j.code!==20&&s(new Error(j.message))})},w=(E,M,z)=>{(n.type==="arrayBuffer"?E.arrayBuffer():n.type==="json"?E.json():E.text()).then(R=>{m||(M&&z&&function(j,H,W){const Y=Eo(j.url);if(V(Y),!wi[Y])return;const Q={status:H.status,statusText:H.statusText,headers:new Se.Headers};H.headers.forEach((pe,me)=>Q.headers.set(me,pe));const te=vr(H.headers.get("Cache-Control")||"");if(te["no-store"])return;te["max-age"]&&Q.headers.set("Expires",new Date(W+1e3*te["max-age"]).toUTCString());const ue=Q.headers.get("Expires");ue&&(new Date(ue).getTime()-W<42e4||function(pe,me){if(Ir===void 0)try{new Response(new ReadableStream),Ir=!0}catch{Ir=!1}Ir?me(pe.body):pe.blob().then(me)}(H,pe=>{const me=new Se.Response(pe,Q);V(Y),wi[Y]&&wi[Y].then(be=>be.put(C(j.url),me)).catch(be=>Nt(be.message))}))}(h,M,z),d=!0,s(null,R,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(R=>{m||s(new Error(R.message))})};return _?function(E,M){const z=Eo(E.url);if(V(z),!wi[z])return M(null);const R=C(E.url);wi[z].then(j=>{j.match(R).then(H=>{const W=function(Y){if(!Y)return!1;const Q=new Date(Y.headers.get("Expires")||0),te=vr(Y.headers.get("Cache-Control")||"");return Q>Date.now()&&!te["no-cache"]}(H);j.delete(R),W&&j.put(R,H.clone()),M(null,H,W)}).catch(M)}).catch(M)}(h,b):b(null,null),{cancel:()=>{m=!0,d||c.abort()}}}(i,e);if(ki()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(n,s){const c=new Se.XMLHttpRequest;c.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(c.responseType="arraybuffer");for(const h in n.headers)c.setRequestHeader(h,n.headers[h]);return n.type==="json"&&(c.responseType="text",c.setRequestHeader("Accept","application/json")),c.withCredentials=n.credentials==="include",c.onerror=()=>{s(new Error(c.statusText))},c.onload=()=>{if((c.status>=200&&c.status<300||c.status===0)&&c.response!==null){let h=c.response;if(n.type==="json")try{h=JSON.parse(c.response)}catch(d){return s(d)}s(null,h,c.getResponseHeader("Cache-Control"),c.getResponseHeader("Expires"))}else s(new J(c.statusText,c.status,n.url))},c.send(n.body),{cancel:()=>c.abort()}}(i,e)},ee=function(i,e){return ie(oi(i,{type:"arrayBuffer"}),e)},oe=function(i,e){return ie(oi(i,{method:"POST"}),e)},ye=function(i,e){return ie(oi(i,{method:"GET"}),e)};function Le(i){const e=Se.document.createElement("a");return e.href=i,e.protocol===Se.document.location.protocol&&e.host===Se.document.location.host}const ve="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Ge,$e;Ge=[],$e=0;
1const Ze=function(i,e){if(Vr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),$e>=ut.MAX_PARALLEL_IMAGE_REQUESTS){const c={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Ge.push(c),c}$e++;let r=!1;const n=()=>{if(!r)for(r=!0,$e--;Ge.length&&$e<ut.MAX_PARALLEL_IMAGE_REQUESTS;){const c=Ge.shift(),{requestParameters:h,callback:d,cancelled:m}=c;m||(c.cancel=Ze(h,d).cancel)}},s=ee(i,(c,h,d,m)=>{n(),c?e(c):h&&(Se.createImageBitmap?function(_,x){const b=new Se.Blob([new Uint8Array(_)],{type:"image/png"});Se.createImageBitmap(b).then(w=>{x(null,w)}).catch(w=>{x(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(_,x)=>e(_,x,d,m)):function(_,x){const b=new Se.Image,w=Se.URL;b.onload=()=>{x(null,b),w.revokeObjectURL(b.src),b.onload=null,Se.requestAnimationFrame(()=>{b.src=ve})},b.onerror=()=>x(new Error("Could not load image. Please make sure to use a supp
1orted image type such as PNG or JPEG. Note that SVGs are not supported."));const E=new Se.Blob([new Uint8Array(_)],{type:"image/png"});b.src=_.byteLength?w.createObjectURL(E):ve}(h,(_,x)=>e(_,x,d,m)))});return{cancel:()=>{s.cancel(),n()}}};function We(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function rt(i,e,r){if(r&&r[i]){const n=r[i].indexOf(e);n!==-1&&r[i].splice(n,1)}}class _t{constructor(e,r={}){oi(this,r),this.type=e}}class zt extends _t{constructor(e,r={}){super("error",oi({error:e},r))}}class bt{on(e,r){return this._listeners=this._listeners||{},We(e,r,this._listeners),this}off(e,r){return rt(e,r,this._listeners),rt(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},We(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new _t(e,r||{}));const n=e.type;if(this.listens(n)){e.target=this;const s=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const d of s)d.call(this,e);const c=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const d of c)rt(n,d,this._oneTimeListeners),d.call(this,e);const h=this._eventedParent;h&&(oi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(e))}else e instanceof zt&&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 r
vendor: 37,643 bytes, line 1
1e=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"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"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"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":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"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"}}}');function
vendor: 370 bytes, line 1
1Li(i,...e){for(const r of e)for(const n in r)i[n]=r[n];return i}function Ft(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Vi(i){if(Array.isArray(i))return i.map(Vi);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Vi(i[r]);return e}return Ft(i)}
vendor: 6,373 bytes, line 1
1class xu extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}var Bi=xu;class ys{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[n,s]of r)this.bindings[n]=s}concat(e){return new ys(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}var Ul=ys;const So={kind:"null"},Pe={kind:"number"},lt={kind:"string"},nt={kind:"boolean"},Qi={kind:"color"},cn={kind:"object"},et={kind:"value"},Ar={kind:"collator"},Rn={kind:"formatted"},Mo={kind:"resolvedImage"};function ji(i,e){return{kind:"array",itemType:i,N:e}}function Ot(i){if(i.kind==="array"){const e=Ot(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Vl=[So,Pe,lt,nt,Qi,Rn,cn,ji(et),Mo];function Fn(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Fn(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 Vl)if(!Fn(r,e))return null}}return`Expected ${Ot(i)} but found ${Ot(e)} instead.`}function xs(i,e){return e.some(r=>r.kind===i.kind)}function On(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 Un(i){var e={exports:{}};return i(e,e.exports),e.exports}var jl=Un(function(i,e){var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function n(d){return(d=Math.round(d))<0?0:d>255?255:d}function s(d){return n(d[d.length-1]==="%"?parseFloat(d)/100*255:parseInt(d))}function c(d){return(m=d[d.length-1]==="%"?parseFloat(d)/100:parseFloat(d))<0?0:m>1?1:m;var m}function h(d,m,_){return _<0?_+=1:_>1&&(_-=1),6*_<1?d+(m-d)*_*6:2*_<1?m:3*_<2?d+(m-d)*(2/3-_)*6:d}try{e.parseCSSColor=function(d){var m,_=d.replace(/ /g,"").toLowerCase();if(_ in r)return r[_].slice();if(_[0]==="#")return _.length===4?(m=parseInt(_.substr(1),16))>=0&&m<=4095?[(3840&m)>>4|(3840&m)>>8,240&m|(240&m)>>4,15&m|(15&m)<<4,1]:null:_.length===7&&(m=parseInt(_.substr(1),16))>=0&&m<=16777215?[(16711680&m)>>16,(65280&m)>>8,255&m,1]:null;var x=_.indexOf("("),b=_.indexOf(")");if(x!==-1&&b+1===_.length){var w=_.substr(0,x),E=_.substr(x+1,b-(x+1)).split(","),M=1;switch(w){case"rgba":if(E.length!==4)return null;M=c(E.pop());case"rgb":return E.length!==3?null:[s(E[0]),s(E[1]),s(E[2]),M];case"hsla":if(E.length!==4)return null;M=c(E.pop());case"hsl":if(E.length!==3)return null;var z=(parseFloat(E[0])%360+360)%360/360,R=c(E[1]),j=c(E[2]),H=j<=.5?j*(R+1):j+R-j*R,W=2*j-H;
1return[n(255*h(W,H,z+1/3)),n(255*h(W,H,z)),n(255*h(W,H,z-1/3)),M];default:return null}}return null}}catch{}});class ei{constructor(e,r,n,s=1){this.r=e,this.g=r,this.b=n,this.a=s}static parse(e){if(!e)return;if(e instanceof ei)return e;if(typeof e!="string")return;const r=jl.parseCSSColor(e);return r?new ei(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,n,s]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(n)},${s})`}toArray(){const{r:e,g:r,b:n,a:s}=this;return s===0?[0,0,0,0]:[255*e/s,255*r/s,255*n/s,s]}toArray01(){const{r:e,g:r,b:n,a:s}=this;return s===0?[0,0,0,0]:[e/s,r/s,n/s,s]}toArray01PremultipliedAlpha(){const{r:e,g:r,b:n,a:s}=this;return[e,r,n,s]}}ei.black=new ei(0,0,0,1),ei.white=new ei(1,1,1,1),ei.transparent=new ei(0,0,0,0),ei.red=new ei(1,0,0,1),ei.blue=new ei(0,0,1,1);var Gt=ei;class Ni{constructor(e,r,n){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Ea{constructor(e,r,n,s,c){this.text=e.normalize?e.normalize():e,this.image=r,this.scale=n,this.fontStack=s,this.textColor=c}}class mi{constructor(e){this.sections=e}static fromString(e){return new mi([new Ea(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 mi?e:mi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const r of this.sections){if(r.image){e.push(["image",r.image.name]);continue}e.push(r.text);const n={};r.fontStack&&(n["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(n["font-scale"]=r.scale),r.textColor&&(n["text-color"]=["rgba"].concat(r.textColor.toArray())),e.push(n)}return e}}class Gi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Gi({name:e,available:!1}):null}serialize(){return["image",this.name]}}function vs(i,e,r,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,r,n]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Io(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Gt||i instanceof Ni||i instanceof mi||i instanceof Gi)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 jt(i){if(i===null)return So;if(typeof i=="string")return lt;if(typeof i=="boolean")return nt;if(typeof i=="number")return Pe;if(i instanceof Gt)return Qi;if(i instanceof Ni)return Ar;if(i instanceof mi)return Rn;if(i instanceof Gi)return Mo;if(Array.isArray(i)){const e=i.length;let r;for(const n of i){const s=jt(n);if(r){if(r===s)continue;r=et;break}r=s}return ji(r||et,e)}return cn}function un(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Gt||i instanceof mi||i instanceof Gi?i.toString():JSON.stringify(i)}class Sa{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 n=e[1];let s=jt(n);const c=r.expectedType;return s.kind!=="array"||s.N!==0||!c||c.kind!=="array"||typeof c.N=="number"&&c.N!==0||(s=c),new Sa(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Gt?["rgba"].concat(this.value.toArray()):this.value instanceof mi?this.value.serialize():this.value}}var Ao=Sa,li=class{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}};const bs={string:lt,number:Pe,boolean:nt,object:cn};class Co{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n,s=1;const c=e[0];if(c==="array"){let d,m;if(e.length>2){const _=e[1];if(typeof _!="string"||!(_ in bs)||_==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);d=bs[_],s++}else d=et;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);m=e[2],s++}
1n=ji(d,m)}else n=bs[c];const h=[];for(;s<e.length;s++){const d=r.parse(e[s],s,et);if(!d)return null;h.push(d)}return new Co(n,h)}evaluate(e){for(let r=0;r<this.args.length;r++){const n=this.args[r].evaluate(e);if(!Fn(this.type,jt(n)))return n;if(r===this.args.length-1)throw new li(`Expected value to be of type ${Ot(this.type)}, but found ${Ot(jt(n))} instead.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,r=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){r.push(n.kind);const s=e.N;(typeof s=="number"||this.args.length>1)&&r.push(s)}}return r.concat(this.args.map(n=>n.serialize()))}}var Cr=Co;class Nr{constructor(e){this.type=Rn,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");const s=[];let c=!1;for(let h=1;h<=e.length-1;++h){const d=e[h];if(c&&typeof d=="object"&&!Array.isArray(d)){c=!1;let m=null;if(d["font-scale"]&&(m=r.parse(d["font-scale"],1,Pe),!m))return null;let _=null;if(d["text-font"]&&(_=r.parse(d["text-font"],1,ji(lt)),!_))return null;let x=null;if(d["text-color"]&&(x=r.parse(d["text-color"],1,Qi),!x))return null;const b=s[s.length-1];b.scale=m,b.font=_,b.textColor=x}else{const m=r.parse(e[h],1,et);if(!m)return null;const _=m.type.kind;if(_!=="string"&&_!=="value"&&_!=="null"&&_!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");c=!0,s.push({content:m,scale:null,font:null,textColor:null})}}return new Nr(s)}evaluate(e){return new mi(this.sections.map(r=>{const n=r.content.evaluate(e);return jt(n)===Mo?new Ea("",n,null,null,null):new Ea(un(n),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const r of this.sections){e.push(r.content.serialize());const n={};r.scale&&(n["font-scale"]=r.scale.serialize()),r.font&&(n["text-font"]=r.font.serialize()),r.textColor&&(n["text-color"]=r.textColor.serialize()),e.push(n)}return e}}class ws{constructor(e){this.type=Mo,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const n=r.parse(e[1],1,lt);return n?new ws(n):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),n=Gi.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const vu={"to-boolean":nt,"to-color":Qi,"to-number":Pe,"to-string":lt};class Ma{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const n=e[0];if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");const s=vu[n],c=[];for(let h=1;h<e.length;h++){const d=r.parse(e[h],h,et);if(!d)return null;c.push(d)}return new Ma(s,c)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,n;for(const s of this.args){if(r=s.evaluate(e),n=null,r instanceof Gt)return r;if(typeof r=="string"){const c=e.parseColor(r);if(c)return c}else if(Array.isArray(r)&&(n=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:vs(r[0],r[1],r[2],r[3]),!n))return new Gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new li(n||`Could not parse color from value '${typeof r=="string"?r:String(JSON.stringify(r))}'`)}if(this.type.kind==="number"){let r=null;for(const n of this.args){if(r=n.evaluate(e),r===null)return 0;const s=Number(r);if(!isNaN(s))return s}throw new li(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?mi.fromString(un(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Gi.fromString(un(this.args[0].evaluate(e))):un(this.args[0].evaluate(e))}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new Nr([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ws(this.args[0]).serialize();const e=[`to-${this.type.kind}`];return this.eachChild(r=>{e.push(r.serialize())}),e}}var Vn=Ma;const bu=["Unknown","Point","LineString","Polygon"];var Nl=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&"id"in this.feature&&this.feature.id?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?bu[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const i=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*e-i[0])+this.featureDistanceData.bearing[1]*(n*e-i[1])}return 0}parseColor(i){let e=this._parseColorCache[i];return e||(e=this._parseColorCache[i]=Gt.parse(i)),e}};class jn{constructor(e,r,n,s){this.name=e,this.type=r,this._evaluate=n,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,r){const n=e[0],s=jn.definitions[n];if(!s)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const c=Array.isArray(s)?s[0]:s.type,h=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,d=h.filter(([_])=>!Array.isArray(_)||_.length===e.length-1);let m=null;for(const[_,x]of d){m=new ql(r.registry,r.path,null,r.scope);const b=[];let w=!1;for(let E=1;E<e.length;E++){const M=e[E],z=Array.isArray(_)?_[E-1]:_.type,R=m.parse(M,1+b.length,z);if(!R){w=!0;break}b.push(R)}if(!w)if(Array.isArray(_)&&_.length!==b.length)m.error(`Expected ${_.length} arguments, but found ${b.length} instead.`);else{for(let E=0;E<b.length;E++){const M=Array.isArray(_)?_[E]:_.type,z=b[E];m.concat(E+1).checkSubtype(M,z.type)}if(m.errors.length===0)return new jn(n,c,x,b)}}if(d.length===1)r.errors.push(...m.errors);else{const _=(d.length?d:h).map(([b])=>{return w=b,Array.isArray(w)?`(${w.map(Ot).join(", ")})`:`(${Ot(w.type)}...)`;var w}).join(" | "),x=[];for(let b=1;b<e.length;b++){const w=r.parse(e[b],1+x.length);if(!w)return null;x.push(Ot(w.type))}r.error(`Expected arguments of type ${_}, but found (${x.join(", ")}) instead.`)}return null}static register(e,r){jn.definitions=r;for(const n in r)e[n]=jn}}var zr=jn;class hn{constructor(e,r,n){this.type=Ar,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");const s=r.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,nt);if(!s)return null;const c=r.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,nt);if(!c)return null;let h=null;return n.locale&&(h=r.parse(n.locale,1,lt),!h)?null:new hn(s,c,h)}evaluate(e){return new Ni(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}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}const Gr=8192;function Ia(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 Ts(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function wu(i,e){const r=(180+i[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,s=Math.pow(2,e.z);return[Math.round(r*s*Gr),Math.round(n*s*Gr)]}function Tu(i,e,r){const n=i[0]-e[0],s=i[1]-e[1],c=i[0]-r[0],h=i[1]-r[1];return n*h-c*s==0&&n*c<=0&&s*h<=0}function Aa(i,e){let r=!1;for(let h=0,d=e.length;h<d;h++){const m=e[h];for(let _=0,x=m.length;_<x-1;_++){if(Tu(i,m[_],m[_+1]))return!1;(s=m[_])[1]>(n=i)[1]!=(c=m[_+1])[1]>n[1]&&n[0]<(c[0]-s[0])*(n[1]-s[1])/(c[1]-s[1])+s[0]&&(r=!r)}}var n,s,c;return r}function Gl(i,e){for(let r=0;r<e.length;r++)if(Aa(i,e[r]))return!0;return!1}function zo(i,e,r,n){const s=n[0]-r[0],c=n[1]-r[1],h=(i[0]-r[0])*c-s*(i[1]-r[1]),d=(e[0]-r[0])*c-s*(e[1]-r[1]);return h>0&&d<0||h<0&&d>0}function Eu(i,e,r){for(const _ of r)for(let x=0;x<_.length-1;++x)if((d=[(h=_[x+1])[0]-(c=_[x])[0],h[1]-c[1]])[0]*(m=[(s=e)[0]-(n=i)[0],s[1]-n[1]])[1]-d[1]*m[0]!=0&&zo(n,s,c,h)&&zo(c,h,n,s))return!0;var n,s,c,h,d,m;return!1}function Zl(i,e){for(let r=0;r<i.length;++r)if(!Aa(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(Eu(i[r],i[r+1],e))return!1;return!0}function Su(i,e){for(let r=0;r<e.length;r++)if(Zl(i,e[r]))return!0;return!1}function Ca(i,e,r){const n=[];for(let s=0;s<i.length;s++){const c=[];for(let h=0;h<i[s].length;h++){const d=wu(i[s][h],r);Ia(e,d),c.push(d)}n.push(c)}return n}function er(i,e,r){const n=[];for(let s=0;s<i.length;s++){const c=Ca(i[s],e,r);n.push(c)}return n}function za(i,e,r,n){if(i[0]<r[0]||i[0]>r[2]){const s=.5*n;let c=i[0]-r[0]>s?-n:r[0]-i[0]>s?n:0;c===0&&(c=i[0]-r[2]>s?-n:r[2]-i[0]>s?n:0),i[0]+=c}Ia(e,i)}function ka(i,e,r,n){const s=Math.pow(2,n.z)*Gr,c=[n.x*Gr,n.y*Gr],h=[];if(!i)return h;for(const d of i)for(const m of d){const _=[m.x+c[0],m.y+c[1]];za(_,e,r,s),h.push(_)}return h}function ko(i,e,r,n){const s=Math.pow(2,n.z)*Gr,c=[n.x*Gr,n.y*Gr],h=[];if(!i)return h;for(const m of i){const _=[];for(const x of m){const b=[x.x+c[0],x.y+c[1]];Ia(e,b),_.push(b)}h.push(_)}if(e[2]-e[0]<=s/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const m of h)for(const _ of m)za(_,e,r,s)}var d;return h}class kr{constructor(e,r){this.type=nt,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 n=e[1];if(n.type==="FeatureCollection")for(let s=0;s<n.features.length;++s){const c=n.features[s].geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new kr(n,n.features[s].geometry)}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new kr(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new kr(n,n)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,n){const s=[1/0,1/0,-1/0,-1/0],c=[1/0,1/0,-1/0,-1/0],h=r.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const d=Ca(n.coordinates,c,h),m=ka(r.geometry(),s,c,h);if(!Ts(s,c))return!1;for(const _ of m)if(!Aa(_,d))return!1}if(n.type==="MultiPolygon"){const d=er(n.coordinates,c,h),m=ka(r.geometry(),s,c,h);if(!Ts(s,c))return!1;for(const _ of m)if(!Gl(_,d))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,n){const s=[1/0,1/0,-1/0,-1/0],c=[1/0,1/0,-1/0,-1/0],h=r.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const d=Ca(n.coordinates,c,h),m=ko(r.geometry(),s,c,h);if(!Ts(s,c))return!1;for(const _ of m)if(!Zl(_,d))return!1}if(n.type==="MultiPolygon"){const d=er(n.coordinates,c,h),m=ko(r.geometry(),s,c,h);if(!Ts(s,c))return!1;for(const _ of m)if(!Su(_,d))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var Es=kr;function Nn(i){if(i instanceof zr&&(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 Es)return!1;let e=!0;return i.eachChild(r=>{e&&!Nn(r)&&(e=!1)}),e}function Gn(i){if(i instanceof zr&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Gn(r)&&(e=!1)}),e}function Ss(i,e){if(i instanceof zr&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(n=>{r&&!Ss(n,e)&&(r=!1)}),r}class gt{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}
1static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const n=e[1];return r.scope.has(n)?new gt(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var $l=gt;class Pa{constructor(e,r=[],n,s=new Ul,c=[]){this.registry=e,this.path=r,this.key=r.map(h=>`[${h}]`).join(""),this.scope=s,this.errors=c,this.expectedType=n}parse(e,r,n,s,c={}){return r?this.concat(r,n,s)._parse(e,c):this._parse(e,c)}_parse(e,r){function n(s,c,h){return h==="assert"?new Cr(c,[s]):h==="coerce"?new Vn(c,[s]):s}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 s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const c=this.registry[s];if(c){let h=c.parse(e,this);if(!h)return null;if(this.expectedType){const d=this.expectedType,m=h.type;if(d.kind!=="string"&&d.kind!=="number"&&d.kind!=="boolean"&&d.kind!=="object"&&d.kind!=="array"||m.kind!=="value")if(d.kind!=="color"&&d.kind!=="formatted"&&d.kind!=="resolvedImage"||m.kind!=="value"&&m.kind!=="string"){if(this.checkSubtype(d,m))return null}else h=n(h,d,r.typeAnnotation||"coerce");else h=n(h,d,r.typeAnnotation||"assert")}if(!(h instanceof Ao)&&h.type.kind!=="resolvedImage"&&Ms(h)){const d=new Nl;try{h=new Ao(h.type,h.evaluate(d))}catch(m){return this.error(m.message),null}}return h}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){const s=typeof e=="number"?this.path.concat(e):this.path,c=n?this.scope.concat(n):this.scope;return new Pa(this.registry,s,r||null,c,this.errors)}error(e,...r){const n=`${this.key}${r.map(s=>`[${s}]`).join("")}`;this.errors.push(new Bi(n,e))}checkSubtype(e,r){const n=Fn(e,r);return n&&this.error(n),n}}var ql=Pa;function Ms(i){if(i instanceof $l)return Ms(i.boundExpression);if(i instanceof zr&&i.name==="error"||i instanceof hn||i instanceof Es)return!1;const e=i instanceof Vn||i instanceof Cr;let r=!0;return i.eachChild(n=>{r=e?r&&Ms(n):r&&n instanceof Ao}),!!r&&Nn(i)&&Ss(i,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Is(i,e){const r=i.length-1;let n,s,c=0,h=r,d=0;for(;c<=h;)if(d=Math.floor((c+h)/2),n=i[d],s=i[d+1],n<=e){if(d===r||e<s)return d;c=d+1}else{if(!(n>e))throw new li("Input is not a number.");h=d-1}return 0}class As{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[s,c]of n)this.labels.push(s),this.outputs.push(c)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(e[1],1,Pe);if(!n)return null;const s=[];let c=null;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);for(let h=1;h<e.length;h+=2){const d=h===1?-1/0:e[h],m=e[h+1],_=h,x=h+1;if(typeof d!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',_);if(s.length&&s[s.length-1][0]>=d)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',_);const b=r.parse(m,x,c);if(!b)return null;c=c||b.type,s.push([d,b])}return new As(c,n,s)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=r[0])return n[0].evaluate(e);const c=r.length;return s>=r[c-1]?n[c-1].evaluate(e):n[Is(r,s)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>
vendor: 5,445 bytes, line 1
10&&e.push(this.labels[r]),e.push(this.outputs[r].serialize());return e}}var Cs=As;function dt(i,e,r){return i*(1-r)+e*r}var Po=Object.freeze({__proto__:null,number:dt,color:function(i,e,r){return new Gt(dt(i.r,e.r,r),dt(i.g,e.g,r),dt(i.b,e.b,r),dt(i.a,e.a,r))},array:function(i,e,r){return i.map((n,s)=>dt(n,e[s],r))}});const pn=.95047,Do=1.08883,Xl=4/29,Lo=6/29,Da=3*Lo*Lo,Mu=Math.PI/180,Iu=180/Math.PI;function zs(i){return i>.008856451679035631?Math.pow(i,1/3):i/Da+Xl}function La(i){return i>Lo?i*i*i:Da*(i-Xl)}function ks(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Ps(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ba(i){const e=Ps(i.r),r=Ps(i.g),n=Ps(i.b),s=zs((.4124564*e+.3575761*r+.1804375*n)/pn),c=zs((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*c-16,a:500*(s-c),b:200*(c-zs((.0193339*e+.119192*r+.9503041*n)/Do)),alpha:i.a}}function Wl(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,n=isNaN(i.b)?e:e-i.b/200;return e=1*La(e),r=pn*La(r),n=Do*La(n),new Gt(ks(3.2404542*r-1.5371385*e-.4985314*n),ks(-.969266*r+1.8760108*e+.041556*n),ks(.0556434*r-.2040259*e+1.0572252*n),i.alpha)}function Hl(i,e,r){const n=e-i;return i+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Bo={forward:Ba,reverse:Wl,interpolate:function(i,e,r){return{l:dt(i.l,e.l,r),a:dt(i.a,e.a,r),b:dt(i.b,e.b,r),alpha:dt(i.alpha,e.alpha,r)}}},Zn={forward:function(i){const{l:e,a:r,b:n}=Ba(i),s=Math.atan2(n,r)*Iu;return{h:s<0?s+360:s,c:Math.sqrt(r*r+n*n),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Mu,r=i.c;return Wl({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Hl(i.h,e.h,r),c:dt(i.c,e.c,r),l:dt(i.l,e.l,r),alpha:dt(i.alpha,e.alpha,r)}}};var Ra=Object.freeze({__proto__:null,lab:Bo,hcl:Zn});class Ds{constructor(e,r,n,s,c){this.type=e,this.operator=r,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[h,d]of c)this.labels.push(h),this.outputs.push(d)}static interpolationFactor(e,r,n,s){let c=0;if(e.name==="exponential")c=Fa(r,e.base,n,s);else if(e.name==="linear")c=Fa(r,1,n,s);else if(e.name==="cubic-bezier"){const h=e.controlPoints;c=new or(h[0],h[1],h[2],h[3]).solve(Fa(r,1,n,s))}return c}static parse(e,r){let[n,s,c,...h]=e;if(!Array.isArray(s)||s.length===0)return r.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const _=s[1];if(typeof _!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:_}}else{if(s[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(s[0])}`,1,0);{const _=s.slice(1);if(_.length!==4||_.some(x=>typeof x!="number"||x<0||x>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:_}}}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(c=r.parse(c,2,Pe),!c)return null;const d=[];let m=null;n==="interpolate-hcl"||n==="interpolate-lab"?m=Qi:r.expectedType&&r.expectedType.kind!=="value"&&(m=r.expectedType);for(let _=0;_<h.length;_+=2){const x=h[_],b=h[_+1],w=_+3,E=_+4;if(typeof x!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(d.length&&d[d.length-1][0]>=x)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const M=r.parse(b,E,m);if(!M)return null;m=m||M.type,d.push([x,M])}return m.kind==="number"||m.kind==="color"||m.kind==="array"&&m.itemType.kind==="number"&&typeof m.N=="number"?new Ds(m,n,s,c,d):r.error(`Type ${Ot(m)} is not interpolatable.`)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=r[0])return n[0].evaluate(e);const c=r.length;if(s>=r[c-1])return n[c-1].evaluate(e);const h=Is(r,s),d=Ds.interpolationFactor(this.interpolation,s,r[h],r[h+1]),m=n[h].evaluate(e),_=n[h+1].evaluate(e);return this.operator==="interpolate"?Po[this.type.kind.toLowerCase()](m,_,d):this.operator==="interpolate-hcl"?Zn.reverse(Zn.interpolate(Zn.forward(m),Zn.forward(_),d)):Bo.reverse(Bo.interpolate(Bo.forward(m),Bo.forward(_),d))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const r=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)r.push(this.labels[n],this.outputs[n].serialize());return r}}function Fa(i,e,r,n){const s=n-r,c=i-r;return s===0?0:e===1?c/s:(Math.pow(e,c)-1)/(Math.pow(e,s)-1)}var ur=Ds;class Oa{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let n=null;const s=r.expectedType;s&&s.kind!=="value"&&(n=s);const c=[];for(const d of e.slice(1)){const m=r.parse(d,1+c.length,n,void 0,{typeAnnotation:"omit"});if(!m)return null;n=n||m.type,c.push(m)}const h=s&&c.some(d=>Fn(s,d.type));return new Oa(h?et:n,c)}
1evaluate(e){let r,n=null,s=0;for(const c of this.args){if(s++,n=c.evaluate(e),n&&n instanceof Gi&&!n.available&&(r||(r=n),n=null,s===this.args.length))return r;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(r=>{e.push(r.serialize())}),e}}var Yl=Oa;class Ua{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let c=1;c<e.length-1;c+=2){const h=e[c];if(typeof h!="string")return r.error(`Expected string, but found ${typeof h} instead.`,c);if(/[^a-zA-Z0-9_]/.test(h))return r.error("Variable names must contain only alphanumeric characters or '_'.",c);const d=r.parse(e[c+1],c+1);if(!d)return null;n.push([h,d])}const s=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return s?new Ua(n,s):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[r,n]of this.bindings)e.push(r,n.serialize());return e.push(this.result.serialize()),e}}var Va=Ua;class ja{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Pe),s=r.parse(e[2],2,ji(r.expectedType||et));return n&&s?new ja(s.type.itemType,n,s):null}evaluate(e){const r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new li(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new li(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new li(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Au=ja;class Na{constructor(e,r){this.type=nt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,et),s=r.parse(e[2],2,et);return n&&s?xs(n.type,[nt,lt,Pe,So,et])?new Na(n,s):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ot(n.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!On(r,["boolean","string","number","null"]))throw new li(`Expected first argument to be of type boolean, string, number or null, but found ${Ot(jt(r))} instead.`);if(!On(n,["string","array"]))throw new li(`Expected second argument to be of type array or string, but found ${Ot(jt(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Cu=Na;class Ro{constructor(e,r,n){this.type=Pe,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,et),s=r.parse(e[2],2,et);if(!n||!s)return null;if(!xs(n.type,[nt,lt,Pe,So,et]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ot(n.type)} instead`);if(e.length===4){const c=r.parse(e[3],3,Pe);return c?new Ro(n,s,c):null}return new Ro(n,s)}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!On(r,["boolean","string","number","null"]))throw new li(`Expected first argument to be of type boolean, string, number or null, but found ${Ot(jt(r))} instead.`);if(!On(n,["string","array"]))throw new li(`Expected second argument to be of type array or string, but found ${Ot(jt(n))} instead.`);if(this.fromIndex){const s=this.fromIndex.evaluate(e);return n.indexOf(r,s)}return n.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Kl=Ro;class Ls{constructor(e,r,n,s,c,h){this.inputType=e,this.type=r,this.input=n,this.cases=s,this.outputs=c,this.otherwise=h}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let n,s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const c={},h=[];for(let _=2;_<e.length-1;_+=2){let x=e[_];const b=e[_+1];Array.isArray(x)||(x=[x]);const w=r.concat(_);
1if(x.length===0)return w.error("Expected at least one branch label.");for(const M of x){if(typeof M!="number"&&typeof M!="string")return w.error("Branch labels must be numbers or strings.");if(typeof M=="number"&&Math.abs(M)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof M=="number"&&Math.floor(M)!==M)return w.error("Numeric branch labels must be integer values.");if(n){if(w.checkSubtype(n,jt(M)))return null}else n=jt(M);if(c[String(M)]!==void 0)return w.error("Branch labels must be unique.");c[String(M)]=h.length}const E=r.parse(b,_,s);if(!E)return null;s=s||E.type,h.push(E)}const d=r.parse(e[1],1,et);if(!d)return null;const m=r.parse(e[e.length-1],e.length-1,s);return m?d.type.kind!=="value"&&r.concat(1).checkSubtype(n,d.type)?null:new Ls(n,s,d,c,h,m):null}evaluate(e){const r=this.input.evaluate(e);return(jt(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()}serialize(){const e=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),n=[],s={};for(const h of r){const d=s[this.cases[h]];d===void 0?(s[this.cases[h]]=n.length,n.push([this.cases[h],[h]])):n[d][1].push(h)}const c=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,d]of n)e.push(d.length===1?c(d[0]):d.map(c)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}var zu=Ls;class Ga{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);const s=[];for(let h=1;h<e.length-1;h+=2){const d=r.parse(e[h],h,nt);if(!d)return null;const m=r.parse(e[h+1],h+1,n);if(!m)return null;s.push([d,m]),n=n||m.type}const c=r.parse(e[e.length-1],e.length-1,n);return c?new Ga(n,s,c):null}evaluate(e){for(const[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(r=>{e.push(r.serialize())}),e}}var Jl=Ga;class Fo{constructor(e,r,n,s){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=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 n=r.parse(e[1],1,et),s=r.parse(e[2],2,Pe);if(!n||!s)return null;if(!xs(n.type,[ji(et),lt,et]))return r.error(`Expected first argument to be of type array or string, but found ${Ot(n.type)} instead`);if(e.length===4){const c=r.parse(e[3],3,Pe);return c?new Fo(n.type,n,s,c):null}return new Fo(n.type,n,s)}evaluate(e){const r=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!On(r,["string","array"]))throw new li(`Expected first argument to be of type array or string, but found ${Ot(jt(r))} instead.`);if(this.endIndex){const s=this.endIndex.evaluate(e);return r.slice(n,s)}return r.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var Ql=Fo;function ec(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 tc(i,e,r,n){return n.compare(e,r)===0}function $n(i,e,r){const n=i!=="=="&&i!=="!=";return class xf{constructor(c,h,d){this.type=nt,this.lhs=c,this.rhs=h,this.collator=d,this.hasUntypedArgument=c.type.kind==="value"||h.type.kind==="value"}static parse(c,h){if(c.length!==3&&c.length!==4)return h.error("Expected two or three arguments.");const d=c[0];let m=h.parse(c[1],1,et);
vendor: 8,978 bytes, line 1
1if(!m)return null;if(!ec(d,m.type))return h.concat(1).error(`"${d}" comparisons are not supported for type '${Ot(m.type)}'.`);let _=h.parse(c[2],2,et);if(!_)return null;if(!ec(d,_.type))return h.concat(2).error(`"${d}" comparisons are not supported for type '${Ot(_.type)}'.`);if(m.type.kind!==_.type.kind&&m.type.kind!=="value"&&_.type.kind!=="value")return h.error(`Cannot compare types '${Ot(m.type)}' and '${Ot(_.type)}'.`);n&&(m.type.kind==="value"&&_.type.kind!=="value"?m=new Cr(_.type,[m]):m.type.kind!=="value"&&_.type.kind==="value"&&(_=new Cr(m.type,[_])));let x=null;if(c.length===4){if(m.type.kind!=="string"&&_.type.kind!=="string"&&m.type.kind!=="value"&&_.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(x=h.parse(c[3],3,Ar),!x)return null}return new xf(m,_,x)}evaluate(c){const h=this.lhs.evaluate(c),d=this.rhs.evaluate(c);if(n&&this.hasUntypedArgument){const m=jt(h),_=jt(d);if(m.kind!==_.kind||m.kind!=="string"&&m.kind!=="number")throw new li(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${m.kind}, ${_.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const m=jt(h),_=jt(d);if(m.kind!=="string"||_.kind!=="string")return e(c,h,d)}return this.collator?r(c,h,d,this.collator.evaluate(c)):e(c,h,d)}eachChild(c){c(this.lhs),c(this.rhs),this.collator&&c(this.collator)}outputDefined(){return!0}serialize(){const c=[i];return this.eachChild(h=>{c.push(h.serialize())}),c}}}const ku=$n("==",function(i,e,r){return e===r},tc),Bs=$n("!=",function(i,e,r){return e!==r},function(i,e,r,n){return!tc(0,e,r,n)}),ic=$n("<",function(i,e,r){return e<r},function(i,e,r,n){return n.compare(e,r)<0}),rc=$n(">",function(i,e,r){return e>r},function(i,e,r,n){return n.compare(e,r)>0}),Pu=$n("<=",function(i,e,r){return e<=r},function(i,e,r,n){return n.compare(e,r)<=0}),Du=$n(">=",function(i,e,r){return e>=r},function(i,e,r,n){return n.compare(e,r)>=0});class Za{constructor(e,r,n,s,c){this.type=lt,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=s,this.maxFractionDigits=c}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const n=r.parse(e[1],1,Pe);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return r.error("NumberFormat options argument must be an object.");let c=null;if(s.locale&&(c=r.parse(s.locale,1,lt),!c))return null;let h=null;if(s.currency&&(h=r.parse(s.currency,1,lt),!h))return null;let d=null;if(s["min-fraction-digits"]&&(d=r.parse(s["min-fraction-digits"],1,Pe),!d))return null;let m=null;return s["max-fraction-digits"]&&(m=r.parse(s["max-fraction-digits"],1,Pe),!m)?null:new Za(n,c,h,d,m)}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}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Rs{constructor(e){this.type=Pe,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Ot(n.type)} instead.`):new Rs(n):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new li(`Expected value to be of type string or array, but found ${Ot(jt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(r=>{e.push(r.serialize())}),e}}const $a={"==":ku,"!=":Bs,">":rc,"<":ic,">=":Du,"<=":Pu,array:Cr,at:Au,boolean:Cr,case:Jl,coalesce:Yl,collator:hn,format:Nr,image:ws,in:Cu,"index-of":Kl,interpolate:ur,"interpolate-hcl":ur,"interpolate-lab":ur,length:Rs,let:Va,literal:Ao,match:zu,number:Cr,"number-format":Za,object:Cr,slice:Ql,step:Cs,string:Cr,"to-boolean":Vn,"to-color":Vn,"to-number":Vn,"to-string":Vn,var:$l,within:Es};function qa(i,[e,r,n,s]){e=e.evaluate(i),r=r.evaluate(i),n=n.evaluate(i);const c=s?s.evaluate(i):1,h=vs(e,r,n,c);if(h)throw new li(h);return new Gt(e/255*c,r/255*c,n/255*c,c)}function Fs(i,e){return i in e}function Xa(i,e){const r=e[i];return r===void 0?null:r}function dn(i){return{type:i}}zr.register($a,{error:[{kind:"error"},[lt],(i,[e])=>{throw new li(e.evaluate(i))}],typeof:[lt,[et],(i,[e])=>Ot(jt(e.evaluate(i)))],"to-rgba":[ji(Pe,4),[Qi],(i,[e])=>e.evaluate(i).toArray()],rgb:[Qi,[Pe,Pe,Pe],qa],rgba:[Qi,[Pe,Pe,Pe,Pe],qa],has:{type:nt,overloads:[[[lt],(i,[e])=>Fs(e.evaluate(i),i.properties())],[[lt,cn],(i,[e,r])=>Fs(e.evaluate(i),r.evaluate(i))]]},get:{type:et,overloads:[[[lt],(i,[e])=>Xa(e.evaluate(i),i.properties())],[[lt,cn],(i,[e,r])=>Xa(e.evaluate(i),r.evaluate(i))]]},"feature-state":[et,[lt],(i,[e])=>Xa(e.evaluate(i),i.featureState||{})],properties:[cn,[],i=>i.properties()],"geometry-type":[lt,[],i=>i.geometryType()],id:[et,[],i=>i.id()],zoom:[Pe,[],i=>i.globals.zoom],pitch:[Pe,[],i=>i.globals.pitch||0],"distance-from-center":[Pe,[],i=>i.distanceFromCenter()],"heatmap-density":[Pe,[],i=>i.globals.heatmapDensity||0],"line-progress":[Pe,[],i=>i.globals.lineProgress||0],"sky-radial-progress":[Pe,[],i=>i.globals.skyRadialProgress||0],accumulated:[et,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Pe,dn(Pe),(i,e)=>{let r=0;for(const n of e)r+=n.evaluate(i);return r}],"*":[Pe,dn(Pe),(i,e)=>{let r=1;for(const n of e)r*=n.evaluate(i);return r}],"-":{type:Pe,overloads:[[[Pe,Pe],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Pe],(i,[e])=>-e.evaluate(i)]]},"/":[Pe,[Pe,Pe],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Pe,[Pe,Pe],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Pe,[],()=>Math.LN2],pi:[Pe,[],()=>Math.PI],e:[Pe,[],()=>Math.E],"^":[Pe,[Pe,Pe],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Pe,[Pe],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Pe,[Pe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Pe,[Pe],(i,[e])=>Math.log(e.evaluate(i))],log2:[Pe,[Pe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Pe,[Pe],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Pe,[Pe],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Pe,[Pe],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Pe,[Pe],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Pe,[Pe],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Pe,[Pe],(i,[e])=>Math.atan(e.evaluate(i))],min:[Pe,dn(Pe),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Pe,dn(Pe),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Pe,[Pe],(i,[e])=>Math.abs(e.evaluate(i))],round:[Pe,[Pe],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Pe,[Pe],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Pe,[Pe],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[nt,[lt,et],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[nt,[et],(i,[e])=>i.id()===e.value],"filter-type-==":[nt,[lt],(i,[e])=>i.geometryType()===e.value],"filter-<":[nt,[lt,et],(i,[e,r])=>{const n=i.properties()[e.value],s=r.value;return typeof n==typeof s&&n<s}],"filter-id-<":[nt,[et],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[nt,[lt,et],(i,[e,r])=>{const n=i.properties()[e.value],s=r.value;return typeof n==typeof s&&n>s}],"filter-id->":[nt,[et],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[nt,[lt,et],(i,[e,r])=>{const n=i.properties()[e.value],s=r.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[nt,[et],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[nt,[lt,et],(i,[e,r])=>{const n=i.properties()[e.value],s=r.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[nt,[et],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[nt,[et],(i,[e])=>e.value in i.properties()],"filter-has-id":[nt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[nt,[ji(lt)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[nt,[ji(et)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[nt,[lt,ji(et)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[nt,[lt,ji(et)],(i,[e,r])=>function(n,s,c,h){for(;c<=h;){const d=c+h>>1;if(s[d]===n)return!0;s[d]>n?h=d-1:c=d+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:nt,overloads:[[[nt,nt],
1(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[dn(nt),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:nt,overloads:[[[nt,nt],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[dn(nt),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[nt,[nt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[nt,[lt],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[lt,[lt],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[lt,[lt],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[lt,dn(et),(i,e)=>e.map(r=>un(r.evaluate(i))).join("")],"resolved-locale":[lt,[Ar],(i,[e])=>e.evaluate(i).resolvedLocale()]});var Oo=$a;function nc(i){return{result:"success",value:i}}function qn(i){return{result:"error",value:i}}function Xn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Wa(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Os(i){return!!i.expression&&i.expression.interpolated}function ft(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Us(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Lu(i){return i}function oc(i,e){const r=e.type==="color",n=i.stops&&typeof i.stops[0][0]=="object",s=n||!(n||i.property!==void 0),c=i.type||(Os(e)?"exponential":"interval");if(r&&((i=Li({},i)).stops&&(i.stops=i.stops.map(_=>[_[0],Gt.parse(_[1])])),i.default=Gt.parse(i.default?i.default:e.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!Ra[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let h,d,m;if(c==="exponential")h=ac;else if(c==="interval")h=Wn;else if(c==="categorical"){h=sc,d=Object.create(null);for(const _ of i.stops)d[_[0]]=_[1];m=typeof i.stops[0][0]}else{if(c!=="identity")throw new Error(`Unknown function type "${c}"`);h=Bu}if(n){const _={},x=[];for(let E=0;E<i.stops.length;E++){const M=i.stops[E],z=M[0].zoom;_[z]===void 0&&(_[z]={zoom:z,type:i.type,property:i.property,default:i.default,stops:[]},x.push(z)),_[z].stops.push([M[0].value,M[1]])}const b=[];for(const E of x)b.push([_[E].zoom,oc(_[E],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:ur.interpolationFactor.bind(void 0,w),zoomStops:b.map(E=>E[0]),evaluate:({zoom:E},M)=>ac({stops:b,base:i.base},e,E).evaluate(E,M)}}if(s){const _=c==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:_,interpolationFactor:ur.interpolationFactor.bind(void 0,_),zoomStops:i.stops.map(x=>x[0]),evaluate:({zoom:x})=>h(i,e,x,d,m)}}return{kind:"source",evaluate(_,x){const b=x&&x.properties?x.properties[i.property]:void 0;return b===void 0?Zi(i.default,e.default):h(i,e,b,d,m)}}}function Zi(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function sc(i,e,r,n,s){return Zi(typeof r===s?n[r]:void 0,i.default,e.default)}function Wn(i,e,r){if(ft(r)!=="number")return Zi(i.default,e.default);const n=i.stops.length;if(n===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[n-1][0])return i.stops[n-1][1];const s=Is(i.stops.map(c=>c[0]),r);return i.stops[s][1]}function ac(i,e,r){const n=i.base!==void 0?i.base:1;if(ft(r)!=="number")return Zi(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 c=Is(i.stops.map(x=>x[0]),r),h=function(x,b,w,E){const M=E-w,z=x-w;return M===0?0:b===1?z/M:(Math.pow(b,z)-1)/(Math.pow(b,M)-1)}(r,n,i.stops[c][0],i.stops[c+1][0]),d=i.stops[c][1],m=i.stops[c+1][1];let _=Po[e.type]||Lu;if(i.colorSpace&&i.colorSpace!=="rgb"){const x=Ra[i.colorSpace];_=(b,w)=>x.reverse(x.interpolate(x.forward(b),x.forward(w),h))}return typeof d.evaluate=="function"?{evaluate(...x){const b=d.evaluate.apply(void 0,x),w=m.evaluate.apply(void 0,x);if(b!==void 0&&w!==void 0)return _(b,w,h)}}:_(d,m,h)}function Bu(i,e,r){return e.type==="color"?r=Gt.parse(r):e.type==="formatted"?r=mi.fromString(r.toString()):e.type==="resolvedImage"?r=Gi.fromString(r.toString()):ft(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0),Zi(r,i.default,e.default)}class Vs{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Nl,this._defaultValue=r?function(n){return n.type==="color"&&(Us(n.default)||Array.isArray(n.default))?new Gt(0,0,0,0):n.type==="color"?Gt.parse(n.default)||null:n.default===void 0?null:n.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,s,c,h,d,m){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=s||null,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=d||null,this._evaluator.featureDistanceData=m||null,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,s,c,h,d,m){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=s||null,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=d||null,this._evaluator.featureDistanceData=m||null;try{const _=this.expression.evaluate(this._evaluator);if(_==null||typeof _=="number"&&_!=_)return this._defaultValue;if(this._enumValues&&!(_ in this._enumValues))throw new li(`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 js(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Oo}function fn(i,e){const r=new ql(Oo,[],e?function(s){const c={color:Qi,string:lt,number:Pe,enum:lt,boolean:nt,formatted:Rn,resolvedImage:Mo};return s.type==="array"?ji(c[s.value]||et,s.length):c[s.type]}(e):void 0),n=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?nc(new Vs(n,e)):qn(r.errors)}class Ns{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Gn(r.expression)}evaluateWithoutErrorHandling(e,r,n,s,c,h){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,s,c,h)}evaluate(e,r,n,s,c,h){return this._styleExpression.evaluate(e,r,n,s,c,h)}}class Uo{constructor(e,r,n,s){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Gn(r.expression),this.interpolationType=s}evaluateWithoutErrorHandling(e,r,n,s,c,h){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,s,c,h)}evaluate(e,r,n,s,c,h){return this._styleExpression.evaluate(e,r,n,s,c,h)}interpolationFactor(e,r,n){return this.interpolationType?ur.interpolationFactor(this.interpolationType,e,r,n):0}}function Gs(i,e){if((i=fn(i,e)).result==="error")return i;const r=i.value.expression,n=Nn(r);if(!n&&!Xn(e))return qn([new Bi("","data expressions not supported")]);const s=Ss(r,["zoom","pitch","distance-from-center"]);if(!s&&!Wa(e))return qn([new Bi("","zoom expressions not supported")]);const c=Hn(r);return c||s?c instanceof Bi?qn([c]):c instanceof ur&&!Os(e)?qn([new Bi("",'"interpolate" expressions cannot be used with this property')]):nc(c?new Uo(n?"camera":"composite",i.value,c.labels,c instanceof ur?c.interpolation:void 0):new Ns(n?"constant":"source",i.value)):qn([new Bi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(e,r){this._parameters=e,this._specification=r,Li(this,oc(this._parameters,this._specification))}static deserialize(e){return new Vo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Hn(i){let e=null;if(i instanceof Va)e=Hn(i.result);else if(i instanceof Yl){for(const r of i.args)if(e=Hn(r),e)break}else(i instanceof Cs||i instanceof ur)&&i.input instanceof zr&&i.input.name==="zoom"&&(e=i);return e instanceof Bi||i.eachChild(r=>{const n=Hn(r);n instanceof Bi?e=n:!e&&n?e=new Bi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new Bi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}class Be{constructor(e,r,n,s){this.message=(e?`${e}: `:"")+n,s&&(this.identifier=s),r!=null&&r.__line__&&(this.line=r.__line__)}}
1function $i(i){const e=i.key,r=i.value,n=i.valueSpec||{},s=i.objectElementValidators||{},c=i.style,h=i.styleSpec;let d=[];const m=ft(r);if(m!=="object")return[new Be(e,r,`object expected, ${m} found`)];for(const _ in r){const x=_.split(".")[0],b=n[x]||n["*"];let w;s[x]?w=s[x]:n[x]?w=si:s["*"]?w=s["*"]:n["*"]&&(w=si),w?d=d.concat(w({key:(e&&`${e}.`)+_,value:r[_],valueSpec:b,style:c,styleSpec:h,object:r,objectKey:_},r)):d.push(new Be(e,r[_],`unknown property "${_}"`))}for(const _ in n)s[_]||n[_].required&&n[_].default===void 0&&r[_]===void 0&&d.push(new Be(e,r,`missing required property "${_}"`));return d}function jo(i){const e=i.value,r=i.valueSpec,n=i.style,s=i.styleSpec,c=i.key,h=i.arrayElementValidator||si;if(ft(e)!=="array")return[new Be(c,e,`array expected, ${ft(e)} found`)];if(r.length&&e.length!==r.length)return[new Be(c,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Be(c,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let d={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum,function:void 0};s.$version<7&&(d.function=r.function),ft(r.value)==="object"&&(d=r.value);let m=[];for(let _=0;_<e.length;_++)m=m.concat(h({array:e,arrayIndex:_,value:e[_],valueSpec:d,style:n,styleSpec:s,key:`${c}[${_}]`}));return m}
1function mn(i){const e=i.key,r=i.value,n=i.valueSpec;let s=ft(r);if(s==="number"&&r!=r&&(s="NaN"),s!=="number")return[new Be(e,r,`number expected, ${s} found`)];if("minimum"in n){let c=n.minimum;if(ft(n.minimum)==="array"&&(c=n.minimum[i.arrayIndex]),r<c)return[new Be(e,r,`${r} is less than the minimum value ${c}`)]}if("maximum"in n){let c=n.maximum;if(ft(n.maximum)==="array"&&(c=n.maximum[i.arrayIndex]),r>c)return[new Be(e,r,`${r} is greater than the maximum value ${c}`)]}return[]}function Ha(i){const e=i.valueSpec,r=Ft(i.value.type);let n,s,c,h={};const d=r!=="categorical"&&i.value.property===void 0,m=!d,_=ft(i.value.stops)==="array"&&ft(i.value.stops[0])==="array"&&ft(i.value.stops[0][0])==="object",x=$i({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(E){if(r==="identity")return[new Be(E.key,E.value,'identity function may not have a "stops" property')];let M=[];const z=E.value;return M=M.concat(jo({key:E.key,value:z,valueSpec:E.valueSpec,style:E.style,styleSpec:E.styleSpec,arrayElementValidator:b})),ft(z)==="array"&&z.length===0&&M.push(new Be(E.key,z,"array must have at least one stop")),M},default:function(E){return si({key:E.key,value:E.value,valueSpec:e,style:E.style,styleSpec:E.styleSpec})}}});return r==="identity"&&d&&x.push(new Be(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||x.push(new Be(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Os(i.valueSpec)&&x.push(new Be(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(m&&!Xn(i.valueSpec)?x.push(new Be(i.key,i.value,"property functions not supported")):d&&!Wa(i.valueSpec)&&x.push(new Be(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!_||i.value.property!==void 0||x.push(new Be(i.key,i.value,'"property" property is required')),x;function b(E){let M=[];const z=E.value,R=E.key;if(ft(z)!=="array")return[new Be(R,z,`array expected, ${ft(z)} found`)];if(z.length!==2)return[new Be(R,z,`array length 2 expected, length ${z.length} found`)];if(_){if(ft(z[0])!=="object")return[new Be(R,z,`object expected, ${ft(z[0])} found`)];if(z[0].zoom===void 0)return[new Be(R,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new Be(R,z,"object stop key must have value")];const j=Ft(z[0].zoom);if(typeof j!="number")return[new Be(R,z[0].zoom,"stop zoom values must be numbers")];if(c&&c>j)return[new Be(R,z[0].zoom,"stop zoom values must appear in ascending order")];j!==c&&(c=j,s=void 0,h={}),M=M.concat($i({key:`${R}[0]`,value:z[0],valueSpec:{zoom:{}},style:E.style,styleSpec:E.styleSpec,objectElementValidators:{zoom:mn,value:w}}))}else M=M.concat(w({key:`${R}[0]`,value:z[0],valueSpec:{},style:E.style,styleSpec:E.styleSpec},z));return js(Vi(z[1]))?M.concat([new Be(`${R}[1]`,z[1],"expressions are not allowed in function stops.")]):M.concat(si({key:`${R}[1]`,value:z[1],valueSpec:e,style:E.style,styleSpec:E.styleSpec}))}function w(E,M){const z=ft(E.value),R=Ft(E.value),j=E.value!==null?E.value:M;if(n){if(z!==n)return[new Be(E.key,j,`${z} stop domain type must match previous stop domain type ${n}`)]}else n=z;if(z!=="number"&&z!=="string"&&z!=="boolean"&&typeof R!="number"&&typeof R!="string"&&typeof R!="boolean")return[new Be(E.key,j,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&r!=="categorical"){let H=`number expected, ${z} found`;return Xn(e)&&r===void 0&&(H+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Be(E.key,j,H)]}return r!=="categorical"||z!=="number"||typeof R=="number"&&isFinite(R)&&Math.floor(R)===R?r!=="categorical"&&z==="number"&&typeof R=="number"&&typeof s=="number"&&s!==void 0&&R<s?[new Be(E.key,j,"stop domain values must appear in ascending order")]:(s=R,r==="categorical"&&R in h?[new Be(E.key,j,"stop domain values must be unique")]:(h[R]=!0,[])):[new Be(E.key,j,`integer expected, found ${String(R)}`)]}}function _n(i){const e=(i.expressionContext==="property"?Gs:fn)(Vi(i.value),i.valueSpec);if(e.result==="error")return e.value.map(n=>new Be(`${i.key}${n.key}`,i.value,n.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Be(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"&&!Gn(r))return[new Be(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter")return Zs(r,i);if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ss(r,["zoom","feature-state"]))return[new Be(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Nn(r))return[new Be(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Zs(i,e){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(e.valueSpec&&e.valueSpec.expression)for(const s of e.valueSpec.expression.parameters)r.delete(s);if(r.size===0)return[];const n=[];return i instanceof zr&&r.has(i.name)?[new Be(e.key,e.value,`["${i.name}"] expression is not supported in a filter for a ${e.object.type}
1 layer with id: ${e.object.id}`)]:(i.eachChild(s=>{n.push(...Zs(s,e))}),n)}function No(i){const e=i.key,r=i.value,n=i.valueSpec,s=[];return Array.isArray(n.values)?n.values.indexOf(Ft(r))===-1&&s.push(new Be(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(Ft(r))===-1&&s.push(new Be(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),s}function Ya(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(!Ya(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function gn(i,e="fill"){if(i==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Ya(i)||(i=yn(i));const r=i;let n=!0;try{n=function(_){if(!Yn(_))return _;let x=Vi(_);return cc(x),x=lc(x),x}(r)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(r,null,2)} 7 `)}const s=re[`filter_${e}`],c=fn(n,s);let h=null;if(c.result==="error")throw new Error(c.value.map(_=>`${_.key}: ${_.message}`).join(", "));h=(_,x,b)=>c.value.evaluate(_,x,{},b);let d=null,m=null;if(n!==r){const _=fn(r,s);if(_.result==="error")throw new Error(_.value.map(x=>`${x.key}: ${x.message}`).join(", "));d=(x,b,w,E,M)=>_.value.evaluate(x,b,{},w,void 0,void 0,E,M),m=!Nn(_.value.expression)}return h=h,{filter:h,dynamicFilter:d||void 0,needGeometry:Go(n),needFeature:!!m}}function lc(i){if(!Array.isArray(i))return i;const e=function(r){if(Ru.has(r[0])){for(let n=1;n<r.length;n++)if(Yn(r[n]))return!0}return r}(i);return e===!0?e:e.map(r=>lc(r))}function cc(i){let e=!1;const r=[];if(i[0]==="case"){for(let n=1;n<i.length-1;n+=2)e=e||Yn(i[n]),r.push(i[n+1]);r.push(i[i.length-1])}else if(i[0]==="match"){e=e||Yn(i[1]);for(let n=2;n<i.length-1;n+=2)r.push(i[n+1]);r.push(i[i.length-1])}else if(i[0]==="step"){e=e||Yn(i[1]);for(let n=1;n<i.length-1;n+=2)r.push(i[n+1])}e&&(i.length=0,i.push("any",...r));for(let n=1;n<i.length;n++)cc(i[n])}function Yn(i){if(!Array.isArray(i))return!1;if((e=i[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let r=1;r<i.length;r++)if(Yn(i[r]))return!0;return!1}const Ru=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Fu(i,e){return i<e?-1:i>e?1:0}function Go(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Go(i[e]))return!0;return!1}function yn(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?vi(i[1],i[2],"=="):e==="!="?$s(vi(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?vi(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(yn))):e==="all"?["all"].concat(i.slice(1).map(yn)):e==="none"?["all"].concat(i.slice(1).map(yn).map($s)):e==="in"?Zo(i[1],i.slice(2)):e==="!in"?$s(Zo(i[1],i.slice(2))):e==="has"?uc(i[1]):e==="!has"?$s(uc(i[1])):e!=="within"||i;var r}function vi(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 Zo(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(Fu)]]:["filter-in-small",i,["literal",e]]}}function uc(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function $s(i){return["!",i]}function Ka(i){return Ya(Vi(i.value))?_n(Li({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):hc(i)}function hc(i){const e=i.value,r=i.key;if(ft(e)!=="array")return[new Be(r,e,`array expected, ${ft(e)} found`)];const n=i.styleSpec;let s,c=[];if(e.length<1)return[new Be(r,e,"filter array must have at least 1 element")];switch(c=c.concat(No({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ft(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ft(e[1])==="$type"&&c.push(new Be(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&c.push(new Be(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(s=ft(e[1]),s!=="string"&&c.push(new Be(`${r}[1]`,e[1],`string expected, ${s} found`)));for(let h=2;h<e.length;h++)s=ft(e[h]),Ft(e[1])==="$type"?c=c.concat(No({key:`${r}[${h}]`,value:e[h],valueSpec:n.geometry_type,style:i.style,styleSpec:i.styleSpec}
7)):s!=="string"&&s!=="number"&&s!=="boolean"&&c.push(new Be(`${r}[${h}]`,e[h],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let h=1;h<e.length;h++)c=c.concat(hc({key:`${r}[${h}]`,value:e[h],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":s=ft(e[1]),e.length!==2?c.push(new Be(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):s!=="string"&&c.push(new Be(`${r}[1]`,e[1],`string expected, ${s} found`));break;case"within":s=ft(e[1]),e.length!==2?c.push(new Be(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):s!=="object"&&c.push(new Be(`${r}[1]`,e[1],`object expected, ${s} found`))}return c}function qs(i,e){const r=i.key,n=i.style,s=i.styleSpec,c=i.value,h=i.objectKey,d=s[`${e}_${i.layerType}`];if(!d)return[];const m=h.match(/^(.*)-transition$/);if(e==="paint"&&m&&d[m[1]]&&d[m[1]].transition)return si({key:r,value:c,valueSpec:s.transition,style:n,styleSpec:s});const _=i.valueSpec||d[h];if(!_)return[new Be(r,c,`unknown property "${h}"`)];let x;if(ft(c)==="string"&&Xn(_)&&!_.tokens&&(x=/^{([^}]+)}$/.exec(c)))return[new Be(r,c,`"${h}" does not support interpolation syntax 8Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(x[1])} }\`.`)];const b=[];return i.layerType==="symbol"&&(h==="text-field"&&n&&!n.glyphs&&b.push(new Be(r,c,'use of "text-field" requires a style "glyphs" property')),h==="text-font"&&Us(Vi(c))&&Ft(c.type)==="identity"&&b.push(new Be(r,c,'"text-font" does not support identity functions'))),b.concat(si({key:i.key,value:c,valueSpec:_,style:n,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:h}))}function pc(i){return qs(i,"paint")}function Xs(i){return qs(i,"layout")}function dc(i){let e=[];
8const r=i.value,n=i.key,s=i.style,c=i.styleSpec;r.type||r.ref||e.push(new Be(n,r,'either "type" or "ref" is required'));let h=Ft(r.type);const d=Ft(r.ref);if(r.id){const m=Ft(r.id);for(let _=0;_<i.arrayIndex;_++){const x=s.layers[_];Ft(x.id)===m&&e.push(new Be(n,r.id,`duplicate layer id "${r.id}", previously used at line ${x.id.__line__}`))}}if("ref"in r){let m;["type","source","source-layer","filter","layout"].forEach(_=>{_ in r&&e.push(new Be(n,r[_],`"${_}" is prohibited for ref layers`))}),s.layers.forEach(_=>{Ft(_.id)===d&&(m=_)}),m?m.ref?e.push(new Be(n,r.ref,"ref cannot reference another ref layer")):h=Ft(m.type):typeof d=="string"&&e.push(new Be(n,r.ref,`ref layer "${d}" not found`))}else if(h!=="background"&&h!=="sky")if(r.source){const m=s.sources&&s.sources[r.source],_=m&&Ft(m.type);m?_==="vector"&&h==="raster"?e.push(new Be(n,r.source,`layer "${r.id}" requires a raster source`)):_==="raster"&&h!=="raster"?e.push(new Be(n,r.source,`layer "${r.id}" requires a vector source`)):_!=="vector"||r["source-layer"]?_==="raster-dem"&&h!=="hillshade"?e.push(new Be(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):h!=="line"||!r.paint||!r.paint["line-gradient"]&&!r.paint["line-trim-offset"]||_==="geojson"&&m.lineMetrics||e.push(new Be(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Be(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Be(n,r.source,`source "${r.source}" not found`))}else e.push(new Be(n,r,'missing required property "source"'));return e=e.concat($i({key:n,value:r,valueSpec:c.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>si({key:`${n}.type`,value:r.type,valueSpec:c.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:m=>Ka(Li({layerType:h},m)),layout:m=>$i({layer:r,key:m.key,value:m.value,valueSpec:{},style:m.style,styleSpec:m.styleSpec,objectElementValidators:{"*":_=>Xs(Li({layerType:h},_))}}),paint:m=>$i({layer:r,key:m.key,value:m.value,valueSpec:{},style:m.style,styleSpec:m.styleSpec,objectElementValidators:{"*":_=>pc(Li({layerType:h},_))}})}})),e}function Kn(i){const e=i.value,r=i.key,n=ft(e);return n!=="string"?[new Be(r,e,`string expected, ${n} found`)]:[]}const Ws={promoteId:function({key:i,value:e}){if(ft(e)==="string")return Kn({key:i,value:e});{const r=[];for(const n in e)r.push(...Kn({key:`${i}.${n}`,value:e[n]}));return r}}};function fc(i){const e=i.value,r=i.key,n=i.styleSpec,s=i.style;if(!e.type)return[new Be(r,e,'"type" is required')];const c=Ft(e.type);let h;switch(c){case"vector":case"raster":case"raster-dem":return h=$i({key:r,value:e,valueSpec:n[`source_${c.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:Ws}),h;case"geojson":if(h=$i({key:r,value:e,valueSpec:n.source_geojson,style:s,styleSpec:n,objectElementValidators:Ws}),e.cluster)for(const d in e.clusterProperties){const[m,_]=e.clusterProperties[d],x=typeof m=="string"?[m,["accumulated"],["get",d]]:m;h.push(..._n({key:`${r}.${d}.map`,value:_,expressionContext:"cluster-map"})),h.push(..._n({key:`${r}.${d}.reduce`,value:x,expressionContext:"cluster-reduce"}))}return h;case"video":return $i({key:r,value:e,valueSpec:n.source_video,style:s,styleSpec:n});case"image":return $i({key:r,value:e,valueSpec:n.source_image,style:s,styleSpec:n});case"canvas":return[new Be(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return No({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:s,styleSpec:n})}}function Ja(i){const e=i.value,r=i.styleSpec,n=r.light,s=i.style;let c=[];const h=ft(e);if(e===void 0)return c;if(h!=="object")return c=c.concat([new Be("light",e,`object expected, ${h} found`)]),c;for(const d in e){const m=d.match(/^(.*)-transition$/);c=c.concat(m&&n[m[1]]&&n[m[1]].transition?si({key:d,value:e[d],valueSpec:r.transition,style:s,styleSpec:r}):n[d]?si({key:d,value:e[d],valueSpec:n[d],style:s,styleSpec:r}):[new Be(d,e[d],`unknown property "${d}"`)])}return c}function Qa(i){const e=i.value,r=i.key,n=i.style,s=i.styleSpec,c=s.terrain;let h=[];const d=ft(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Be("terrain",e,`object expected, ${d} found`)]),h;for(const m in e){const _=m.match(/^(.*)-transition$/);h=h.concat(_&&c[_[1]]&&c[_[1]].transition?si({key:m,value:e[m],valueSpec:s.transition,style:n,styleSpec:s}
8):c[m]?si({key:m,value:e[m],valueSpec:c[m],style:n,styleSpec:s}):[new Be(m,e[m],`unknown property "${m}"`)])}if(e.source){const m=n.sources&&n.sources[e.source],_=m&&Ft(m.type);m?_!=="raster-dem"&&h.push(new Be(r,e.source,`terrain cannot be used with a source of type ${String(_)}, it only be used with a "raster-dem" source type`)):h.push(new Be(r,e.source,`source "${e.source}" not found`))}else h.push(new Be(r,e,'terrain is missing required property "source"'));return h}function mc(i){const e=i.value,r=i.style,n=i.styleSpec,s=n.fog;let c=[];const h=ft(e);if(e===void 0)return c;if(h!=="object")return c=c.concat([new Be("fog",e,`object expected, ${h} found`)]),c;for(const d in e){const m=d.match(/^(.*)-transition$/);c=c.concat(m&&s[m[1]]&&s[m[1]].transition?si({key:d,value:e[d],valueSpec:n.transition,style:r,styleSpec:n}):s[d]?si({key:d,value:e[d],valueSpec:s[d],style:r,styleSpec:n}):[new Be(d,e[d],`unknown property "${d}"`)])}return c}const Hs={"*":()=>[],array:jo,boolean:function(i){const e=i.value,r=i.key,n=ft(e);return n!=="boolean"?[new Be(r,e,`boolean expected, ${n} found`)]:[]}
8,number:mn,color:function(i){const e=i.key,r=i.value,n=ft(r);return n!=="string"?[new Be(e,r,`color expected, ${n} found`)]:jl.parseCSSColor(r)===null?[new Be(e,r,`color expected, "${r}" found`)]:[]},enum:No,filter:Ka,function:Ha,layer:dc,object:$i,source:fc,light:Ja,terrain:Qa,fog:mc,string:Kn,formatted:function(i){return Kn(i).length===0?[]:_n(i)},resolvedImage:function(i){return Kn(i).length===0?[]:_n(i)},projection:function(i){const e=i.value,r=i.styleSpec,n=r.projection,s=i.style;let c=[];const h=ft(e);if(h==="object")for(const d in e)c=c.concat(si({key:d,value:e[d],valueSpec:n[d],style:s,styleSpec:r}));else h!=="string"&&(c=c.concat([new Be("projection",e,`object or string expected, ${h} found`)]));return c}};function si(i){const e=i.value,r=i.valueSpec,n=i.styleSpec;return r.expression&&Us(Ft(e))?Ha(i):r.expression&&js(Vi(e))?_n(i):r.type&&Hs[r.type]?Hs[r.type](i):$i(Li({},i,{valueSpec:r.type?n[r.type]:r}))}function _c(i){const e=i.value,r=i.key,n=Kn(i);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new Be(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new Be(r,e,'"glyphs" url must include a "{range}" token'))),n}function gc(i,e=re){return tr(si({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:_c,"*":()=>[]}}))}const yc=i=>tr(pc(i)),Ou=i=>tr(Xs(i));function tr(i){return i.slice().sort((e,r)=>e.line&&r.line?e.line-r.line:0)}function xc(i,e){let r=!1;if(e&&e.length)for(const n of e)i.fire(new zt(new Error(n.message))),r=!0;return r}var Jn=hr;function hr(i,e,r){var n=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var s=new Int32Array(this.arrayBuffer);i=s[0],this.d=(e=s[1])+2*(r=s[2]);for(var c=0;c<this.d*this.d;c++){var h=s[3+c],d=s[3+c+1];n.push(h===d?null:s.subarray(h,d))}var m=s[3+n.length+1];this.keys=s.subarray(s[3+n.length],m),this.bboxes=s.subarray(m),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var _=0;_<this.d*this.d;_++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=i,this.padding=r,this.scale=e/i,this.uid=0;var x=r/e*i;this.min=-x,this.max=i+x}hr.prototype.insert=function(i,e,r,n,s){this._forEachCell(e,r,n,s,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(s)},hr.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},hr.prototype._insertCell=function(i,e,r,n,s,c){this.cells[s].push(c)},hr.prototype.query=function(i,e,r,n,s){var c=this.min,h=this.max;if(i<=c&&e<=c&&h<=r&&h<=n&&!s)return Array.prototype.slice.call(this.keys);var d=[];return this._forEachCell(i,e,r,n,this._queryCell,d,{},s),d},hr.prototype._queryCell=function(i,e,r,n,s,c,h,d){var m=this.cells[s];if(m!==null)for(var _=this.keys,x=this.bboxes,b=0;b<m.length;b++){var w=m[b];if(h[w]===void 0){var E=4*w;(d?d(x[E+0],x[E+1],x[E+2],x[E+3]):i<=x[E+2]&&e<=x[E+3]&&r>=x[E+0]&&n>=x[E+1])?(h[w]=!0,c.push(_[w])):h[w]=!1}}},hr.prototype._forEachCell=function(i,e,r,n,s,c,h,d){for(var m=this._convertToCellCoord(i),_=this._convertToCellCoord(e),x=this._convertToCellCoord(r),b=this._convertToCellCoord(n),w=m;w<=x;w++)for(var E=_;E<=b;E++){var M=this.d*E+w;if((!d||d(this._convertFromCellCoord(w),this._convertFromCellCoord(E),this._convertFromCellCoord(w+1),this._convertFromCellCoord(E+1)))&&s.call(this,i,e,r,n,M,c,h,d))return}},hr.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},hr.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},hr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var s=new Int32Array(e+r+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;for(var c=e,h=0;h<i.length;h++){var d=i[h];s[3+h]=c,s.set(d,c),c+=d.length}return s[3+i.length]=c,s.set(this.keys,c),s[3+i.length+1]=c+=this.keys.length,s.set(this.bboxes,c),c+=this.bboxes.length,s.buffer};const Ys={};function Re(i,e,r={}){Object.defineProperty(i,"_classRegistryKey",{value:e,writeable:!1}),Ys[e]={klass:i,omit:r.omit||[]}}Re(Object,"Object"),Jn.serialize=function(i,e){const r=i.toArrayBuffer();return e&&e.push(r),{buffer:r}},Jn.deserialize=function(i){return new Jn(i.buffer)},Object.defineProperty(Jn,"name",{value:"Grid"}),Re(Jn,"Grid"),Re(Gt,"Color"),Re(Error,"Error"),Re(J,"AJAXError"),Re(Gi,"ResolvedImage"),Re(Vo,"StylePropertyFunction"),Re(Vs,"StyleExpression",{omit:["_evaluator"]}),Re(Uo,"ZoomDependentExpression"),Re(Ns,"ZoomConstantExpression"),Re(zr,"CompoundExpression",{omit:["_evaluate"]});for(const i in Oo)Ys[Oo[i]._classRegistryKey]||Re(Oo[i],`Expression${i}`);function vc(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function bc(i){return Se.ImageBitmap&&i instanceof Se.ImageBitmap}function $o(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp)return i;if(vc(i)||bc(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof Se.ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const n of i)r.push($o(n,e));return r}if(typeof i=="object"){const r=i.constructor,n=r._classRegistryKey;if(!n)throw new Error(`can't serialize object of unregistered class ${n}`);const s=r.serialize?r.serialize(i,e):{};if(!r.serialize){for(const c in i)i.hasOwnProperty(c)&&(Ys[n].omit.indexOf(c)>=0||(s[c]=$o(i[c],e)));i instanceof Error&&(s.message=i.message)}if(s.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(s.$name=n),s}throw new Error("can't serialize object of type "+typeof i)}function qo(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||vc(i)||bc(i)||ArrayBuffer.isView(i)||i instanceof Se.ImageData)return i;if(Array.isArray(i))return i.map(qo);if(typeof i=="object"){const e=i.$name||"Object",{klass:r}=Ys[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const n=Object.create(r.prototype);for(const s of Object.keys(i))s!=="$name"&&(n[s]=qo(i[s]));return n}throw new Error("can't deserialize object of type "+typeof i)}class wc{constructor(){this.first=!0}update(e,r){const n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}const Tc=i=>i>=1536&&i<=1791,Ec=i=>i>=1872&&i<=1919,Xo=i=>i>=2208&&i<=2303,Sc=i=>i>=11904&&i<=12031,Mc=i=>i>=12032&&i<=12255,Wo=i=>i>=12272&&i<=12287,Ks=i=>i>=12288&&i<=12351,Js=i=>i>=12352&&i<=12447,Qs=i=>i>=12448&&i<=12543,el=i=>i>=12544&&i<=12591,tl=i=>i>=12704&&i<=12735,il=i=>i>=12736&&i<=12783,rl=i=>i>=12784&&i<=12799,ea=i=>i>=12800&&i<=13055,ta=i=>i>=13056&&i<=13311,Ic=i=>i>=13312&&i<=19903,nl=i=>i>=19968&&i<=40959,Ac=i=>i>=40960&&i<=42127,ia=i=>i>=42128&&i<=42191,Cc=i=>i>=44032&&i<=55215,zc=i=>i>=63744&&i<=64255,ol=i=>i>=64336&&i<=65023,kc=i=>i>=65040&&i<=65055,sl=i=>i>
8=65072&&i<=65103,al=i=>i>=65104&&i<=65135,ll=i=>i>=65136&&i<=65279,cl=i=>i>=65280&&i<=65519;function ra(i){for(const e of i)if(t(e.charCodeAt(0)))return!0;return!1}function na(i){for(const e of i)if(!l(e.charCodeAt(0)))return!1;return!0}function l(i){return!(Tc(i)||Ec(i)||Xo(i)||ol(i)||ll(i))}function t(i){return!(i!==746&&i!==747&&(i<4352||!(tl(i)||el(i)||sl(i)&&!(i>=65097&&i<=65103)||zc(i)||ta(i)||Sc(i)||il(i)||!(!Ks(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ic(i)||nl(i)||ea(i)||(e=>e>=12592&&e<=12687)(i)||(e=>e>=43360&&e<=43391)(i)||(e=>e>=55216&&e<=55295)(i)||(e=>e>=4352&&e<=4607)(i)||Cc(i)||Js(i)||Wo(i)||(e=>e>=12688&&e<=12703)(i)||Mc(i)||rl(i)||Qs(i)&&i!==12540||!(!cl(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)||!(!al(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||(e=>e>=5120&&e<=5759)(i)||(e=>e>=6320&&e<=6399)(i)||kc(i)||(e=>e>=19904&&e<=19967)(i)||Ac(i)||ia(i))))}function o(i){return!(t(i)||function(e){return!!((r=>r>=128&&r<=255)(e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||(r=>r>=8192&&r<=8303)(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)||(r=>r>=8448&&r<=8527)(e)||(r=>r>=8528&&r<=8591)(e)||(r=>r>=8960&&r<=9215)(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)||(r=>r>=9216&&r<=9279)(e)&&e!==9251||(r=>r>=9280&&r<=9311)(e)||(r=>r>=9312&&r<=9471)(e)||(r=>r>=9632&&r<=9727)(e)||(r=>r>=9728&&r<=9983)(e)&&!(e>=9754&&e<=9759)||(r=>r>=11008&&r<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ks(e)||Qs(e)||(r=>r>=57344&&r<=63743)(e)||sl(e)||al(e)||cl(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function u(i){return i>=1424&&i<=2303||ol(i)||ll(i)}function p(i,e){return!(!e&&u(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||(r=>r>=6016&&r<=6143)(i))}function f(i){for(const e of i)if(u(e.charCodeAt(0)))return!0;return!1}const g="deferred",y="loading",v="loaded";let T=null,S="unavailable",A=null;const k=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(S="error"),T&&T(i)};function L(){B.fire(new _t("pluginStateChange",{pluginStatus:S,pluginURL:A}))}const B=new bt,P=function(){return S},G=function(){if(S!==g||!A)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");S=y,L(),A&&ee({url:A},i=>{i?k(i):(S=v,L())})},D={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>S===v||D.applyArabicShaping!=null,isLoading:()=>S===y,setState(i){S=i.pluginStatus,A=i.pluginURL},isParsed:()=>D.applyArabicShaping!=null&&D.processBidirectionalText!=null&&D.processStyledBidirectionalText!=null,getPluginURL:()=>A};class F{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition,this.pitch=r.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new wc,this.transition={},this.pitch=0)}isSupportedScript(e){return function(r,n){for(const s of r)if(!p(s.charCodeAt(0),n))return!1;return!0}(e,D.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),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class O{constructor(e,r){this.property=e,this.value=r,this.expression=function(n,s){if(Us(n))return new Vo(n,s);if(js(n)){const c=Gs(n,s);if(c.result==="error")throw new Error(c.value.map(h=>`${h.key}: ${h.message}`).join(", "));return c.value}{let c=n;return typeof n=="string"&&s.type==="color"&&(c=Gt.parse(n)),{kind:"constant",evaluate:()=>c}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}}class X{constructor(e){this.property=e,this.value=new O(e,void 0)}transitioned(e,r){return new Z(this.property,this.value,r,oi({},e.transition,this.transition),e.now)}
vendor: 4,849 bytes, line 8
8untransitioned(){return new Z(this.property,this.value,null,{},0)}}class N{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Oi(this._values[e].value.value)}setValue(e,r){this._values.hasOwnProperty(e)||(this._values[e]=new X(this._values[e].property)),this._values[e].value=new O(this._values[e].property,r===null?void 0:Oi(r))}getTransition(e){return Oi(this._values[e].transition)}setTransition(e,r){this._values.hasOwnProperty(e)||(this._values[e]=new X(this._values[e].property)),this._values[e].transition=Oi(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n);const s=this.getTransition(r);s!==void 0&&(e[`${r}-transition`]=s)}return e}transitioned(e,r){const n=new K(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].transitioned(e,r._values[s]);return n}untransitioned(){const e=new K(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Z{constructor(e,r,n,s,c){const h=s.delay||0,d=s.duration||0;c=c||0,this.property=e,this.value=r,this.begin=c+h,this.end=this.begin+d,e.specification.transition&&(s.delay||s.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){const s=e.now||0,c=this.value.possiblyEvaluate(e,r,n),h=this.prior;if(h){if(s>this.end)return this.prior=null,c;if(this.value.isDataDriven())return this.prior=null,c;if(s<this.begin)return h.possiblyEvaluate(e,r,n);{const d=(s-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,r,n),c,mo(d))}}return c}}class K{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){const s=new ce(this._properties);for(const c of Object.keys(this._values))s._values[c]=this._values[c].possiblyEvaluate(e,r,n);return s}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class le{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Oi(this._values[e].value)}setValue(e,r){this._values[e]=new O(this._values[e].property,r===null?void 0:Oi(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){const s=new ce(this._properties);for(const c of Object.keys(this._values))s._values[c]=this._values[c].possiblyEvaluate(e,r,n);return s}}class he{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,s){return this.property.evaluate(this.value,this.parameters,e,r,n,s)}}class ce{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class ae{constructor(e){this.specification=e}possiblyEvaluate(e,r){return e.expression.evaluate(r)}interpolate(e,r,n){const s=Po[this.specification.type];return s?s(e,r,n):e}}class q{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,s){return new he(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},n,s)}:e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new he(this,{kind:"constant",value:void 0},e.parameters);const s=Po[this.specification.type];return s?new he(this,{kind:"constant",value:s(e.value.value,r.value.value,n)},e.parameters):e}evaluate(e,r,n,s,c,h){return e.kind==="constant"?e.value:e.evaluate(r,n,s,c,h)}}class ge extends q{possiblyEvaluate(e,r,n,s){if(e.value===void 0)return new he(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const c=e.expression.evaluate(r,null,{},n,s),h=e.property.specification.type==="resolvedImage"&&typeof c!="string"?c.name:c,d=this._calculate(h,h,h,r);return new he(this,{kind:"constant",value:d},r)}if(e.expression.kind==="camera"){const c=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 he(this,{kind:"constant",value:c},r)}return new he(this,e.expression,r)}evaluate(e,r,n,s,c,h){if(e.kind==="source"){const d=e.evaluate(r,n,s,c,h);return this._calculate(d,d,d,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,s),e.evaluate({zoom:Math.floor(r.zoom)},n,s),e.evaluate({zoom:Math.floor(r.zoom)+1},n,s),r):e.value}_calculate(e,r,n,s){return s.zoom>s.zoomHistory.lastIntegerZoom?{from:e,to:r,other:n}:{from:n,to:r,other:e}}interpolate(e){return e}}class _e{constructor(e){this.specification=e}
vendor: 23,403 bytes, line 8
8possiblyEvaluate(e,r,n,s){if(e.value!==void 0){if(e.expression.kind==="constant"){const c=e.expression.evaluate(r,null,{},n,s);return this._calculate(c,c,c,r)}return this._calculate(e.expression.evaluate(new F(Math.floor(r.zoom-1),r)),e.expression.evaluate(new F(Math.floor(r.zoom),r)),e.expression.evaluate(new F(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,n,s){return s.zoom>s.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}}class ze{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,s){return!!e.expression.evaluate(r,null,{},n,s)}interpolate(){return!1}}class de{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const r=new F(0,{});for(const n in e){const s=e[n];s.specification.overridable&&this.overridableProperties.push(n);const c=this.defaultPropertyValues[n]=new O(s,void 0),h=this.defaultTransitionablePropertyValues[n]=new X(s);this.defaultTransitioningPropertyValues[n]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate(r)}}}function Ve(i,e){return 256*(i=Qe(Math.floor(i),0,255))+Qe(Math.floor(e),0,255)}Re(q,"DataDrivenProperty"),Re(ae,"DataConstantProperty"),Re(ge,"CrossFadedDataDrivenProperty"),Re(_e,"CrossFadedProperty"),Re(ze,"ColorRampProperty");const Ce={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ae{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 Ee{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")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Ie(i,e=1){let r=0,n=0;return{members:i.map(s=>{const c=Ce[s.type].BYTES_PER_ELEMENT,h=r=He(r,Math.max(e,c)),d=s.components||1;return n=Math.max(n,c),r+=c*d,{name:s.name,type:s.type,components:d,offset:h}}),size:He(r,Math.max(n,e)),alignment:e}}function He(i,e){return Math.ceil(i/e)*e}class Ne extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const s=2*e;return this.int16[s+0]=r,this.int16[s+1]=n,e}}Ne.prototype.bytesPerElement=4,Re(Ne,"StructArrayLayout2i4");class tt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,r,n)}emplace(e,r,n,s){const c=3*e;return this.int16[c+0]=r,this.int16[c+1]=n,this.int16[c+2]=s,e}}tt.prototype.bytesPerElement=6,Re(tt,"StructArrayLayout3i6");class Ue extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,s)}emplace(e,r,n,s,c){const h=4*e;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=s,this.int16[h+3]=c,e}}Ue.prototype.bytesPerElement=8,Re(Ue,"StructArrayLayout4i8");class Ke extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,n,s,c,h,d)}emplace(e,r,n,s,c,h,d,m){const _=6*e,x=12*e,b=3*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.uint8[x+4]=s,this.uint8[x+5]=c,this.uint8[x+6]=h,this.uint8[x+7]=d,this.float32[b+2]=m,e}}Ke.prototype.bytesPerElement=12,Re(Ke,"StructArrayLayout2i4ub1f12");class yt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,s)}emplace(e,r,n,s,c){const h=4*e;return this.float32[h+0]=r,this.float32[h+1]=n,this.float32[h+2]=s,this.float32[h+3]=c,e}}yt.prototype.bytesPerElement=16,Re(yt,"StructArrayLayout4f16");class Tt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d,m,_,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,n,s,c,h,d,m,_,x)}emplace(e,r,n,s,c,h,d,m,_,x,b){const w=10*e;return this.uint16[w+0]=r,this.uint16[w+1]=n,this.uint16[w+2]=s,this.uint16[w+3]=c,this.uint16[w+4]=h,this.uint16[w+5]=d,this.uint16[w+6]=m,this.uint16[w+7]=_,this.uint16[w+8]=x,this.uint16[w+9]=b,e}}Tt.prototype.bytesPerElement=20,Re(Tt,"StructArrayLayout10ui20");class qt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d,m){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,n,s,c,h,d,m)}emplace(e,r,n,s,c,h,d,m,_){const x=8*e;return this.uint16[x+0]=r,this.uint16[x+1]=n,this.uint16[x+2]=s,this.uint16[x+3]=c,this.uint16[x+4]=h,this.uint16[x+5]=d,this.uint16[x+6]=m,this.uint16[x+7]=_,e}}qt.prototype.bytesPerElement=16,Re(qt,"StructArrayLayout8ui16");class Mt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,n,s,c,h)}emplace(e,r,n,s,c,h,d){const m=6*e;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=s,this.int16[m+3]=c,this.int16[m+4]=h,this.int16[m+5]=d,e}}Mt.prototype.bytesPerElement=12,Re(Mt,"StructArrayLayout6i12");class Ri extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d,m,_,x,b,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,n,s,c,h,d,m,_,x,b,w)}emplace(e,r,n,s,c,h,d,m,_,x,b,w,E){const M=12*e;return this.int16[M+0]=r,this.int16[M+1]=n,this.int16[M+2]=s,this.int16[M+3]=c,this.uint16[M+4]=h,this.uint16[M+5]=d,this.uint16[M+6]=m,this.uint16[M+7]=_,this.int16[M+8]=x,this.int16[M+9]=b,this.int16[M+10]=w,this.int16[M+11]=E,e}}Ri.prototype.bytesPerElement=24,Re(Ri,"StructArrayLayout4i4ui4i24");class pr extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,n,s,c,h)}emplace(e,r,n,s,c,h,d){const m=10*e,_=5*e;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=s,this.float32[_+2]=c,this.float32[_+3]=h,this.float32[_+4]=d,e}}pr.prototype.bytesPerElement=20,Re(pr,"StructArrayLayout3i3f20");class Pr extends Ee{_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}}Pr.prototype.bytesPerElement=4,Re(Pr,"StructArrayLayout1ul4");class Pt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d,m,_,x,b,w,E){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,n,s,c,h,d,m,_,x,b,w,E)}emplace(e,r,n,s,c,h,d,m,_,x,b,w,E,M){const z=20*e,R=10*e;return this.int16[z+0]=r,this.int16[z+1]=n,this.int16[z+2]=s,this.int16[z+3]=c,this.int16[z+4]=h,this.float32[R+3]=d,this.float32[R+4]=m,this.float32[R+5]=_,this.float32[R+6]=x,this.int16[z+14]=b,this.uint32[R+8]=w,this.uint16[z+18]=E,this.uint16[z+19]=M,e}}Pt.prototype.bytesPerElement=40,Re(Pt,"StructArrayLayout5i4f1i1ul2ui40");class Bt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,n,s,c,h,d)}emplace(e,r,n,s,c,h,d,m){const _=8*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=s,this.int16[_+4]=c,this.int16[_+5]=h,this.int16[_+6]=d,this.int16[_+7]=m,e}}Bt.prototype.bytesPerElement=16,Re(Bt,"StructArrayLayout3i2i2i16");class xt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,n,s,c)}emplace(e,r,n,s,c,h){const d=4*e,m=8*e;return this.float32[d+0]=r,this.float32[d+1]=n,this.float32[d+2]=s,this.int16[m+6]=c,this.int16[m+7]=h,e}}xt.prototype.bytesPerElement=16,Re(xt,"StructArrayLayout2f1f2i16");class Yt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,s)}emplace(e,r,n,s,c){const h=12*e,d=3*e;return this.uint8[h+0]=r,this.uint8[h+1]=n,this.float32[d+1]=s,this.float32[d+2]=c,e}}Yt.prototype.bytesPerElement=12,Re(Yt,"StructArrayLayout2ub2f12");class ci extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,r,n)}emplace(e,r,n,s){const c=3*e;return this.float32[c+0]=r,this.float32[c+1]=n,this.float32[c+2]=s,e}}ci.prototype.bytesPerElement=12,Re(ci,"StructArrayLayout3f12");class ht extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,r,n)}emplace(e,r,n,s){const c=3*e;return this.uint16[c+0]=r,this.uint16[c+1]=n,this.uint16[c+2]=s,e}}ht.prototype.bytesPerElement=6,Re(ht,"StructArrayLayout3ui6");class Ti extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d,m,_,x,b,w,E,M,z,R,j,H,W,Y,Q){const te=this.length;return this.resize(te+1),this.emplace(te,e,r,n,s,c,h,d,m,_,x,b,w,E,M,z,R,j,H,W,Y,Q)}emplace(e,r,n,s,c,h,d,m,_,x,b,w,E,M,z,R,j,H,W,Y,Q,te){const ue=30*e,pe=15*e,me=60*e;return this.int16[ue+0]=r,this.int16[ue+1]=n,this.int16[ue+2]=s,this.float32[pe+2]=c,this.float32[pe+3]=h,this.uint16[ue+8]=d,this.uint16[ue+9]=m,this.uint32[pe+5]=_,this.uint32[pe+6]=x,this.uint32[pe+7]=b,this.uint16[ue+16]=w,this.uint16[ue+17]=E,this.uint16[ue+18]=M,this.float32[pe+10]=z,this.float32[pe+11]=R,this.uint8[me+48]=j,this.uint8[me+49]=H,this.uint8[me+50]=W,this.uint32[pe+13]=Y,this.int16[ue+28]=Q,this.uint8[me+58]=te,e}}Ti.prototype.bytesPerElement=60,Re(Ti,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class xn extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d,m,_,x,b,w,E,M,z,R,j,H,W,Y,Q,te,ue,pe,me,be,se,fe,we,Te){const De=this.length;return this.resize(De+1),this.emplace(De,e,r,n,s,c,h,d,m,_,x,b,w,E,M,z,R,j,H,W,Y,Q,te,ue,pe,me,be,se,fe,we,Te)}emplace(e,r,n,s,c,h,d,m,_,x,b,w,E,M,z,R,j,H,W,Y,Q,te,ue,pe,me,be,se,fe,we,Te,De){const xe=38*e,ke=19*e;return this.int16[xe+0]=r,this.int16[xe+1]=n,this.int16[xe+2]=s,this.float32[ke+2]=c,this.float32[ke+3]=h,this.int16[xe+8]=d,this.int16[xe+9]=m,this.int16[xe+10]=_,this.int16[xe+11]=x,this.int16[xe+12]=b,this.int16[xe+13]=w,this.uint16[xe+14]=E,this.uint16[xe+15]=M,this.uint16[xe+16]=z,this.uint16[xe+17]=R,this.uint16[xe+18]=j,this.uint16[xe+19]=H,this.uint16[xe+20]=W,this.uint16[xe+21]=Y,this.uint16[xe+22]=Q,this.uint16[xe+23]=te,this.uint16[xe+24]=ue,this.uint16[xe+25]=pe,this.uint16[xe+26]=me,this.uint16[xe+27]=be,this.uint16[xe+28]=se,this.uint32[ke+15]=fe,this.float32[ke+16]=we,this.float32[ke+17]=Te,this.float32[ke+18]=De,e}}xn.prototype.bytesPerElement=76,Re(xn,"StructArrayLayout3i2f6i15ui1ul3f76");class ir extends Ee{_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}}ir.prototype.bytesPerElement=4,Re(ir,"StructArrayLayout1f4");class Qn extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,n,s,c,h,d)}emplace(e,r,n,s,c,h,d,m){const _=7*e;return this.float32[_+0]=r,this.float32[_+1]=n,this.float32[_+2]=s,this.float32[_+3]=c,this.float32[_+4]=h,this.float32[_+5]=d,this.float32[_+6]=m,e}}Qn.prototype.bytesPerElement=28,Re(Qn,"StructArrayLayout7f28");class eo extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,s,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,n,s,c)}emplace(e,r,n,s,c,h){const d=5*e;return this.float32[d+0]=r,this.float32[d+1]=n,this.float32[d+2]=s,this.float32[d+3]=c,this.float32[d+4]=h,e}}eo.prototype.bytesPerElement=20,Re(eo,"StructArrayLayout5f20");class Zr extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,s)}emplace(e,r,n,s,c){const h=6*e;return this.uint32[3*e+0]=r,this.uint16[h+2]=n,this.uint16[h+3]=s,this.uint16[h+4]=c,e}}Zr.prototype.bytesPerElement=12,Re(Zr,"StructArrayLayout1ul3ui12");class Kt extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const s=2*e;return this.uint16[s+0]=r,this.uint16[s+1]=n,e}}Kt.prototype.bytesPerElement=4,Re(Kt,"StructArrayLayout2ui4");class dr extends Ee{_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}}dr.prototype.bytesPerElement=2,Re(dr,"StructArrayLayout1ui2");class Dr extends Ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const s=2*e;return this.float32[s+0]=r,this.float32[s+1]=n,e}}Dr.prototype.bytesPerElement=8,Re(Dr,"StructArrayLayout2f8");class Ho extends Ae{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}Ho.prototype.size=12;class Gh extends Mt{get(e){return new Ho(this,e)}}Re(Gh,"FillExtrusionExtArray");class Zh extends Ae{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Zh.prototype.size=40;class Uu extends Pt{get(e){return new Zh(this,e)}}Re(Uu,"CollisionBoxArray");class $h extends Ae{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}$h.prototype.size=60;class qh extends Ti{get(e){return new $h(this,e)}}Re(qh,"PlacedSymbolArray");class Xh extends Ae{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(e){this._structArray.uint32[this._pos4+15]=e}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}Xh.prototype.size=76;class Wh extends xn{get(e){return new Xh(this,e)}}Re(Wh,"SymbolInstanceArray");class Hh extends ir{getoffsetX(e){return this.float32[1*e+0]}}Re(Hh,"GlyphOffsetArray");class Yh extends tt{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Re(Yh,"SymbolLineVertexArray");class Kh extends Ae{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Kh.prototype.size=12;class Jh extends Zr{get(e){return new Kh(this,e)}}Re(Jh,"FeatureIndexArray");class Qh extends Ae{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}Qh.prototype.size=4;class ep extends Kt{get(e){return new Qh(this,e)}}Re(ep,"FillExtrusionCentroidArray");class tp extends Ae{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}tp.prototype.size=12;class ip extends Mt{get(e){return new tp(this,e)}}Re(ip,"CircleGlobeExtArray");const vf=Ie([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),bf=Ie([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var rp=Un(function(i){i.exports=function(e,r){var n,s,c,h,d,m,_,x;for(s=e.length-(n=3&e.length),c=r,d=3432918353,m=461845907,x=0;x<s;)_=255&e.charCodeAt(x)|(255&e.charCodeAt(++x))<<8|(255&e.charCodeAt(++x))<<16|(255&e.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=
85*(65535&(c=(c^=_=(65535&(_=(_=(65535&_)*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(_=0,n){case 3:_^=(255&e.charCodeAt(x+2))<<16;case 2:_^=(255&e.charCodeAt(x+1))<<8;case 1:c^=_=(65535&(_=(_=(65535&(_^=255&e.charCodeAt(x)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295}return c^=e.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0}}),wf=Un(function(i){i.exports=function(e,r){for(var n,s=e.length,c=r^s,h=0;s>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(h)|(255&e.charCodeAt(++h))<<8|(255&e.charCodeAt(++h))<<16|(255&e.charCodeAt(++h))<<24))+((1540483477*(n>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),s-=4,++h;switch(s){case 3:c^=(255&e.charCodeAt(h+2))<<16;case 2:c^=(255&e.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&e.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0}}),ul=rp,Tf=wf;ul.murmur3=rp,ul.murmur2=Tf;class Pc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,s){this.ids.push(np(e)),this.positions.push(r,n,s)}getPositions(e){const r=np(e);let n=0,s=this.ids.length-1;for(;n<s;){const h=n+s>>1;this.ids[h]>=r?s=h:n=h+1}const c=[];for(;this.ids[n]===r;)c.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return c}static serialize(e,r){const n=new Float64Array(e.ids),s=new Uint32Array(e.positions);return Vu(n,s,0,n.length-1),r&&r.push(n.buffer,s.buffer),{ids:n,positions:s}}static deserialize(e){const r=new Pc;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function np(i){const e=+i;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:ul(String(i))}function Vu(i,e,r,n){for(;r<n;){const s=i[r+n>>1];let c=r-1,h=n+1;for(;;){do c++;while(i[c]<s);do h--;while(i[h]>s);if(c>=h)break;Dc(i,c,h),Dc(e,3*c,3*h),Dc(e,3*c+1,3*h+1),Dc(e,3*c+2,3*h+2)}h-r<n-h?(Vu(i,e,r,h),r=h+1):(Vu(i,e,h+1,n),n=h)}}function Dc(i,e,r){const n=i[e];i[e]=i[r],i[r]=n}Re(Pc,"FeaturePositionMap");class vn{constructor(e,r){this.gl=e.gl,this.location=r}}class Lc extends vn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class op extends vn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class sp extends vn{constructor(e,r){super(e,r),this.current=Gt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Ef=new Float32Array(16),Sf=new Float32Array(9),Mf=new Float32Array(4);function ju(i){return[Ve(255*i.r,255*i.g),Ve(255*i.b,255*i.a)]}class hl{constructor(e,r,n){this.value=e,this.uniformNames=r.map(s=>`u_${s}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new sp(e,r):new Lc(e,r)}}class oa{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio||1,this.pixelRatioTo=e.pixelRatio||1,this.patternFrom=r.tl.concat(r.br),this.patternTo=e.tl.concat(e.br)}setUniform(e,r,n,s){const c=s==="u_pattern_to"||s==="u_dash_to"?this.patternTo:s==="u_pattern_from"||s==="u_dash_from"?this.patternFrom:s==="u_pixel_ratio_to"?this.pixelRatioTo:s==="u_pixel_ratio_from"?this.pixelRatioFrom:null;c&&e.set(c)}getBinding(e,r,n){return n==="u_pattern_from"||n==="u_pattern_to"||n==="u_dash_from"||n==="u_dash_to"?new op(e,r):new Lc(e,r)}}class bn{constructor(e,r,n,s){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(c=>({name:`a_${c}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,r,n,s,c,h){const d=this.paintVertexArray.length,m=this.expression.evaluate(new F(0),r,{},c,s,h);this.paintVertexArray.resize(e),this._setPaintValue(d,e,m)}
8updatePaintArray(e,r,n,s,c){const h=this.expression.evaluate({zoom:0},n,s,void 0,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,n){if(this.type==="color"){const s=ju(n);for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,s[0],s[1])}else{for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Lr{constructor(e,r,n,s,c,h){this.expression=e,this.uniformNames=r.map(d=>`u_${d}_t`),this.type=n,this.useIntegerZoom=s,this.zoom=c,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,r,n,s,c,h){const d=this.expression.evaluate(new F(this.zoom),r,{},c,s,h),m=this.expression.evaluate(new F(this.zoom+1),r,{},c,s,h),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,d,m)}updatePaintArray(e,r,n,s,c){const h=this.expression.evaluate({zoom:this.zoom},n,s,void 0,c),d=this.expression.evaluate({zoom:this.zoom+1},n,s,void 0,c);this._setPaintValue(e,r,h,d)}_setPaintValue(e,r,n,s){if(this.type==="color"){const c=ju(n),h=ju(s);for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,c[0],c[1],h[0],h[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,n,s);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,s=Qe(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(s)}getBinding(e,r,n){return new Lc(e,r)}}class to{constructor(e,r,n,s,c,h,d){this.expression=e,this.type=n,this.useIntegerZoom=s,this.zoom=c,this.layerId=d,this.paintVertexAttributes=(n==="array"?bf:vf).members;for(let m=0;m<r.length;++m);this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,n){const s=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(s,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,s,c,h){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],h)}_setPaintValues(e,r,n,s){if(!s||!n)return;const{min:c,mid:h,max:d}=n,m=s[c],_=s[h],x=s[d];if(m&&_&&x)for(let b=e;b<r;b++)this._setPaintValue(this.zoomInPaintVertexArray,b,_,m),this._setPaintValue(this.zoomOutPaintVertexArray,b,_,x)}_setPaintValue(e,r,n,s){e.emplace(r,n.tl[0],n.tl[1],n.br[0],n.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],n.pixelRatio,s.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class io{constructor(e,r,n=()=>!0){this.binders={},this._buffers=[];const s=[];for(const c in e.paint._values){if(!n(c))continue;const h=e.paint.get(c);if(!(h instanceof he&&Xn(h.property.specification)))continue;const d=Af(c,e.type),m=h.value,_=h.property.specification.type,x=h.property.useIntegerZoom,b=h.property.specification["property-type"],w=b==="cross-faded"||b==="cross-faded-data-driven",E=String(c)==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant";if(m.kind!=="constant"||E)if(m.kind==="source"||E||w){const M=ap(c,_,"source");this.binders[c]=w?new to(m,d,_,x,r,M,e.id):new bn(m,d,_,M),s.push(`/a_${c}`)}else{const M=ap(c,_,"composite");this.binders[c]=new Lr(m,d,_,x,r,M),s.push(`/z_${c}`)}else this.binders[c]=w?new oa(m.value,d):new hl(m.value,d,_),s.push(`/u_${c}`)}this.cacheKey=s.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof bn||r instanceof Lr?r.maxValue:0}populatePaintArrays(e,r,n,s,c,h){for(const d in this.binders){const m=this.binders[d];(m instanceof bn||m instanceof Lr||m instanceof to)&&m.populatePaintArray(e,r,n,s,c,h)}}setConstantPatternPositions(e,r){for(const n in this.binders){const s=this.binders[n];s instanceof oa&&s.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,s,c,h){let d=!1;for(const m in e){const _=r.getPositions(m);for(const x of _){const b=n.feature(x.index);for(const w in this.binders){const E=this.binders[w];if((E instanceof bn||E instanceof Lr||E instanceof to)&&E.expression.isStateDependent===!0){const M=s.paint.get(w);E.expression=M.value,E.updatePaintArray(x.start,x.end,b,e[m],c,h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const n=this.binders[r];(n instanceof hl||n instanceof oa)&&e.push(...n.uniformNames.map(s=>`#define HAS_UNIFORM_${s}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof bn||n instanceof Lr||n instanceof to)for(let s=0;s<n.paintVertexAttributes.length;s++)e.push(n.paintVertexAttributes[s].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof hl||n instanceof oa||n instanceof Lr)for(const s of n.uniformNames)e.push(s)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const n=[];for(const s in this.binders){const c=this.binders[s];if(c instanceof hl||c instanceof oa||c instanceof Lr){for(const h of c.uniformNames)if(r[h]){const d=c.getBinding(e,r[h],h);n.push({name:h,property:s,binding:d})}}}return n}setUniforms(e,r,n,s){for(const{name:c,property:h,binding:d}of r)this.binders[h].setUniform(d,s,n.get(h),c)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const n=this.binders[r];if(e&&n instanceof to){const s=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;s&&this._buffers.push(s)}else(n instanceof bn||n instanceof Lr)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(const r in this.binders){const n=this.binders[r];(n instanceof bn||n instanceof Lr||n instanceof to)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof bn||r instanceof Lr||r instanceof to)&&r.destroy()}}}class Yo{constructor(e,r,n=()=>!0){this.programConfigurations={};for(const s of e)this.programConfigurations[s.id]=new io(s,r,n);this.needsUpload=!1,this._featureMap=new Pc,this._bufferOffset=0}populatePaintArrays(e,r,n,s,c,h,d){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,s,c,h,d);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,s,c){for(const h of n)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,s,c
8)||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()}}const If={"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"],"line-dasharray":["dash_to","dash_from"]};function Af(i,e){return If[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}const Cf={"line-pattern":{source:Tt,composite:Tt},"fill-pattern":{source:Tt,composite:Tt},"fill-extrusion-pattern":{source:Tt,composite:Tt},"line-dasharray":{source:qt,composite:qt}},zf={color:{source:Dr,composite:yt},number:{source:ir,composite:Dr}};function ap(i,e,r){const n=Cf[i];return n&&n[r]||zf[e][r]}Re(hl,"ConstantBinder"),Re(oa,"CrossFadedConstantBinder"),Re(bn,"SourceExpressionBinder"),Re(to,"CrossFadedCompositeBinder"),Re(Lr,"CompositeExpressionBinder"),Re(io,"ProgramConfiguration",{omit:["_buffers"]}),Re(Yo,"ProgramConfigurationSet");const Bc="-transition";class Br extends bt{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,e.type!=="custom"&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&e.type!=="sky"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new le(r.layout)),r.paint)){this._transitionablePaint=new N(r.paint);for(const n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(const n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ce(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){r!=null&&this._validate(Ou,`layers.${this.id}.layout.${e}`,e,r,n)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return kn(e,Bc)?this._transitionablePaint.getTransition(e.slice(0,-Bc.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null&&this._validate(yc,`layers.${this.id}.paint.${e}`,e,r,n))return!1;if(kn(e,Bc))return this._transitionablePaint.setTransition(e.slice(0,-Bc.length),r||void 0),!1;{const s=this._transitionablePaint._values[e],c=s.property.specification["property-type"]==="cross-faded-data-driven",h=s.value.isDataDriven(),d=s.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const m=this._transitionablePaint._values[e].value;return m.isDataDriven()||h||c||this._handleOverridablePaintPropertyUpdate(e,d,m)}}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getProgramConfiguration(e){return null}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}
8serialize(){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),rn(e,(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,s,c={}){return(!c||c.validate!==!1)&&xc(this,e.call(gc,{key:r,layerType:this.type,objectKey:n,value:s,styleSpec:re,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){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 he&&Xn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=gn(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const kf=Ie([{name:"a_pos",components:2,type:"Int16"}],4),Pf=Ie([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Xt{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,s){let c=this.segments[this.segments.length-1];return e>Xt.MAX_VERTEX_ARRAY_LENGTH&&Nt(`Max vertices per segment is ${Xt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!c||c.vertexLength+e>Xt.MAX_VERTEX_ARRAY_LENGTH||c.sortKey!==s)&&(c={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},s!==void 0&&(c.sortKey=s),this.segments.push(c)),c}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,s){return new Xt([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:s,vaos:{},sortKey:0}])}}Xt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Re(Xt,"SegmentVector");var qe=8192;class ro{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Et?new Et(e.lng,e.lat):Et.convert(e),this}setSouthWest(e){return this._sw=e instanceof Et?new Et(e.lng,e.lat):Et.convert(e),this}extend(e){const r=this._sw,n=this._ne;let s,c;if(e instanceof Et)s=e,c=e;else{if(!(e instanceof ro))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ro.convert(e)):this.extend(Et.convert(e)):this;if(s=e._sw,c=e._ne,!s||!c)return this}return r||n?(r.lng=Math.min(s.lng,r.lng),r.lat=Math.min(s.lat,r.lat),n.lng=Math.max(c.lng,n.lng),n.lat=Math.max(c.lat,n.lat)):(this._sw=new Et(s.lng,s.lat),this._ne=new Et(c.lng,c.lat)),this}getCenter(){return new Et((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 Et(this.getWest(),this.getNorth())}getSouthEast(){return new Et(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:n}=Et.convert(e);let s=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&s}static convert(e){return!e||e instanceof ro?e:new ro(e)}}const Nu=63710088e-1;class Et{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 Et(Fr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,n=this.lat*r,s=e.lat*r,c=Math.sin(n)*Math.sin(s)+Math.cos(n)*Math.cos(s)*Math.cos((e.lng-this.lng)*r);return Nu*Math.acos(Math.min(c,1))}toBounds(e=0){const r=360*e/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new ro(new Et(this.lng-n,this.lat-r),new Et(this.lng+n,this.lat+r))}static convert(e){if(e instanceof Et)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Et(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Et(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const lp=2*Math.PI*Nu;function Gu(i){return lp*Math.cos(i*Math.PI/180)}function Ko(i){return(180+i)/360}function Jo(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function fr(i,e){return i/Gu(e)}function Ei(i){return 360*i-180}function ti(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180)
vendor: 33,655 bytes, line 8
8)-90}function cp(i,e){return i*Gu(ti(e))}const $r=85.051129;class sa{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){const n=Et.convert(e);return new sa(Ko(n.lng),Jo(n.lat),fr(r,n.lat))}toLngLat(){return new Et(Ei(this.x),ti(this.y))}toAltitude(){return cp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/lp*(e=ti(this.y),1/Math.cos(e*Math.PI/180));var e}}function Zu(i,e,r,n,s,c,h,d,m){const _=(e+n)/2,x=(r+s)/2,b=new Me(_,x);d(b),function(w,E,M,z,R,j){const H=M-R,W=z-j;return Math.abs((z-E)*H-(M-w)*W)/Math.hypot(H,W)}(b.x,b.y,c.x,c.y,h.x,h.y)>=m?(Zu(i,e,r,_,x,c,b,d,m),Zu(i,_,x,n,s,b,h,d,m)):i.push(h)}function up(i,e,r){let n=i[0],s=n.x,c=n.y;e(n);const h=[n];for(let d=1;d<i.length;d++){const m=i[d],{x:_,y:x}=m;e(m),Zu(h,s,c,_,x,n,m,e,r),s=_,c=x,n=m}return h}function $u(i,e,r,n,s){if(s(e,r)){const c=e.add(r).mult(.5);n(c),$u(i,e,c,n,s),$u(i,c,r,n,s)}else i.push(r)}function Df(i,e,r){let n=i[0];e(n);const s=[n];for(let c=1;c<i.length;c++){const h=i[c];e(h),$u(s,n,h,e,r),n=h}return s}const qu=Math.pow(2,14)-1,hp=-qu-1;function Lf(i,e){const r=Math.round(i.x*e),n=Math.round(i.y*e);return i.x=Qe(r,hp,qu),i.y=Qe(n,hp,qu),(r<i.x||r>i.x+1||n<i.y||n>i.y+1)&&Nt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),i}function wn(i,e,r){const n=i.loadGeometry(),s=i.extent,c=qe/s;if(e&&r&&r.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:d,x:m,y:_,projection:x}=r,b=w=>{const E=Ei((e.x+w.x/s)/h),M=ti((e.y+w.y/s)/h),z=x.project(E,M);w.x=(z.x*d-m)*s,w.y=(z.y*d-_)*s};for(let w=0;w<n.length;w++)if(i.type!==1)n[w]=up(n[w],b,1);else{const E=[];for(const M of n[w])M.x<0||M.x>=s||M.y<0||M.y>=s||(b(M),E.push(M));n[w]=E}}for(const h of n)for(const d of h)Lf(d,c);return n}function Qo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?wn(i):[]}}function Rc(i,e,r,n,s){i.emplaceBack(2*e+(n+1)/2,2*r+(s+1)/2)}function Fc(i,e,r){i.emplaceBack(e.x,e.y,e.z,r[0]*16384,r[1]*16384,r[2]*16384)}class Xu{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.projection=e.projection,this.layoutVertexArray=new Ne,this.indexArray=new ht,this.segments=new Xt,this.programConfigurations=new Yo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n,s){const c=this.layers[0],h=[];let d=null;c.type==="circle"&&(d=c.layout.get("circle-sort-key"));for(const{feature:_,id:x,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,M=Qo(_,E);if(!this.layers[0]._featureFilter.filter(new F(this.zoom),M,n))continue;const z=d?d.evaluate(M,{},n):void 0,R={id:x,properties:_.properties,type:_.type,sourceLayerIndex:w,index:b,geometry:E?M.geometry:wn(_,n,s),patterns:{},sortKey:z};h.push(R)}d&&h.sort((_,x)=>_.sortKey-x.sortKey);let m=null;s.projection.name==="globe"&&(this.globeExtVertexArray=new ip,m=s.projection);for(const _ of h){const{geometry:x,index:b,sourceLayerIndex:w}=_,E=e[b].feature;this.addFeature(_,x,b,r.availableImages,n,m),r.featureIndex.insert(E,x,b,w,this.index)}}update(e,r,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Pf.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,r,n,s,c,h){for(const d of r)for(const m of d){const _=m.x,x=m.y;if(_<0||_>=qe||x<0||x>=qe)continue;if(h){const E=h.projectTilePoint(_,x,c),M=h.upVector(c,_,x),z=this.globeExtVertexArray;Fc(z,E,M),Fc(z,E,M),Fc(z,E,M),Fc(z,E,M)}const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=b.vertexLength;Rc(this.layoutVertexArray,_,x,-1,-1),Rc(this.layoutVertexArray,_,x,1,-1),Rc(this.layoutVertexArray,_,x,1,1),Rc(this.layoutVertexArray,_,x,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+2,w+3),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},s,c)}}function pp(i,e){for(let r=0;r<i.length;r++)if(es(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(es(i,e[r]))return!0;return!!Wu(i,e)}function Bf(i,e,r){return!!es(i,e)||!!Hu(e,i,r)}function dp(i,e){if(i.length===1)return mp(e,i[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let s=0;s<n.length;s++)if(es(i,n[s]))return!0}for(let r=0;r<i.length;r++)if(mp(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Wu(i,e[r]))return!0;return!1}function Rf(i,e,r){if(i.length>1){if(Wu(i,e))return!0;for(let n=0;n<e.length;n++)if(Hu(e[n],i,r))return!0}for(let n=0;n<i.length;n++)if(Hu(i[n],e,r))return!0;return!1}function Wu(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const n=i[r],s=i[r+1];for(let c=0;c<e.length-1;c++)if(Ff(n,s,e[c],e[c+1]))return!0}return!1}function Ff(i,e,r,n){return fi(i,r,n)!==fi(e,r,n)&&fi(i,e,r)!==fi(i,e,n)}function Hu(i,e,r){const n=r*r;if(e.length===1)return i.distSqr(e[0])<n;for(let s=1;s<e.length;s++)if(fp(i,e[s-1],e[s])<n)return!0;return!1}function fp(i,e,r){const n=e.distSqr(r);if(n===0)return i.distSqr(e);const s=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/n;return i.distSqr(s<0?e:s>1?r:r.sub(e)._mult(s)._add(e))}function mp(i,e){let r,n,s,c=!1;for(let h=0;h<i.length;h++){r=i[h];for(let d=0,m=r.length-1;d<r.length;m=d++)n=r[d],s=r[m],n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(c=!c)}return c}function es(i,e){let r=!1;for(let n=0,s=i.length-1;n<i.length;s=n++){const c=i[n],h=i[s];c.y>e.y!=h.y>e.y&&e.x<(h.x-c.x)*(e.y-c.y)/(h.y-c.y)+c.x&&(r=!r)}return r}function _p(i,e,r,n,s){for(const h of i)if(e<=h.x&&r<=h.y&&n>=h.x&&s>=h.y)return!0;const c=[new Me(e,r),new Me(e,s),new Me(n,s),new Me(n,r)];if(i.length>2){for(const h of c)if(es(i,h))return!0}for(let h=0;h<i.length-1;h++)if(Of(i[h],i[h+1],c))return!0;return!1}function Of(i,e,r){const n=r[0],s=r[2];if(i.x<n.x&&e.x<n.x||i.x>s.x&&e.x>s.x||i.y<n.y&&e.y<n.y||i.y>s.y&&e.y>s.y)return!1;const c=fi(i,e,r[0]);return c!==fi(i,e,r[1])||c!==fi(i,e,r[2])||c!==fi(i,e,r[3])}function aa(i,e,r){const n=e.paint.get(i).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Oc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function gp(i,e,r,n,s){if(!e[0]&&!e[1])return i;const c=Me.convert(e)._mult(s);r==="viewport"&&c._rotate(-n);const h=[];for(let d=0;d<i.length;d++)h.push(i[d].sub(c));return h}function yp(i,e,r,n){const s=Me.convert(i)._mult(n);return e==="viewport"&&s._rotate(-r),s}Re(Xu,"CircleBucket",{omit:["layers"]});const Uf=new de({"circle-sort-key":new q(re.layout_circle["circle-sort-key"])});var Vf={paint:new de({"circle-radius":new q(re.paint_circle["circle-radius"]),"circle-color":new q(re.paint_circle["circle-color"]),"circle-blur":new q(re.paint_circle["circle-blur"]),"circle-opacity":new q(re.paint_circle["circle-opacity"]),"circle-translate":new ae(re.paint_circle["circle-translate"]),"circle-translate-anchor":new ae(re.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ae(re.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ae(re.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new q(re.paint_circle["circle-stroke-width"]),"circle-stroke-color":new q(re.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new q(re.paint_circle["circle-stroke-opacity"])}),layout:Uf},Uc=1e-6,qi=typeof Float32Array<"u"?Float32Array:Array;function xp(){var i=new qi(9);return qi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function Xi(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function no(i,e,r){var n=e[0],s=e[1],c=e[2],h=e[3],d=e[4],m=e[5],_=e[6],x=e[7],b=e[8],w=e[9],E=e[10],M=e[11],z=e[12],R=e[13],j=e[14],H=e[15],W=r[0],Y=r[1],Q=r[2],te=r[3];return i[0]=W*n+Y*d+Q*b+te*z,i[1]=W*s+Y*m+Q*w+te*R,i[2]=W*c+Y*_+Q*E+te*j,i[3]=W*h+Y*x+Q*M+te*H,i[4]=(W=r[4])*n+(Y=r[5])*d+(Q=r[6])*b+(te=r[7])*z,i[5]=W*s+Y*m+Q*w+te*R,i[6]=W*c+Y*_+Q*E+te*j,i[7]=W*h+Y*x+Q*M+te*H,i[8]=(W=r[8])*n+(Y=r[9])*d+(Q=r[10])*b+(te=r[11])*z,i[9]=W*s+Y*m+Q*w+te*R,i[10]=W*c+Y*_+Q*E+te*j,i[11]=W*h+Y*x+Q*M+te*H,i[12]=(W=r[12])*n+(Y=r[13])*d+(Q=r[14])*b+(te=r[15])*z,i[13]=W*s+Y*m+Q*w+te*R,i[14]=W*c+Y*_+Q*E+te*j,i[15]=W*h+Y*x+Q*M+te*H,i}function ts(i,e,r){var n,s,c,h,d,m,_,x,b,w,E,M,z=r[0],R=r[1],j=r[2];return e===i?(i[12]=e[0]*z+e[4]*R+e[8]*j+e[12],i[13]=e[1]*z+e[5]*R+e[9]*j+e[13],i[14]=e[2]*z+e[6]*R+e[10]*j+e[14],i[15]=e[3]*z+e[7]*R+e[11]*j+e[15]):(s=e[1],c=e[2],h=e[3],d=e[4],m=e[5],_=e[6],x=e[7],b=e[8],w=e[9],E=e[10],M=e[11],i[0]=n=e[0],i[1]=s,i[2]=c,i[3]=h,i[4]=d,i[5]=m,i[6]=_,i[7]=x,i[8]=b,i[9]=w,i[10]=E,i[11]=M,i[12]=n*z+d*R+b*j+e[12],i[13]=s*z+m*R+w*j+e[13],i[14]=c*z+_*R+E*j+e[14],i[15]=h*z+x*R+M*j+e[15]),i}function qr(i,e,r){var n=r[0],s=r[1],c=r[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*s,i[5]=e[5]*s,i[6]=e[6]*s,i[7]=e[7]*s,i[8]=e[8]*c,i[9]=e[9]*c,i[10]=e[10]*c,i[11]=e[11]*c,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function Vc(i,e,r){var n=Math.sin(r),s=Math.cos(r),c=e[4],h=e[5],d=e[6],m=e[7],_=e[8],x=e[9],b=e[10],w=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=c*s+_*n,i[5]=h*s+x*n,i[6]=d*s+b*n,i[7]=m*s+w*n,i[8]=_*s-c*n,i[9]=x*s-h*n,i[10]=b*s-d*n,i[11]=w*s-m*n,i}function jc(i,e,r){var n=Math.sin(r),s=Math.cos(r),c=e[0],h=e[1],d=e[2],m=e[3],_=e[8],x=e[9],b=e[10],w=e[11];return e!==i&&(i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=c*s-_*n,i[1]=h*s-x*n,i[2]=d*s-b*n,i[3]=m*s-w*n,i[8]=c*n+_*s,i[9]=h*n+x*s,i[10]=d*n+b*s,i[11]=m*n+w*s,i}function vp(i,e,r){var n,s,c,h=r[0],d=r[1],m=r[2],_=Math.hypot(h,d,m);return _<Uc?null:(h*=_=1/_,d*=_,m*=_,n=Math.sin(e),s=Math.cos(e),i[0]=h*h*(c=1-s)+s,i[1]=d*h*c+m*n,i[2]=m*h*c-d*n,i[3]=0,i[4]=h*d*c-m*n,i[5]=d*d*c+s,i[6]=m*d*c+h*n,i[7]=0,i[8]=h*m*c+d*n,i[9]=d*m*c-h*n,i[10]=m*m*c+s,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i)}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var jf=no;function Yu(){var i=new qi(3);return qi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function bp(i){var e=new qi(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e}function pl(i){return Math.hypot(i[0],i[1],i[2])}function la(i,e,r){var n=new qi(3);return n[0]=i,n[1]=e,n[2]=r,n}function oo(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i}function Ku(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i}function wp(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i}function Nc(i,e,r){return i[0]=Math.min(e[0],r[0]),i[1]=Math.min(e[1],r[1]),i[2]=Math.min(e[2],r[2]),i}function Gc(i,e,r){return i[0]=Math.max(e[0],r[0]),i[1]=Math.max(e[1],r[1]),i[2]=Math.max(e[2],r[2]),i}function Xr(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i}function Zc(i,e,r,n){return i[0]=e[0]+r[0]*n,i[1]=e[1]+r[1]*n,i[2]=e[2]+r[2]*n,i}function Si(i,e){var r=e[0],n=e[1],s=e[2],c=r*r+n*n+s*s;return c>0&&(c=1/Math.sqrt(c)),i[0]=e[0]*c,i[1]=e[1]*c,i[2]=e[2]*c,i}function mr(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Ju(i,e,r){var n=e[0],s=e[1],c=e[2],h=r[0],d=r[1],m=r[2];return i[0]=s*m-c*d,i[1]=c*h-n*m,i[2]=n*d-s*h,i}function _i(i,e,r){var n=e[0],s=e[1],c=e[2],h=r[3]*n+r[7]*s+r[11]*c+r[15];return i[0]=(r[0]*n+r[4]*s+r[8]*c+r[12])/(h=h||1),i[1]=(r[1]*n+r[5]*s+r[9]*c+r[13])/h,i[2]=(r[2]*n+r[6]*s+r[10]*c+r[14])/h,i}function Tp(i,e,r){var n=r[0],s=r[1],c=r[2],h=e[0],d=e[1],m=e[2],_=s*m-c*d,x=c*h-n*m,b=n*d-s*h,w=s*b-c*x,E=c*_-n*b,M=n*x-s*_,z=2*r[3];return x*=z,b*=z,E*=2,M*=2,i[0]=h+(_*=z)+(w*=2),i[1]=d+x+E,i[2]=m+b+M,i}var dl,_r=Ku,Nf=wp,Gf=pl;function Ep(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i[3]=e[3]*r,i}function is(i,e,r){var n=e[0],s=e[1],c=e[2],h=e[3];return i[0]=r[0]*n+r[4]*s+r[8]*c+r[12]*h,i[1]=r[1]*n+r[5]*s+r[9]*c+r[13]*h,i[2]=r[2]*n+r[6]*s+r[10]*c+r[14]*h,i[3]=r[3]*n+r[7]*s+r[11]*c+r[15]*h,i}function Sp(){var i=new qi(4);return qi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function Mp(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function Ip(i,e,r){r*=.5;var n=e[0],s=e[1],c=e[2],h=e[3],d=Math.sin(r),m=Math.cos(r);return i[0]=n*m+h*d,i[1]=s*m+c*d,i[2]=c*m-s*d,i[3]=h*m-n*d,i}function Ap(i,e,r){r*=.5;var n=e[0],s=e[1],c=e[2],h=e[3],d=Math.sin(r),m=Math.cos(r);return i[0]=n*m-c*d,i[1]=s*m+h*d,i[2]=c*m+n*d,i[3]=h*m-s*d,i}Yu(),dl=new qi(4),qi!=Float32Array&&(dl[0]=0,dl[1]=0,dl[2]=0,dl[3]=0),Yu(),la(1,0,0),la(0,1,0),Sp(),Sp(),xp();class Qu{constructor(e,r){this.pos=e,this.dir=r}intersectsPlane(e,r,n){const s=mr(r,this.dir);if(Math.abs(s)<1e-6)return!1;const c=((e[0]-this.pos[0])*r[0]+(e[1]-this.pos[1])*r[1]+(e[2]-this.pos[2])*r[2])/s;return n[0]=this.pos[0]+this.dir[0]*c,n[1]=this.pos[1]+this.dir[1]*c,n[2]=this.pos[2]+this.dir[2]*c,!0}closestPointOnSphere(e,r,n){if(function(E,M){var z=E[0],R=E[1],j=E[2],H=M[0],W=M[1],Y=M[2];return Math.abs(z-H)<=Uc*Math.max(1,Math.abs(z),Math.abs(H))&&Math.abs(R-W)<=Uc*Math.max(1,Math.abs(R),Math.abs(W))&&Math.abs(j-Y)<=Uc*Math.max(1,Math.abs(j),Math.abs(Y))}(this.pos,e)||r===0)return n[0]=n[1]=n[2]=0,!1;const[s,c,h]=this.dir,d=this.pos[0]-e[0],m=this.pos[1]-e[1],_=this.pos[2]-e[2],x=s*s+c*c+h*h,b=2*(d*s+m*c+_*h),w=b*b-4*x*(d*d+m*m+_*_-r*r);if(w<0){const E=Math.max(-b/2,0),M=d+s*E,z=m+c*E,R=_+h*E,j=Math.hypot(M,z,R);return n[0]=M*r/j,n[1]=z*r/j,n[2]=R*r/j,!1}{const E=(-b-Math.sqrt(w))/(2*x);if(E<0){const M=Math.hypot(d,m,_);return n[0]=d*r/M,n[1]=m*r/M,n[2]=_*r/M,!1}return n[0]=d+s*E,n[1]=m+c*E,n[2]=_+h*E,!0}}}class eh{constructor(e,r,n,s,c){this.TL=e,this.TR=r,this.BR=n,this.BL=s,this.horizon=c}static fromInvProjectionMatrix(e,r,n){const s=[-1,1,1],c=[1,1,1],h=[1,-1,1],d=[-1,-1,1],m=_i(s,s,e),_=_i(c,c,e),x=_i(h,h,e),b=_i(d,d,e);return new eh(m,_,x,b,r/n)}}class th{constructor(e,r){this.points=e,this.planes=r}static fromInvProjectionMatrix(e,r,n,s){const c=Math.pow(2,n),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(m=>{const _=is([],m,e),x=1/_[3]/r*c;return function(b,w,E){return b[0]=w[0]*E[0],b[1]=w[1]*E[1],b[2]=w[2]*E[2],b[3]=w[3]*E[3],b}(_,_,[x,x,s?1/_[3]:x,x])}),d=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(m=>{const _=Si([],Ju([],_r([],h[m[0]],h[m[1]]),_r([],h[m[2]],h[m[1]]))),x=-mr(_,h[m[1]]);return _.concat(x)});return new th(h,d)}}class rr{constructor(e,r){this.min=e,this.max=r,this.center=Xr([],oo([],this.min,this.max),.5)}quadrant(e){const r=[e%2==0,e<2],n=bp(this.min),s=bp(this.max);for(let c=0;c<r.length;c++)n[c]=r[c]?this.min[c]:this.center[c],s[c]=r[c]?this.center[c]:this.max[c];return s[2]=this.max[2],new rr(n,s)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,r=this.max;return[[e[0],e[1],e[2]],[r[0],e[1],e[2]],[r[0],r[1],e[2]],[e[0],r[1],e[2]],[e[0],e[1],r[2]],[r[0],e[1],r[2]],[r[0],r[1],r[2]],[e[0],r[1],r[2]]]}intersects(e){const r=this.getCorners();let n=!0;for(let s=0;s<e.planes.length;s++){const c=e.planes[s];let h=0;for(let d=0;d<r.length;d++)h+=mr(c,r[d])+c[3]>=0;if(h===0)return 0;h!==r.length&&(n=!1)}if(n)return 2;for(let s=0;s<3;s++){let c=Number.MAX_VALUE,h=-Number.MAX_VALUE;for(let d=0;d<e.points.length;d++){const m=e.points[d][s]-this.min[s];c=Math.min(c,m),h=Math.max(h,m)}if(h<0||c>this.max[s]-this.min[s])return 0}return 1}}function Cp(i,e,r,n,s,c,h,d,m){if(c&&i.queryGeometry.isAboveHorizon)return!1;c&&(m*=i.pixelToTileUnitsFactor);const _=i.tileID.canonical,x=r.projection.upVectorScale(_,r.center.lat,r.worldSize).metersToTile;for(const b of e)for(const w of b){const E=w.add(d),M=s&&r.elevation?r.elevation.exaggeration()*s.getElevationAt(E.x,E.y,!0):0,z=r.projection.projectTilePoint(E.x,E.y,_);if(M>0){const W=r.projection.upVector(_,E.x,E.y);z.x+=W[0]*x*M,z.y+=W[1]*x*M,z.z+=W[2]*x*M}const R=c?E:Zf(z.x,z.y,z.z,n),j=c?i.tilespaceRays.map(W=>qf(W,M)):i.queryGeometry.screenGeometry,H=is([],[z.x,z.y,z.z,1],n);if(!h&&c?m*=H[3]/r.cameraToCenterDistance:h&&!c&&(m*=r.cameraToCenterDistance/H[3]),c){const W=ti((w.y/qe+_.y)/(1<<_.z));m/=r.projection.pixelsPerMeter(W,1)/fr(1,W)}if(Bf(j,R,m))return!0}return!1}function Zf(i,e,r,n){const s=is([],[i,e,r,1],n);return new Me(s[0]/s[3],s[1]/s[3])}const zp=la(0,0,0),$f=la(0,0,1);function qf(i,e){const r=Yu();return zp[2]=e,i.intersectsPlane(zp,$f,r),new Me(r[0],r[1])}class kp extends Xu{}function Pp(i,{width:e,height:r},n,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*r*n)throw new RangeError("mismatched image size")}else s=new Uint8Array(e*r*n);return i.width=e,i.height=r,i.data=s,i}function Dp(i,e,r){const{width:n,height:s}=e;n===i.width&&s===i.height||(ih(i,e,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,n),height:Math.min(i.height,s)},r),i.width=n,i.height=s,i.data=e.data)}function ih(i,e,r,n,s,c){if(s.width===0||s.height===0)return e;if(s.width>i.width||s.height>i.height||r.x>i.width-s.width||r.y>i.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||n.x>e.width-s.width||n.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const h=i.data,d=e.data;for(let m=0;m<s.height;m++){const _=((r.y+m)*i.width+r.x)*c,x=((n.y+m)*e.width+n.x)*c;for(let b=0;b<s.width*c;b++)d[x+b]=h[_+b]}return e}Re(kp,"HeatmapBucket",{omit:["layers"]});class Tn{constructor(e,r){Pp(this,e,1,r)}resize(e){Dp(this,new Tn(e),1)}clone(){return new Tn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,s,c){ih(e,r,n,s,c,1)}}class Wi{constructor(e,r){Pp(this,e,4,r)}resize(e){Dp(this,new Wi(e),4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Wi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,s,c){ih(e,r,n,s,c,4)}}Re(Tn,"AlphaImage"),Re(Wi,"RGBAImage");var Xf={paint:new de({"heatmap-radius":new q(re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new q(re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ae(re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ze(re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ae(re.paint_heatmap["heatmap-opacity"])})};function rh(i){const e={},r=i.resolution||256,n=i.clips?i.clips.length:1,s=i.image||new Wi({width:r,height:n}),c=(h,d,m)=>{e[i.evaluationKey]=m;const _=i.expression.evaluate(e);s.data[h+d+0]=Math.floor(255*_.r/_.a),s.data[h+d+1]=Math.floor(255*_.g/_.a),s.data[h+d+2]=Math.floor(255*_.b/_.a),s.data[h+d+3]=Math.floor(255*_.a)};if(i.clips)for(let h=0,d=0;h<n;++h,d+=4*r)for(let m=0,_=0;m<r;m++,_+=4){const x=m/(r-1),{start:b,end:w}=i.clips[h];c(d,_,b*(1-x)+w*x)}else for(let h=0,d=0;h<r;h++,d+=4)c(0,d,h/(r-1));return s}var Wf={paint:new de({"hillshade-illumination-direction":new ae(re.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ae(re.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ae(re.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ae(re.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ae(re.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ae(re.paint_hillshade["hillshade-accent-color"])})};const Hf=Ie([{name:"a_pos",components:2,type:"Int16"}],4),{members:Yf}=Hf;var $c=qc,Kf=qc;function qc(i,e,r){r=r||2;var n,s,c,h,d,m,_,x=e&&e.length,b=x?e[0]*r:i.length,w=Lp(i,0,b,r,!0),E=[];if(!w||w.next===w.prev)return E;if(x&&(w=function(z,R,j,H){var W,Y,Q,te=[];for(W=0,Y=R.length;W<Y;W++)(Q=Lp(z,R[W]*H,W<Y-1?R[W+1]*H:z.length,H,!1))===Q.next&&(Q.steiner=!0),te.push(om(Q));for(te.sort(im),W=0;W<te.length;W++)j=so(j=rm(te[W],j),j.next);return j}(i,e,w,r)),i.length>80*r){n=c=i[0],s=h=i[1];for(var M=r;M<b;M+=r)(d=i[M])<n&&(n=d),(m=i[M+1])<s&&(s=m),d>c&&(c=d),m>h&&(h=m);_=(_=Math.max(c-n,h-s))!==0?1/_:0}return fl(w,E,r,n,s,_),E}function Lp(i,e,r,n,s){var c,h;if(s===sh(i,e,r,n)>0)for(c=e;c<r;c+=n)h=Fp(c,i[c],i[c+1],h);else for(c=r-n;c>=e;c-=n)h=Fp(c,i[c],i[c+1],h);return h&&Xc(h,h.next)&&(_l(h),h=h.next),h}function so(i,e){if(!i)return i;e||(e=i);var r,n=i;do if(r=!1,n.steiner||!Xc(n,n.next)&&Jt(n.prev,n,n.next)!==0)n=n.next;else{if(_l(n),(n=e=n.prev)===n.next)break;r=!0}while(r||n!==e);return e}function fl(i,e,r,n,s,c,h){if(i){!h&&c&&function(x,b,w,E){var M=x;do M.z===null&&(M.z=nh(M.x,M.y,b,w,E)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==x);M.prevZ.nextZ=null,M.prevZ=null,function(z){var R,j,H,W,Y,Q,te,ue,pe=1;do{for(j=z,z=null,Y=null,Q=0;j;){for(Q++,H=j,te=0,R=0;R<pe&&(te++,H=H.nextZ);R++);for(ue=pe;te>0||ue>0&&H;)te!==0&&(ue===0||!H||j.z<=H.z)?(W=j,j=j.nextZ,te--):(W=H,H=H.nextZ,ue--),Y?Y.nextZ=W:z=W,W.prevZ=Y,Y=W;j=H}Y.nextZ=null,pe*=2}while(Q>1)}(M)}(i,n,s,c);for(var d,m,_=i;i.prev!==i.next;)if(d=i.prev,m=i.next,c?Qf(i,n,s,c):Jf(i))e.push(d.i/r),e.push(i.i/r),e.push(m.i/r),_l(i),i=m.next,_=m.next;else if((i=m)===_){h?h===1?fl(i=em(so(i),e,r),e,r,n,s,c,2):h===2&&tm(i,e,r,n,s,c):fl(so(i),e,r,n,s,c,1);break}}}function Jf(i){var e=i.prev,r=i,n=i.next;if(Jt(e,r,n)>=0)return!1;for(var s=i.next.next;s!==i.prev;){if(ca(e.x,e.y,r.x,r.y,n.x,n.y,s.x,s.y)&&Jt(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function Qf(i,e,r,n){var s=i.prev,c=i,h=i.next;if(Jt(s,c,h)>=0)return!1;for(var d=s.x>c.x?s.x>h.x?s.x:h.x:c.x>h.x?c.x:h.x,m=s.y>c.y?s.y>h.y?s.y:h.y:c.y>h.y?c.y:h.y,_=nh(s.x<c.x?s.x<h.x?s.x:h.x:c.x<h.x?c.x:h.x,s.y<c.y?s.y<h.y?s.y:h.y:c.y<h.y?c.y:h.y,e,r,n),x=nh(d,m,e,r,n),b=i.prevZ,w=i.nextZ;b&&b.z>=_&&w&&w.z<=x;){if(b!==i.prev&&b!==i.next&&ca(s.x,s.y,c.x,c.y,h.x,h.y,b.x,b.y)&&Jt(b.prev,b,b.next)>=0||(b=b.prevZ,w!==i.prev&&w!==i.next&&ca(s.x,s.y,c.x,c.y,h.x,h.y,w.x,w.y)&&Jt(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;b&&b.z>=_;){if(b!==i.prev&&b!==i.next&&ca(s.x,s.y,c.x,c.y,h.x,h.y,b.x,b.y)&&Jt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=x;){if(w!==i.prev&&w!==i.next&&ca(s.x,s.y,c.x,c.y,h.x,h.y,w.x,w.y)&&Jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function em(i,e,r){var n=i;do{var s=n.prev,c=n.next.next;!Xc(s,c)&&Bp(s,n,n.next,c)&&ml(s,c)&&ml(c,s)&&(e.push(s.i/r),e.push(n.i/r),e.push(c.i/r),_l(n),_l(n.next),n=i=c),n=n.next}while(n!==i);return so(n)}function tm(i,e,r,n,s,c){var h=i;do{for(var d=h.next.next;d!==h.prev;){if(h.i!==d.i&&sm(h,d)){var m=Rp(h,d);return h=so(h,h.next),m=so(m,m.next),fl(h,e,r,n,s,c),void fl(m,e,r,n,s,c)}d=d.next}h=h.next}while(h!==i)}function im(i,e){return i.x-e.x}function rm(i,e){var r=function(c,h){var d,m=h,_=c.x,x=c.y,b=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var w=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(w<=_&&w>b){if(b=w,w===_){if(x===m.y)return m;if(x===m.next.y)return m.next}d=m.x<m.next.x?m:m.next}}m=m.next}while(m!==h);if(!d)return null;if(_===b)return d;var E,M=d,z=d.x,R=d.y,j=1/0;m=d;do _>=m.x&&m.x>=z&&_!==m.x&&ca(x<R?_:b,x,z,R,x<R?b:_,x,m.x,m.y)&&(E=Math.abs(x-m.y)/(_-m.x),ml(m,c)&&(E<j||E===j&&(m.x>d.x||m.x===d.x&&nm(d,m)))&&(d=m,j=E)),m=m.next;while(m!==M);return d}(i,e);if(!r)return e;var n=Rp(r,i),s=so(r,r.next);return so(n,n.next),e===r?s:e}function nm(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function nh(i,e,r,n,s){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-r)*s)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function om(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function ca(i,e,r,n,s,c,h,d){return(s-h)*(e-d)-(i-h)*(c-d)>=0&&(i-h)*(n-d)-(r-h)*(e-d)>=0&&(r-h)*(c-d)-(s-h)*(n-d)>=0}function sm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,n){var s=r;do{if(s.i!==r.i&&s.next.i!==r.i&&s.i!==n.i&&s.next.i!==n.i&&Bp(s,s.next,r,n))return!0;s=s.next}while(s!==r);return!1}(i,e)&&(ml(i,e)&&ml(e,i)&&function(r,n){var s=r,c=!1,h=(r.x+n.x)/2,d=(r.y+n.y)/2;do s.y>d!=s.next.y>d&&s.next.y!==s.y&&h<(s.next.x-s.x)*(d-s.y)/(s.next.y-s.y)+s.x&&(c=!c),s=s.next;while(s!==r);return c}(i,e)&&(Jt(i.prev,i,e.prev)||Jt(i,e.prev,e))||Xc(i,e)&&Jt(i.prev,i,i.next)>0&&Jt(e.prev,e,e.next)>0)}function Jt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Xc(i,e){return i.x===e.x&&i.y===e.y}function Bp(i,e,r,n){var s=Hc(Jt(i,e,r)),c=Hc(Jt(i,e,n)),h=Hc(Jt(r,n,i)),d=Hc(Jt(r,n,e));return s!==c&&h!==d||!(s!==0||!Wc(i,r,e))||!(c!==0||!Wc(i,n,e))||!(h!==0||!Wc(r,i,n))||!(d!==0||!Wc(r,e,n))}function Wc(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 Hc(i){return i>0?1:i<0?-1:0}function ml(i,e){return Jt(i.prev,i,i.next)<0?Jt(i,e,i.next)>=0&&Jt(i,i.prev,e)>=0:Jt(i,e,i.prev)<0||Jt(i,i.next,e)<0}function Rp(i,e){var r=new oh(i.i,i.x,i.y),n=new oh(e.i,e.x,e.y),s=i.next,c=e.prev;return i.next=e,e.prev=i,r.next=s,s.prev=r,n.next=r,r.prev=n,c.next=n,n.prev=c,n}function Fp(i,e,r,n){var s=new oh(i,e,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function _l(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 oh(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sh(i,e,r,n){for(var s=0,c=e,h=r-n;c<r;c+=n)s+=(i[h]-i[c])*(i[c+1]+i[h+1]),h=c;return s}function am(i,e,r,n,s){Op(i,e,r||0,n||i.length-1,s||lm)}function Op(i,e,r,n,s){for(;n>r;){if(n-r>600){var c=n-r+1,h=e-r+1,d=Math.log(c),m=.5*Math.exp(2*d/3),_=.5*Math.sqrt(d*m*(c-m)/c)*(h-c/2<0?-1:1);Op(i,e,Math.max(r,Math.floor(e-h*m/c+_)),Math.min(n,Math.floor(e+(c-h)*m/c+_)),s)}var x=i[e],b=r,w=n;for(gl(i,r,e),s(i[n],x)>0&&gl(i,r,n);b<w;){for(gl(i,b,w),b++,w--;s(i[b],x)<0;)b++;for(;s(i[w],x)>0;)w--}s(i[r],x)===0?gl(i,r,w):gl(i,++w,n),w<=e&&(r=w+1),e<=w&&(n=w-1)}}function gl(i,e,r){var n=i[e];i[e]=i[r],i[r]=n}function lm(i,e){return i<e?-1:i>e?1:0}function ah(i,e){const r=i.length;if(r<=1)return[i];const n=[];let s,c;for(let h=0;h<r;h++){const d=xr(i[h]);d!==0&&(i[h].area=Math.abs(d),c===void 0&&(c=d<0),c===d<0?(s&&n.push(s),s=[i[h]]):s.push(i[h]))}if(s&&n.push(s),e>1)for(let h=0;h<n.length;h++)n[h].length<=e||(am(n[h],e,1,n[h].length-1,cm),n[h]=n[h].slice(0,e));return n}function cm(i,e){return e.area-i.area}function lh(i,e,r){const n=r.patternDependencies;let s=!1;for(const c of e){const h=c.paint.get(`${i}-pattern`);h.isConstant()||(s=!0);const d=h.constantOr(null);d&&(s=!0,n[d.to]=!0,n[d.from]=!0)}return s}function ch(i,e,r,n,s){const c=s.patternDependencies;for(const h of e){const d=h.paint.get(`${i}-pattern`).value;if(d.kind!=="constant"){let m=d.evaluate({zoom:n-1},r,{},s.availableImages),_=d.evaluate({zoom:n},r,{},s.availableImages),x=d.evaluate({zoom:n+1},r,{},s.availableImages);m=m&&m.name?m.name:m,_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,c[m]=!0,c[_]=!0,c[x]=!0,r.patterns[h.id]={min:m,mid:_,max:x}}}return r}qc.deviation=function(i,e,r,n){var s=e&&e.length,c=Math.abs(sh(i,0,s?e[0]*r:i.length,r));if(s)for(var h=0,d=e.length;h<d;h++)c-=Math.abs(sh(i,e[h]*r,h<d-1?e[h+1]*r:i.length,r));var m=0;for(h=0;h<n.length;h+=3){var _=n[h]*r,x=n[h+1]*r,b=n[h+2]*r;m+=Math.abs((i[_]-i[b])*(i[x+1]-i[_+1])-(i[_]-i[x])*(i[b+1]-i[_+1]))}return c===0&&m===0?0:Math.abs((m-c)/c)},qc.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,s=0;s<i.length;s++){for(var c=0;c<i[s].length;c++)for(var h=0;h<e;h++)r.vertices.push(i[s][c][h]);s>0&&r.holes.push(n+=i[s-1].length)}return r},$c.default=Kf;class Yc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ne,this.indexArray=new ht,this.indexArray2=new Kt,this.programConfigurations=new Yo(e.layers,e.zoom),this.segments=new Xt,this.segments2=new Xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id),this.projection=e.projection}populate(e,r,n,s){this.hasPattern=lh("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:d,id:m,index:_,sourceLayerIndex:x}of e){const b=this.layers[0]._featureFilter.needGeometry,w=Qo(d,b);if(!this.layers[0]._featureFilter.filter(new F(this.zoom),w,n))continue;const E=c?c.evaluate(w,{},n,r.availableImages):void 0,M={id:m,properties:d.properties,type:d.type,sourceLayerIndex:x,index:_,geometry:b?w.geometry:wn(d,n,s),patterns:{},sortKey:E};h.push(M)}c&&h.sort((d,m)=>d.sortKey-m.sortKey);for(const d of h){const{geometry:m,index:_,sourceLayerIndex:x}=d;if(this.hasPattern){const b=ch("fill",this.layers,d,this.zoom,r);this.patternFeatures.push(b)}else this.addFeature(d,m,_,n,{},r.availableImages);r.featureIndex.insert(e[_].feature,m,_,x,this.index)}}update(e,r,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n,s)}addFeatures(e,r,n,s,c){for(const h of this.patternFeatures)this.addFeature(h,h.geometry,h.index,r,n,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yf),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,n,s,c,h=[]){for(const d of ah(r,500)){let m=0;for(const M of d)m+=M.length;const _=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=_.vertexLength,b=[],w=[];for(const M of d){if(M.length===0)continue;M!==d[0]&&w.push(b.length/2);const z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),R=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(R+M.length-1,R),b.push(M[0].x),b.push(M[0].y);for(let j=1;j<M.length;j++)this.layoutVertexArray.emplaceBack(M[j].x,M[j].y),this.indexArray2.emplaceBack(R+j-1,R+j),b.push(M[j].x),b.push(M[j].y);z.vertexLength+=M.length,z.primitiveLength+=M.length}const E=$c(b,w);for(let M=0;M<E.length;M+=3)this.indexArray.emplaceBack(x+E[M],x+E[M+1],x+E[M+2]);_.vertexLength+=m,_.primitiveLength+=E.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,c,h,s)}}Re(Yc,"FillBucket",{omit:["layers","patternFeatures"]});const um=new de({"fill-sort-key":new q(re.layout_fill["fill-sort-key"])});var hm={paint:new de({"fill-antialias":new ae(re.paint_fill["fill-antialias"]),"fill-opacity":new q(re.paint_fill["fill-opacity"]),"fill-color":new q(re.paint_fill["fill-color"]),"fill-outline-color":new q(re.paint_fill["fill-outline-color"]),"fill-translate":new ae(re.paint_fill["fill-translate"]),"fill-translate-anchor":new ae(re.paint_fill["fill-translate-anchor"]),"fill-pattern":new ge(re.paint_fill["fill-pattern"])}),layout:um};const pm=Ie([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),dm=Ie([{name:"a_centroid_pos",components:2,type:"Uint16"}]),fm=Ie([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:mm}=pm;var Up=ua;function ua(i,e,r,n,s){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=n,this._values=s,i.readFields(_m,this,e)}function _m(i,e,r){i==1?e.id=r.readVarint():i==2?function(n,s){for(var c=n.readVarint()+n.pos;n.pos<c;){var h=s._keys[n.readVarint()],d=s._values[n.readVarint()];s.properties[h]=d}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function gm(i){for(var e,r,n=0,s=0,c=i.length,h=c-1;s<c;h=s++)n+=((r=i[h]).x-(e=i[s]).x)*(e.y+r.y);return n}ua.types=["Unknown","Point","LineString","Polygon"],ua.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,n=1,s=0,c=0,h=0,d=[];i.pos<r;){if(s<=0){var m=i.readVarint();n=7&m,s=m>>3}if(s--,n===1||n===2)c+=i.readSVarint(),h+=i.readSVarint(),n===1&&(e&&d.push(e),e=[]),e.push(new Me(c,h));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&d.push(e),d},ua.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,n=0,s=0,c=0,h=1/0,d=-1/0,m=1/0,_=-1/0;i.pos<e;){if(n<=0){var x=i.readVarint();r=7&x,n=x>>3}if(n--,r===1||r===2)(s+=i.readSVarint())<h&&(h=s),s>d&&(d=s),(c+=i.readSVarint())<m&&(m=c),c>_&&(_=c);else if(r!==7)throw new Error("unknown command "+r)}return[h,m,d,_]},ua.prototype.toGeoJSON=function(i,e,r){var n,s,c=this.extent*Math.pow(2,r),h=this.extent*i,d=this.extent*e,m=this.loadGeometry(),_=ua.types[this.type];function x(E){for(var M=0;M<E.length;M++){var z=E[M];E[M]=[360*(z.x+h)/c-180,360/Math.PI*Math.atan(Math.exp((180-360*(z.y+d)/c)*Math.PI/180)
8)-90]}}switch(this.type){case 1:var b=[];for(n=0;n<m.length;n++)b[n]=m[n][0];x(m=b);break;case 2:for(n=0;n<m.length;n++)x(m[n]);break;case 3:for(m=function(E){var M=E.length;if(M<=1)return[E];for(var z,R,j=[],H=0;H<M;H++){var W=gm(E[H]);W!==0&&(R===void 0&&(R=W<0),R===W<0?(z&&j.push(z),z=[E[H]]):z.push(E[H]))}return z&&j.push(z),j}(m),n=0;n<m.length;n++)for(s=0;s<m[n].length;s++)x(m[n][s])}m.length===1?m=m[0]:_="Multi"+_;var w={type:"Feature",geometry:{type:_,coordinates:m},properties:this.properties};return"id"in this&&(w.id=this.id),w};var Vp=jp;function jp(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(ym,this,e),this.length=this._features.length}function ym(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(n){for(var s=null,c=n.readVarint()+n.pos;n.pos<c;){var h=n.readVarint()>>3;s=h===1?n.readString():h===2?n.readFloat():h===3?n.readDouble():h===4?n.readVarint64():h===5?n.readVarint():h===6?n.readSVarint():h===7?n.readBoolean():null}return s}(r))}function xm(i,e,r){if(i===3){var n=new Vp(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}jp.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 Up(this._pbf,e,this.extent,this._keys,this._values)};var rs={VectorTile:function(i,e){this.layers=i.readFields(xm,{},e)},VectorTileFeature:Up,VectorTileLayer:Vp};function Kc(i,e,r,n){const s=[],c=n===0?(h,d,m,_,x,b)=>{h.push(new Me(b,m+(b-d)/(_-d)*(x-m)))}:(h,d,m,_,x,b)=>{h.push(new Me(d+(b-m)/(x-m)*(_-d),b))};for(const h of i){const d=[];for(const m of h){if(m.length<=2)continue;const _=[];for(let w=0;w<m.length-1;w++){const E=m[w].x,M=m[w].y,z=m[w+1].x,R=m[w+1].y,j=n===0?E:M,H=n===0?z:R;j<e?H>e&&c(_,E,M,z,R,e):j>r?H<r&&c(_,E,M,z,R,r):_.push(m[w]),H<e&&j>=e&&c(_,E,M,z,R,e),H>r&&j<=r&&c(_,E,M,z,R,r)}let x=m[m.length-1];const b=n===0?x.x:x.y;b>=e&&b<=r&&_.push(x),_.length&&(x=_[_.length-1],_[0].x===x.x&&_[0].y===x.y||_.push(_[0]),d.push(_))}d.length&&s.push(d)}return s}const vm=rs.VectorTileFeature.types,bm=Math.pow(2,13);function yl(i,e,r,n,s,c,h,d){i.emplaceBack((e<<1)+h,(r<<1)+c,(Math.floor(n*bm)<<1)+s,Math.round(d))}function xl(i,e,r){i.emplaceBack(e.x,e.y,e.z,r[0]*16384,r[1]*16384,r[2]*16384)}class Np{constructor(){this.acc=new Me(0,0),this.polyCount=[]}startRing(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new Me(e.x,e.y),this.max=new Me(e.x,e.y))}append(e,r){this.currentPolyCount.edges++,this.acc._add(e);const n=this.min,s=this.max;e.x<n.x?n.x=e.x:e.x>s.x&&(s.x=e.x),e.y<n.y?n.y=e.y:e.y>s.y&&(s.y=e.y),((e.x===0||e.x===qe)&&e.x===r.x)!=((e.y===0||e.y===qe)&&e.y===r.y)&&this.processBorderOverlap(e,r),r.x<0!=e.x<0&&this.addBorderIntersection(0,dt(r.y,e.y,(0-r.x)/(e.x-r.x))),r.x>qe!=e.x>qe&&this.addBorderIntersection(1,dt(r.y,e.y,(qe-r.x)/(e.x-r.x))),r.y<0!=e.y<0&&this.addBorderIntersection(2,dt(r.x,e.x,(0-r.y)/(e.y-r.y))),r.y>qe!=e.y>qe&&this.addBorderIntersection(3,dt(r.x,e.x,(qe-r.y)/(e.y-r.y)))}addBorderIntersection(e,r){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];r<n[0]&&(n[0]=r),r>n[1]&&(n[1]=r)}processBorderOverlap(e,r){if(e.x===r.x){if(e.y===r.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,r.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,r.x),this.addBorderIntersection(n,e.x)}}centroid(){const e=this.polyCount.reduce((r,n)=>r+n.edges,0);return e!==0?this.acc.div(e)._round():new Me(0,0)}span(){return new Me(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((e,r)=>e+ +(r[0]!==Number.MAX_VALUE),0)}}class vl{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Ue,this.centroidVertexArray=new ep,this.indexArray=new ht,this.programConfigurations=new Yo(e.layers,e.zoom),this.segments=new Xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id),this.enableTerrain=e.enableTerrain}populate(e,r,n,s){this.features=[],this.hasPattern=lh("fill-extrusion",this.layers,r),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(c){const h=Math.exp(Math.PI*(1-c.y/(1<<c.z)*2));return 80150034*h/(h*h+1)/qe/(1<<c.z)}(n);for(const{feature:c,id:h,index:d,sourceLayerIndex:m}of e){const _=this.layers[0]._featureFilter.needGeometry,x=Qo(c,_);if(!this.layers[0]._featureFilter.filter(new F(this.zoom),x,n))continue;const b={id:h,sourceLayerIndex:m,index:d,geometry:_?x.geometry:wn(c,n,s),properties:c.properties,type:c.type,patterns:{}},w=this.layoutVertexArray.length;this.hasPattern?this.features.push(ch("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,d,n,{},r.availableImages,s),r.featureIndex.insert(c,b.geometry,d,m,this.index,w)}this.sortBorders()}addFeatures(e,r,n,s,c){for(const h of this.features){const{geometry:d}=h;this.addFeature(h,d,h.index,r,n,s,c)}this.sortBorders()}update(e,r,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,mm),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,fm.members,!0))),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.centroidVertexArray.length!==0&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,dm.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,s,c,h,d){const m=[new Me(0,0),new Me(qe,qe)],_=d.projection,x=_.name==="globe",b=this.enableTerrain&&!x?new Np:null;x&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Gh);const w=ah(r,500);for(let z=w.length-1;z>=0;z--){const R=w[z];(R.length===0||(E=R[0]).every(j=>j.x<=0)||E.every(j=>j.x>=qe)||E.every(j=>j.y<=0)||E.every(j=>j.y>=qe))&&w.splice(z,1)}var E;let M;if(x)M=Zp(w,m,s);else{M=[];
vendor: 13,738 bytes, line 8
8for(const z of w)M.push({polygon:z,bounds:m})}for(const z of M){const R=z.polygon;let j=0,H=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let ue=0;ue<R.length;ue++){const pe=R[ue];if(pe.length===0)continue;j+=pe.length;let me=0;b&&b.startRing(pe[0]);for(let be=0;be<pe.length;be++){const se=pe[be];if(be>=1){const fe=pe[be-1];if(!wm(se,fe,z.bounds)){b&&b.append(se,fe),H.vertexLength+4>Xt.MAX_VERTEX_ARRAY_LENGTH&&(H=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const we=se.sub(fe)._perp(),Te=we.x/(Math.abs(we.x)+Math.abs(we.y)),De=we.y>0?1:0,xe=fe.dist(se);me+xe>32768&&(me=0),yl(this.layoutVertexArray,se.x,se.y,Te,De,0,0,me),yl(this.layoutVertexArray,se.x,se.y,Te,De,0,1,me),me+=xe,yl(this.layoutVertexArray,fe.x,fe.y,Te,De,0,0,me),yl(this.layoutVertexArray,fe.x,fe.y,Te,De,0,1,me);const ke=H.vertexLength;if(this.indexArray.emplaceBack(ke,ke+2,ke+1),this.indexArray.emplaceBack(ke+1,ke+2,ke+3),H.vertexLength+=4,H.primitiveLength+=2,x){const Je=this.layoutVertexExtArray,ot=_.projectTilePoint(se.x,se.y,s),je=_.projectTilePoint(fe.x,fe.y,s),Fe=_.upVector(s,se.x,se.y),st=_.upVector(s,fe.x,fe.y);xl(Je,ot,Fe),xl(Je,ot,Fe),xl(Je,je,st),xl(Je,je,st)}}}}}if(H.vertexLength+j>Xt.MAX_VERTEX_ARRAY_LENGTH&&(H=this.segments.prepareSegment(j,this.layoutVertexArray,this.indexArray)),vm[e.type]!=="Polygon")continue;const W=[],Y=[],Q=H.vertexLength;for(let ue=0;ue<R.length;ue++){const pe=R[ue];if(pe.length!==0){pe!==R[0]&&Y.push(W.length/2);for(let me=0;me<pe.length;me++){const be=pe[me];yl(this.layoutVertexArray,be.x,be.y,0,0,1,1,0),W.push(be.x),W.push(be.y),b&&b.currentPolyCount.top++,x&&xl(this.layoutVertexExtArray,_.projectTilePoint(be.x,be.y,s),_.upVector(s,be.x,be.y))}}}const te=$c(W,Y);for(let ue=0;ue<te.length;ue+=3)this.indexArray.emplaceBack(Q+te[ue],Q+te[ue+2],Q+te[ue+1]);H.primitiveLength+=te.length/3,H.vertexLength+=j}if(b&&b.polyCount.length>0){if(b.borders){b.vertexArrayOffset=this.centroidVertexArray.length;const z=b.borders,R=this.featuresOnBorder.push(b)-1;for(let j=0;j<4;j++)z[j][0]!==Number.MAX_VALUE&&this.borders[j].push(R)}this.encodeCentroid(b.borders?void 0:b.centroid(),b)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,c,h,s)}sortBorders(){for(let e=0;e<4;e++)this.borders[e].sort((r,n)=>this.featuresOnBorder[r].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}encodeCentroid(e,r,n=!0){let s,c;if(e)if(e.y!==0){const d=r.span()._mult(this.tileToMeter);s=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(d.x/10)),c=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(d.y/10))}else s=Math.ceil(7*(e.x+450)),c=0;else s=0,c=+n;let h=n?this.centroidVertexArray.length:r.vertexArrayOffset;for(const d of r.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*d.edges+d.top);for(let m=0;m<2*d.edges;m++)this.centroidVertexArray.emplace(h++,0,c),this.centroidVertexArray.emplace(h++,s,c);for(let m=0;m<d.top;m++)this.centroidVertexArray.emplace(h++,s,c)}}}function wm(i,e,r){return i.x===e.x&&(i.x<r[0].x||i.x>r[1].x)||i.y===e.y&&(i.y<r[0].y||i.y>r[1].y)}function Gp(){const i=Math.PI/32,e=Math.tan(i),r=Nu;return r*Math.sqrt(1+2*e*e)-r}function Zp(i,e,r){const n=1<<r.z,s=Ei(r.x/n),c=Ei((r.x+1)/n),h=ti(r.y/n),d=ti((r.y+1)/n);return function(m,_,x,b,w=0,E){const M=[];if(!m.length||!x||!b)return M;const z=(te,ue)=>{for(const pe of te)M.push({polygon:pe,bounds:ue})},R=Math.ceil(Math.log2(x)),j=Math.ceil(Math.log2(b)),H=R-j,W=[];for(let te=0;te<Math.abs(H);te++)W.push(H>0?0:1);for(let te=0;te<Math.min(R,j);te++)W.push(0),W.push(1);let Y=m;if(Y=Kc(Y,_[0].y-w,_[1].y+w,1),Y=Kc(Y,_[0].x-w,_[1].x+w,0),!Y.length)return M;const Q=[];for(W.length?Q.push({polygons:Y,bounds:_,depth:0}):z(Y,_);Q.length;){const te=Q.pop(),ue=te.depth,pe=W[ue],me=te.bounds[0],be=te.bounds[1],se=pe===0?me.x:me.y,fe=pe===0?be.x:be.y,we=E?E(pe,se,fe):.5*(se+fe),Te=Kc(te.polygons,se-w,we+w,pe),De=Kc(te.polygons,we-w,fe+w,pe);if(Te.length){const xe=[me,new Me(pe===0?we:be.x,pe===1?we:be.y)];W.length>ue+1?Q.push({polygons:Te,bounds:xe,depth:ue+1}):z(Te,xe)}if(De.length){const xe=[new Me(pe===0?we:me.x,pe===1?we:me.y),be];W.length>ue+1?Q.push({polygons:De,bounds:xe,depth:ue+1}):z(De,xe)}}return M}(i,e,Math.ceil((c-s)/11.25),Math.ceil((h-d)/11.25),1,(m,_,x)=>{if(m===0)return .5*(_+x);{const b=ti((r.y+_/qe)/n);return(Jo(.5*(ti((r.y+x/qe)/n)+b))*n-r.y)*qe}})}Re(vl,"FillExtrusionBucket",{omit:["layers","features"]}),Re(Np,"PartMetadata");var Tm={paint:new de({"fill-extrusion-opacity":new ae(re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new q(re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ae(re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ae(re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ge(re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new q(re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new q(re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ae(re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function $p(i,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[i*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Jc{constructor(e,r,n){this.z=e,this.x=r,this.y=n,this.key=bl(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r){const n=function(c,h,d){var m=$p(256*c,256*(h=Math.pow(2,d)-h-1),d),_=$p(256*(c+1),256*(h+1),d);return m[0]+","+m[1]+","+_[0]+","+_[1]}(this.x,this.y,this.z),s=function(c,h,d){let m,_="";for(let x=c;x>0;x--)m=1<<x-1,_+=(h&m?1:0)+(d&m?2:0);return _}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",s).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class qp{constructor(e,r){this.wrap=e,this.canonical=r,this.key=bl(e,r.z,r.z,r.x,r.y)}}class Mi{constructor(e,r,n,s,c){this.overscaledZ=e,this.wrap=r,this.canonical=new Jc(n,+s,+c),this.key=r===0&&e===n?this.canonical.key:bl(r,e,n,s,c)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const r=this.canonical.z-e;return e>this.canonical.z?new Mi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Mi(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r=!0){if(this.overscaledZ===e&&r)return this.key;if(e>this.canonical.z)return bl(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return bl(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Mi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,n=2*this.canonical.x,s=2*this.canonical.y;return[new Mi(r,this.wrap,r,n,s),new Mi(r,this.wrap,r,n+1,s),new Mi(r,this.wrap,r,n,s+1),new Mi(r,this.wrap,r,n+1,s+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Mi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Mi(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new qp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function bl(i,e,r,n,s){const c=1<<Math.min(r,22);let h=c*(s%c)+n%c;return i&&r<22&&(h+=c*c*((i<0?-2*i-1:2*i)%(1<<2*(22-r)))),16*(32*h+r)+(e-r)}function wl(i,e){return i.x*e.x+i.y*e.y}function Xp(i,e){if(i.length===1){let r=0;const n=e[r++];let s;for(;!s||n.equals(s);)if(s=e[r++],!s)return 1/0;for(;r<e.length;r++){const c=e[r],h=i[0],d=s.sub(n),m=c.sub(n),_=h.sub(n),x=wl(d,d),b=wl(d,m),w=wl(m,m),E=wl(_,d),M=wl(_,m),z=x*w-b*b,R=(w*E-b*M)/z,j=(x*M-b*E)/z,H=n.z*(1-R-j)+s.z*R+c.z*j;if(isFinite(H))return H}return 1/0}{let r=1/0;for(const n of e)r=Math.min(r,n.z);return r}}function Qc(i){const e=new Me(i[0],i[1]);return e.z=i[2],e}function Wp(i,e,r,n,s,c,h,d){const m=h*s.getElevationAt(i,e,!0,!0),_=c[0]!==0,x=_?c[1]===0?h*(c[0]/7-450):h*function(b,w,E){const M=Math.floor(w[0]/8),z=Math.floor(w[1]/8),R=10*(w[0]-8*M),j=10*(w[1]-8*z),H=b.getElevationAt(M,z,!0,!0),W=b.getMeterToDEM(E),Y=Math.floor(.5*(R*W-1)),Q=Math.floor(.5*(j*W-1)),te=b.tileCoordToPixel(M,z),ue=2*Y+1,pe=2*Q+1,me=function(De,xe,ke,Je,ot){return[De.getElevationAtPixel(xe,ke,!0),De.getElevationAtPixel(xe+ot,ke,!0),De.getElevationAtPixel(xe,ke+ot,!0),De.getElevationAtPixel(xe+Je,ke+ot,!0)]}(b,te.x-Y,te.y-Q,ue,pe),be=Math.abs(me[0]-me[1]),se=Math.abs(me[2]-me[3]),fe=Math.abs(me[0]-me[2])+Math.abs(me[1]-me[3]),we=Math.min(.25,.5*W*(be+se)/ue),Te=Math.min(.25,.5*W*fe/pe);return H+Math.max(we*R,Te*j)}(s,c,d):m;return{base:m+(r===0)?-1:r,top:_?Math.max(x+n,m+r+2):m+n}}Re(Jc,"CanonicalTileID"),Re(Mi,"OverscaledTileID",{omit:["projMatrix"]});const Em=Ie([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Sm}=Em,Mm=Ie([{name:"a_packed",components:4,type:"Float32"}]),{members:Im}=Mm,Am=rs.VectorTileFeature.types,Cm=Math.cos(Math.PI/180*37.5);class eu{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.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ke,this.layoutVertexArray2=new yt,this.indexArray=new ht,this.programConfigurations=new Yo(e.layers,e.zoom),this.segments=new Xt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n,s){this.hasPattern=lh("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=[];for(const{feature:x,id:b,index:w,sourceLayerIndex:E}of e){const M=this.layers[0]._featureFilter.needGeometry,z=Qo(x,M);if(!this.layers[0]._featureFilter.filter(new F(this.zoom),z,n))continue;const R=c?c.evaluate(z,{},n):void 0,j={id:b,properties:x.properties,type:x.type,sourceLayerIndex:E,index:w,geometry:M?z.geometry:wn(x,n,s),patterns:{},sortKey:R};h.push(j)}c&&h.sort((x,b)=>x.sortKey-b.sortKey);const{lineAtlas:d,featureIndex:m}=r,_=this.addConstantDashes(d);for(const x of h){const{geometry:b,index:w,sourceLayerIndex:E}=x;if(_&&this.addFeatureDashes(x,d),this.hasPattern){const M=ch("line",this.layers,x,this.zoom,r);this.patternFeatures.push(M)}else this.addFeature(x,b,w,n,d.positions,r.availableImages);m.insert(e[w].feature,b,w,E,this.index)}}addConstantDashes(e){let r=!1;for(const n of this.layers){const s=n.paint.get("line-dasharray").value,c=n.layout.get("line-cap").value;if(s.kind!=="constant"||c.kind!=="constant")r=!0;else{const h=c.value,d=s.value;if(!d)continue;e.addDash(d.from,h),e.addDash(d.to,h),d.other&&e.addDash(d.other,h)}}return r}addFeatureDashes(e,r){const n=this.zoom;for(const s of this.layers){const c=s.paint.get("line-dasharray").value,h=s.layout.get("line-cap").value;if(c.kind==="constant"&&h.kind==="constant")continue;let d,m,_,x,b,w;if(c.kind==="constant"){const R=c.value;if(!R)continue;d=R.other||R.to,m=R.to,_=R.from}else d=c.evaluate({zoom:n-1},e),m=c.evaluate({zoom:n},e),_=c.evaluate({zoom:n+1},e);h.kind==="constant"?x=b=w=h.value:(x=h.evaluate({zoom:n-1},e),b=h.evaluate({zoom:n},e),w=h.evaluate({zoom:n+1},e)),r.addDash(d,x),r.addDash(m,b),r.addDash(_,w);const E=r.getKey(d,x),M=r.getKey(m,b),z=r.getKey(_,w);e.patterns[s.id]={min:E,mid:M,max:z}}}update(e,r,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n,s)}addFeatures(e,r,n,s,c){for(const h of this.patternFeatures)this.addFeature(h,h.geometry,h.index,r,n,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,Im)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Sm),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&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,n,s,c,h){const d=this.layers[0].layout,m=d.get("line-join").evaluate(e,{}),_=d.get("line-cap").evaluate(e,{}),x=d.get("line-miter-limit"),b=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const w of r)this.addLine(w,e,m,_,x,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,c,h,s)}addLine(e,r,n,s,c,h){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
8oFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let j=0;j<e.length-1;j++)this.totalDistance+=e[j].dist(e[j+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const d=Am[r.type]==="Polygon";let m=e.length;for(;m>=2&&e[m-1].equals(e[m-2]);)m--;let _=0;for(;_<m-1&&e[_].equals(e[_+1]);)_++;if(m<(d?3:2))return;n==="bevel"&&(c=1.05);const x=this.overscaling<=16?122880/(512*this.overscaling):0,b=this.segments.prepareSegment(10*m,this.layoutVertexArray,this.indexArray);let w,E,M,z,R;this.e1=this.e2=-1,d&&(w=e[m-2],R=e[_].sub(w)._unit()._perp());for(let j=_;j<m;j++){if(M=j===m-1?d?e[_+1]:void 0:e[j+1],M&&e[j].equals(M))continue;R&&(z=R),w&&(E=w),w=e[j],R=M?M.sub(w)._unit()._perp():z,z=z||R;let H=z.add(R);H.x===0&&H.y===0||H._unit();const W=z.x*R.x+z.y*R.y,Y=H.x*R.x+H.y*R.y,Q=Y!==0?1/Y:1/0,te=2*Math.sqrt(2-2*Y),ue=Y<Cm&&E&&M,pe=z.x*R.y-z.y*R.x>0;if(ue&&j>_){const se=w.dist(E);if(se>2*x){const fe=w.sub(w.sub(E)._mult(x/se)._round());this.updateDistance(E,fe),this.addCurrentVertex(fe,z,0,0,b),E=fe}}const me=E&&M;let be=me?n:d?"butt":s;if(me&&be==="round"&&(Q<h?be="miter":Q<=2&&(be="fakeround")),be==="miter"&&Q>c&&(be="bevel"),be==="bevel"&&(Q>2&&(be="flipbevel"),Q<c&&(be="miter")),E&&this.updateDistance(E,w),be==="miter")H._mult(Q),this.addCurrentVertex(w,H,0,0,b);else if(be==="flipbevel"){if(Q>100)H=R.mult(-1);else{const se=Q*z.add(R).mag()/z.sub(R).mag();H._perp()._mult(se*(pe?-1:1))}this.addCurrentVertex(w,H,0,0,b),this.addCurrentVertex(w,H.mult(-1),0,0,b)}else if(be==="bevel"||be==="fakeround"){const se=-Math.sqrt(Q*Q-1),fe=pe?se:0,we=pe?0:se;if(E&&this.addCurrentVertex(w,z,fe,we,b),be==="fakeround"){const Te=Math.round(180*te/Math.PI/20);for(let De=1;De<Te;De++){let xe=De/Te;if(xe!==.5){const Je=xe-.5;xe+=xe*Je*(xe-1)*((1.0904+W*(W*(3.55645-1.43519*W)-3.2452))*Je*Je+(.848013+W*(.215638*W-1.06021)))}const ke=R.sub(z)._mult(xe)._add(z)._unit()._mult(pe?-1:1);this.addHalfVertex(w,ke.x,ke.y,!1,pe,0,b)}}M&&this.addCurrentVertex(w,R,-fe,-we,b)}else if(be==="butt")this.addCurrentVertex(w,H,0,0,b);else if(be==="square"){const se=E?1:-1;E||this.addCurrentVertex(w,H,se,se,b),this.addCurrentVertex(w,H,0,0,b),E&&this.addCurrentVertex(w,H,se,se,b)}else be==="round"&&(E&&(this.addCurrentVertex(w,z,0,0,b),this.addCurrentVertex(w,z,1,1,b,!0)),M&&(this.addCurrentVertex(w,R,-1,-1,b,!0),this.addCurrentVertex(w,R,0,0,b)));if(ue&&j<m-1){const se=w.dist(M);if(se>2*x){const fe=w.add(M.sub(w)._mult(x/se)._round());this.updateDistance(w,fe),this.addCurrentVertex(fe,R,0,0,b),w=fe}}}}addCurrentVertex(e,r,n,s,c,h=!1){const d=r.y*s-r.x,m=-r.y-r.x*s;this.addHalfVertex(e,r.x+r.y*n,r.y-r.x*n,h,!1,n,c),this.addHalfVertex(e,d,m,h,!0,-s,c)}addHalfVertex({x:e,y:r},n,s,c,h,d,m){this.layoutVertexArray.emplaceBack((e<<1)+(c?1:0),(r<<1)+(h?1:0),Math.round(63*n)+128,Math.round(63*s)+128,1+(d===0?0:d<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const _=m.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,_),m.primitiveLength++),h?this.e2=_:this.e1=_}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Re(eu,"LineBucket",{omit:["layers","patternFeatures"]});const zm=new de({"line-cap":new q(re.layout_line["line-cap"]),"line-join":new q(re.layout_line["line-join"]),"line-miter-limit":new ae(re.layout_line["line-miter-limit"]),"line-round-limit":new ae(re.layout_line["line-round-limit"]),"line-sort-key":new q(re.layout_line["line-sort-key"])});var Hp={paint:new de({"line-opacity":new q(re.paint_line["line-opacity"]),"line-color":new q(re.paint_line["line-color"]),"line-translate":new ae(re.paint_line["line-translate"]),"line-translate-anchor":new ae(re.paint_line["line-translate-anchor"]),"line-width":new q(re.paint_line["line-width"]),"line-gap-width":new q(re.paint_line["line-gap-width"]),"line-offset":new q(re.paint_line["line-offset"]),"line-blur"
8:new q(re.paint_line["line-blur"]),"line-dasharray":new ge(re.paint_line["line-dasharray"]),"line-pattern":new ge(re.paint_line["line-pattern"]),"line-gradient":new ze(re.paint_line["line-gradient"]),"line-trim-offset":new ae(re.paint_line["line-trim-offset"])}),layout:zm};const Yp=new class extends q{possiblyEvaluate(i,e){return e=new F(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,n){return e=oi({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,n)}}(Hp.paint.properties["line-width"].specification);function Kp(i,e){return e>0?e+2*i:i}Yp.useIntegerZoom=!0;const km=Ie([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Pm=Ie([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Dm=Ie([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ie([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Lm=Ie([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Bm=Ie([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Jp=Ie([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Rm=Ie([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ie([{name:"triangle",components:3,type:"Uint16"}]),Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ie([{type:"Float32",name:"offsetX"}]),Ie([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var gi=24;const Wr=128;function uh(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new F(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:s}=r;let c=0;for(;c<n.length&&n[c]<=i;)c++;c=Math.max(0,c-1);let h=c;for(;h<n.length&&n[h]<i+1;)h++;h=Math.min(n.length-1,h);const d=n[c],m=n[h];return r.kind==="composite"?{kind:"composite",minZoom:d,maxZoom:m,interpolationType:s}:{kind:"camera",minZoom:d,maxZoom:m,minSize:r.evaluate(new F(d)),maxSize:r.evaluate(new F(m)),interpolationType:s}}}function tu(i,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:s}){return i.kind==="source"?n/Wr:i.kind==="composite"?dt(n/Wr,s/Wr,r):e}function ha(i,e){let r=0,n=0;if(i.kind==="constant")n=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:s,minZoom:c,maxZoom:h}=i,d=s?Qe(ur.interpolationFactor(s,e,c,h),0,1):0;i.kind==="camera"?n=dt(i.minSize,i.maxSize,d):r=d}return{uSizeT:r,uSize:n}}var Fm=Object.freeze({__proto__:null,getSizeData:uh,evaluateSizeForFeature:tu,evaluateSizeForZoom:ha,SIZE_PACK_FACTOR:Wr});
8function Om(i,e,r){return i.sections.forEach(n=>{n.text=function(s,c,h){const d=c.layout.get("text-transform").evaluate(h,{});return d==="uppercase"?s=s.toLocaleUpperCase():d==="lowercase"&&(s=s.toLocaleLowerCase()),D.applyArabicShaping&&(s=D.applyArabicShaping(s)),s}(n.text,e,r)}),i}const Tl={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};function Um(i){return i==="\uFE36"||i==="\uFE48"||i==="\uFE38"||i==="\uFE44"||i==="\uFE42"||i==="\uFE3E"||i==="\uFE3C"||i==="\uFE3A"||i==="\uFE18"||i==="\uFE40"||i==="\uFE10"||i==="\uFE13"||i==="\uFE14"||i==="\uFF40"||i==="\uFFE3"||i==="\uFE11"||i==="\uFE12"}function Vm(i){return i==="\uFE35"||i==="\uFE47"||i==="\uFE37"||i==="\uFE43"||i==="\uFE41"||i==="\uFE3D"||i==="\uFE3B"||i==="\uFE39"||i==="\uFE17"||i==="\uFE3F"}var Qp=function(i,e,r,n,s){var c,h,d=8*s-n-1,m=(1<<d)-1,_=m>>1,x=-7,b=r?s-1:0,w=r?-1:1,E=i[e+b];for(b+=w,c=E&(1<<-x)-1,E>>=-x,x+=d;x>0;c=256*c+i[e+b],b+=w,x-=8);for(h=c&(1<<-x)-1,c>>=-x,x+=n;x>0;h=256*h+i[e+b],b+=w,x-=8);if(c===0)c=1-_;else{if(c===m)return h?NaN:1/0*(E?-1:1);h+=Math.pow(2,n),c-=_}return(E?-1:1)*h*Math.pow(2,c-n)},ed=function(i,e,r,n,s,c){var h,d,m,_=8*c-s-1,x=(1<<_)-1,b=x>>1,w=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:c-1,M=n?1:-1,z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(d=isNaN(e)?1:0,h=x):(h=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-h))<1&&(h--,m*=2),(e+=h+b>=1?w/m:w*Math.pow(2,1-b))*m>=2&&(h++,m/=2),h+b>=x?(d=0,h=x):h+b>=1?(d=(e*m-1)*Math.pow(2,s),h+=b):(d=e*Math.pow(2,b-1)*Math.pow(2,s),h=0));s>=8;i[r+E]=255&d,E+=M,d/=256,s-=8);for(h=h<<s|d,_+=s;_>0;i[r+E]=255&h,E+=M,h/=256,_-=8);i[r+E-M]|=128*z},El=At;function At(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}At.Varint=0,At.Fixed64=1,At.Bytes=2,At.Fixed32=5;var hh=4294967296,td=1/hh,id=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function En(i){return i.type===At.Bytes?i.readVarint()+i.pos:i.pos+1}function pa(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function rd(i,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var s=r.pos-1;s>=i;s--)r.buf[s+n]=r.buf[s]}function jm(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Nm(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Gm(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Zm(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function $m(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function qm(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Xm(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Wm(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Hm(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function iu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function da(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}
8function nd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Ym(i,e,r){e.glyphs=[],i===1&&r.readMessage(Km,e)}function Km(i,e,r){if(i===3){const{id:n,bitmap:s,width:c,height:h,left:d,top:m,advance:_}=r.readMessage(Jm,{});e.glyphs.push({id:n,bitmap:new Tn({width:c+6,height:h+6},s),metrics:{width:c,height:h,left:d,top:m,advance:_}})}else i===4?e.ascender=r.readSVarint():i===5&&(e.descender=r.readSVarint())}function Jm(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function ph(i){let e=0,r=0;for(const h of i)e+=h.w*h.h,r=Math.max(r,h.w);i.sort((h,d)=>d.h-h.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let s=0,c=0;for(const h of i)for(let d=n.length-1;d>=0;d--){const m=n[d];if(!(h.w>m.w||h.h>m.h)){if(h.x=m.x,h.y=m.y,c=Math.max(c,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===m.w&&h.h===m.h){const _=n.pop();d<n.length&&(n[d]=_)}else h.h===m.h?(m.x+=h.w,m.w-=h.w):h.w===m.w?(m.y+=h.h,m.h-=h.h):(n.push({x:m.x+h.w,y:m.y,w:m.w-h.w,h:h.h}),m.y+=h.h,m.h-=h.h);break}}return{w:s,h:c,fill:e/(s*c)||0}}At.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,c=this.pos;this.type=7&n,i(s,e,this),this.pos===c&&this.skip(n)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=iu(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=nd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=iu(this.buf,this.pos)+iu(this.buf,this.pos+4)*hh;return this.pos+=8,i},readSFixed64:function(){var i=iu(this.buf,this.pos)+nd(this.buf,this.pos+4)*hh;return this.pos+=8,i},readFloat:function(){var i=Qp(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Qp(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(s,c,h){var d,m,_=h.buf;if(d=(112&(m=_[h.pos++]))>>4,m<128||(d|=(127&(m=_[h.pos++]))<<3,m<128)||(d|=(127&(m=_[h.pos++]))<<10,m<128)||(d|=(127&(m=_[h.pos++]))<<17,m<128)||(d|=(127&(m=_[h.pos++]))<<24,m<128)||(d|=(1&(m=_[h.pos++]))<<31,m<128))return pa(s,d,c);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&id?function(r,n,s){return id.decode(r.subarray(n,s))}(this.buf,e,i):function(r,n,s){for(var c="",h=n;h<s;){var d,m,_,x=r[h],b=null,w=x>239?4:x>223?3:x>191?2:1;if(h+w>s)break;w===1?x<128&&(b=x):w===2?(192&(d=r[h+1]))==128&&(b=(31&x)<<6|63&d)<=127&&(b=null):w===3?(m=r[h+2],(192&(d=r[h+1]))==128&&(192&m)==128&&((b=(15&x)<<12|(63&d)<<6|63&m)<=2047||b>=55296&&b<=57343)&&(b=null)):w===4&&(m=r[h+2],_=r[h+3],(192&(d=r[h+1]))==128&&(192&m)==128&&(192&_)==128&&((b=(15&x)<<18|(63&d)<<12|(63&m)<<6|63&_)<=65535||b>=1114112)&&(b=null)),b===null?(b=65533,w=1):b>65535&&(b-=65536,c+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),c+=String.fromCharCode(b),h+=w}return c}(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!==At.Bytes)return i.push(this.readVarint(e));var r=En(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==At.Bytes)return i.push(this.readSVarint());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==At.Bytes)return i.push(this.readBoolean());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i}
vendor: 29,338 bytes, line 8
8,readPackedFloat:function(i){if(this.type!==At.Bytes)return i.push(this.readFloat());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==At.Bytes)return i.push(this.readDouble());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed32());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed32());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed64());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed64());var e=En(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===At.Varint)for(;this.buf[this.pos++]>127;);else if(e===At.Bytes)this.pos=this.readVarint()+this.pos;else if(e===At.Fixed32)this.pos+=4;else{if(e!==At.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),da(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),da(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),da(this.buf,-1&i,this.pos),da(this.buf,Math.floor(i*td),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),da(this.buf,-1&i,this.pos),da(this.buf,Math.floor(i*td),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var n,s;if(e>=0?(n=e%4294967296|0,s=e/4294967296|0):(s=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,s=s+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(c,h,d){d.buf[d.pos++]=127&c|128,c>>>=7,d.buf[d.pos++]=127&c|128,c>>>=7,d.buf[d.pos++]=127&c|128,c>>>=7,d.buf[d.pos++]=127&c|128,d.buf[d.pos]=127&(c>>>=7)}(n,0,r),function(c,h){var d=(7&c)<<4;h.buf[h.pos++]|=d|((c>>>=3)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c)))))}(s,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(n,s,c){for(var h,d,m=0;m<s.length;m++){if((h=s.charCodeAt(m))>55295&&h<57344){if(!d){h>56319||m+1===s.length?(n[c++]=239,n[c++]=191,n[c++]=189):d=h;continue}if(h<56320){n[c++]=239,n[c++]=191,n[c++]=189,d=h;continue}h=d-55296<<10|h-56320|65536,d=null}else d&&(n[c++]=239,n[c++]=191,n[c++]=189,d=null);h<128?n[c++]=h:(h<2048?n[c++]=h>>6|192:(h<65536?n[c++]=h>>12|224:(n[c++]=h>>18|240,n[c++]=h>>12&63|128),n[c++]=h>>6&63|128),n[c++]=63&h|128)}return c}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&rd(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),ed(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),ed(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var n=this.pos-r;n>=128&&rd(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(i,e,r){this.writeTag(i,At.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,jm,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Nm,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,$m,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Gm,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Zm,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,qm,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Xm,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Wm,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Hm,e)},writeBytesField:function(i,e){this.writeTag(i,At.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,At.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,At.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,At.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class dh{constructor(e,{pixelRatio:r,version:n,stretchX:s,stretchY:c,content:h}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=s,this.stretchY=c,this.content=h,this.version=n}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class od{constructor(e,r){const n={},s={};this.haveRenderCallbacks=[];const c=[];this.addImages(e,n,c),this.addImages(r,s,c);const{w:h,h:d}=ph(c),m=new Wi({width:h||1,height:d||1});for(const _ in e){const x=e[_],b=n[_].paddedRect;Wi.copy(x.data,m,{x:0,y:0},{x:b.x+1,y:b.y+1},x.data)}for(const _ in r){const x=r[_],b=s[_].paddedRect,w=b.x+1,E=b.y+1,M=x.data.width,z=x.data.height;Wi.copy(x.data,m,{x:0,y:0},{x:w,y:E},x.data),Wi.copy(x.data,m,{x:0,y:z-1},{x:w,y:E-1},{width:M,height:1}),Wi.copy(x.data,m,{x:0,y:0},{x:w,y:E+z},{width:M,height:1}),Wi.copy(x.data,m,{x:M-1,y:0},{x:w-1,y:E},{width:1,height:z}),Wi.copy(x.data,m,{x:0,y:0},{x:w+M,y:E},{width:1,height:z})}this.image=m,this.iconPositions=n,this.patternPositions=s}addImages(e,r,n){for(const s in e){const c=e[s],h={x:0,y:0,w:c.data.width+2,h:c.data.height+2};n.push(h),r[s]=new dh(h,c),c.hasRenderCallback&&this.haveRenderCallbacks.push(s)}}patchUpdatedImages(e,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(n=>e.hasImage(n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;const[s,c]=e.tl;n.update(r.data,void 0,{x:s,y:c})}}Re(dh,"ImagePosition"),Re(od,"ImageAtlas");const nr={horizontal:1,vertical:2,horizontalOnly:3};class Sl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const n=new Sl;return n.scale=e||1,n.fontStack=r,n}static forImage(e){const r=new Sl;return r.imageName=e,r}}class fa{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const n=new fa;for(let s=0;s<e.sections.length;s++){const c=e.sections[s];c.image?n.addImageSection(c):n.addTextSection(c,r)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(e){this.text=function(r,n){let s="";for(let c=0;c<r.length;c++){const h=r.charCodeAt(c+1)||null,d=r.charCodeAt(c-1)||null;s+=!n&&(h&&o(h)&&!Tl[r[c+1]]||d&&o(d)&&!Tl[r[c-1]])||!Tl[r[c]]?r[c]:Tl[r[c]]}return s}(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&ru[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ru[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const n=new fa;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Sl.forText(e.scale,e.fontStack||r));const n=this.sections.length-1;for(let s=0;s<e.text.length;++s)this.sectionIndex.push(n)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void Nt("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(Sl.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Nt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function fh(i,e,r,n,s,c,h,d,m,_,x,b,w,E,M,z){const R=fa.fromFeature(i,s);let j;b===nr.vertical&&R.verticalizePunctuation(w);const{processBidirectionalText:H,processStyledBidirectionalText:W}=D;if(H&&R.sections.length===1){j=[];const te=H(R.toString(),mh(R,_,c,e,n,E,M));for(const ue of te){const pe=new fa;pe.text=ue,pe.sections=R.sections;for(let me=0;me<ue.length;me++)pe.sectionIndex.push(0);j.push(pe)}}else if(W){j=[];const te=W(R.text,R.sectionIndex,mh(R,_,c,e,n,E,M));for(const ue of te){const pe=new fa;pe.text=ue[0],pe.sectionIndex=ue[1],pe.sections=R.sections,j.push(pe)}}else j=function(te,ue){const pe=[],me=te.text;let be=0;for(const se of ue)pe.push(te.substring(be,se)),be=se;return be<me.length&&pe.push(te.substring(be,me.length)),pe}(R,mh(R,_,c,e,n,E,M));const Y=[],Q={positionedLines:Y,text:R.toString(),top:x[1],bottom:x[1],left:x[0],right:x[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(te,ue,pe,me,be,se,fe,we,Te,De,xe,ke){let Je=0,ot=0,je=0;const Fe=we==="right"?1:we==="left"?0:.5;let st=!1;for(const at of be){const mt=at.getSections();for(const Ct of mt){if(Ct.imageName)continue;const It=ue[Ct.fontStack];if(It&&(st=It.ascender!==void 0&&It.descender!==void 0,!st))break}if(!st)break}let it=0;for(const at of be){at.trim();const mt=at.getMaxScale(),Ct=(mt-1)*gi,It={positionedGlyphs:[],lineOffset:0};te.positionedLines[it]=It;const St=It.positionedGlyphs;let Dt=0;if(!at.length()){ot+=se,++it;continue}let Ut=0,ui=0;for(let ct=0;ct<at.length();ct++){const $t=at.getSection(ct),bi=at.getSectionIndex(ct),vt=at.getCharCode(ct);let Vt=$t.scale,Ai=null,Rt=null,Ht=null,hi=gi,ai=0;const yi=!(Te===nr.horizontal||!xe&&!t(vt)||xe&&(ru[vt]||(Oe=vt,Tc(Oe)||Ec(Oe)||Xo(Oe)||ol(Oe)||ll(Oe))));if($t.imageName){const Ci=me[$t.imageName];if(!Ci)continue;Ht=$t.imageName,te.iconsInText=te.iconsInText||!0,Rt=Ci.paddedRect;const pi=Ci.displaySize;Vt=Vt*gi/ke,Ai={width:pi[0],height:pi[1],left:1,top:-3,advance:yi?pi[1]:pi[0],localGlyph:!1},ai=st?-Ai.height*Vt:mt*gi-17-pi[1]*Vt,hi=Ai.advance;const Mn=(yi?pi[0]:pi[1])*Vt-gi*mt;Mn>0&&Mn>Dt&&(Dt=Mn)}else{const Ci=pe[$t.fontStack];if(!Ci)continue;Ci[vt]&&(Rt=Ci[vt]);const pi=ue[$t.fontStack];if(!pi)continue;const Mn=pi.glyphs[vt];if(!Mn)continue;if(Ai=Mn.metrics,hi=vt!==8203?gi:0,st){const va=pi.ascender!==void 0?Math.abs(pi.ascender):0,Bl=pi.descender!==void 0?Math.abs(pi.descender):0,Rl=(va+Bl)*Vt;Ut<Rl&&(Ut=Rl,ui=(va-Bl)/2*Vt),ai=-va*Vt}else ai=(mt-Vt)*gi-17}yi?(te.verticalizable=!0,St.push({glyph:vt,imageName:Ht,x:Je,y:ot+ai,vertical:yi,scale:Vt,localGlyph:Ai.localGlyph,fontStack:$t.fontStack,sectionIndex:bi,metrics:Ai,rect:Rt}),Je+=hi*Vt+De):(St.push({glyph:vt,imageName:Ht,x:Je,y:ot+ai,vertical:yi,scale:Vt,localGlyph:Ai.localGlyph,fontStack:$t.fontStack,sectionIndex:bi,metrics:Ai,rect:Rt}),Je+=Ai.advance*Vt+De)}St.length!==0&&(je=Math.max(Je-De,je),st?ud(St,Fe,Dt,ui,se*mt/2):ud(St,Fe,Dt,0,se/2)),Je=0;const Fi=se*mt+Dt;It.lineOffset=Math.max(Dt,Ct),ot+=Fi,++it}var Oe;const ii=ot,{horizontalAlign:Wt,verticalAlign:Zt}=_h(fe);(function(at,mt,Ct,It,St,Dt){const Ut=(mt-Ct)*St,ui=-Dt*It;for(const Fi of at)for(const ct of Fi.positionedGlyphs)ct.x+=Ut,ct.y+=ui})(te.positionedLines,Fe,Wt,Zt,je,ii),te.top+=-Zt*ii,te.bottom=te.top+ii,te.left+=-Wt*je,te.right=te.left+je,te.hasBaseline=st}(Q,e,r,n,j,h,d,m,b,_,w,z),!function(te){for(const ue of te)if(ue.positionedGlyphs.length!==0)return!1;return!0}(Y)&&Q}const ru={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Qm={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 sd(i,e,r,n,s,c){if(e.imageName){const h=n[e.imageName];return h?h.displaySize[0]*e.scale*gi/c+s:0}{const h=r[e.fontStack],d=h&&h.glyphs[i];return d?d.metrics.advance*e.scale+s:0}}function ad(i,e,r,n){const s=Math.pow(i-e,2);return n?i<e?s/2:2*s:s+Math.abs(r)*r}function e_(i,e,r){let n=0;return i===10&&(n-=1e4),r&&(n+=150),i!==40&&i!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function ld(i,e,r,n,s,c){let h=null,d=ad(e,r,s,c);for(const m of n){const _=ad(e-m.x,r,s,c)+m.badness;_<=d&&(h=m,d=_)}return{index:i,x:e,priorBreak:h,badness:d}}function cd(i){return i?cd(i.priorBreak).concat(i.index):[]}function mh(i,e,r,n,s,c,h){if(c!=="point")return[];if(!i)return[];const d=[],m=function(w,E,M,z,R,j){let H=0;for(let W=0;W<w.length();W++){const Y=w.getSection(W);H+=sd(w.getCharCode(W),Y,z,R,E,j)}return H/Math.max(1,Math.ceil(H/M))}(i,e,r,n,s,h),_=i.text.indexOf("\u200B")>=0;let x=0;for(let w=0;w<i.length();w++){const E=i.getSection(w),M=i.getCharCode(w);if(ru[M]||(x+=sd(M,E,n,s,e,h)),w<i.length()-1){const z=!((b=M)<11904||!(tl(b)||el(b)||sl(b)||zc(b)||ta(b)||Sc(b)||il(b)||Ks(b)||Ic(b)||nl(b)||ea(b)||cl(b)||Js(b)||Wo(b)||Mc(b)||rl(b)||Qs(b)||kc(b)||ia(b)||Ac(b)));(Qm[M]||z||E.imageName)&&d.push(ld(w+1,x,m,d,e_(M,i.getCharCode(w+1),z&&_),!1))}}var b;return cd(ld(i.length(),x,m,d,0,!0))}function _h(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function ud(i,e,r,n,s){if(!(e||r||n||s))return;const c=i.length-1,h=i[c],d=(h.x+h.metrics.advance*h.scale)*e;for(let m=0;m<=c;m++)i[m].x-=d,i[m].y+=r+n+s}function t_(i,e,r){const{horizontalAlign:n,verticalAlign:s}=_h(r),c=e[0]-i.displaySize[0]*n,h=e[1]-i.displaySize[1]*s;return{image:i,top:h,bottom:h+i.displaySize[1],left:c,right:c+i.displaySize[0]}}function hd(i,e,r,n,s,c){const h=i.image;let d;if(h.content){const R=h.content,j=h.pixelRatio||1;d=[R[0]/j,R[1]/j,h.displaySize[0]-R[2]/j,h.displaySize[1]-R[3]/j]}const m=e.left*c,_=e.right*c;let x,b,w,E;r==="width"||r==="both"?(E=s[0]+m-n[3],b=s[0]+_+n[1]):(E=s[0]+(m+_-h.displaySize[0])/2,b=E+h.displaySize[0]);const M=e.top*c,z=e.bottom*c;return r==="height"||r==="both"?(x=s[1]+M-n[0],w=s[1]+z+n[2]):(x=s[1]+(M+z-h.displaySize[1])/2,w=x+h.displaySize[1]),{image:h,top:x,right:b,bottom:w,left:E,collisionPadding:d}}class Sn extends Me{constructor(e,r,n,s,c){super(e,r),this.angle=s,this.z=n,c!==void 0&&(this.segment=c)}clone(){return new Sn(this.x,this.y,this.z,this.angle,this.segment)}}function pd(i,e,r,n,s){if(e.segment===void 0)return!0;let c=e,h=e.segment+1,d=0;for(;d>-r/2;){if(h--,h<0)return!1;d-=i[h].dist(c),c=i[h]}d+=i[h].dist(i[h+1]),h++;const m=[];let _=0;for(;d<r/2;){const x=i[h],b=i[h+1];if(!b)return!1;let w=i[h-1].angleTo(x)-x.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),m.push({distance:d,angleDelta:w}),_+=w;d-m[0].distance>n;)_-=m.shift().angleDelta;if(_>s)return!1;h++,d+=x.dist(b)}return!0}function dd(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function fd(i,e,r){return i?.6*e*r:0}function md(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function i_(i,e,r,n,s,c){const h=fd(r,s,c),d=md(r,n)*c;let m=0;const _=dd(i)/2;for(let x=0;x<i.length-1;x++){const b=i[x],w=i[x+1],E=b.dist(w);if(m+E>_){const M=(_-m)/E,z=dt(b.x,w.x,M),R=dt(b.y,w.y,M),j=new Sn(z,R,0,w.angleTo(b),x);return!h||pd(i,j,d,h,e)?j:void 0}m+=E}}function r_(i,e,r,n,s,c,h,d,m){const _=fd(n,c,h),x=md(n,s),b=x*h,w=i[0].x===0||i[0].x===m||i[0].y===0||i[0].y===m;return e-b<e/4&&(e=b+e/4),_d(i,w?e/2*d%e:(x/2+2*c)*h*d%e,e,_,r,b,w,!1,m)}function _d(i,e,r,n,s,c,h,d,m){const _=c/2,x=dd(i);let b=0,w=e-r,E=[];for(let M=0;M<i.length-1;M++){const z=i[M],R=i[M+1],j=z.dist(R),H=R.angleTo(z);for(;w+r<b+j;){w+=r;const W=(w-b)/j,Y=dt(z.x,R.x,W),Q=dt(z.y,R.y,W);if(Y>=0&&Y<m&&Q>=0&&Q<m&&w-_>=0&&w+_<=x){const te=new Sn(Y,Q,0,H,M);te._round(),n&&!pd(i,te,c,n,s)||E.push(te)}}b+=j}return d||E.length||h||(E=_d(i,b/2,r,n,s,c,h,!0,m)),E}function gd(i,e,r,n,s){const c=[];for(let h=0;h<i.length;h++){const d=i[h];let m;for(let _=0;_<d.length-1;_++){let x=d[_],b=d[_+1];x.x<e&&b.x<e||(x.x<e?x=new Me(e,x.y+(e-x.x)/(b.x-x.x)*(b.y-x.y))._round():b.x<e&&(b=new Me(e,x.y+(e-x.x)/(b.x-x.x)*(b.y-x.y))._round()),x.y<r&&b.y<r||(x.y<r?x=new Me(x.x+(r-x.y)/(b.y-x.y)*(b.x-x.x),r)._round():b.y<r&&(b=new Me(x.x+(r-x.y)/(b.y-x.y)*(b.x-x.x),r)._round()),x.x>=n&&b.x>=n||(x.x>=n?x=new Me(n,x.y+(n-x.x)/(b.x-x.x)*(b.y-x.y))._round():b.x>=n&&(b=new Me(n,x.y+(n-x.x)/(b.x-x.x)*(b.y-x.y))._round()),x.y>=s&&b.y>=s||(x.y>=s?x=new Me(x.x+(s-x.y)/(b.y-x.y)*(b.x-x.x),s)._round():b.y>=s&&(b=new Me(x.x+(s-x.y)/(b.y-x.y)*(b.x-x.x),s)._round()),m&&x.equals(m[m.length-1])||(m=[x],c.push(m)),m.push(b)))))}}return c}Re(Sn,"Anchor");const Ml=1e20;function yd(i,e,r,n,s,c,h,d,m){for(let _=e;_<e+n;_++)xd(i,r*c+_,c,s,h,d,m);for(let _=r;_<r+s;_++)xd(i,_*c+e,1,n,h,d,m)}function xd(i,e,r,n,s,c,h){c[0]=0,h[0]=-Ml,h[1]=Ml,s[0]=i[e];for(let d=1,m=0,_=0;d<n;d++){s[d]=i[e+d*r];const x=d*d;do{const b=c[m];_=(s[d]-s[b]+x-b*b)/(d-b)/2}while(_<=h[m]&&--m>-1);m++,c[m]=d,h[m]=_,h[m+1]=Ml}for(let d=0,m=0;d<n;d++){for(;h[m+1]<d;)m++;const _=c[m],x=d-_;i[e+d*r]=s[_]+x*x}}const gh={none:0,ideographs:1,all:2};class ma{constructor(e,r,n){this.requestManager=e,this.localGlyphMode=r,this.localFontFamily=n,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,r){const n=[];for(const s in e)for(const c of e[s])n.push({stack:s,id:c});Or(n,({stack:s,id:c},h)=>{let d=this.entries[s];d||(d=this.entries[s]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let m=d.glyphs[c];if(m!==void 0)return void h(null,{stack:s,id:c,glyph:m});if(m=this._tinySDF(d,s,c),m)return d.glyphs[c]=m,void h(null,{stack:s,id:c,glyph:m});const _=Math.floor(c/256);if(256*_>65535)return void h(new Error("glyphs > 65535 not supported"));if(d.ranges[_])return void h(null,{stack:s,id:c,glyph:m});let x=d.requests[_];x||(x=d.requests[_]=[],ma.loadGlyphRange(s,_,this.url,this.requestManager,(b,w)=>{if(w){d.ascender=w.ascender,d.descender=w.descender;for(const E in w.glyphs)this._doesCharSupportLocalGlyph(+E)||(d.glyphs[+E]=w.glyphs[+E]);d.ranges[_]=!0}for(const E of x)E(b,w);delete d.requests[_]})),x.push((b,w)=>{b?h(b):w&&h(null,{stack:s,id:c,glyph:w.glyphs[c]||null})})},(s,c)=>{if(s)r(s);else if(c){const h={};for(const{stack:d,id:m,glyph:_}of c)h[d]===void 0&&(h[d]={}),h[d].glyphs===void 0&&(h[d].glyphs={}),h[d].glyphs[m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics},h[d].ascender=this.entries[d].ascender,h[d].descender=this.entries[d].descender;r(null,h)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==gh.none&&(this.localGlyphMode===gh.all?!!this.localFontFamily:!!this.localFontFamily&&(nl(e)||Cc(e)||Js(e)||Qs(e)||Ks(e)))}_tinySDF(e,r,n){const s=this.localFontFamily;if(!s||!this._doesCharSupportLocalGlyph(n))return;let c=e.tinySDF;if(!c){let z="400";/bold/i.test(r)?z="900":/medium/i.test(r)?z="500":/light/i.test(r)&&(z="200"),c=e.tinySDF=new ma.TinySDF({fontFamily:s,fontWeight:z,fontSize:48,buffer:6,radius:16}),c.fontWeight=z}if(this.localGlyphs[c.fontWeight][n])return this.localGlyphs[c.fontWeight][n];const h=String.fromCharCode(n),{data:d,width:m,height:_,glyphWidth:x,glyphHeight:b,glyphLeft:w,glyphTop:E,glyphAdvance:M}=c.draw(h);return this.localGlyphs[c.fontWeight][n]={id:n,bitmap:new Tn({width:m,height:_},d),metrics:{width:x/2,height:b/2,left:w/2,top:E/2-27,advance:M/2,localGlyph:!0}}}}function vd(i,e,r,n){const s=[],c=i.image,h=c.pixelRatio,d=c.paddedRect.w-2,m=c.paddedRect.h-2,_=i.right-i.left,x=i.bottom-i.top,b=c.stretchX||[[0,d]],w=c.stretchY||[[0,m]],E=(se,fe)=>se+fe[1]-fe[0],M=b.reduce(E,0),z=w.reduce(E,0),R=d-M,j=m-z;let H=0,W=M,Y=0,Q=z,te=0,ue=R,pe=0,me=j;if(c.content&&n){const se=c.content;H=nu(b,0,se[0]),Y=nu(w,0,se[1]),W=nu(b,se[0],se[2]),Q=nu(w,se[1],se[3]),te=se[0]-H,pe=se[1]-Y,ue=se[2]-se[0]-W,me=se[3]-se[1]-Q}const be=(se,fe,we,Te)=>{const De=ou(se.stretch-H,W,_,i.left),xe=su(se.fixed-te,ue,se.stretch,M),ke=ou(fe.stretch-Y,Q,x,i.top),Je=su(fe.fixed-pe,me,fe.stretch,z),ot=ou(we.stretch-H,W,_,i.left),je=su(we.fixed-te,ue,we.stretch,M),Fe=ou(Te.stretch-Y,Q,x,i.top),st=su(Te.fixed-pe,me,Te.stretch,z),it=new Me(De,ke),Oe=new Me(ot,ke),ii=new Me(ot,Fe),Wt=new Me(De,Fe),Zt=new Me(xe/h,Je/h),at=new Me(je/h,st/h),mt=e*Math.PI/180;if(mt){const St=Math.sin(mt),Dt=Math.cos(mt),Ut=[Dt,-St,St,Dt];it._matMult(Ut),Oe._matMult(Ut),Wt._matMult(Ut),ii._matMult(Ut)}const Ct=se.stretch+se.fixed,It=fe.stretch+fe.fixed;return{tl:it,tr:Oe,bl:Wt,br:ii,tex:{x:c.paddedRect.x+1+Ct,y:c.paddedRect.y+1+It,w:we.stretch+we.fixed-Ct,h:Te.stretch+Te.fixed-It},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Zt,pixelOffsetBR:at,minFontScaleX:ue/h/_,minFontScaleY:me/h/x,isSDF:r}};if(n&&(c.stretchX||c.stretchY)){const se=bd(b,R,M),fe=bd(w,j,z);for(let we=0;we<se.length-1;we++){const Te=se[we],De=se[we+1];for(let xe=0;xe<fe.length-1;xe++)s.push(be(Te,fe[xe],De,fe[xe+1]))}}else s.push(be({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:d+1},{fixed:0,stretch:m+1}));return s}function nu(i,e,r){let n=0;for(const s of i)n+=Math.max(e,Math.min(r,s[1]))-Math.max(e,Math.min(r,s[0]));return n}function bd(i,e,r){const n=[{fixed:-1,stretch:0}];for(const[s,c]of i){const h=n[n.length-1];n.push({fixed:s-h.stretch,stretch:h.stretch}),n.push({fixed:s-h.stretch,stretch:h.stretch+(c-s)})}return n.push({fixed:e+1,stretch:r}),n}function ou(i,e,r,n){return i/e*r+n}function su(i,e,r,n){return i-e*r/n}function n_(i,e,r,n){const s=e+i.positionedLines[n].lineOffset;return n===0?r+s/2:r+(s+(e+i.positionedLines[n-1].lineOffset))/2}ma.loadGlyphRange=function(i,e,r,n,s){const c=256*e,h=c+255,d=n.transformRequest(n.normalizeGlyphsURL(r).replace("{fontstack}",i).replace("{range}",`${c}-${h}`),$.Glyphs);ee(d,(m,_)=>{if(m)s(m);else if(_){const x={},b=function(w){return new El(w).readFields(Ym,{})}(_);for(const w of b.glyphs)x[w.id]=w;s(null,{glyphs:x,ascender:b.ascender,descender:b.descender})}})},ma.TinySDF=class{constructor({fontSize:i=24,buffer:e=3,radius:r=8,cutoff:n=.25,fontFamily:s="sans-serif",fontWeight:c="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=r;const d=this.size=i+4*e,m=this._createCanvas(d),_=this.ctx=m.getContext("2d",{willReadFrequently:!0});_.font=`${h} ${c} ${i}px ${s}`,_.textBaseline="alphabetic",_.textAlign="left",_.fillStyle="black",this.gridOuter=new Float64Array(d*d),this.gridInner=new Float64Array(d*d),this.f=new Float64Array(d),this.z=new Float64Array(d+1),this.v=new Uint16Array(d)}_createCanvas(i){const e=document.createElement("canvas");return e.width=e.height=i,e}draw(i){const{width:e,actualBoundingBoxAscent:r,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:c}=this.ctx.measureText(i),h=Math.ceil(r),d=Math.min(this.size-this.buffer,Math.ceil(c-s)),m=Math.min(this.size-this.buffer,h+Math.ceil(n)),_=d+2*this.buffer,x=m+2*this.buffer,b=Math.max(_*x,0),w=new Uint8ClampedArray(b),E={data:w,width:_,height:x,glyphWidth:d,glyphHeight:m,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(d===0||m===0)return E;const{ctx:M,buffer:z,gridInner:R,gridOuter:j}=this;M.clearRect(z,z,d,m),M.fillText(i,z,z+h);const H=M.getImageData(z,z,d,m);j.fill(Ml,0,b),R.fill(0,0,b);for(let W=0;W<m;W++)for(let Y=0;Y<d;Y++){const Q=H.data[4*(W*d+Y)+3]/255;if(Q===0)continue;const te=(W+z)*_+Y+z;if(Q===1)j[te]=0,R[te]=Ml;else{const ue=.5-Q;j[te]=ue>0?ue*ue:0,R[te]=ue<0?ue*ue:0}}yd(j,0,0,_,x,_,this.f,this.v,this.z),yd(R,z,z,d,m,_,this.f,this.v,this.z);for(let W=0;W<b;W++){const Y=Math.sqrt(j[W])-Math.sqrt(R[W]);w[W]=Math.round(255-255*(Y/this.radius+this.cutoff))}return E}};class o_{constructor(e=[],r=s_){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this.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:n}=this,s=r[e];for(;e>0;){const c=e-1>>1,h=r[c];if(n(s,h)>=0)break;r[e]=h,e=c}r[e]=s}_down(e){const{data:r,compare:n}=this,s=this.length>>1,c=r[e];for(;e<s;){let h=1+(e<<1),d=r[h];const m=h+1;if(m<this.length&&n(r[m],d)<0&&(h=m,d=r[m]),n(d,c)>=0)break;r[e]=d,e=h}r[e]=c}}function s_(i,e){return i<e?-1:i>e?1:0}function a_(i,e=1,r=!1){let n=1/0,s=1/0,c=-1/0,h=-1/0;const d=i[0];for(let E=0;E<d.length;E++){const M=d[E];(!E||M.x<n)&&(n=M.x),(!E||M.y<s)&&(s=M.y),(!E||M.x>c)&&(c=M.x),(!E||M.y>h)&&(h=M.y)}const m=Math.min(c-n,h-s);let _=m/2;const x=new o_([],l_);if(m===0)return new Me(n,s);for(let E=n;E<c;E+=m)for(let M=s;M<h;M+=m)x.push(new _a(E+_,M+_,_,i));let b=function(E){let M=0,z=0,R=0;const j=E[0];for(let H=0,W=j.length,Y=W-1;H<W;Y=H++){const Q=j[H],te=j[Y],ue=Q.x*te.y-te.x*Q.y;z+=(Q.x+te.x)*ue,R+=(Q.y+te.y)*ue,M+=3*ue}return new _a(z/M,R/M,0,E)}(i),w=x.length;for(;x.length;){const E=x.pop();(E.d>b.d||!b.d)&&(b=E,r&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-b.d<=e||(_=E.h/2,x.push(new _a(E.p.x-_,E.p.y-_,_,i)),x.push(new _a(E.p.x+_,E.p.y-_,_,i)),x.push(new _a(E.p.x-_,E.p.y+_,_,i)),x.push(new _a(E.p.x+_,E.p.y+_,_,i)),w+=4)}return r&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function l_(i,e){return e.max-i.max}function _a(i,e,r,n){this.p=new Me(i,e),this.h=r,this.d=function(s,c){let h=!1,d=1/0;for(let m=0;m<c.length;m++){const _=c[m];for(let x=0,b=_.length,w=b-1;x<b;w=x++){const E=_[x],M=_[w];E.y>s.y!=M.y>s.y&&s.x<(M.x-E.x)*(s.y-E.y)/(M.y-E.y)+E.x&&(h=!h),d=Math.min(d,fp(s,E,M))}}return(h?1:-1)*Math.sqrt(d)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}const yh=Number.POSITIVE_INFINITY,c_=Math.sqrt(2);function wd(i,e){return e[1]!==yh?function(r,n,s){let c=0,h=0;switch(n=Math.abs(n),s=Math.abs(s),r){case"top-right":case"top-left":case"top":h=s-7;break;case"bottom-right":case"bottom-left":case"bottom":h=7-s}switch(r){case"top-right":case"bottom-right":case"right":c=-n;break;case"top-left":case"bottom-left":case"left":c=n}return[c,h]}(i,e[0],e[1]):function(r,n){let s=0,c=0;n<0&&(n=0);const h=n/c_;switch(r){case"top-right":case"top-left":c=h-7;break;case"bottom-right":case"bottom-left":c=7-h;break;case"bottom":c=7-n;break;case"top":c=n-7}switch(r){case"top-right":case"bottom-right":s=-h;break;case"top-left":case"bottom-left":s=h;break;case"left":s=n;break;case"right":s=-n}return[s,c]}(i,e[0])}function u_(i,e,r,n,s,c,h,d,m,_){i.createArrays(),i.tilePixelRatio=qe/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const x=i.layers[0].layout,b=i.layers[0]._unevaluatedLayout._values,w={};if(i.textSizeData.kind==="composite"){const{minZoom:z,maxZoom:R}=i.textSizeData;w.compositeTextSizes=[b["text-size"].possiblyEvaluate(new F(z),d),b["text-size"].possiblyEvaluate(new F(R),d)]}if(i.iconSizeData.kind==="composite"){const{minZoom:z,maxZoom:R}=i.iconSizeData;w.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new F(z),d),b["icon-size"].possiblyEvaluate(new F(R),d)]}w.layoutTextSize=b["text-size"].possiblyEvaluate(new F(m+1),d),w.layoutIconSize=b["icon-size"].possiblyEvaluate(new F(m+1),d),w.textMaxSize=b["text-size"].possiblyEvaluate(new F(18),d);const E=x.get("text-rotation-alignment")==="map"&&x.get("symbol-placement")!=="point",M=x.get("text-size");for(const z of i.features){const R=x.get("text-font").evaluate(z,{},d).join(","),j=M.evaluate(z,{},d),H=w.layoutTextSize.evaluate(z,{},d),W=(w.layoutIconSize.evaluate(z,{},d),{horizontal:{},vertical:void 0}),Y=z.text;let Q,te=[0,0];if(Y){const me=Y.toString(),be=x.get("text-letter-spacing").evaluate(z,{},d)*gi,se=x.get("text-line-height").evaluate(z,{},d)*gi,fe=na(me)?be:0,we=x.get("text-anchor").evaluate(z,{},d),Te=x.get("text-variable-anchor");if(!Te){const je=x.get("text-radial-offset").evaluate(z,{},d);te=je?wd(we,[je*gi,yh]):x.get("text-offset").evaluate(z,{},d).map(Fe=>Fe*gi)}
8let De=E?"center":x.get("text-justify").evaluate(z,{},d);const xe=x.get("symbol-placement"),ke=xe==="point",Je=xe==="point"?x.get("text-max-width").evaluate(z,{},d)*gi:0,ot=je=>{i.allowVerticalPlacement&&ra(me)&&(W.vertical=fh(Y,e,r,s,R,Je,se,we,je,fe,te,nr.vertical,!0,xe,H,j))};if(!E&&Te){const je=De==="auto"?Te.map(st=>xh(st)):[De];let Fe=!1;for(let st=0;st<je.length;st++){const it=je[st];if(!W.horizontal[it])if(Fe)W.horizontal[it]=W.horizontal[0];else{const Oe=fh(Y,e,r,s,R,Je,se,"center",it,fe,te,nr.horizontal,!1,xe,H,j);Oe&&(W.horizontal[it]=Oe,Fe=Oe.positionedLines.length===1)}}ot("left")}else{if(De==="auto"&&(De=xh(we)),ke||x.get("text-writing-mode").indexOf("horizontal")>=0||!ra(me)){const je=fh(Y,e,r,s,R,Je,se,we,De,fe,te,nr.horizontal,!1,xe,H,j);je&&(W.horizontal[De]=je)}ot(xe==="point"?"left":De)}}let ue=!1;if(z.icon&&z.icon.name){const me=n[z.icon.name];me&&(Q=t_(s[z.icon.name],x.get("icon-offset").evaluate(z,{},d),x.get("icon-anchor").evaluate(z,{},d)),ue=me.sdf,i.sdfIcons===void 0?i.sdfIcons=me.sdf:i.sdfIcons!==me.sdf&&Nt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(me.pixelRatio!==i.pixelRatio||x.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}const pe=Ed(W.horizontal)||W.vertical;i.iconsInText||(i.iconsInText=!!pe&&pe.iconsInText),(pe||Q)&&h_(i,z,W,Q,n,w,H,0,te,ue,h,d,_)}c&&i.generateCollisionDebugBuffers(m,i.collisionBoxArray)}function xh(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 h_(i,e,r,n,s,c,h,d,m,_,x,b,w){let E=c.textMaxSize.evaluate(e,{},b);E===void 0&&(E=h);const M=i.layers[0].layout,z=M.get("icon-offset").evaluate(e,{},b),R=Ed(r.horizontal)||r.vertical,j=w.name==="globe",H=h/24,W=i.tilePixelRatio*E/24,Y=(fe=i.overscaling,i.zoom>18&&fe>2&&(fe>>=1),Math.max(qe/(512*fe),1)*M.get("symbol-spacing")),Q=M.get("text-padding")*i.tilePixelRatio,te=M.get("icon-padding")*i.tilePixelRatio,ue=Ye(M.get("text-max-angle")),pe=M.get("text-rotation-alignment")==="map"&&M.get("symbol-placement")!=="point",me=M.get("icon-rotation-alignment")==="map"&&M.get("symbol-placement")!=="point",be=M.get("symbol-placement"),se=Y/2;var fe;const we=M.get("icon-text-fit");let Te;n&&we!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Te=hd(n,r.vertical,we,M.get("icon-text-fit-padding"),z,H)),R&&(n=hd(n,R,we,M.get("icon-text-fit-padding"),z,H)));const De=(xe,ke,Je)=>{if(ke.x<0||ke.x>=qe||ke.y<0||ke.y>=qe)return;let ot=null;if(j){const{x:je,y:Fe,z:st}=w.projectTilePoint(ke.x,ke.y,Je);ot={anchor:new Sn(je,Fe,st,0,void 0),up:w.upVector(Je,ke.x,ke.y)}}(function(je,Fe,st,it,Oe,ii,Wt,Zt,at,mt,Ct,It,St,Dt,Ut,ui,Fi,ct,$t,bi,vt,Vt,Ai,Rt,Ht){const hi=je.addToLineVertexArray(Fe,it);let ai,yi,Ci,pi,Mn,va,Bl,Rl=0,lf=0,cf=0,uf=0,Rh=-1,Fh=-1;const Qr={};let hf=ul("");const as=st?st.anchor:Fe;let Oh=0,Uh=0;if(at._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Oh,Uh]=at.layout.get("text-offset").evaluate(vt,{},Ht).map(Ki=>Ki*gi):(Oh=at.layout.get("text-radial-offset").evaluate(vt,{},Ht)*gi,Uh=yh),je.allowVerticalPlacement&&Oe.vertical){const Ki=Oe.vertical;if(Ut)va=vh(Ki),Zt&&(Bl=vh(Zt));else{const Ji=at.layout.get("text-rotate").evaluate(vt,{},Ht)+90;Ci=au(mt,as,Fe,Ct,It,St,Ki,Dt,Ji,ui),Zt&&(pi=au(mt,as,Fe,Ct,It,St,Zt,ct,Ji))}}if(ii){const Ki=at.layout.get("icon-rotate").evaluate(vt,{},Ht),Ji=at.layout.get("icon-text-fit")!=="none",Fl=vd(ii,Ki,Ai,Ji),jh=Zt?vd(Zt,Ki,Ai,Ji):void 0;yi=au(mt,as,Fe,Ct,It,St,ii,ct,Ki),Rl=4*Fl.length;const pf=je.iconSizeData;let ls=null;pf.kind==="source"?(ls=[Wr*at.layout.get("icon-size").evaluate(vt,{},Ht)],ls[0]>ao&&Nt(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):pf.kind==="composite"&&(ls=[Wr*Vt.compositeIconSizes[0].evaluate(vt,{},Ht),Wr*Vt.compositeIconSizes[1].evaluate(vt,{},Ht)],(ls[0]>ao||ls[1]>ao)&&Nt(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),je.addSymbols(je.icon,Fl,ls,bi,$t,vt,!1,st,Fe,hi.lineStartIndex,hi.lineLength,-1,Rt,Ht),Rh=je.icon.placedSymbolArray.length-1,jh&&(lf=4*jh.length,je.addSymbols(je.icon,jh,ls,bi,$t,vt,nr.vertical,st,Fe,hi.lineStartIndex,hi.lineLength,-1,Rt,Ht),Fh=je.icon.placedSymbolArray.length-1)}for(const Ki in Oe.horizontal){const Ji=Oe.horizontal[Ki];ai||(hf=ul(Ji.text),Ut?Mn=vh(Ji):ai=au(mt,as,Fe,Ct,It,St,Ji,Dt,at.layout.get("text-rotate").evaluate(vt,{},Ht),ui));const Fl=Ji.positionedLines.length===1;if(cf+=Td(je,st,Fe,Ji,Wt,at,Ut,vt,ui,hi,Oe.vertical?nr.horizontal:nr.horizontalOnly,Fl?Object.keys(Oe.horizontal):[Ki],Qr,Rh,Vt,Rt,Ht),Fl)break}Oe.vertical&&(uf+=Td(je,st,Fe,Oe.vertical,Wt,at,Ut,vt,ui,hi,nr.vertical,["vertical"],Qr,Fh,Vt,Rt,Ht));let fo=-1;const Vh=(Ki,Ji)=>Ki?Math.max(Ki,Ji):Ji;fo=Vh(Mn,fo),fo=Vh(va,fo),fo=Vh(Bl,fo);const G_=fo>-1?1:0;je.glyphOffsetArray.length>=co.MAX_GLYPHS&&Nt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),vt.sort
8Key!==void 0&&je.addToSortKeyRanges(je.symbolInstances.length,vt.sortKey),je.symbolInstances.emplaceBack(as.x,as.y,as.z,Fe.x,Fe.y,Qr.right>=0?Qr.right:-1,Qr.center>=0?Qr.center:-1,Qr.left>=0?Qr.left:-1,Qr.vertical>=0?Qr.vertical:-1,Rh,Fh,hf,ai!==void 0?ai:je.collisionBoxArray.length,ai!==void 0?ai+1:je.collisionBoxArray.length,Ci!==void 0?Ci:je.collisionBoxArray.length,Ci!==void 0?Ci+1:je.collisionBoxArray.length,yi!==void 0?yi:je.collisionBoxArray.length,yi!==void 0?yi+1:je.collisionBoxArray.length,pi||je.collisionBoxArray.length,pi?pi+1:je.collisionBoxArray.length,Ct,cf,uf,Rl,lf,G_,0,Oh,Uh,fo)})(i,ke,ot,xe,r,n,s,Te,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,Q,pe,m,0,te,me,z,e,c,_,x,b)};if(be==="line")for(const xe of gd(e.geometry,0,0,qe,qe)){const ke=r_(xe,Y,ue,r.vertical||R,n,24,W,i.overscaling,qe);for(const Je of ke){const ot=R;ot&&p_(i,ot.text,se,Je)||De(xe,Je,b)}}else if(be==="line-center"){for(const xe of e.geometry)if(xe.length>1){const ke=i_(xe,ue,r.vertical||R,n,24,W);ke&&De(xe,ke,b)}}else if(e.type==="Polygon")for(const xe of ah(e.geometry,0)){const ke=a_(xe,16);De(xe[0],new Sn(ke.x,ke.y,0,0,void 0),b)}else if(e.type==="LineString")for(const xe of e.geometry)De(xe,new Sn(xe[0].x,xe[0].y,0,0,void 0),b);else if(e.type==="Point")for(const xe of e.geometry)for(const ke of xe)De([ke],new Sn(ke.x,ke.y,0,0,void 0),b)}const ao=32640;function Td(i,e,r,n,s,c,h,d,m,_,x,b,w,E,M,z,R){const j=function(Y,Q,te,ue,pe,me,be,se){const fe=[];if(Q.positionedLines.length===0)return fe;const we=ue.layout.get("text-rotate").evaluate(me,{})*Math.PI/180,Te=function(ot){const je=ot[0],Fe=ot[1],st=je*Fe;return st>0?[je,-Fe]:st<0?[-je,Fe]:je===0?[Fe,je]:[Fe,-je]}(te);let De=Math.abs(Q.top-Q.bottom);for(const ot of Q.positionedLines)De-=ot.lineOffset;const xe=Q.positionedLines.length,ke=De/xe;let Je=Q.top-te[1];for(let ot=0;ot<xe;++ot){const je=Q.positionedLines[ot];Je=n_(Q,ke,Je,ot);for(const Fe of je.positionedGlyphs){if(!Fe.rect)continue;const st=Fe.rect||{};let it=4,Oe=!0,ii=1,Wt=0;if(Fe.imageName){const Rt=be[Fe.imageName];if(!Rt)continue;if(Rt.sdf){Nt("SDF images are not supported in formatted text and will be ignored.");continue}Oe=!1,ii=Rt.pixelRatio,it=1/ii}const Zt=(pe||se)&&Fe.vertical,at=Fe.metrics.advance*Fe.scale/2,mt=Fe.metrics,Ct=Fe.rect;if(Ct===null)continue;se&&Q.verticalizable&&(Wt=Fe.imageName?at-Fe.metrics.width*Fe.scale/2:0);const It=pe?[Fe.x+at,Fe.y]:[0,0];let St=[0,0],Dt=[0,0],Ut=!1;pe||(Zt?(Dt=[Fe.x+at+Te[0],Fe.y+Te[1]-Wt],Ut=!0):St=[Fe.x+at+te[0],Fe.y+te[1]-Wt]);const ui=Ct.w*Fe.scale/(ii*(Fe.localGlyph?2:1)),Fi=Ct.h*Fe.scale/(ii*(Fe.localGlyph?2:1));let ct,$t,bi,vt;if(Zt){const Rt=Fe.y-Je,Ht=new Me(-at,at-Rt),hi=-Math.PI/2,ai=new Me(...Dt);ct=new Me(-at+St[0],St[1]),ct._rotateAround(hi,Ht)._add(ai),ct.x+=-Rt+at,ct.y-=(mt.left-it)*Fe.scale;const yi=Fe.imageName?mt.advance*Fe.scale:gi*Fe.scale,Ci=String.fromCharCode(Fe.glyph);Um(Ci)?ct.x+=(1-it)*Fe.scale:Vm(Ci)?ct.x+=yi-mt.height*Fe.scale+(-it-1)*Fe.scale:ct.x+=Fe.imageName||mt.width+2*it===Ct.w&&mt.height+2*it===Ct.h?(yi-Fi)/2:(yi-(mt.height+2*it)*Fe.scale)/2,$t=new Me(ct.x,ct.y-ui),bi=new Me(ct.x+Fi,ct.y),vt=new Me(ct.x+Fi,ct.y-ui)}else{const Rt=(mt.left-it)*Fe.scale-at+St[0],Ht=(-mt.top-it)*Fe.scale+St[1],hi=Rt+ui,ai=Ht+Fi;ct=new Me(Rt,Ht),$t=new Me(hi,Ht),bi=new Me(Rt,ai),vt=new Me(hi,ai)}if(we){let Rt;Rt=pe?new Me(0,0):Ut?new Me(Te[0],Te[1]):new Me(te[0],te[1]),ct._rotateAround(we,Rt),$t._rotateAround(we,Rt),bi._rotateAround(we,Rt),vt._rotateAround(we,Rt)}const Vt=new Me(0,0),Ai=new Me(0,0);fe.push({tl:ct,tr:$t,bl:bi,br:vt,tex:st,writingMode:Q.writingMode,glyphOffset:It,sectionIndex:Fe.sectionIndex,isSDF:Oe,pixelOffsetTL:Vt,pixelOffsetBR:Ai,minFontScaleX:0,minFontScaleY:0})}}return fe}(0,n,m,c,h,d,s,i.allowVerticalPlacement),H=i.textSizeData;let W=null;H.kind==="source"?(W=[Wr*c.layout.get("text-size").evaluate(d,{},R)],W[0]>ao&&Nt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):H.kind==="composite"&&(W=[Wr*M.compositeTextSizes[0].evaluate(d,{},R),Wr*M.compositeTextSizes[1].evaluate(d,{},R)],(W[0]>ao||W[1]>ao)&&Nt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,j,W,m,h,d,x,e,r,_.lineStartIndex,_.lineLength,E,z,R);for(const Y of b)w[Y]=i.text.placedSymbolArray.length-1;return 4*j.length}function Ed(i){for(const e in i)return i[e];return null}function au(i,e,r,n,s,c,h,d,m,_){let x=h.top,b=h.bottom,w=h.left,E=h.right;const M=h.collisionPadding;if(M&&(w-=M[0],x-=M[1],E+=M[2],b+=M[3]),m){const z=new Me(w,x),R=new Me(E,x),j=new Me(w,b),H=new Me(E,b),W=Ye(m);let Y=new Me(0,0);
vendor: 18,023 bytes, line 8
8_&&(Y=new Me(_[0],_[1])),z._rotateAround(W,Y),R._rotateAround(W,Y),j._rotateAround(W,Y),H._rotateAround(W,Y),w=Math.min(z.x,R.x,j.x,H.x),E=Math.max(z.x,R.x,j.x,H.x),x=Math.min(z.y,R.y,j.y,H.y),b=Math.max(z.y,R.y,j.y,H.y)}return i.emplaceBack(e.x,e.y,e.z,r.x,r.y,w,x,E,b,d,n,s,c),i.length-1}function vh(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);const e=i.bottom-i.top;return e>0?Math.max(10,e):null}function p_(i,e,r,n){const s=i.compareText;if(e in s){const c=s[e];for(let h=c.length-1;h>=0;h--)if(n.dist(c[h])<r)return!0}else s[e]=[];return s[e].push(n),!1}const d_=Ie([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_merc_pos",components:2},{type:"Float32",name:"a_uv",components:2}]),{members:Sd}=d_,Md=Ie([{name:"a_pos_3",components:3,type:"Int16"}]);var Il=Ie([{name:"a_pos",type:"Int16",components:2}]);const ns=qe/Math.PI/2,bh=2*fr(1,0)*ns*Math.PI,ga=[64,32,16],Hi=-ns,Yi=ns,f_=[new rr([Hi,Hi,Hi],[Yi,Yi,Yi]),new rr([Hi,Hi,Hi],[0,0,Yi]),new rr([0,Hi,Hi],[Yi,0,Yi]),new rr([Hi,0,Hi],[0,Yi,Yi]),new rr([0,0,Hi],[Yi,Yi,Yi])];function Id(i,e,r,n=!0){const s=Xr([],i._camera.position,i.worldSize),c=[e,r,1,1];is(c,c,i.pixelMatrixInverse),Ep(c,c,1/c[3]);const h=Si([],_r([],c,s)),d=i.globeMatrix,m=[d[12],d[13],d[14]],_=_r([],m,s),x=pl(_),b=Si([],_),w=i.worldSize/(2*Math.PI),E=mr(b,h),M=Math.asin(w/x);if(M<Math.acos(E)){if(!n)return null;const be=[],se=[];Xr(be,h,x/E),Si(se,_r(se,be,_)),Si(h,oo(h,_,Xr(h,se,Math.tan(M)*x)))}const z=[];new Qu(s,h).closestPointOnSphere(m,w,z);const R=Si([],wr(d,0)),j=Si([],wr(d,1)),H=Si([],wr(d,2)),W=mr(R,z),Y=mr(j,z),Q=mr(H,z),te=ni(Math.asin(-Y/w));let ue=ni(Math.atan2(W,Q));ue=i.center.lng+function(be,se){const fe=(se-be+180)%360-180;return fe<-180?fe+360:fe}(i.center.lng,ue);const pe=Ko(ue),me=Qe(Jo(te),0,1);return new sa(pe,me)}class m_{constructor(e,r,n){this.a=_r([],e,n),this.b=_r([],r,n),this.center=n;const s=Si([],this.a),c=Si([],this.b);this.angle=Math.acos(mr(s,c))}}function wh(i,e){if(i.angle===0)return null;let r;return r=i.a[e]===0?1/i.angle*.5*Math.PI:1/i.angle*Math.atan(i.b[e]/i.a[e]/Math.sin(i.angle)-1/Math.tan(i.angle)),r<0||r>1?null:function(n,s,c,h){const d=Math.sin(c);return n*(Math.sin((1-h)*c)/d)+s*(Math.sin(h*c)/d)}(i.a[e],i.b[e],i.angle,Qe(r,0,1))+i.center[e]}function Hr(i){if(i.z<=1)return f_[i.z+2*i.y+i.x];const[e,r]=Th(i),n=[Ii(e[0],e[1]),Ii(e[0],r[1]),Ii(r[0],e[1]),Ii(r[0],r[1])],s=[Yi,Yi,Yi],c=[Hi,Hi,Hi];for(const h of n)s[0]=Math.min(s[0],h[0]),s[1]=Math.min(s[1],h[1]),s[2]=Math.min(s[2],h[2]),c[0]=Math.max(c[0],h[0]),c[1]=Math.max(c[1],h[1]),c[2]=Math.max(c[2],h[2]);return new rr(s,c)}function __(i,e,r){const n=e/i.worldSize,s=Number.MAX_VALUE,c=[-s,-s,-s],h=[s,s,s],d=Xi(new Float64Array(16));if(qr(d,d,[n,n,n]),no(d,d,i.globeMatrix),r.z<=1){const se=Hr(r).getCorners();for(let fe=0;fe<se.length;fe++)_i(se[fe],se[fe],d),Nc(h,h,se[fe]),Gc(c,c,se[fe]);return new rr(h,c)}const[m,_]=Th(r),x=new ro;x.setSouthWest([m[1],_[0]]),x.setNorthEast([_[1],m[0]]);const b=[Ii(x.getSouth(),x.getWest()),Ii(x.getSouth(),x.getEast()),Ii(x.getNorth(),x.getEast()),Ii(x.getNorth(),x.getWest())];for(let se=0;se<b.length;se++)_i(b[se],b[se],d),Nc(h,h,b[se]),Gc(c,c,b[se]);if(x.contains(i.center)){c[2]=0;const se=i.point,fe=[se.x*n,se.y*n,0];return Nc(h,h,fe),Gc(c,c,fe),new rr(h,c)}const w=[d[12],d[13],d[14]],E=i.center.lng,M=Qe(i.center.lat,-85.051129,$r),z=[Ko(E),Jo(M)],R=x.getCenter().lng,j=Qe(x.getCenter().lat,-85.051129,$r),H=[Ko(R),Jo(j)];let W=new Array(3),Y=0,Q=z[0]-H[0];const te=z[1]-H[1];if(Q>.5?Q-=1:Q<-.5&&(Q+=1),Math.abs(Q)>Math.abs(te))Y=Q>=0?1:3,W=w;else{Y=te>=0?0:2;const se=[d[4],d[5],d[6]];let fe;fe=te>=0?-Math.sin(Ye(x.getSouth()))*ns:-Math.sin(Ye(x.getNorth()))*ns,W=Zc(W,w,se,fe)}const ue=b[Y],pe=b[(Y+1)%4],me=new m_(ue,pe,W),be=[wh(me,0)||ue[0],wh(me,1)||ue[1],wh(me,2)||ue[2]];return h[2]=Math.min(ue[2],pe[2]),Nc(h,h,be),Gc(c,c,be),new rr(h,c)}function Th(i){const e=1<<i.z,r=i.x/e,n=(i.x+1)/e,s=(i.y+1)/e;return[[ti(i.y/e),Ei(r)],[ti(s),Ei(n)]]}function Ad(i,e,r,n=ns){return r=Ye(r),[i*Math.sin(r)*n,-e*n,i*Math.cos(r)*n]}function Ii(i,e,r){return Ad(Math.cos(Ye(i)),Math.sin(Ye(i)),e,r)}function Cd(i,e,r){const n=Math.pow(2,r.z),s=(i/qe+r.x)/n;return Ii(ti((e/qe+r.y)/n),Ei(s))}function lu(i){return 16383/Math.max(..._r([],i.max,i.min))}function Al(i){const e=Xi(new Float64Array(16)),r=lu(i);var n,s;return qr(e,e,[r,r,r]),ts(e,e,((n=[])[0]=-(s=i.min)[0],n[1]=-s[1],n[2]=-s[2],n)),e}function zd(i){const e=Xi(new Float64Array(16)),r=1/lu(i);return ts(e,e,i.min),qr(e,e,[r,r,r]),e}function kd(i,e,r,n,s){const c=function(m){const _=qe/(2*Math.PI);return m/(2*Math.PI)/_}(r),h=[i,e,-r/(2*Math.PI)],d=Xi(new Float64Array(16));return ts(d,d,h),qr(d,d,[c,c,c]),Vc(d,d,Ye(-s)),jc(d,d,Ye(-n)),d}function Eh(i){return sr(5,6,i)}function Pd(i,e){const r=Ii(e.lat,e.lng);return c=(n=Ku([],function(E){const M=Ii(E._center.lat,E._center.lng);let z=Ju([],la(0,1,0),M);const R=vp([],-E.angle,M);z=_i(z,z,R),vp(R,-E._pitch,z);const j=Si([],M);return Xr(j,j,E.cameraToCenterDistance/E.pixelsPerMeter*bh),_i(j,j,R),oo([],M,j)}(i),r))[0],h=n[1],d=n[2],m=(s=r)[0],_=s[1],x=s[2],w=(b=Math.sqrt(c*c+h*h+d*d)*Math.sqrt(m*m+_*_+x*x))&&mr(n,s)/b,Math.acos(Math.min(Math.max(w,-1),1));var n,s,c,h,d,m,_,x,b,w}const Dd=Ye(85),g_=Math.cos(Dd),y_=Math.sin(Dd);function Ld(i,e){const r=i.fovAboveCenter,n=i.elevation?i.elevation.getMinElevationBelowMSL()*e:0,s=(i._camera.position[2]*i.worldSize-n)/Math.cos(i._pitch),c=Math.sin(r)*s/Math.sin(Math.max(Math.PI/2-i._pitch-r,.01)),h=Math.sin(i._pitch)*c+s;return Math.min(1.01*h,s*(1/i._horizonShift))}function os(i,e){if(!e.isReprojectedInTileSpace)return{scale:1<<i.z,x:i.x,y:i.y,x2:i.x+1,y2:i.y+1,projection:e};const r=Math.pow(2,-i.z),n=i.x*r,s=(i.x+1)*r,c=i.y*r,h=(i.y+1)*r,d=Ei(n),m=Ei(s),_=ti(c),x=ti(h),b=e.project(d,_),w=e.project(m,_),E=e.project(m,x),M=e.project(d,x);let z=Math.min(b.x,w.x,E.x,M.x),R=Math.min(b.y,w.y,E.y,M.y),j=Math.max(b.x,w.x,E.x,M.x),H=Math.max(b.y,w.y,E.y,M.y);const W=r/16;function Y(te,ue,pe,me,be,se){const fe=(pe+be)/2,we=(me+se)/2,Te=e.project(Ei(fe),ti(we)),De=Math.max(0,z-Te.x,R-Te.y,Te.x-j,Te.y-H);z=Math.min(z,Te.x),j=Math.max(j,Te.x),R=Math.min(R,Te.y),H=Math.max(H,Te.y),De>W&&(Y(te,Te,pe,me,fe,we),Y(Te,ue,fe,we,be,se))}Y(b,w,n,c,s,c),Y(w,E,s,c,s,h),Y(E,M,s,h,n,h),Y(M,b,n,h,n,c),z-=W,R-=W,j+=W,H+=W;const Q=1/Math.max(j-z,H-R);return{scale:Q,x:z*Q,y:R*Q,x2:j*Q,y2:H*Q,projection:e}}const x_=Xi(new Float32Array(16));class lo{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,r){return{x:0,y:0,z:0}}unproject(e,r){return new Et(0,0)}projectTilePoint(e,r,n){return{x:e,y:r,z:0}}locationPoint(e,r,n=!0){return e._coordinatePoint(e.locationCoordinate(r),n)}pixelsPerMeter(e,r){return fr(1,e)*r}pixelSpaceConversion(e,r,n){return 1}farthestPixelDistance(e){return Ld(e,e.pixelsPerMeter)}pointCoordinate(e,r,n,s){const c=e.horizonLineFromTop(!1),h=new Me(r,Math.max(c,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,s))}pointCoordinate3D(e,r,n){const s=new Me(r,n);if(e.elevation)return e.elevation.pointCoordinate(s);{const c=this.pointCoordinate(e,s.x,s.y,0);return[c.x,c.y,c.z]}}isPointAboveHorizon(e,r){if(e.elevation)return!this.pointCoordinate3D(e,r.x,r.y);const n=e.horizonLineFromTop();return r.y<n}createInversionMatrix(e,r){return x_}createTileMatrix(e,r,n){let s,c,h;const d=n.canonical,m=Xi(new Float64Array(16));if(this.isReprojectedInTileSpace){const _=os(d,this);s=1,c=_.x+n.wrap*_.scale,h=_.y,qr(m,m,[s/_.scale,s/_.scale,e.pixelsPerMeter/r])}else s=r/e.zoomScale(d.z),c=(d.x+Math.pow(2,d.z)*n.wrap)*s,h=d.y*s;return ts(m,m,[c,h,0]),qr(m,m,[s/qe,s/qe,1]),m}upVector(e,r,n){return[0,0,1]}upVectorScale(e,r,n){return{metersToTile:1}}}class v_ extends lo{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[r,n]=this.parallels=e.parallels||[29.5,45.5],s=Math.sin(Ye(r));this.n=(s+Math.sin(Ye(n)))/2,this.c=1+s*(2*this.n-s),this.r0=Math.sqrt(this.c)/this.n}project(e,r){const{n,c:s,r0:c}=this,h=Ye(e-this.center[0]),d=Ye(r),m=Math.sqrt(s-2*n*Math.sin(d))/n;return{x:m*Math.sin(h*n),y:m*Math.cos(h*n)-c,z:0}}unproject(e,r){const{n,c:s,r0:c}=this,h=c+r;let d=Math.atan2(e,Math.abs(h))*Math.sign(h);h*n<0&&(d-=Math.PI*Math.sign(e)*Math.sign(h));const m=Ye(this.center[0])*n;d=Fr(d,-Math.PI-m,Math.PI-m);const _=ni(d/n)+this.center[0],x=Math.asin(Qe((s-(e*e+h*h)*n*n)/(2*n),-1,1)),b=Qe(ni(x),-85.051129,$r);return new Et(_,b)}}const Cl=1.340264,zl=-.081106,kl=893e-6,Pl=.003796,cu=Math.sqrt(3)/2;class b_ extends lo{project(e,r){r=r/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(cu*Math.sin(r)),s=n*n,c=s*s*s;return{x:.5*(e*Math.cos(n)/(cu*(Cl+3*zl*s+c*(7*kl+9*Pl*s)))/Math.PI+.5),y:1-.5*(n*(Cl+zl*s+c*(kl+Pl*s))/Math.PI+1),z:0}}unproject(e,r){e=(2*e-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,s=n*n,c=s*s*s;for(let x,b,w,E=0;E<12&&(b=n*(Cl+zl*s+c*(kl+Pl*s))-r,w=Cl+3*zl*s+c*(7*kl+9*Pl*s),x=b/w,n=Qe(n-x,-Math.PI/3,Math.PI/3),s=n*n,c=s*s*s,!(Math.abs(x)<1e-12));++E);const h=cu*e*(Cl+3*zl*s+c*(7*kl+9*Pl*s))/Math.cos(n),d=Math.asin(Math.sin(n)/cu),m=Qe(180*h/Math.PI,-180,180),_=Qe(180*d/Math.PI,-85.051129,$r);return new Et(m,_)}}class w_ extends lo{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,r){return{x:.5+e/360,y:.5-r/360,z:0}}unproject(e,r){const n=360*(e-.5),s=Qe(360*(.5-r),-85.051129,$r);return new Et(n,s)}}const ya=Math.PI/2;function uu(i){return Math.tan((ya+i)/2)}class T_ extends lo{constructor(e){super(e),this.center=e.center||[0,30];const[r,n]=this.parallels=e.parallels||[30,30],s=Ye(r),c=Ye(n),h=Math.cos(s);this.n=s===c?Math.sin(s):Math.log(h/Math.cos(c))/Math.log(uu(c)/uu(s)),this.f=h*Math.pow(uu(s),this.n)/this.n}project(e,r){r=Ye(r),e=Ye(e-this.center[0]);const n=1e-6,{n:s,f:c}=this;c>0?r<-ya+n&&(r=-ya+n):r>ya-n&&(r=ya-n);const h=c/Math.pow(uu(r),s),d=h*Math.sin(s*e),m=c-h*Math.cos(s*e);return{x:.5*(d/Math.PI+.5),y:1-.5*(m/Math.PI+.5),z:0}}unproject(e,r){e=(2*e-.5)*Math.PI,r=(2*(1-r)-.5)*Math.PI;const{n,f:s}=this,c=s-r,h=Math.sign(c),d=Math.sign(n)*Math.sqrt(e*e+c*c);let m=Math.atan2(e,Math.abs(c))*h;c*n<0&&(m-=Math.PI*Math.sign(e)*h);const _=Qe(ni(m/n)+this.center[0],-180,180),x=Qe(ni(2*Math.atan(Math.pow(s/d,1/n))-ya),-85.051129,$r);return new Et(_,x)}}class Bd extends lo{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,r){return{x:Ko(e),y:Jo(r),z:0}}unproject(e,r){const n=Ei(e),s=ti(r);return new Et(n,s)}}const Rd=Ye($r);class E_ extends lo{project(e,r){const n=(r=Ye(r))*r,s=n*n;return{x:.5*((e=Ye(e))*(.8707-.131979*n+s*(s*(.003971*n-.001529*s)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+n*(.015085+s*(.028874*n-.044475-.005916*s)))/Math.PI+1),z:0}}unproject(e,r){e=(2*e-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,s=25,c=0,h=n*n;do{h=n*n;const _=h*h;c=(n*(1.007226+h*(.015085+_*(.028874*h-.044475-.005916*_)))-r)/(1.007226+h*(.045255+_*(.259866*h-.311325-.005916*11*_))),n=Qe(n-c,-Rd,Rd)}while(Math.abs(c)>1e-6&&--s>0);h=n*n;const d=Qe(ni(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),m=ni(n);return new Et(d,m)}}const Fd=Ye($r);class S_ extends lo{project(e,r){r=Ye(r),e=Ye(e);const n=Math.cos(r),s=2/Math.PI,c=Math.acos(n*Math.cos(e/2)),h=Math.sin(c)/c,d=.5*(e*s+2*n*Math.sin(e/2)/h)||0,m=.5*(r+Math.sin(r)/h)||0;return{x:.5*(d/Math.PI+.5),y:1-.5*(m/Math.PI+1),z:0}}unproject(e,r){let n=e=(2*e-.5)*Math.PI,s=r=(2*(1-r)-1)*Math.PI,c=25;const h=1e-6;let d=0,m=0;do{const _=Math.cos(s),x=Math.sin(s),b=2*x*_,w=x*x,E=_*_,M=Math.cos(n/2),z=Math.sin(n/2),R=2*M*z,j=z*z,H=1-E*M*M,W=H?1/H:0,Y=H?Math.acos(_*M)*Math.sqrt(1/H):0,Q=.5*(2*Y*_*z+2*n/Math.PI)-e,te=.5*(Y*x+s)-r,ue=.5*W*(E*j+Y*_*M*w)+1/Math.PI,pe=W*(R*b/4-Y*x*z),me=.125*W*(b*z-Y*x*E*R),be=.5*W*(w*M+Y*j*_)+.5,se=pe*me-be*ue;d=(te*pe-Q*be)/se,m=(Q*me-te*ue)/se,n=Qe(n-d,-Math.PI,Math.PI),s=Qe(s-m,-Fd,Fd)}while((Math.abs(d)>h||Math.abs(m)>h)&&--c>0);return new Et(ni(n),ni(s))}}class Od extends lo{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Ye(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,r){const{scale:n,cosPhi:s}=this;return{x:Ye(e)*s*n+.5,y:-Math.sin(Ye(r))/s*n+.5,z:0}}unproject(e,r){const{scale:n,cosPhi:s}=this,c=-(r-.5)/n,h=Qe(ni((e-.5)/n)/s,-180,180),d=Math.asin(Qe(c*s,-1,1)),m=Qe(ni(d),-85.051129,$r);return new Et(h,m)}}class M_ extends Bd{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(e,r,n){const s=Math.pow(2,n.z),c=(e/qe+n.x)/s,h=Ii(ti((r/qe+n.y)/s),Ei(c));return _i(h,h,Al(Hr(n))),{x:h[0],y:h[1],z:h[2]}}locationPoint(e,r){const n=Ii(r.lat,r.lng),s=Si([],n),c=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(r),e._centerAltitude):e._centerAltitude;Zc(n,n,s,fr(1,0)*qe*c);const h=Xi(new Float64Array(16));return no(h,e.pixelMatrix,e.globeMatrix),_i(n,n,h),new Me(n[0],n[1])}pixelsPerMeter(e,r){return fr(1,0)*r}pixelSpaceConversion(e,r,n){const s=dt(fr(1,45)*r,fr(1,e)*r,n);return this.pixelsPerMeter(e,r)/s}createTileMatrix(e,r,n){const s=zd(Hr(n.canonical));return no(new Float64Array(16),e.globeMatrix,s)}createInversionMatrix(e,r){const{center:n}=e,s=Xi(new Float64Array(16));return no(s,s,Al(Hr(r))),jc(s,s,Ye(n.lng)),Vc(s,s,Ye(n.lat)),qr(s,s,[e._projectionScaler,e._projectionScaler,1]),Float32Array.from(s)}pointCoordinate(e,r,n,s){return Id(e,r,n,!0)||new sa(0,0)}pointCoordinate3D(e,r,n){const s=this.pointCoordinate(e,r,n,0);return[s.x,s.y,s.z]}isPointAboveHorizon(e,r){return!Id(e,r.x,r.y,!1)}farthestPixelDistance(e){const r=function(s,c){const h=s.cameraToCenterDistance,d=s._centerAltitude*c,m=s._camera,_=s._camera.forward(),x=oo([],Xr([],_,-h),[0,0,d]),b=s.worldSize/(2*Math.PI),w=[0,0,-b],E=s.width/s.height,M=Math.tan(s.fovAboveCenter),z=Xr([],m.up(),M),R=Xr([],m.right(),M*E),j=Si([],oo([],oo([],_,z),R)),H=[];let W;if(new Qu(x,j).closestPointOnSphere(w,b,H)){const Y=oo([],H,w),Q=_r([],Y,x);W=Math.cos(s.fovAboveCenter)*pl(Q)}else{const Y=_r([],x,w),Q=_r([],w,x);Si(Q,Q);const te=pl(Y)-b;W=Math.sqrt(te*(te+2*b));const ue=Math.acos(W/(b+te))-Math.acos(mr(_,Q));W*=Math.cos(ue)}return 1.01*W}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Eh(e.zoom);if(n>0){const s=Ld(e,fr(1,e.center.lat)*e.worldSize),c=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return dt(r,s+c*(1-Math.cos(h)),Math.pow(n,10))}return r}upVector(e,r,n){const s=1<<e.z,c=(r/qe+e.x)/s;return Ii(ti((n/qe+e.y)/s),Ei(c),1)}upVectorScale(e){return{metersToTile:bh*lu(Hr(e))}}}function Ud(i){const e=i.parallels,r=!!e&&Math.abs(e[0]+e[1])<.01;switch(i.name){case"mercator":return new Bd(i);case"equirectangular":return new w_(i);case"naturalEarth":return new E_(i);case"equalEarth":return new b_(i);case"winkelTripel":return new S_(i);case"albers":return r?new Od(i):new v_(i);case"lambertConformalConic":return r?new Od(i):new T_(i);case"globe":return new M_(i)}throw new Error(`Invalid projection name: ${i.name}`)}const I_=rs.VectorTileFeature.types,A_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hu(i,e,r,n,s,c,h,d,m,_,x,b,w){const E=d?Math.min(ao,Math.round(d[0])):0,M=d?Math.min(ao,Math.round(d[1])):0;i.emplaceBack(e,r,Math.round(32*n),Math.round(32*s),c,h,(E<<1)+(m?1:0),M,16*_,16*x,256*b,256*w)}function pu(i,e,r,n,s,c,h){i.emplaceBack(e,r,n,s,c,h)}function du(i,e,r,n,s){i.emplaceBack(e,r,n,s),i.emplaceBack(e,r,n,s),i.emplaceBack(e,r,n,s),i.emplaceBack(e,r,n,s)}function C_(i){for(const e of i.sections)if(f(e.text))return!0;return!1}class Sh{constructor(e){this.layoutVertexArray=new Ri,this.indexArray=new ht,this.programConfigurations=e,this.segments=new Xt,this.dynamicLayoutVertexArray=new yt,this.opacityVertexArray=new Pr,this.placedSymbolArray=new qh,this.globeExtVertexArray=new pr}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,s){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,km.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Dm.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,A_,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Pm.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||s)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Re(Sh,"SymbolBuffers");class Mh{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new Xt,this.collisionVertexArray=new Yt,this.collisionVertexArrayExt=new ci}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Lm.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Bm.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
8stroy())}}Re(Mh,"CollisionBuffers");class co{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Xi([]),this.placementViewportMatrix=Xi([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=uh(this.zoom,r["text-size"]),this.iconSizeData=uh(this.zoom,r["icon-size"]);const n=this.layers[0].layout,s=n.get("symbol-sort-key"),c=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=c!=="viewport-y"&&s.constantOr(1)!==void 0,this.sortFeaturesByY=(c==="viewport-y"||c==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(h=>nr[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection}createArrays(){this.text=new Sh(new Yo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Sh(new Yo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Hh,this.lineVertexArray=new Yh,this.symbolInstances=new Wh}calculateGlyphDependencies(e,r,n,s,c){for(let h=0;h<e.length;h++)if(r[e.charCodeAt(h)]=!0,s&&c){const d=Tl[e.charAt(h)];d&&(r[d.charCodeAt(0)]=!0)}}populate(e,r,n,s){const c=this.layers[0],h=c.layout,d=this.projection.name==="globe",m=h.get("text-font"),_=h.get("text-field"),x=h.get("icon-image"),b=(_.value.kind!=="constant"||_.value.value instanceof mi&&!_.value.value.isEmpty()||_.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),w=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,E=h.get("symbol-sort-key");if(this.features=[],!b&&!w)return;const M=r.iconDependencies,z=r.glyphDependencies,R=r.availableImages,j=new F(this.zoom);for(const{feature:H,id:W,index:Y,sourceLayerIndex:Q}of e){const te=c._featureFilter.needGeometry,ue=Qo(H,te);if(!c._featureFilter.filter(j,ue,n))continue;if(te||(ue.geometry=wn(H,n,s)),d&&H.type!==1&&n.z<=5){const se=ue.geometry,fe=1<<n.z,we=n.x,Te=n.y,De=.98078528056;for(let xe=0;xe<se.length;xe++)se[xe]=Df(se[xe],ke=>ke,(ke,Je)=>mr(Ii(ti((ke.y/qe+Te)/fe),Ei((ke.x/qe+we)/fe),1),Ii(ti((Je.y/qe+Te)/fe),Ei((Je.x/qe+we)/fe),1))<De)}let pe,me;if(b){const se=c.getValueAndResolveTokens("text-field",ue,n,R),fe=mi.factory(se);C_(fe)&&(this.hasRTLText=!0),(!this.hasRTLText||P()==="unavailable"||this.hasRTLText&&D.isParsed())&&(pe=Om(fe,c,ue))}if(w){const se=c.getValueAndResolveTokens("icon-image",ue,n,R);me=se instanceof Gi?se:Gi.fromString(se)}if(!pe&&!me)continue;const be=this.sortFeaturesByKey?E.evaluate(ue,{},n):void 0;if(this.features.push({id:W,text:pe,icon:me,index:Y,sourceLayerIndex:Q,geometry:ue.geometry,properties:H.properties,type:I_[H.type],sortKey:be}),me&&(M[me.name]=!0),pe){const se=m.evaluate(ue,{},n).join(","),fe=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(nr.vertical)>=0;for(const we of pe.sections)if(we.image)M[we.image.name]=!0;else{const Te=ra(pe.toString()),De=we.fontStack||se,xe=z[De]=z[De]||{};this.calculateGlyphDependencies(we.text,xe,fe,this.allowVerticalPlacement,Te)}}}h.get("symbol-placement")==="line"&&(this.features=function(H){const W={},Y={},Q=[];let te=0;function ue(se){Q.push(H[se]),te++}function pe(se,fe,we){const Te=Y[se];return delete Y[se],Y[fe]=Te,Q[Te].geometry[0].pop(),Q[Te].geometry[0]=Q[Te].geometry[0].concat(we[0]),Te}function me(se,fe,we){const Te=W[fe];return delete W[fe],W[se]=Te,Q[Te].geometry[0].shift(),Q[Te].geometry[0]=we[0].concat(Q[Te].geometry[0]),Te}function be(se,fe,we){const Te=we?fe[0][fe[0].length-1]:fe[0][0];return`${se}:${Te.x}:${Te.y}`}for(let se=0;se<H.length;se++){const fe=H[se],we=fe.geometry,Te=fe.text?fe.text.toString():null;if(!Te){ue(se);continue}const De=be(Te,we),xe=be(Te,we,!0);if(De in Y&&xe in W&&Y[De]!==W[xe]){const ke=me(De,xe,we),Je=pe(De,xe,Q[ke].geometry);delete W[De],delete Y[xe],Y[be(Te,Q[Je].geometry,!0)]=Je,Q[ke].geometry=null}else De in Y?pe(De,xe,we):xe in W?me(De,xe,we):(ue(se),W[De]=te-1,Y[xe]=te-1)}return Q.filter(se=>se.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((H,W)=>H.sortKey-W.sortKey)}update(e,r,n,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n,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()}getProjection(){return this.projectionInstance||(this.projectionInstance=Ud(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const n=this.lineVertexArray.length,s=e.segment;if(s!==void 0){let c=e.dist(r[s+1]),h=e.dist(r[s]);const d={};for(let m=s+1;
vendor: 31,251 bytes, line 8
8m<r.length;m++)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=s||0;m>=0;m--)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const _=d[m];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,s,c,h,d,m,_,x,b,w,E,M){const z=e.indexArray,R=e.layoutVertexArray,j=e.globeExtVertexArray,H=e.segments.prepareSegment(4*r.length,R,z,this.canOverlap?h.sortKey:void 0),W=this.glyphOffsetArray.length,Y=H.vertexLength,Q=this.allowVerticalPlacement&&d===nr.vertical?Math.PI/2:0,te=h.text&&h.text.sections;for(let pe=0;pe<r.length;pe++){const{tl:me,tr:be,bl:se,br:fe,tex:we,pixelOffsetTL:Te,pixelOffsetBR:De,minFontScaleX:xe,minFontScaleY:ke,glyphOffset:Je,isSDF:ot,sectionIndex:je}=r[pe],Fe=H.vertexLength,st=Je[1];if(hu(R,_.x,_.y,me.x,st+me.y,we.x,we.y,n,ot,Te.x,Te.y,xe,ke),hu(R,_.x,_.y,be.x,st+be.y,we.x+we.w,we.y,n,ot,De.x,Te.y,xe,ke),hu(R,_.x,_.y,se.x,st+se.y,we.x,we.y+we.h,n,ot,Te.x,De.y,xe,ke),hu(R,_.x,_.y,fe.x,st+fe.y,we.x+we.w,we.y+we.h,n,ot,De.x,De.y,xe,ke),m){const it=m.anchor,Oe=m.up;pu(j,it.x,it.y,it.z,Oe[0],Oe[1],Oe[2]),pu(j,it.x,it.y,it.z,Oe[0],Oe[1],Oe[2]),pu(j,it.x,it.y,it.z,Oe[0],Oe[1],Oe[2]),pu(j,it.x,it.y,it.z,Oe[0],Oe[1],Oe[2]),du(e.dynamicLayoutVertexArray,it.x,it.y,it.z,Q)}else du(e.dynamicLayoutVertexArray,_.x,_.y,_.z,Q);z.emplaceBack(Fe,Fe+1,Fe+2),z.emplaceBack(Fe+1,Fe+2,Fe+3),H.vertexLength+=4,H.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Je[0]),pe!==r.length-1&&je===r[pe+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,h,h.index,{},E,M,te&&te[je])}const ue=m?m.anchor:_;e.placedSymbolArray.emplaceBack(ue.x,ue.y,ue.z,_.x,_.y,W,this.glyphOffsetArray.length-W,Y,x,b,_.segment,n?n[0]:0,n?n[1]:0,s[0],s[1],d,0,!1,0,w,0)}_commitLayoutVertex(e,r,n,s,c,h,d){e.emplaceBack(r,n,s,c,h,Math.round(d.x),Math.round(d.y))}_addCollisionDebugVertices(e,r,n,s,c,h,d){const m=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),_=m.vertexLength,x=d.tileAnchorX,b=d.tileAnchorY;for(let E=0;E<4;E++)n.collisionVertexArray.emplaceBack(0,0,0,0);n.collisionVertexArrayExt.emplaceBack(r,-e.padding,-e.padding),n.collisionVertexArrayExt.emplaceBack(r,e.padding,-e.padding),n.collisionVertexArrayExt.emplaceBack(r,e.padding,e.padding),n.collisionVertexArrayExt.emplaceBack(r,-e.padding,e.padding),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Me(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Me(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Me(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Me(e.x1,e.y2)),m.vertexLength+=4;const w=n.indexArray;w.emplaceBack(_,_+1),w.emplaceBack(_+1,_+2),w.emplaceBack(_+2,_+3),w.emplaceBack(_+3,_),m.primitiveLength+=4}_addTextDebugCollisionBoxes(e,r,n,s,c,h){for(let d=s;d<c;d++){const m=n.get(d),_=this.getSymbolInstanceTextSize(e,h,r,d);this._addCollisionDebugVertices(m,_,this.textCollisionBox,m.projectedAnchorX,m.projectedAnchorY,m.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,r,n,s,c,h){for(let d=s;d<c;d++){const m=n.get(d),_=this.getSymbolInstanceIconSize(e,r,d);this._addCollisionDebugVertices(m,_,this.iconCollisionBox,m.projectedAnchorX,m.projectedAnchorY,m.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Mh(Bt,Jp.members,Kt),this.iconCollisionBox=new Mh(Bt,Jp.members,Kt);const n=ha(this.iconSizeData,e),s=ha(this.textSizeData,e);for(let c=0;c<this.symbolInstances.length;c++){const h=this.symbolInstances.get(c);this._addTextDebugCollisionBoxes(s,e,r,h.textBoxStartIndex,h.textBoxEndIndex,h),this._addTextDebugCollisionBoxes(s,e,r,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h),this._addIconDebugCollisionBoxes(n,e,r,h.iconBoxStartIndex,h.iconBoxEndIndex,h),this._addIconDebugCollisionBoxes(n,e,r,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h)}}getSymbolInstanceTextSize(e,r,n,s){const c=this.text.placedSymbolArray.get(r.rightJustifiedTextSymbolIndex>=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:s),h=tu(this.textSizeData,e,c)/gi;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,r,n){const s=this.icon.placedSymbolArray.get(n),c=tu(this.iconSizeData,e,s);return this.tilePixelRatio*c}_commitDebugCollisionVertexUpdate(e,r,n){e.emplaceBack(r,-n,-n),e.emplaceBack(r,n,-n),e.emplaceBack(r,n,n),e.emplaceBack(r,-n,n)}_updateTextDebugCollisionBoxes(e,r,n,s,c,h){for(let d=s;d<c;d++){const m=n.get(d),_=this.getSymbolInstanceTextSize(e,h,r,d);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,_,m.padding)}}_updateIconDebugCollisionBoxes(e,r,n,s,c){for(let h=s;h<c;h++){const d=n.get(h),m=this.getSymbolInstanceIconSize(e,r,h);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,m,d.padding)}}updateCollisionDebugBuffers(e,r){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=ha(this.iconSizeData,e),s=ha(this.textSizeData,e);for(let c=0;c<this.symbolInstances.length;c++){const h=this.symbolInstances.get(c);this._updateTextDebugCollisionBoxes(s,e,r,h.textBoxStartIndex,h.textBoxEndIndex,h),this._updateTextDebugCollisionBoxes(s,e,r,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h),this._updateIconDebugCollisionBoxes(n,e,r,h.iconBoxStartIndex,h.iconBoxEndIndex),this._updateIconDebugCollisionBoxes(n,e,r,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,r,n,s,c,h,d,m,_){const x={};for(let b=r;b<n;b++){const w=e.get(b);x.textBox={x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,padding:w.padding,projectedAnchorX:w.projectedAnchorX,projectedAnchorY:w.projectedAnchorY,projectedAnchorZ:w.projectedAnchorZ,tileAnchorX:w.tileAnchorX,tileAnchorY:w.tileAnchorY},x.textFeatureIndex=w.featureIndex;break}for(let b=s;b<c;b++){const w=e.get(b);x.verticalTextBox={x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,padding:w.padding,projectedAnchorX:w.projectedAnchorX,projectedAnchorY:w.projectedAnchorY,projectedAnchorZ:w.projectedAnchorZ,tileAnchorX:w.tileAnchorX,tileAnchorY:w.tileAnchorY},x.verticalTextFeatureIndex=w.featureIndex;break}for(let b=h;b<d;b++){const w=e.get(b);x.iconBox={x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,padding:w.padding,projectedAnchorX:w.projectedAnchorX,projectedAnchorY:w.projectedAnchorY,projectedAnchorZ:w.projectedAnchorZ,tileAnchorX:w.tileAnchorX,tileAnchorY:w.tileAnchorY},x.iconFeatureIndex=w.featureIndex;break}for(let b=m;b<_;b++){const w=e.get(b);x.verticalIconBox={x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,padding:w.padding,projectedAnchorX:w.projectedAnchorX,projectedAnchorY:w.projectedAnchorY,projectedAnchorZ:w.projectedAnchorZ,tileAnchorX:w.tileAnchorX,tileAnchorY:w.tileAnchorY},x.verticalIconFeatureIndex=w.featureIndex;break}return x}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const n=e.placedSymbolArray.get(r),s=n.vertexStartIndex+4*n.numGlyphs;for(let c=n.vertexStartIndex;c<s;c+=4)e.indexArray.emplaceBack(c,c+1,c+2),e.indexArray.emplaceBack(c+1,c+2,c+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),n=Math.cos(e),s=[],c=[],h=[];for(let d=0;d<this.symbolInstances.length;++d){h.push(d);const m=this.symbolInstances.get(d);s.push(0|Math.round(r*m.tileAnchorX+n*m.tileAnchorY)),c.push(m.featureIndex)}return h.sort((d,m)=>s[d]-s[m]||c[m]-c[d]),h}addToSortKeyRanges(e,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((s,c,h)=>{s>=0&&h.indexOf(s)===c&&this.addIndicesForPlacedSymbol(this.text,s)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Re(co,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),co.MAX_GLYPHS=65535,co.addDynamicAttributes=du;const z_=new de({"symbol-placement":new ae(re.layout_symbol["symbol-placement"]),"symbol-spacing":new ae(re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ae(re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new q(re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ae(re.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ae(re.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new ae(re.layout_symbol["icon-ignore-placement"]),"icon-optional":new ae(re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ae(re.layout_symbol["icon-rotation-alignment"]),"icon-size":new q(re.layout_symbol["icon-size"]),"icon-text-fit":new ae(re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ae(re.layout_symbol["icon-text-fit-padding"]),"icon-image":new q(re.layout_symbol["icon-image"]),"icon-rotate":new q(re.layout_symbol["icon-rotate"]),"icon-padding":new ae(re.layout_symbol["icon-padding"]),"icon-keep-upright":new ae(re.layout_symbol["icon-keep-upright"]),"icon-offset":new q(re.layout_symbol["icon-offset"]),"icon-anchor":new q(re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ae(re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ae(re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ae(re.layout_symbol["text-rotation-alignment"]),"text-field":new q(re.layout_symbol["text-field"]),"text-font":new q(re.layout_symbol["text-font"]),"text-size":new q(re.layout_symbol["text-size"]),"text-max-width":new q(re.layout_symbol["text-max-width"]),"text-line-height":new q(re.layout_symbol["text-line-height"]),"text-letter-spacing":new q(re.layout_symbol["text-letter-spacing"]),"text-justify":new q(re.layout_symbol["text-justify"]),"text-radial-offset":new q(re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ae(re.layout_symbol["text-variable-anchor"]),"text-anchor":new q(re.layout_symbol["text-anchor"]),"text-max-angle":new ae(re.layout_symbol["text-max-angle"]),"text-writing-mode":new ae(re.layout_symbol["text-writing-mode"]),"text-rotate":new q(re.layout_symbol["text-rotate"]),"text-padding":new ae(re.layout_symbol["text-padding"]),"text-keep-upright":new ae(re.layout_symbol["text-keep-upright"]),"text-transform":new q(re.layout_symbol["text-transform"]),"text-offset":new q(re.layout_symbol["text-offset"]),"text-allow-overlap":new ae(re.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new ae(re.layout_symbol["text-ignore-placement"]),"text-optional":new ae(re.layout_symbol["text-optional"])});var Ih={paint:new de({"icon-opacity":new q(re.paint_symbol["icon-opacity"]),"icon-color":new q(re.paint_symbol["icon-color"]),"icon-halo-color":new q(re.paint_symbol["icon-halo-color"]),"icon-halo-width":new q(re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new q(re.paint_symbol["icon-halo-blur"]),"icon-translate":new ae(re.paint_symbol["icon-translate"]),"icon-translate-anchor":new ae(re.paint_symbol["icon-translate-anchor"]),"text-opacity":new q(re.paint_symbol["text-opacity"]),"text-color":new q(re.paint_symbol["text-color"],{runtimeType:Qi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new q(re.paint_symbol["text-halo-color"]),"text-halo-width":new q(re.paint_symbol["text-halo-width"]),"text-halo-blur":new q(re.paint_symbol["text-halo-blur"]),"text-translate":new ae(re.paint_symbol["text-translate"]),"text-translate-anchor":new ae(re.paint_symbol["text-translate-anchor"])}),layout:z_};class Vd{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:So,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Re(Vd,"FormatSectionOverride",{omit:["defaultValue"]});class fu extends Br{constructor(e){super(e,Ih)}recalculate(e,r){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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const s=[];for(const c of n)s.indexOf(c)<0&&s.push(c);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,s){const c=this.layout.get(e).evaluate(r,{},n,s),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||js(h.value)||!c?c:function(d,m){return m.replace(/{([^{}]+)}/g,(_,x)=>x in d?String(d[x]):"")}(r.properties,c)}createBucket(e){return new co(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Ih.paint.overridableProperties){if(!fu.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),n=new Vd(r),s=new Vs(n,r.property.specification);let c=null;c=r.value.kind==="constant"||r.value.kind==="source"?new Ns("source",s):new Uo("composite",s,r.value.zoomStops,r.value._interpolationType),this.paint._values[e]=new he(r.property,c,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&fu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const n=e.get("text-field"),s=Ih.paint.properties[r];let c=!1;const h=d=>{for(const m of d)if(s.overrides&&s.overrides.hasOverride(m))return void(c=!0)};if(n.value.kind==="constant"&&n.value.value instanceof mi)h(n.value.value.sections);else if(n.value.kind==="source"){const d=_=>{c||(_ instanceof Ao&&jt(_.value)===Rn?h(_.value.sections):_ instanceof Nr?h(_.sections):_.eachChild(d))},m=n.value;m._styleExpression&&d(m._styleExpression.expression)}return c}getProgramConfiguration(e){return new io(this,e)}}var k_={paint:new de({"background-color":new ae(re.paint_background["background-color"]),"background-pattern":new _e(re.paint_background["background-pattern"]),"background-opacity":new ae(re.paint_background["background-opacity"])})},P_={paint:new de({"raster-opacity":new ae(re.paint_raster["raster-opacity"]),"raster-hue-rotate":new ae(re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ae(re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ae(re.paint_raster["raster-brightness-max"]),"raster-saturation":new ae(re.paint_raster["raster-saturation"]),"raster-contrast":new ae(re.paint_raster["raster-contrast"]),"raster-resampling":new ae(re.paint_raster["raster-resampling"]),"raster-fade-duration":new ae(re.paint_raster["raster-fade-duration"])})};class D_ extends Br{constructor(e){super(e,{}),this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}var L_={paint:new de({"sky-type":new ae(re.paint_sky["sky-type"]),"sky-atmosphere-sun":new ae(re.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new ae(re.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new ae(re.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new ae(re.paint_sky["sky-gradient-radius"]),"sky-gradient":new ze(re.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new ae(re.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new ae(re.paint_sky["sky-atmosphere-color"]),"sky-opacity":new ae(re.paint_sky["sky-opacity"])})};function Ah(i,e,r){const n=[0,0,1],s=Mp([]);return Ap(s,s,r?-Ye(i)+Math.PI:Ye(i)),Ip(s,s,-Ye(e)),Tp(n,n,s),Si(n,n)}const B_={circle:class extends Br{constructor(i){super(i,Vf)}createBucket(i){return new Xu(i)}queryRadius(i){const e=i;return aa("circle-radius",this,e)+aa("circle-stroke-width",this,e)+Oc(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,n,s,c,h,d){const m=yp(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),c.angle,i.pixelToTileUnitsFactor),_=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r);return Cp(i,n,c,h,d,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",m,_)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new io(this,i)}},heatmap:class extends Br{createBucket(i){return new kp(i)}constructor(i){super(i,Xf),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=rh({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(i){return aa("heatmap-radius",this,i)}queryIntersectsFeature(i,e,r,n,s,c,h,d){const m=this.paint.get("heatmap-radius").evaluate(e,r);return Cp(i,n,c,h,d,!0,!0,new Me(0,0),m)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new io(this,i)}},hillshade:class extends Br{constructor(i){super(i,Wf)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends Br{constructor(i){super(i,hm)}getProgramIds(){const i=this.paint.get("fill-pattern"),e=i&&i.constantOr(1),r=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getProgramConfiguration(i){return new io(this,i)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Yc(i)}queryRadius(){return Oc(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,n,s,c){return!i.queryGeometry.isAboveHorizon&&dp(gp(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),c.angle,i.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends Br{constructor(i){super(i,Tm)}createBucket(i){return new vl(i)}queryRadius(){return Oc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(i){return new io(this,i)}queryIntersectsFeature(i,e,r,n,s,c,h,d,m){const _=yp(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),c.angle,i.pixelToTileUnitsFactor),x=this.paint.get("fill-extrusion-height").evaluate(e,r),b=this.paint.get("fill-extrusion-base").evaluate(e,r),w=[0,0],E=d&&c.elevation,M=c.elevation?c.elevation.exaggeration():1,z=i.tile.getBucket(this);if(E&&z instanceof vl){const H=z.centroidVertexArray,W=m+1;if(W<H.length){const Y=H.get(W);w[0]=Y.a_centroid_pos0,w[1]=Y.a_centroid_pos1}}if(w[0]===0&&w[1]===1)return!1;c.projection.name==="globe"&&(n=Zp([n],[new Me(0,0),new Me(qe,qe)],i.tileID.canonical).map(H=>H.polygon).flat());const R=function(H,W,Y,Q,te,ue,pe,me,be,se,fe){return H.projection.name==="globe"?function(we,Te,De,xe,ke,Je,ot,je,Fe,st,it){const Oe=[],ii=[],Wt=we.projection.upVectorScale(it,we.center.lat,we.worldSize).metersToTile,Zt=[0,0,0,1],at=[0,0,0,1],mt=(It,St,Dt,Ut)=>{It[0]=St,It[1]=Dt,It[2]=Ut,It[3]=1},Ct=Gp();De>0&&(De+=Ct),xe+=Ct;for(const It of Te){const St=[],Dt=[];for(const Ut of It){const ui=Ut.x+ke.x,Fi=Ut.y+ke.y,ct=we.projection.projectTilePoint(ui,Fi,it),$t=we.projection.upVector(it,Ut.x,Ut.y);let bi=De,vt=xe;if(ot){const Vt=Wp(ui,Fi,De,xe,ot,je,Fe,st);bi+=Vt.base,vt+=Vt.top}De!==0?mt(Zt,ct.x+$t[0]*Wt*bi,ct.y+$t[1]*Wt*bi,ct.z+$t[2]*Wt*bi):mt(Zt,ct.x,ct.y,ct.z),mt(at,ct.x+$t[0]*Wt*vt,ct.y+$t[1]*Wt*vt,ct.z+$t[2]*Wt*vt),_i(Zt,Zt,Je),_i(at,at,Je),St.push(Qc(Zt)),Dt.push(Qc(at))}Oe.push(St),ii.push(Dt)}return[Oe,ii]}(H,W,Y,Q,te,ue,pe,me,be,se,fe):pe?function(we,Te,De,xe,ke,Je,ot,je,Fe){const st=[],it=[],Oe=[0,0,0,1];for(const ii of we){const Wt=[],Zt=[];for(const at of ii){const mt=at.x+xe.x,Ct=at.y+xe.y,It=Wp(mt,Ct,Te,De,Je,ot,je,Fe);Oe[0]=mt,Oe[1]=Ct,Oe[2]=It.base,Oe[3]=1,is(Oe,Oe,ke),Oe[3]=Math.max(Oe[3],1e-5);const St=Qc([Oe[0]/Oe[3],Oe[1]/Oe[3],Oe[2]/Oe[3]]);Oe[0]=mt,Oe[1]=Ct,Oe[2]=It.top,Oe[3]=1,is(Oe,Oe,ke),Oe[3]=Math.max(Oe[3],1e-5);const Dt=Qc([Oe[0]/Oe[3],Oe[1]/Oe[3],Oe[2]/Oe[3]]);Wt.push(St),Zt.push(Dt)}st.push(Wt),it.push(Zt)}return[st,it]}(W,Y,Q,te,ue,pe,me,be,se):function(we,Te,De,xe,ke){const Je=[],ot=[],je=ke[8]*Te,Fe=ke[9]*Te,st=ke[10]*Te,it=ke[11]*Te,Oe=ke[8]*De,ii=ke[9]*De,Wt=ke[10]*De,Zt=ke[11]*De;for(const at of we){const mt=[],Ct=[];for(const It of at){const St=It.x+xe.x,Dt=It.y+xe.y,Ut=ke[0]*St+ke[4]*Dt+ke[12],ui=ke[1]*St+ke[5]*Dt+ke[13],Fi=ke[2]*St+ke[6]*Dt+ke[14],ct=ke[3]*St+ke[7]*Dt+ke[15],$t=Ut+je,bi=ui+Fe,vt=Fi+st,Vt=Math.max(ct+it,1e-5),Ai=Ut+Oe,Rt=ui+ii,Ht=Fi+Wt,hi=Math.max(ct+Zt,1e-5),ai=new Me($t/Vt,bi/Vt);ai.z=vt/Vt,mt.push(ai);const yi=new Me(Ai/hi,Rt/hi);yi.z=Ht/hi,Ct.push(yi)}Je.push(mt),ot.push(Ct)}return[Je,ot]}(W,Y,Q,te,ue)}(c,n,b,x,_,h,E?d:null,w,M,c.center.lat,i.tileID.canonical),j=i.queryGeometry;return function(H,W,Y){let Q=1/0;dp(Y,W)&&(Q=Xp(Y,W[0]));for(let te=0;te<W.length;te++){const ue=W[te],pe=H[te];for(let me=0;me<ue.length-1;me++){const be=ue[me],se=[be,ue[me+1],pe[me+1],pe[me],be];pp(Y,se)&&(Q=Math.min(Q,Xp(Y,se)))}}return Q!==1/0&&Q}(R[0],R[1],j.isPointQuery()?j.screenBounds:j.screenGeometry)}},line:class extends Br{constructor(i){super(i,Hp),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){if(i==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Cs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Yp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new eu(i)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(i){return new io(this,i)}queryRadius(i){const e=i,r=Kp(aa("line-width",this,e),aa("line-gap-width",this,e)),n=aa("line-offset",this,e);return r/2+Math.abs(n)+Oc(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,n,s,c){if(i.queryGeometry.isAboveHorizon)return!1;const h=gp(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),c.angle,i.pixelToTileUnitsFactor),d=i.pixelToTileUnitsFactor/2*Kp(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),m=this.paint.get("line-offset").evaluate(e,r);return m&&(n=function(_,x){const b=[],w=new Me(0,0);for(let E=0;E<_.length;E++){const M=_[E],z=[];for(let R=0;R<M.length;R++){const j=M[R-1],H=M[R],W=M[R+1],Y=R===0?w:H.sub(j)._unit()._perp(),Q=R===M.length-1?w:W.sub(H)._unit()._perp(),te=Y._add(Q)._unit();te._mult(1/(te.x*Q.x+te.y*Q.y)),z.push(te._mult(x)._add(H))}b.push(z)}return b}(n,m*i.pixelToTileUnitsFactor)),function(_,x,b){for(let w=0;w<x.length;w++){const E=x[w];if(_.length>=3){for(let M=0;M<E.length;M++)if(es(_,E[M]))return!0}if(Rf(_,E,b))return!0}return!1}(h,n,d)}isTileClipped(){return!0}},symbol:fu,background:class extends Br{constructor(i){super(i,k_)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends Br{constructor(i){super(i,P_)}getProgramIds(){return["raster"]}},sky:class extends Br{constructor(i){super(i,L_),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="sky-gradient"?this._updateColorRamp():i!=="sky-atmosphere-sun"&&i!=="sky-atmosphere-halo-color"&&i!=="sky-atmosphere-color"&&i!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=rh({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(i){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(i,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),s=!n,c=i.style.light,h=c.properties.get("position");return s&&c.properties.get("anchor")==="viewport"&&Nt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),s?Ah(h.azimuthal,90-h.polar,e):Ah(n[0],90-n[1],e)}const r=this.paint.get("sky-gradient-center");return Ah(r[0],90-r[1],e)}is3D(){return!1}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const i=this.paint.get("sky-type");return i==="atmosphere"?["skyboxCapture","skybox"]:i==="gradient"?["skyboxGradient"]:null}}};class Dl{constructor(e,r,n,s){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(r,s)}update(e,r,n){const{width:s,height:c}=e,{context:h}=this,{gl:d}=h,{HTMLImageElement:m,HTMLCanvasElement:_,HTMLVideoElement:x,ImageData:b,ImageBitmap:w}=Se;if(d.bindTexture(d.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(this.format===d.RGBA&&(!r||r.premultiply!==!1)),n||this.size&&this.size[0]===s&&this.size[1]===c){const{x:E,y:M}=n||{x:0,y:0};e instanceof m||e instanceof _||e instanceof x||e instanceof b||w&&e instanceof w?d.texSubImage2D(d.TEXTURE_2D,0,E,M,d.RGBA,d.UNSIGNED_BYTE,e):d.texSubImage2D(d.TEXTURE_2D,0,E,M,s,c,d.RGBA,d.UNSIGNED_BYTE,e.data)}else this.size=[s,c],e instanceof m||e instanceof _||e instanceof x||e instanceof b||w&&e instanceof w?d.texImage2D(d.TEXTURE_2D,0,this.format,this.format,d.UNSIGNED_BYTE,e):d.texImage2D(d.TEXTURE_2D,0,this.format,s,c,0,this.format,d.UNSIGNED_BYTE,e.data);this.useMipmap=Boolean(r&&r.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&d.generateMipmap(d.TEXTURE_2D)}bind(e,r){const{context:n}=this,{gl:s}=n;s.bindTexture(s.TEXTURE_2D,this.texture),e!==this.filter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,this.useMipmap?e===s.NEAREST?s.NEAREST_MIPMAP_NEAREST:s.LINEAR_MIPMAP_NEAREST:e),this.filter=e),r!==this.wrap&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Ch{constructor(e,r){this.width=e,this.height=r,this.nextRow=0,this.image=new Tn({width:e,height:r}),this.positions={},this.uploaded=!1}getDash(e,r){const n=this.getKey(e,r);return this.positions[n]}trim(){const e=this.width,r=this.height=us(this.nextRow);this.image.resize({width:e,height:r})}getKey(e,r){return e.join(",")+r}getDashRanges(e,r,n){const s=[];let c=e.length%2==1?-e[e.length-1]*n:0,h=e[0]*n,d=!0;s.push({left:c,right:h,isDash:d,zeroLength:e[0]===0});let m=e[0];for(let _=1;_<e.length;_++){d=!d;const x=e[_];c=m*n,m+=x,h=m*n,s.push({left:c,right:h,isDash:d,zeroLength:x===0})}return s}addRoundDash(e,r,n){const s=r/2;for(let c=-n;c<=n;c++){const h=this.width*(this.nextRow+n+c);let d=0,m=e[d];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++d]);const x=Math.abs(_-m.left),b=Math.abs(_-m.right),w=Math.min(x,b);let E;const M=c/n*(s+1);if(m.isDash){const z=s-Math.abs(M);E=Math.sqrt(w*w+z*z)}else E=s-Math.sqrt(w*w+M*M);this.image.data[h+_]=Math.max(0,Math.min(255,E+128))}}}
8addRegularDash(e,r){for(let m=e.length-1;m>=0;--m){const _=e[m],x=e[m+1];_.zeroLength?e.splice(m,1):x&&x.isDash===_.isDash&&(x.left=_.left,e.splice(m,1))}const n=e[0],s=e[e.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const c=this.width*this.nextRow;let h=0,d=e[h];for(let m=0;m<this.width;m++){m/d.right>1&&(d=e[++h]);const _=Math.abs(m-d.left),x=Math.abs(m-d.right),b=Math.min(_,x);this.image.data[c+m]=Math.max(0,Math.min(255,(d.isDash?b:-b)+r+128))}}addDash(e,r){const n=this.getKey(e,r);if(this.positions[n])return this.positions[n];const s=r==="round",c=s?7:0,h=2*c+1;if(this.nextRow+h>this.height)return Nt("LineAtlas out of space"),null;e.length===0&&e.push(1);let d=0;for(let x=0;x<e.length;x++)e[x]<0&&(Nt("Negative value is found in line dasharray, replacing values with 0"),e[x]=0),d+=e[x];if(d!==0){const x=this.width/d,b=this.getDashRanges(e,this.width,x);s?this.addRoundDash(b,x,c):this.addRegularDash(b,r==="square"?.5*x:0)}const m=this.nextRow+c;this.nextRow+=h;const _={tl:[m,c],br:[d,0]};return this.positions[n]=_,_}}Re(Ch,"LineAtlas");class R_{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(){this._channel=void 0,this._callback=()=>{}}}class F_{constructor(){this.tasks={},this.taskQueue=[],Ur(["process"],this),this.invoker=new R_(this.process),this.nextId=0}add(e,r){const n=this.nextId++,s=function({type:c,isSymbolTile:h,zoom:d}){return d=d||0,c==="message"?0:c!=="maybePrepare"||h?c!=="parseTile"||h?c==="parseTile"&&h?300-d:c==="maybePrepare"&&h?400-d:500:200-d:100-d}(r);if(s===0){ki();try{e()}finally{}return{cancel:()=>{}}}return this.tasks[n]={fn:e,metadata:r,priority:s,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){ki();try{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const r=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}finally{}}pick(){let e=null,r=1/0;for(let s=0;s<this.taskQueue.length;s++){const c=this.tasks[this.taskQueue[s]];c.priority<r&&(r=c.priority,e=s)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}class jd{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const O_=["tile","layer","source","sourceLayer","state"];class Nd{constructor(e,r,n,s,c){this.type="Feature",this._vectorTileFeature=e,this._z=r,this._x=n,this._y=s,this.properties=e.properties,this.id=c}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",geometry:this.geometry,properties:this.properties};this.id!==void 0&&(e.id=this.id);for(const r of O_)this[r]!==void 0&&(e[r]=this[r]);return e}}const gr=32,Yr=33,uo=new Uint16Array(8184);for(let i=0;i<2046;i++){let e=i+2,r=0,n=0,s=0,c=0,h=0,d=0;for(1&e?s=c=h=gr:r=n=d=gr;(e>>=1)>1;){const _=r+s>>1,x=n+c>>1;1&e?(s=r,c=n,r=h,n=d):(r=s,n=c,s=h,c=d),h=_,d=x}const m=4*i;uo[m+0]=r,uo[m+1]=n,uo[m+2]=s,uo[m+3]=c}const Kr=new Uint16Array(2178),ho=new Uint8Array(1089),mu=new Uint16Array(1089);function Gd(i){return i===0?-.03125:i===32?.03125:0}var Zd=Ie([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const $d={type:2,extent:qe,loadGeometry:()=>[[new Me(0,0),new Me(8193,0),new Me(8193,8193),new Me(0,8193),new Me(0,0)]]};class zh{constructor(e,r,n,s,c){this.tileID=e,this.uid=Cn(),this.uses=0,this.tileSize=r,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=c,this.expiredRequestCount=0,this.state="loading",s&&s.transform&&(this.projection=s.transform.projection)}registerFadeDuration(e){const r=e+this.timeAdded;r<Ui.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=os(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(e,r,n){if(this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(s,c){const h={};if(!c)return h;for(const d of s){const m=d.layerIds.map(_=>
vendor: 3,308 bytes, line 8
8c.getLayer(_)).filter(Boolean);if(m.length!==0){d.layers=m,d.stateDependentLayerIds&&(d.stateDependentLayers=d.stateDependentLayerIds.map(_=>m.filter(x=>x.id===_)[0]));for(const _ of m)h[_.id]=d}}return h}(e.buckets,r.style),this.hasSymbolBuckets=!1;for(const s in this.buckets){const c=this.buckets[s];if(c instanceof co){if(this.hasSymbolBuckets=!0,!n)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const s in this.buckets){const c=this.buckets[s];if(c instanceof co&&c.hasRTLText){this.hasRTLText=!0,D.isLoading()||D.isLoaded()||P()!=="deferred"||G();break}}this.queryPadding=0;for(const s in this.buckets){const c=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(s).queryRadius(c))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new Uu}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugIndexBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.id]}upload(e){for(const n in this.buckets){const s=this.buckets[n];s.uploadPending()&&s.upload(e)}const r=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Dl(e,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Dl(e,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Dl(e,this.lineAtlas.image,r.ALPHA),this.lineAtlas.uploaded=!0)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,r,n,s,c,h,d,m){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:s,pixelPosMatrix:d,transform:h,params:c,tileTransform:this.tileTransform},e,r,n):{}}querySourceFeatures(e,r){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const s=n.loadVTLayers(),c=r?r.sourceLayer:"",h=s._geojsonTileLayer||s[c];if(!h)return;const d=gn(r&&r.filter),{z:m,x:_,y:x}=this.tileID.canonical,b={z:m,x:_,y:x};for(let w=0;w<h.length;w++){const E=h.feature(w);if(d.needGeometry){const R=Qo(E,!0);if(!d.filter(new F(this.tileID.overscaledZ),R,this.tileID.canonical))continue}
8else if(!d.filter(new F(this.tileID.overscaledZ),E))continue;const M=n.getId(E,c),z=new Nd(E,m,_,x,M);z.tile=b,e.push(z)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const r=this.expirationTime;if(e.cacheControl){const n=vr(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const n=Date.now();let s=!1;if(this.expirationTime>n)s=!1;else if(r)if(this.expirationTime<r)s=!0;else{const c=this.expirationTime-r;c?this.expirationTime=n+Math.max(c,3e4):s=!0}else s=!0;s?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0||!r)return;const n=this.latestFeatureIndex.loadVTLayers(),s=r.style.listImages();for(const c in this.buckets){if(!r.style.hasLayer(c))continue;const h=this.buckets[c],d=h.layers[0].sourceLayer||"_geojsonTileLayer",m=n[d],_=e[d];if(!m||!_||Object.keys(_).length===0)continue;if(h.update(_,m,s,this.imageAtlas&&this.imageAtlas.patternPositions||{}),h instanceof eu||h instanceof Yc){const b=r.style._getSourceCache(h.layers[0].source);r._terrain&&r._terrain.enabled&&b&&h.programConfigurations.needsUpload&&r._terrain._clearRenderCacheForTile(b.id,this.tileID)}const x=r&&r.style&&r.style.getLayer(c);x&&(this.queryPadding=Math.max(this.queryPadding,x.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ui.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ui.now()+e}setTexture(e,r){const n=r.context,s=n.gl;this.texture=r.getTileTexture(e.width),this.texture?this.texture.update(e,{useMipmap:!0}):(this.texture=new Dl(n,e,s.RGBA,{useMipmap:!0}),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),n.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax))}setDependencies(e,r){const n={};for(const s of r)n[s]=!0;this.dependencies[e]=n}hasDependency(e,r){for(const n of e){const s=this.dependencies[n];if(s){for(const c of r)if(s[c])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(e,r){if(!r||r.name==="mercator"||this._tileDebugBuffer)return;const n=wn($d,this.tileID.canonical,this.tileTransform)[0],s=new Ne,c=new dr;for(let h=0;h<n.length;h++){const{x:d,y:m}=n[h];s.emplaceBack(d,m),c.emplaceBack(h)}c.emplaceBack(0),this._tileDebugIndexBuffer=e.createIndexBuffer(c),this._tileDebugBuffer=e.createVertexBuffer(s,Il.members),this._tileDebugSegments=Xt.simpleSegment(0,0,s.length,c.length)}_makeTileBoundsBuffers(e,r){if(this._tileBoundsBuffer||!r||r.name==="mercator")return;const n=wn($d,this.tileID.canonical,this.tileTransform)[0];let s,c;if(this.isRaster){const h=function(d,m){const _=os(d,m),x=Math.pow(2,d.z);for(let R=0;R<Yr;R++)for(let j=0;j<Yr;j++){const H=Ei((d.x+(j+Gd(j))/gr)/x),W=ti((d.y+(R+Gd(R))/gr)/x),Y=m.project(H,W),Q=R*Yr+j;Kr[2*Q+0]=Math.round((Y.x*_.scale-_.x)*qe),Kr[2*Q+1]=Math.round((Y.y*_.scale-_.y)*qe)}ho.fill(0),mu.fill(0);for(let R=2045;R>=0;R--){const j=4*R,H=uo[j+0],W=uo[j+1],Y=uo[j+2],Q=uo[j+3],te=H+Y>>1,ue=W+Q>>1,pe=te+ue-W,me=ue+H-te,be=W*Yr+H,se=Q*Yr+Y,fe=ue*Yr+te,we=Math.hypot((Kr[2*be+0]+Kr[2*se+0])/2-Kr[2*fe+0],(Kr[2*be+1]+Kr[2*se+1])/2-Kr[2*fe+1])>=16;if(ho[fe]=ho[fe]||(we?1:0),R<1022){const Te=(W+me>>1)*Yr+(H+pe>>1),De=(Q+me>>1)*Yr+(Y+pe>>1);ho[fe]=ho[fe]||ho[Te]||ho[De]}}const b=new Ue,w=new ht;let E=0;function M(R,j){const H=j*Yr+R;return mu[H]===0&&(b.emplaceBack(Kr[2*H+0],Kr[2*H+1],R*qe/gr,j*qe/gr),mu[H]=++E),mu[H]-1}function z(R,j,H,W,Y,Q){const te=R+H>>1,ue=j+W>>1;if(Math.abs(R-Y)+Math.abs(j-Q)>1&&ho[ue*Yr+te])z(Y,Q,R,j,te,ue),z(H,W,Y,Q,te,ue);else{const pe=M(R,j),me=M(H,W),be=M(Y,Q);w.emplaceBack(pe,me,be)}}return z(0,0,gr,gr,gr,0),z(gr,gr,0,0,0,gr),{vertices:b,indices:w}}(this.tileID.canonical,r);s=h.vertices,c=h.indices}else{s=new Ue,c=new ht;for(const{x:d,y:m}of n)s.emplaceBack(d,m,0,0);const h=$c(s.int16,void 0,4);for(let d=0;d<h.length;d+=3)c.emplaceBack(h[d],h[d+1],h[d+2])}this._tileBoundsBuffer=e.createVertexBuffer(s,Zd.members),this._tileBoundsIndexBuffer=e.createIndexBuffer(c),this._tileBoundsSegments=Xt.simpleSegment(0,0,s.length,c.length)}_makeGlobeTileDebugBuffers(e,r){if(this._globeTileDebugBorderBuffer||this._globeTileDebugTextBuffer||!r||r.name!=="globe")return;const n=this.tileID.canonical,s=Al(Hr(n));this._makeGlobeTileDebugBorderBuffer(e,n,s),this._makeGlobeTileDebugTextBuffer(e,n,s)}_makeGlobeTileDebugBorderBuffer(e,r,n){const s=new Ne,c=new dr,h=new tt,d=(_,x,b,w,E)=>{const M=(b-_)/(E-1),z=(w-x)/(E-1),R=s.length;for(let j=0;j<E;j++){const H=_+j*M,W=x+j*z;s.emplaceBack(H,W);const Y=Cd(H,W,r),Q=_i(Y,Y,n);h.emplaceBack(Q[0],Q[1],Q[2]),c.emplaceBack(R+j)}},m=qe;d(0,0,m,0,16),d(m,0,m,m,16),d(m,m,0,m,16),d(0,m,0,0,16),this._tileDebugIndexBuffer=e.createIndexBuffer(c),this._tileDebugBuffer=e.createVertexBuffer(s,Il.members),this._globeTileDebugBorderBuffer=e.createVertexBuffer(h,Md.members),this._tileDebugSegments=Xt.simpleSegment(0,0,s.length,c.length)}_makeGlobeTileDebugTextBuffer(e,r,n){const s=new Ne,c=new ht,h=new tt,d=25;c.reserve(32),s.reserve(d),h.reserve(d);const m=(_,x)=>d*_+x;for(let _=0;_<d;_++){const x=2048*_;for(let b=0;b<d;b++){const w=2048*b;s.emplaceBack(w,x);const E=Cd(w,x,r),M=_i(E,E,n);h.emplaceBack(M[0],M[1],M[2])}}for(let _=0;_<4;_++)for(let x=0;x<4;x++){const b=m(_,x),w=m(_,x+1),E=m(_+1,x),M=m(_+1,x+1);c.emplaceBack(b,w,E),c.emplaceBack(E,w,M)}this._tileDebugTextIndexBuffer=e.createIndexBuffer(c),this._tileDebugTextBuffer=e.createVertexBuffer(s,Il.members),this._globeTileDebugTextBuffer=e.createVertexBuffer(h,Md.members),this._tileDebugTextSegments=Xt.simpleSegment(0,0,d,32)}}class U_{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,r,n){const s=String(r);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][s]=this.stateChanges[e][s]||{},oi(this.stateChanges[e][s],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(const c in this.state[e])c!==s&&(this.deletedStates[e][c]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][s]===null){this.deletedStates[e][s]={};for(const c in this.state[e][s])n[c]||(this.deletedStates[e][s][c]=null)}else for(const c in n)this.deletedStates[e]&&this.deletedStates[e][s]&&this.deletedStates[e][s][c]===null&&delete this.deletedStates[e][s][c]}removeFeatureState(e,r,n){if(this.deletedStates[e]===null)return;const s=String(r);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&r!==void 0)this.deletedStates[e][s]!==null&&(this.deletedStates[e][s]=this.deletedStates[e][s]||{},this.deletedStates[e][s][n]=null);else if(r!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][s])for(n in this.deletedStates[e][s]={},this.stateChanges[e][s])this.deletedStates[e][s][n]=null;else this.deletedStates[e][s]=null;else this.deletedStates[e]=null}getState(e,r){const n=String(r),s=oi({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const c=this.deletedStates[e][r];if(c===null)return{};for(const h in c)delete s[h]}return s}initializeTileState(e,r){e.setFeatureState(this.state,r)}coalesceChanges(e,r){const n={};for(const s in this.stateChanges){this.state[s]=this.state[s]||{};const c={};for(const h in this.stateChanges[s])this.state[s][h]||(this.state[s][h]={}),oi(this.state[s][h],this.stateChanges[s][h]),c[h]=this.state[s][h];n[s]=c}for(const s in this.deletedStates){this.state[s]=this.state[s]||{};const c={};if(this.deletedStates[s]===null)for(const h in this.state[s])c[h]={},this.state[s][h]={};else for(const h in this.deletedStates[s]){if(this.deletedStates[s][h]===null)this.state[s][h]={};else for(const d of Object.keys(this.deletedStates[s][h]))delete this.state[s][h][d];c[h]=this.state[s][h]}n[s]=n[s]||{},oi(n[s],c)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(const s in e)e[s].setFeatureState(n,r)}}class qd{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,r){const n=this.toIdx(e,r);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,r){return this.leaves[this.toIdx(e,r)]}toIdx(e,r){return r*this.size+e}}function Xd(i,e,r,n){let s=0,c=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(n[h])<1e-15){if(r[h]<i[h]||r[h]>e[h])return null}else{const d=1/n[h];let m=(i[h]-r[h])*d,_=(e[h]-r[h])*d;if(m>_){const x=m;m=_,_=x}if(m>s&&(s=m),_<c&&(c=_),s>c)return null}return s}function Wd(i,e,r,n,s,c,h,d,m,_,x){const b=n-i,w=s-e,E=c-r,M=h-i,z=d-e,R=m-r,j=x[1]*R-x[2]*z,H=x[2]*M-x[0]
vendor: 6,683 bytes, line 8
8*R,W=x[0]*z-x[1]*M,Y=b*j+w*H+E*W;if(Math.abs(Y)<1e-15)return null;const Q=1/Y,te=_[0]-i,ue=_[1]-e,pe=_[2]-r,me=(te*j+ue*H+pe*W)*Q;if(me<0||me>1)return null;const be=ue*E-pe*w,se=pe*b-te*E,fe=te*w-ue*b,we=(x[0]*be+x[1]*se+x[2]*fe)*Q;return we<0||me+we>1?null:(M*be+z*se+R*fe)*Q}function Hd(i,e,r){return(i-e)/(r-e)}function Yd(i,e,r,n,s,c,h,d,m){const _=1<<r,x=c-n,b=h-s,w=(i+1)/_*x+n,E=(e+0)/_*b+s,M=(e+1)/_*b+s;d[0]=(i+0)/_*x+n,d[1]=E,m[0]=w,m[1]=M}class Kd{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const r=function(c){const h=Math.ceil(Math.log2(c.dim/8)),d=[];let m=Math.ceil(Math.pow(2,h));const _=1/m,x=(E,M,z,R,j)=>{const H=R?1:0,W=(E+1)*z-H,Y=M*z,Q=(M+1)*z-H;j[0]=E*z,j[1]=Y,j[2]=W,j[3]=Q};let b=new qd(m);const w=[];for(let E=0;E<m*m;E++){x(E%m,Math.floor(E/m),_,!1,w);const M=po(w[0],w[1],c),z=po(w[2],w[1],c),R=po(w[2],w[3],c),j=po(w[0],w[3],c);b.minimums.push(Math.min(M,z,R,j)),b.maximums.push(Math.max(M,z,R,j)),b.leaves.push(1)}for(d.push(b),m/=2;m>=1;m/=2){const E=d[d.length-1];b=new qd(m);for(let M=0;M<m*m;M++){x(M%m,Math.floor(M/m),2,!0,w);const z=E.getElevation(w[0],w[1]),R=E.getElevation(w[2],w[1]),j=E.getElevation(w[2],w[3]),H=E.getElevation(w[0],w[3]),W=E.isLeaf(w[0],w[1]),Y=E.isLeaf(w[2],w[1]),Q=E.isLeaf(w[2],w[3]),te=E.isLeaf(w[0],w[3]),ue=Math.min(z.min,R.min,j.min,H.min),pe=Math.max(z.max,R.max,j.max,H.max),me=W&&Y&&Q&&te;b.maximums.push(pe),b.minimums.push(ue),b.leaves.push(pe-ue<=5&&me?1:0)}d.push(b)}return d}(this.dem),n=r.length-1,s=r[n];this._addNode(s.minimums[0],s.maximums[0],s.leaves[0]),this._construct(r,0,0,n,0)}raycastRoot(e,r,n,s,c,h,d=1){return Xd([e,r,-100],[n,s,this.maximums[0]*d],c,h)}raycast(e,r,n,s,c,h,d=1){if(!this.nodeCount)return null;const m=this.raycastRoot(e,r,n,s,c,h,d);if(m==null)return null;const _=[],x=[],b=[],w=[],E=[{idx:0,t:m,nodex:0,nodey:0,depth:0}];for(;E.length>0;){const{idx:M,t:z,nodex:R,nodey:j,depth:H}=E.pop();if(this.leaves[M]){Yd(R,j,H,e,r,n,s,b,w);const Y=1<<H,Q=(R+0)/Y,te=(R+1)/Y,ue=(j+0)/Y,pe=(j+1)/Y,me=po(Q,ue,this.dem)*d,be=po(te,ue,this.dem)*d,se=po(te,pe,this.dem)*d,fe=po(Q,pe,this.dem)*d,we=Wd(b[0],b[1],me,w[0],b[1],be,w[0],w[1],se,c,h),Te=Wd(w[0],w[1],se,b[0],w[1],fe,b[0],b[1],me,c,h),De=Math.min(we!==null?we:Number.MAX_VALUE,Te!==null?Te:Number.MAX_VALUE);if(De!==Number.MAX_VALUE)return De;{const xe=Zc([],c,h,z);if(Jd(me,be,fe,se,Hd(xe[0],b[0],w[0]),Hd(xe[1],b[1],w[1]))>=xe[2])return z}continue}let W=0;for(let Y=0;Y<this._siblingOffset.length;Y++){Yd((R<<1)+this._siblingOffset[Y][0],(j<<1)+this._siblingOffset[Y][1],H+1,e,r,n,s,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[M]+Y]*d;const Q=Xd(b,w,c,h);if(Q!=null){const te=Q;_[Y]=te;let ue=!1;for(let pe=0;pe<W&&!ue;pe++)te>=_[x[pe]]&&(x.splice(pe,0,Y),ue=!0);ue||(x[W]=Y),W++}}for(let Y=0;Y<W;Y++){const Q=x[Y];E.push({idx:this.childOffsets[M]+Q,t:_[Q],nodex:(R<<1)+this._siblingOffset[Q][0],nodey:(j<<1)+this._siblingOffset[Q][1],depth:H+1})}}return null}_addNode(e,r,n){return this.minimums.push(e),this.maximums.push(r),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,r,n,s,c){if(e[s].isLeaf(r,n)===1)return;this.childOffsets[c]||(this.childOffsets[c]=this.nodeCount);const h=s-1,d=e[h];let m=0,_=0;for(let x=0;x<this._siblingOffset.length;x++){const b=2*r+this._siblingOffset[x][0],w=2*n+this._siblingOffset[x][1],E=d.getElevation(b,w),M=d.isLeaf(b,w),z=this._addNode(E.min,E.max,M);M&&(m|=1<<x),_||(_=z)}for(let x=0;x<this._siblingOffset.length;x++)m&1<<x||this._construct(e,2*r+this._siblingOffset[x][0],2*n+this._siblingOffset[x][1],h,_+x)}}function Jd(i,e,r,n,s,c){return dt(dt(i,r,c),dt(e,n,c),s)}function po(i,e,r){const n=r.dim,s=Qe(i*n-.5,0,n-1),c=Qe(e*n-.5,0,n-1),h=Math.floor(s),d=Math.floor(c),m=Math.min(h+1,n-1),_=Math.min(d+1,n-1);return Jd(r.get(h,d),r.get(m,d),r.get(h,_),r.get(m,_),s-h,c-d)}const Qd={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class _u{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,r,n,s=!1,c=!1){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return Nt(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const h=this.dim=r.height-2,d=new Uint32Array(r.data.buffer);if(this.pixels=new Uint8Array(r.data.buffer),this.encoding=n||"mapbox",this.borderReady=s,!s){for(let m=0;m<h;m++)d[this._idx(-1,m)]=d[this._idx(0,m)],d[this._idx(h,m)]=d[this._idx(h-1,m)],d[this._idx(m,-1)]=d[this._idx(m,0)],d[this._idx(m,h)]=d[this._idx(m,h-1)];d[this._idx(-1,-1)]=d[this._idx(0,0)],d[this._idx(h,-1)]=d[this._idx(h-1,0)],d[this._idx(-1,h)]=d[this._idx(0,h-1)],d[this._idx(h,h)]=d[this._idx(h-1,h-1)],c&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new Kd(this)}get(e,r,n=!1){n&&(e=Qe(e,-1,this.dim),r=Qe(r,-1,this.dim));const s=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(this.pixels[s],this.pixels[s+1],this.pixels[s+2])}static getUnpackVector(e){return Qd[e]}get unpackVector(){return Qd[this.encoding]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,n){return(256*e*256+256*r+n)/10-1e4}_unpackTerrarium(e,r,n){return 256*e+r+n/256-32768}static pack(e,r){const n=[0,0,0,0],s=_u.getUnpackVector(r);let c=Math.floor((e+s[3])/s[2]);return n[2]=c%256,c=Math.floor(c/256),n[1]=c%256,c=Math.floor(c/256),n[0]=c,n}getPixels(){return new Wi({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let s=r*this.dim,c=r*this.dim+this.dim,h=n*this.dim,d=n*this.dim+this.dim;switch(r){case-1:s=c-1;break;case 1:c=s+1}switch(n){case-1:h=d-1;break;case 1:d=h+1}const m=-r*this.dim,_=-n*this.dim;for(let x=h;x<d;x++)for(let b=s;b<c;b++){const w=4*this._idx(b,x),E=4*this._idx(b+m,x+_);this.pixels[w+0]=e.pixels[E+0],this.pixels[w+1]=e.pixels[E+1],this.pixels[w+2]=e.pixels[E+2],this.pixels[w+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Re(_u,"DEMData"),Re(Kd,"DemMinMaxQuadTree",{omit:["dem"]});class V_{constructor(e,r){this.max=e,this.onRemove=r,this.reset()}reset(){for(const e in this.data)for(const r of this.data[e])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(e,r,n){const s=e.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const c={value:r,timeout:void 0};if(n!==void 0&&(c.timeout=setTimeout(()=>{this.remove(e,c)}
8,n)),this.data[s].push(c),this.order.push(s),this.order.length>this.max){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const r=this.data[e].shift();return r.timeout&&clearTimeout(r.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),r.value}getByKey(e){const r=this.data[e];return r?r[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,r){if(!this.has(e))return this;const n=e.wrapped().key,s=r===void 0?0:this.data[n].indexOf(r),c=this.data[n][s];return this.data[n].splice(s,1),c.timeout&&clearTimeout(c.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(c.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(e){const r=[];for(const n in this.data)for(const s of this.data[n])e(s.value)||r.push(s);for(const n of r)this.remove(n.value.tileID,n)}}class xa{constructor(e,r,n){this.func=e,this.mask=r,this.range=n}}xa.ReadOnly=!1,xa.ReadWrite=!0,xa.disabled=new xa(519,xa.ReadOnly,[0,1]);const kh=7680;class Ph{constructor(e,r,n,s,c,h){this.test=e,this.ref=r,this.mask=n,this.fail=s,this.depthFail=c,this.pass=h}}Ph.disabled=new Ph({func:519,mask:0},0,0,kh,kh,kh);class Jr{constructor(e,r,n){this.blendFunction=e,this.blendColor=r,this.mask=n}}Jr.Replace=[1,0],Jr.disabled=new Jr(Jr.Replace,Gt.transparent,[!1,!1,!1,!1]),Jr.unblended=new Jr(Jr.Replace,Gt.transparent,[!0,!0,!0,!0]),Jr.alphaBlended=new Jr([1,771],Gt.transparent,[!0,!0,!0,!0]);const Dh=1029,Lh=2305;class Rr{constructor(e,r,n){this.enable=e,this.mode=r,this.frontFace=n}}Rr.disabled=new Rr(!1,Dh,Lh),Rr.backCCW=new Rr(!0,Dh,Lh),Rr.backCW=new Rr(!0,Dh,2304),Rr.frontCW=new Rr(!0,1028,2304),Rr.frontCCW=new Rr(!0,1028,Lh);class ss extends bt{constructor(e,r,n){super(),this.id=e,this._onlySymbols=n,r.on("data",s=>{s.dataType==="source"&&s.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&s.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new V_(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new U_,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(e){this.map=e,this._minTileCacheSize=this._minTileCacheSize===void 0&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const e in this._tiles){const r=this._tiles[e];if(r.state!=="loaded"&&r.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,r){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,r)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,()=>{})}serialize(){return this._source.serialize()}prepare(e){if(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._source.prepareTile)for(const r in this._tiles){const n=this._tiles[r];this._source.prepareTile(n)&&this.map.painter.terrain&&this.map.painter.terrain._clearRenderCacheForTile(this.id,n.tileID),n.upload(e),n.prepare(this.map.style.imageManager)}else for(const r in this._tiles){const n=this._tiles[r];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return An(this._tiles).map(e=>e.tileID).sort(ef).map(e=>e.key)}getRenderableIds(e){const r=[];for(const n in this._tiles)this._isIdRenderable(+n,e)&&r.push(this._tiles[n]);return e?r.sort((n,s)=>{const c=n.tileID,h=s.tileID,d=new Me(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),m=new Me(h.canonical.x,h.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-h.overscaledZ||m.y-d.y||m.x-d.x}).map(n=>n.tileID.key):r.map(n=>n.tileID).sort(ef).map(n=>n.key)}hasRenderableParent(e){const r=this.findLoadedParent(e,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(e,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(r||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(+e,"reloading")}}_reloadTile(e,r){const n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=r),this._loadTile(n,this._tileLoaded.bind(this,n,e,r)))}_tileLoaded(e,r,n,s){if(s)if(e.state="errored",s.status!==404)this._source.fire(new zt(s,{tile:e}));else if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const c=this.map.painter.terrain;this.update(this.transform,c.getScaledDemTileSize(),!0),c.resetTileLookupCache(this.id
8)}else this.update(this.transform);else e.timeAdded=Ui.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,e),this._source.type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new _t("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const r=this.getRenderableIds();for(let s=0;s<r.length;s++){const c=r[s];if(e.neighboringTiles&&e.neighboringTiles[c]){const h=this.getTileByID(c);n(e,h),n(h,e)}}function n(s,c){if(!s.dem||s.dem.borderReady)return;s.needsHillshadePrepare=!0,s.needsDEMTextureUpload=!0;let h=c.tileID.canonical.x-s.tileID.canonical.x;const d=c.tileID.canonical.y-s.tileID.canonical.y,m=Math.pow(2,s.tileID.canonical.z),_=c.tileID.key;h===0&&d===0||Math.abs(d)>1||(Math.abs(h)>1&&(Math.abs(h+m)===1?h+=m:Math.abs(h-m)===1&&(h-=m)),c.dem&&s.dem&&(s.dem.backfillBorder(c.dem,h,d),s.neighboringTiles&&s.neighboringTiles[_]&&(s.neighboringTiles[_].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,r,n,s){for(const c in this._tiles){let h=this._tiles[c];if(s[c]||!h.hasData()||h.tileID.overscaledZ<=r||h.tileID.overscaledZ>n)continue;let d=h.tileID;for(;h&&h.tileID.overscaledZ>r+1;){const _=h.tileID.scaledTo(h.tileID.overscaledZ-1);h=this._tiles[_.key],h&&h.hasData()&&(d=_)}let m=d;for(;m.overscaledZ>r;)if(m=m.scaledTo(m.overscaledZ-1),e[m.key]){s[d.key]=d;break}}}findLoadedParent(e,r){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let n=e.overscaledZ-1;n>=r;n--){const s=e.scaledTo(n),c=this._getLoadedTile(s);if(c)return c}}_getLoadedTile(e){const r=this._tiles[e.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,r){r=r||this._source.tileSize;const n=Math.ceil(e.width/r)+1,s=Math.ceil(e.height/r)+1,c=Math.floor(n*s*5),h=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,c):c,d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,h):h;this._cache.setMaxSize(d)}handleWrapJump(e){const r=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,r){const n={};for(const s in this._tiles){const c=this._tiles[s];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+r),n[c.tileID.key]=c}this._tiles=n;for(const s in this._timers)clearTimeout(this._timers[s]),delete this._timers[s];for(const s in this._tiles)this._setTileReloadTimer(+s,this._tiles[s])}}update(e,r,n){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;let s;this.updateCacheSize(e,r),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(d=>new Mi(d.canonical.z,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y)):(s=e.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(s=s.filter(d=>this._source.hasTile(d)))):s=[];const c=this._updateRetainedTiles(s);if(tf(this._source.type)&&s.length!==0){const d={},m={},_=Object.keys(c);for(const b of _){const w=c[b],E=this._tiles[b];if(!E||E.fadeEndTime&&E.fadeEndTime<=Ui.now())continue;const M=this.findLoadedParent(w,Math.max(w.overscaledZ-ss.maxOverzooming,this._source.minzoom));M&&(this._addTile(M.tileID),d[M.tileID.key]=M.tileID),m[b]=w}const x=s[s.length-1].overscaledZ;for(const b in this._tiles){const w=this._tiles[b];if(c[b]||!w.hasData())continue;let E=w.tileID;for(;E.overscaledZ>x;){E=E.scaledTo(E.overscaledZ-1);const M=this._tiles[E.key];if(M&&M.hasData()&&m[E.key]){c[b]=w.tileID;break}}}for(const b in d)c[b]||(this._coveredTiles[b]=!0,c[b]=d[b])}for(const d in c)this._tiles[d].clearFadeHold();const h=function(d,m){const _=[];for(const x in d)x in m||_.push(x);return _}(this._tiles,c);for(const d of h){const m=this._tiles[d];m.hasSymbolBuckets&&!m.holdingForFade()?m.setHoldDuration(this.map._fadeDuration):m.hasSymbolBuckets&&!m.symbolFadeFinished()||this._removeTile(+d)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const r={};if(e.length===0)return r;const n={},s=e.reduce((_,x)=>
8Math.min(_,x.overscaledZ),1/0),c=e[0].overscaledZ,h=Math.max(c-ss.maxOverzooming,this._source.minzoom),d=Math.max(c+ss.maxUnderzooming,this._source.minzoom),m={};for(const _ of e){const x=this._addTile(_);r[_.key]=_,x.hasData()||s<this._source.maxzoom&&(m[_.key]=_)}this._retainLoadedChildren(m,s,d,r);for(const _ of e){let x=this._tiles[_.key];if(x.hasData())continue;if(_.canonical.z>=this._source.maxzoom){const w=_.children(this._source.maxzoom)[0],E=this.getTile(w);if(E&&E.hasData()){r[w.key]=w;continue}}else{const w=_.children(this._source.maxzoom);if(r[w[0].key]&&r[w[1].key]&&r[w[2].key]&&r[w[3].key])continue}let b=x.wasRequested();for(let w=_.overscaledZ-1;w>=h;--w){const E=_.scaledTo(w);if(n[E.key]||(n[E.key]=!0,x=this.getTile(E),!x&&b&&(x=this._addTile(E)),x&&(r[E.key]=E,b=x.wasRequested(),x.hasData())))break}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const r=[];let n,s=this._tiles[e].tileID;for(;s.overscaledZ>0;){if(s.key in this._loadedParentTiles){n=this._loadedParentTiles[s.key];break}r.push(s.key);const c=s.scaledTo(s.overscaledZ-1);if(n=this._getLoadedTile(c),n)break;s=c}for(const c of r)this._loadedParentTiles[c]=n}}_addTile(e){let r=this._tiles[e.key];if(r)return this._source.prepareTile&&this._source.prepareTile(r),r;r=this._cache.getAndRemove(e),r&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));const n=Boolean(r);if(!n){const s=this.map?this.map.painter:null;r=new zh(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,s,this._isRaster),this._source.prepareTile&&this._source.prepareTile(r)||this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))}return r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new _t("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(e,r){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=r.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}_removeTile(e){const r=this._tiles[e];r&&(r.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),r.uses>0||(r.hasData()&&r.state!=="reloading"?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,r,n){const s=[],c=this.transform;if(!c)return s;const h=c.projection.name==="globe",d=Ko(c.center.lng);for(const m in this._tiles){const _=this._tiles[m];if(n&&_.clearQueryDebugViz(),_.holdingForFade())continue;let x;if(h){const b=_.tileID.canonical;if(b.z===0){const w=[Math.abs(Qe(d,...Ll(b,-1))-d),Math.abs(Qe(d,...Ll(b,1))-d)];x=[0,2*w.indexOf(Math.min(...w))-1]}else{const w=[Math.abs(Qe(d,...Ll(b,-1))-d),Math.abs(Qe(d,...Ll(b,0))-d),Math.abs(Qe(d,...Ll(b,1))-d)];x=[w.indexOf(Math.min(...w))-1]}}else x=[0];for(const b of x){const w=e.containsTile(_,c,r,b);w&&s.push(w)}}return s}getVisibleCoordinates(e){const r=this.getRenderableIds(e).map(n=>this._tiles[n].tileID);for(const n of r)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(tf(this._source.type))for(const e in this._tiles){const r=this._tiles[e];if(r.fadeEndTime!==void 0&&r.fadeEndTime>=Ui.now())return!0}return!1}setFeatureState(e,r,n){this._state.updateState(e=e||"_geojsonTileLayer",r,n)}removeFeatureState(e,r,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",r,n)}getFeatureState(e,r){return this._state.getState(e=e||"_geojsonTileLayer",r)}setDependencies(e,r,n){const s=this._tiles[e];s&&s.setDependencies(r,n)}reloadTilesForDependencies(e,r){for(const n in this._tiles)this._tiles[n].hasDependency(e,r)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(e,r))}_preloadTiles(e,r){const n=new Map,s=Array.isArray(e)?e:[e],c=this.map.painter.terrain,h=this.usedForTerrain&&c?c.getScaledDemTileSize():this._source.tileSize;
vendor: 4,370 bytes, line 8
8for(const d of s){const m=d.coveringTiles({tileSize:h,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const _ of m)n.set(_.key,_);this.usedForTerrain&&d.updateElevation(!1)}Or(Array.from(n.values()),(d,m)=>{const _=new zh(d,this._source.tileSize*d.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(_,x=>{this._source.type==="raster-dem"&&_.dem&&this._backfillDEM(_),m(x,_)})},r)}}function ef(i,e){const r=Math.abs(2*i.wrap)-+(i.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return i.overscaledZ-e.overscaledZ||n-r||e.canonical.y-i.canonical.y||e.canonical.x-i.canonical.x}function tf(i){return i==="raster"||i==="image"||i==="video"}function Ll(i,e){const r=1<<i.z;return[i.x/r+e,(i.x+1)/r+e]}ss.maxOverzooming=10,ss.maxUnderzooming=3;class gu{constructor(e,r,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=r,this._offset=n}static create(e,r,n){const s=n||e.findDEMTileFor(r);if(!s||!s.dem)return;const c=s.dem,h=s.tileID,d=1<<r.canonical.z-h.canonical.z;return new gu(s,s.tileSize/qe/d,[(r.canonical.x/d-h.canonical.x)*c.dim,(r.canonical.y/d-h.canonical.y)*c.dim])}tileCoordToPixel(e,r){const n=r*this._scale+this._offset[1],s=Math.floor(e*this._scale+this._offset[0]),c=Math.floor(n);return new Me(s,c)}getElevationAt(e,r,n,s){const c=e*this._scale+this._offset[0],h=r*this._scale+this._offset[1],d=Math.floor(c),m=Math.floor(h),_=this._dem;return s=!!s,n?dt(dt(_.get(d,m,s),_.get(d,m+1,s),h-m),dt(_.get(d+1,m,s),_.get(d+1,m+1,s),h-m),c-d):_.get(d,m,s)}getElevationAtPixel(e,r,n){return this._dem.get(e,r,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*fr(1,e)*this._dem.stride}}class rf{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Jn(qe,16,0),this.featureIndexArray=new Jh,this.promoteId=r}insert(e,r,n,s,c,h=0){const d=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,s,c,h);const m=this.grid;for(let _=0;_<r.length;_++){const x=r[_],b=[1/0,1/0,-1/0,-1/0];for(let w=0;w<x.length;w++){const E=x[w];b[0]=Math.min(b[0],E.x),b[1]=Math.min(b[1],E.y),b[2]=Math.max(b[2],E.x),b[3]=Math.max(b[3],E.y)}b[0]<qe&&b[1]<qe&&b[2]>=0&&b[3]>=0&&m.insert(d,b[0],b[1],b[2],b[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new rs.VectorTile(new El(this.rawTileData)).layers,this.sourceLayerCoder=new jd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,r,n,s){this.loadVTLayers();const c=e.params||{},h=gn(c.filter),d=e.tileResult,m=e.transform,_=d.bufferedTilespaceBounds,x=this.grid.query(_.min.x,_.min.y,_.max.x,_.max.y,(M,z,R,j)=>_p(d.bufferedTilespaceGeometry,M,z,R,j));x.sort(j_);let b=null;m.elevation&&x.length>0&&(b=gu.create(m.elevation,this.tileID));const w={};let E;for(let M=0;M<x.length;M++){const z=x[M];if(z===E)continue;E=z;const R=this.featureIndexArray.get(z);let j=null;this.loadMatchingFeature(w,R,h,c.layers,c.availableImages,r,n,s,(H,W,Y,Q=0)=>(j||(j=wn(H,this.tileID.canonical,e.tileTransform)),W.queryIntersectsFeature(d,H,Y,j,this.z,e.transform,e.pixelPosMatrix,b,Q)))}return w}loadMatchingFeature(e,r,n,s,c,h,d,m,_){const{featureIndex:x,bucketIndex:b,sourceLayerIndex:w,layoutVertexArrayOffset:E}=r,M=this.bucketLayerIDs[b];if(s&&!function(H,W){for(let Y=0;Y<H.length;Y++)if(W.indexOf(H[Y])>=0)return!0;return!1}(s,M))return;const z=this.sourceLayerCoder.decode(w),R=this.vtLayers[z].feature(x);if(n.needGeometry){const H=Qo(R,!0);if(!n.filter(new F(this.tileID.overscaledZ),H,this.tileID.canonical))return}else if(!n.filter(new F(this.tileID.overscaledZ),R))return;const j=this.getId(R,z);for(let H=0;H<M.length;H++){const W=M[H];if(s&&s.indexOf(W)<0)continue;const Y=h[W];if(!Y)continue;let Q={};j!==void 0&&m&&(Q=m.getState(Y.sourceLayer||"_geojsonTileLayer",j));const te=oi({},d[W]);te.paint=nf(te.paint,Y.paint,R,Q,c),te.layout=nf(te.layout,Y.layout,R,Q,c);const ue=!_||_(R,Y,Q,E);if(!ue)continue;const pe=new Nd(R,this.z,this.x,this.y,j);pe.layer=te;let me=e[W];me===void 0&&(me=e[W]=[]),me.push({featureIndex:x,feature:pe,intersectionZ:ue})}}lookupSymbolFeatures(e,r,n,s,c,h,d,m){const _={};this.loadVTLayers();const x=gn(c);
8for(const b of e)this.loadMatchingFeature(_,{bucketIndex:n,sourceLayerIndex:s,featureIndex:b,layoutVertexArrayOffset:0},x,h,d,m,r);return _}loadFeature(e){const{featureIndex:r,sourceLayerIndex:n}=e;this.loadVTLayers();const s=this.sourceLayerCoder.decode(n),c=this.vtFeatures[s];if(c[r])return c[r];const h=this.vtLayers[s].feature(r);return c[r]=h,h}hasLayer(e){for(const r of this.bucketLayerIDs)for(const n of r)if(e===n)return!0;return!1}getId(e,r){let n=e.id;return this.promoteId&&(n=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof n=="boolean"&&(n=Number(n))),n}}function nf(i,e,r,n,s){return ar(i,(c,h)=>{const d=e instanceof ce?e.get(h):null;return d&&d.evaluate?d.evaluate(r,n,s):d})}function j_(i,e){return e-i}Re(rf,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class of{constructor(e){const r={},n=[];for(const d in e){const m=e[d],_=r[d]={};for(const x in m.glyphs){const b=m.glyphs[+x];if(!b||b.bitmap.width===0||b.bitmap.height===0)continue;const w=b.metrics.localGlyph?2:1,E={x:0,y:0,w:b.bitmap.width+2*w,h:b.bitmap.height+2*w};n.push(E),_[x]=E}}const{w:s,h:c}=ph(n),h=new Tn({width:s||1,height:c||1});for(const d in e){const m=e[d];for(const _ in m.glyphs){const x=m.glyphs[+_];if(!x||x.bitmap.width===0||x.bitmap.height===0)continue;const b=r[d][_],w=x.metrics.localGlyph?2:1;Tn.copy(x.bitmap,h,{x:0,y:0},{x:b.x+w,y:b.y+w},x.bitmap)}}this.image=h,this.positions=r}}Re(of,"GlyphAtlas");class N_{constructor(e){this.tileID=new Mi(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.tileZoom=e.tileZoom,this.uid=e.uid,this.zoom=e.zoom,this.canonical=e.tileID.canonical,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.enableTerrain=!!e.enableTerrain,this.isSymbolTile=e.isSymbolTile,this.tileTransform=os(e.tileID.canonical,e.projection),this.projection=e.projection}parse(e,r,n,s,c){this.status="parsing",this.data=e,this.collisionBoxArray=new Uu;const h=new jd(Object.keys(e.layers).sort()),d=new rf(this.tileID,this.promoteId);d.bucketLayerIDs=[];const m={},_=new Ch(256,256),x={featureIndex:d,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:_,availableImages:n},b=r.familiesBySource[this.source];for(const Q in b){const te=e.layers[Q];if(!te)continue;let ue=!1,pe=!1;for(const se of b[Q])se[0].type==="symbol"?ue=!0:pe=!0;if(this.isSymbolTile===!0&&!ue||this.isSymbolTile===!1&&!pe)continue;te.version===1&&Nt(`Vector tile source "${this.source}" layer "${Q}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const me=h.encode(Q),be=[];for(let se=0;se<te.length;se++){const fe=te.feature(se),we=d.getId(fe,Q);be.push({feature:fe,id:we,index:se,sourceLayerIndex:me})}for(const se of b[Q]){const fe=se[0];this.isSymbolTile!==void 0&&fe.type==="symbol"!==this.isSymbolTile||fe.minzoom&&this.zoom<Math.floor(fe.minzoom)||fe.maxzoom&&this.zoom>=fe.maxzoom||fe.visibility!=="none"&&(Bh(se,this.zoom,n),(m[fe.id]=fe.createBucket({index:d.bucketLayerIDs.length,layers:se,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:me,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:n})).populate(be,x,this.tileID.canonical,this.tileTransform),d.bucketLayerIDs.push(se.map(we=>we.id)))}}let w,E,M,z;_.trim();const R={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},j=ar(x.glyphDependencies,Q=>Object.keys(Q).map(Number));Object.keys(j).length?s.send("getGlyphs",{uid:this.uid,stacks:j},(Q,te)=>{w||(w=Q,E=te,Y.call(this))},void 0,!1,R):E={};const H=Object.keys(x.iconDependencies);H.length?s.send("getImages",{icons:H,source:this.source,tileID:this.tileID,type:"icons"},(Q,te)=>{w||(w=Q,M=te,Y.call(this))},void 0,!1,R):M={};const W=Object.keys(x.patternDependencies);function Y(){if(w)return c(w);if(E&&M&&z){const Q=new of(E),te=new od(M,z);for(const ue in m){const pe=m[ue];pe instanceof co?(Bh(pe.layers,this.zoom,n),u_(pe,E,Q.positions,M,te.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection)):pe.hasPattern&&(pe instanceof eu||pe instanceof Yc||pe instanceof vl)&&(Bh(pe.layers,this.zoom,n),pe.addFeatures(x,this.tileID.canonical,te.patternPositions,n,this.tileTransform))}this.status="done",c(null,{buckets:An(m).filter(ue=>!ue.isEmpty()),featureIndex:d,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Q.image,lineAtlas:_,imageAtlas:te,glyphMap:this.returnDependencies?E:null,iconMap:this.returnDependencies?M:null,glyphPositions:this.returnDependencies?Q.positions:null})}}W.length?s.send("getImages",{icons:W,source:this.source,tileID:this.tileID,type:"patterns"},(Q,te)=>{w||(w=Q,z=te,Y.call(this))},void 0,!1,R):z={},Y.call(this)}}function Bh(i,e,r){const n=new F(e);for(const s of i)s.recalculate(n,r)}class sf{constructor(e){this.entries={}
vendor: 9,399 bytes, line 8
8,this.scheduler=e}request(e,r,n,s){const c=this.entries[e]=this.entries[e]||{callbacks:[]};if(c.result){const[h,d]=c.result;return this.scheduler?this.scheduler.add(()=>{s(h,d)},r):s(h,d),()=>{}}return c.callbacks.push(s),c.cancel||(c.cancel=n((h,d)=>{c.result=[h,d];for(const m of c.callbacks)this.scheduler?this.scheduler.add(()=>{m(h,d)},r):m(h,d);setTimeout(()=>delete this.entries[e],3e3)})),()=>{c.result||(c.callbacks=c.callbacks.filter(h=>h!==s),c.callbacks.length||(c.cancel(),delete this.entries[e]))}}}function af(i,e,r){const n=JSON.stringify(i.request);return i.data&&(this.deduped.entries[n]={result:[null,i.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},s=>{const c=ee(i.request,(h,d,m,_)=>{h?s(h):d&&s(null,{vectorTile:r?void 0:new rs.VectorTile(new El(d)),rawData:d,cacheControl:m,expires:_})});return()=>{c.cancel(),s()}},e)}a.ARRAY_TYPE=qi,a.AUTH_ERR_MSG=Pi,a.Aabb=rr,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.cancelCallbacks={},Ur(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=ki()?i:Se,this.scheduler=new F_}send(i,e,r,n,s=!1,c){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=c,this.callbacks[h]=r);const d=Pn(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:n,mustQueue:s,sourceMapId:this.mapId,data:$o(e,d)},d),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){const n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n.cancel()}else if(e.mustQueue||ki()){const n=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add(()=>this.processTask(r,e),n&&n.metadata||{type:"message"})}else this.processTask(r,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(qo(e.error)):r(null,qo(e.data)))}else{const r=Pn(this.globalScope)?void 0:[],n=e.hasCallback?(c,h)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:c?$o(c):null,data:$o(h,r)},r)}:c=>{},s=qo(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,s,n);else if(this.parent.getWorkerSource){const c=e.type.split(".");this.parent.getWorkerSource(e.sourceMapId,c[0],s.source)[c[1]](s,n)}else n(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.CanonicalTileID=Jc,a.Color=Gt,a.ColorMode=Jr,a.CullFaceMode=Rr,a.DEMData=_u,a.DataConstantProperty=ae,a.DedupedRequest=sf,a.DepthMode=xa,a.EXTENT=qe,a.Elevation=class{isDataAvailableAtPoint(i){const e=this._source();if(!e||i.y<0||i.y>1)return!1;const r=e.getSource().maxzoom,n=1<<r,s=Math.floor(i.x),c=Math.floor((i.x-s)*n),h=Math.floor(i.y*n),d=this.findDEMTileFor(new Mi(r,s,r,c,h));return!(!d||!d.dem)}getAtPointOrZero(i,e=0){return this.getAtPoint(i,e)||0}getAtPoint(i,e,r=!0){e==null&&(e=null);const n=this._source();if(!n||i.y<0||i.y>1)return e;const s=n.getSource().maxzoom,c=1<<s,h=Math.floor(i.x),d=i.x-h,m=new Mi(s,h,s,Math.floor(d*c),Math.floor(i.y*c)),_=this.findDEMTileFor(m);if(!_||!_.dem)return e;const x=_.dem,b=1<<_.tileID.canonical.z,w=(d*b-_.tileID.canonical.x)*x.dim,E=(i.y*b-_.tileID.canonical.y)*x.dim,M=Math.floor(w),z=Math.floor(E);return(r?this.exaggeration():1)*dt(dt(x.get(M,z),x.get(M,z+1),E-z),dt(x.get(M+1,z),x.get(M+1,z+1),E-z),w-M)}getAtTileOffset(i,e,r){const n=1<<i.canonical.z;return this.getAtPointOrZero(new sa(i.wrap+(i.canonical.x+e/qe)/n,(i.canonical.y+r/qe)/n))}getAtTileOffsetFunc(i,e,r,n){return s=>{const c=this.getAtTileOffset(i,s.x,s.y),h=n.upVector(i.canonical,s.x,s.y);return Xr(h,h,c*n.upVectorScale(i.canonical,e,r).metersToTile),h}}getForTilePoints(i,e,r,n){const s=gu.create(this,i,n);return!!s&&(e.forEach(c=>{c[2]=this.exaggeration()*s.getElevationAt(c[0],c[1],r)}),!0)}getMinMaxForTile(i){const e=this.findDEMTileFor(i);if(!e||!e.dem)return null;const r=e.dem.tree,n=e.tileID,s=1<<i.canonical.z-n.canonical.z;let c=i.canonical.x/s-n.canonical.x,h=i.canonical.y/s-n.canonical.y,d=0;for(let m=0;m<i.canonical.z-n.canonical.z&&!r.leaves[d];m++){c*=2,h*=2;const _=2*Math.floor(h)+Math.floor(c);d=r.childOffsets[d]+_,c%=1,h%=1}return{min:this.exaggeration()*r.minimums[d],max:this.exaggeration()*r.maximums[d]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(i,e,r){throw new Error("Pure virtual method called.")}pointCoordinate(i){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(i){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}},a.ErrorEvent=zt,a.EvaluationParameters=F,a.Event=_t,a.Evented=bt,a.FillExtrusionBucket=vl,a.Frustum=th,a.FrustumCorners=eh,a.GLOBE_METERS_TO_ECEF=bh,a.GLOBE_RADIUS=ns,a.GLOBE_SCALE_MATCH_LATITUDE=45,a.GLOBE_ZOOM_THRESHOLD_MAX=6,a.GLOBE_ZOOM_THRESHOLD_MIN=5,a.GlobeSharedBuffers=class{constructor(i){this._createGrid(i),this._createPoles(i)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const i of this._poleSegments)i.destroy();for(const i of this._gridSegments)i.destroy();if(this._wireframeIndexBuffer){this._wireframeIndexBuffer.destroy();for(const i of this._wireframeSegments)i.destroy()}}_createGrid(i){const e=new Ne,r=new ht,n=65;for(let s=0;s<n;s++)for(let c=0;c<n;c++)e.emplaceBack(c,s);this._gridSegments=[];for(let s=0,c=0;s<ga.length;s++){const h=ga[s];for(let m=0;m<h;m++)for(let _=0;_<64;_++){const x=m*n+_;r.emplaceBack(x+1,x,x+n),r.emplaceBack(x+n,x+n+1,x+1)}const d=64*h*2;this._gridSegments.push(Xt.simpleSegment(0,c,(h+1)*n,d)),c+=d}this._gridBuffer=i.createVertexBuffer(e,Il.members),this._gridIndexBuffer=i.createIndexBuffer(r,!0)}_createPoles(i){const e=new ht;for(let s=0;s<=64;s++)e.emplaceBack(0,s+1,s+2);this._poleIndexBuffer=i.createIndexBuffer(e,!0);const r=new Qn,n=new Qn;this._poleSegments=[];for(let s=0,c=0;s<5;s++){const h=1<<s,d=512*h/Math.PI/2,m=360/h;r.emplaceBack(0,-d,0,0,0,.5,0),n.emplaceBack(0,-d,0,0,0,.5,1);for(let _=0;_<=64;_++){const x=_/64,b=dt(0,m,x),[w,E,M]=Ad(g_,y_,b,d);r.emplaceBack(w,E,M,0,0,x,0),n.emplaceBack(w,E,M,0,0,x,1)}this._poleSegments.push(Xt.simpleSegment(c,0,66,64)),c+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(r,Sd,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(n,Sd,!1)}getGridBuffers(i){return[this._gridBuffer,this._gridIndexBuffer,this._gridSegments[i]]}getPoleBuffers(i){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[i]]}getWirefameBuffers(i,e){if(!this._wireframeSegments){const r=new Kt,n=64,s=n+1;this._wireframeSegments=[];for(let c=0,h=0;c<ga.length;c++){const d=ga[c];for(let _=0;_<d;_++)for(let x=0;x<n;x++){const b=_*s+x;r.emplaceBack(b,b+1),r.emplaceBack(b,b+s),r.emplaceBack(b,b+s+1)}const m=d*n*3;this._wireframeSegments.push(Xt.simpleSegment(0,h,(d+1)*s,m)),h+=m}this._wireframeIndexBuffer=i.createIndexBuffer(r)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[e]]}},a.GlyphManager=ma,a.ImagePosition=dh,a.LineAtlas=Ch,a.LngLat=Et,a.LngLatBounds=ro,a.LocalGlyphMode=gh,a.MAX_MERCATOR_LATITUDE=$r,a.MercatorCoordinate=sa,a.ONE_EM=gi,a.OverscaledTileID=Mi,a.Properties=de,a.RGBAImage=Wi,a.Ray=Qu,a.RequestManager=class{constructor(i,e,r){this._transformRequestFn=i,this._customAccessToken=e,this._silenceAuthErrors=!!r,this._createSkuToken()}_createSkuToken(){const i=function(){let e="";for(let r=0;r<10;r++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",xo,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,e){return this._transformRequestFn&&this._transformRequestFn(i,e)||{url:i}}normalizeStyleURL(i,e){if(!cr(i))return i;const r=Di(i);return r.path=`/styles/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||e)}normalizeGlyphsURL(i,e){if(!cr(i))return i;const r=Di(i);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||e)}normalizeSourceURL(i,e,r,n){if(!cr(i))return i;const s=Di(i);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),r&&s.params.push(`language=${r}`),n&&s.params.push(`worldview=${n}`),this._makeAPIURL(s,this._customAccessToken||e)}normalizeSpriteURL(i,e,r,n){const s=Di(i);return cr(i)?(s.path=`/styles/v1${s.path}/sprite${e}${r}`,this._makeAPIURL(s,this._customAccessToken||n)):(s.path+=`${e}${r}`,Mr(s))}normalizeTileURL(i,e,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!cr(i))return i;const n=Di(i);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||r&&n.authority!=="raster"&&r===512?"@2x":""}${Vr.supported?".webp":"$1"}`),n.authority==="raster"?n.path=`/${ut.RASTER_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${ut.TILE_URL_VERSION}${n.path}`);
8const s=this._customAccessToken||function(c){for(const h of c){const d=h.match(/^access_token=(.*)$/);if(d)return d[1]}return null}(n.params)||ut.ACCESS_TOKEN;return ut.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(i,e){const r=Di(i);if(!r.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!r.path.match(/\.[\w]+$/))return i;let n="mapbox://";r.path.match(/^\/raster\/v1\//)?n+=`raster/${r.path.replace(`/${ut.RASTER_URL_PREFIX}/`,"")}`:n+=`tiles/${r.path.replace(`/${ut.TILE_URL_VERSION}/`,"")}`;let s=r.params;return e&&(s=s.filter(c=>!c.match(/^access_token=/))),s.length&&(n+=`?${s.join("&")}`),n}canonicalizeTileset(i,e){const r=!!e&&cr(e),n=[];for(const s of i.tiles||[])ln(s)?n.push(this.canonicalizeTileURL(s,r)):n.push(s);return n}_makeAPIURL(i,e){const r="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",n=Di(ut.API_URL);if(i.protocol=n.protocol,i.authority=n.authority,i.protocol==="http"){const s=i.params.indexOf("secure");s>=0&&i.params.splice(s,1)}if(n.path!=="/"&&(i.path=`${n.path}${i.path}`),!ut.REQUIRE_ACCESS_TOKEN)return Mr(i);if(e=e||ut.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${r}`);if(e[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return i.params=i.params.filter(s=>s.indexOf("access_token")===-1),i.params.push(`access_token=${e||""}`),Mr(i)}},a.ResourceType=$,a.SegmentVector=Xt,a.SourceCache=ss,a.StencilMode=Ph,a.StructArrayLayout1ui2=dr,a.StructArrayLayout2f1f2i16=xt,a.StructArrayLayout2i4=Ne,a.StructArrayLayout2ui4=Kt,a.StructArrayLayout3f12=ci,a.StructArrayLayout3ui6=ht,a.StructArrayLayout4i8=Ue,a.StructArrayLayout5f20=eo,a.Texture=Dl,a.Tile=zh,a.Transitionable=N,a.Uniform1f=Lc,a.Uniform1i=class extends vn{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends vn{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]))}},a.Uniform3f=class extends vn{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]))}},a.Uniform4f=op,a.UniformColor=sp,a.UniformMatrix2f=class extends vn{constructor(i,e){super(i,e),this.current=Mf}set(i){for(let e=0;e<4;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},a.UniformMatrix3f=class extends vn{constructor(i,e){super(i,e),this.current=Sf}set(i){for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},a.UniformMatrix4f=class extends vn{constructor(i,e){super(i,e),this.current=Ef}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}}},a.UnwrappedTileID=qp,a.ValidationError=Be,a.VectorTileWorkerSource=class extends bt{constructor(i,e,r,n,s){super(),this.actor=i,this.layerIndex=e,this.availableImages=r,this.loadVectorData=s||af,this.loading={},this.loaded={},this.deduped=new sf(i.scheduler),this.isSpriteLoaded=n,this.scheduler=i.scheduler}loadTile(i,e){const r=i.uid,n=i&&i.request,s=n&&n.collectResourceTiming,c=this.loading[r]=new N_(i);c.abort=this.loadVectorData(i,(h,d)=>{const m=!this.loading[r];if(delete this.loading[r],m||h||!d)return c.status="done",m||(this.loaded[r]=c),e(h);const _=d.rawData,x={};d.expires&&(x.expires=d.expires),d.cacheControl&&(x.cacheControl=d.cacheControl),c.vectorTile=d.vectorTile||new rs.VectorTile(new El(_));const b=()=>{c.parse(c.vectorTile,this.layerIndex,this.availableImages,this.actor,(w,E)=>{if(w||!E)return e(w);const M={};if(s){const z=nn(n);z.length>0&&(M.resourceTiming=JSON.parse(JSON.stringify(z)))}e(null,oi({rawTileData:_.slice(0)},E,x,M))})};this.isSpriteLoaded?b():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(b,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):b()}),this.loaded=this.loaded||{},this.loaded[r]=c})}reloadTile(i,e){const r=this.loaded,n=i.uid,s=this;if(r&&r[n]){const c=r[n];c.showCollisionBoxes=i.showCollisionBoxes,c.enableTerrain=!!i.enableTerrain,c.projection=i.projection,c.tileTransform=os(i.tileID.canonical,i.projection);const h=(d,m)=>{const _=c.reloadCallback;_&&(delete c.reloadCallback,c.parse(c.vectorTile,s.layerIndex,this.availableImages,s.actor,_)),e(d,m)};c.status==="parsing"?c.reloadCallback=h:c.status==="done"&&(c.vectorTile?c.parse(c.vectorTile,this.layerIndex,this.availableImages,this.actor,h):h())}}abortTile(i,e){const r=i.uid,n=this.loading[r];
vendor: 9,209 bytes, line 8
8n&&(n.abort&&n.abort(),delete this.loading[r]),e()}removeTile(i,e){const r=this.loaded,n=i.uid;r&&r[n]&&delete r[n],e()}},a.WritingMode=nr,a.ZoomHistory=wc,a.add=oo,a.addDynamicAttributes=du,a.adjoint=function(i,e){var r=e[0],n=e[1],s=e[2],c=e[3],h=e[4],d=e[5],m=e[6],_=e[7],x=e[8];return i[0]=h*x-d*_,i[1]=s*_-n*x,i[2]=n*d-s*h,i[3]=d*m-c*x,i[4]=r*x-s*m,i[5]=s*c-r*d,i[6]=c*_-h*m,i[7]=n*m-r*_,i[8]=r*h-n*c,i},a.asyncAll=Or,a.bezier=tn,a.bindAll=Ur,a.boundsAttributes=Zd,a.bufferConvexPolygon=function(i,e){const r=[];for(let n=0;n<i.length;n++){const s=Fr(n-1,-1,i.length-1),c=Fr(n+1,-1,i.length-1),h=i[n],d=i[c],m=i[s].sub(h).unit(),_=d.sub(h).unit(),x=_.angleWithSep(m.x,m.y),b=m.add(_).unit().mult(-1*e/Math.sin(x/2));r.push(h.add(b))}return r},a.cacheEntryPossiblyAdded=function(i){U++,U>gs&&(i.getActor().send("enforceCacheSizeLimit",Bn),U=0)},a.calculateGlobeLabelMatrix=function(i,e){const{x:r,y:n}=i.point,s=kd(r,n,i.worldSize/i._projectionScaler,0,0);return no(s,s,zd(Hr(e)))},a.calculateGlobeMatrix=function(i){const{x:e,y:r}=i.point,{lng:n,lat:s}=i._center;return kd(e,r,i.worldSize,n,s)},a.calculateGlobeMercatorMatrix=function(i){const e=i.worldSize,r=i.point,n=fr(1,i.center.lat)*e,s=i.pixelsPerMeter,c=e/(n/i.pixelsPerMeter),h=Xi(new Float64Array(16));return ts(h,h,[r.x,r.y,0]),qr(h,h,[c,c,s]),Float32Array.from(h)},a.circumferenceAtLatitude=Gu,a.clamp=Qe,a.clearTileCache=function(i){const e=[];for(const r in wi)e.push(Se.caches.delete(r)),delete wi[r];i&&Promise.all(e).catch(i).then(()=>i())},a.clipLine=gd,a.clone=function(i){var e=new qi(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},a.clone$1=Oi,a.collisionCircleLayout=Rm,a.config=ut,a.conjugate=function(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i[3]=e[3],i},a.create=function(){var i=new qi(16);return qi!=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},a.create$1=xp,a.createExpression=fn,a.createLayout=Ie,a.createStyleLayer=function(i){return i.type==="custom"?new D_(i):new B_[i.type](i)},a.cross=Ju,a.degToRad=Ye,a.distance=function(i,e){return Math.hypot(e[0]-i[0],e[1]-i[1],e[2]-i[2])},a.div=function(i,e,r){return i[0]=e[0]/r[0],i[1]=e[1]/r[1],i[2]=e[2]/r[2],i},a.dot=mr,a.ease=In,a.easeCubicInOut=mo,a.emitValidationErrors=xc,a.endsWith=kn,a.enforceCacheSizeLimit=function(i){for(const e in wi)V(e),wi[e].then(r=>{r.keys().then(n=>{for(let s=0;s<n.length-i;s++)r.delete(n[s])})})},a.evaluateSizeForFeature=tu,a.evaluateSizeForZoom=ha,a.evaluateVariableOffset=wd,a.evented=B,a.exactEquals=function(i,e){return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]&&i[3]===e[3]},a.exactEquals$1=function(i,e){return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]},a.exported=Ui,a.exported$1=Vr,a.extend=oi,a.extend$1=Li,a.fillExtrusionHeightLift=Gp,a.filterObject=rn,a.fromMat4=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],i},a.fromQuat=function(i,e){var r=e[0],n=e[1],s=e[2],c=e[3],h=r+r,d=n+n,m=s+s,_=r*h,x=n*h,b=n*d,w=s*h,E=s*d,M=s*m,z=c*h,R=c*d,j=c*m;return i[0]=1-b-M,i[1]=x+j,i[2]=w-R,i[3]=0,i[4]=x-j,i[5]=1-_-M,i[6]=E+z,i[7]=0,i[8]=w+R,i[9]=E-z,i[10]=1-_-b,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},a.fromRotation=function(i,e){var r=Math.sin(e),n=Math.cos(e);return i[0]=n,i[1]=r,i[2]=0,i[3]=-r,i[4]=n,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},a.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},a.furthestTileCorner=function(i){const e=Math.round((i+45+360)%360/90)%4;return en[e]},a.getAABBPointSquareDist=function(i,e,r){let n=0;for(let s=0;s<2;++s){const c=r?r[s]:0;i[s]>c&&(n+=(i[s]-c)*(i[s]-c)),e[s]<c&&(n+=(c-e[s])*(c-e[s]))}return n},a.getAnchorAlignment=_h,a.getAnchorJustification=xh,a.getBounds=function(i){let e=1/0,r=1/0,n=-1/0,s=-1/0;for(const c of i)e=Math.min(e,c.x),r=Math.min(r,c.y),n=Math.max(n,c.x),s=Math.max(s,c.y);return{min:new Me(e,r),max:new Me(n,s)}},a.getColumn=wr,a.getGridMatrix=function(i,e,r){const[n,s]=e,c=.015625;return[0,(s[1]-n[1])*c,1<<i.z,(s[0]-n[0])/ga[r],0,i.y,n[0],n[1],c]},a.getImage=Ze,a.getJSON=function(i,e){return ie(oi(i,{type:"json"}),e)},a.getLatitudinalLod=function(i){const e=80.051129;i=Qe(i,-80.051129,e)/e*90;const r=Math.pow(Math.abs(Math.sin(Ye(i))),3);return Math.round(r*(ga.length-1))},a.getMapSessionAPI=Ta,a.getPerformanceMeasurement=nn,a.getProjection=Ud,a.getRTLTextPluginStatus=P,a.getReferrer=ne,a.getTilePoint=function(i,{x:e,y:r},n=0){return new Me(((e-n)*i.scale-i.x)*qe,(r*i.scale-i.y)*qe)},a.getTileVec3=function(i,e,r=0){return la(((e.x-r)*i.scale-i.x)*qe,(e.y*i.scale-i.y)*qe,cp(e.z,e.y))},a.getVideo=function(i,e){const r=Se.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let n=0;n<i.length;n++){const s=Se.document.createElement("source");Le(i[n])||(r.crossOrigin="Anonymous"),s.src=i[n],r.appendChild(s)}return{cancel:()=>{}}},a.globeCenterToScreenPoint=function(i){const e=[0,0,0],r=Xi(new Float64Array(16));return no(r,i.pixelMatrix,i.globeMatrix),_i(e,e,r),new Me(e[0],e[1])},a.globeECEFOrigin=function(i,e){const r=[0,0,0];return _i(r,r,Al(Hr(e.canonical))),_i(r,r,i),r},a.globeNormalizeECEF=Al,a.globePixelsToTileUnits=function(i,e){return qe/(512*Math.pow(2,i))*lu(Hr(e))},a.globePoleMatrixForTile=function(i,e,r){const n=Xi(new Float64Array(16)),s=1<<i,c=360*(e/s-.5),h=r.point,d=r.worldSize/(r.tileSize*s);return ts(n,n,[h.x,h.y,-r.worldSize/Math.PI/2]),qr(n,n,[d,d,d]),Vc(n,n,Ye(-r._center.lat)),jc(n,n,Ye(-r._center.lng+c)),Float32Array.from(n)},a.globeTileBounds=Hr,a.globeTileLatLngCorners=Th,a.globeTiltAtLngLat=Pd,a.globeToMercatorTransition=Eh,a.globeUseCustomAntiAliasing=function(i,e,r){const n=Eh(r.zoom),s=i.style.map._antialias,c=!!e.extStandardDerivatives,h=e.extStandardDerivativesForceOff||i.terrain&&i.terrain.exaggeration()>0;return n===0&&!s&&!h&&c},a.identity=Xi,a.identity$1=Mp,a.invert=function(i,e){var r=e[0],n=e[1],s=e[2],c=e[3],h=e[4],d=e[5],m=e[6],_=e[7],x=e[8],b=e[9],w=e[10],E=e[11],M=e[12],z=e[13],R=e[14],j=e[15],H=r*d-n*h,W=r*m-s*h,Y=r*_-c*h,Q=n*m-s*d,te=n*_-c*d,ue=s*_-c*m,pe=x*z-b*M,me=x*R-w*M,be=x*j-E*M,se=b*R-w*z,fe=b*j-E*z,we=w*j-E*R,Te=H*we-W*fe+Y*se+Q*be-te*me+ue*pe;return Te?(i[0]=(d*we-m*fe+_*se)*(Te=1/Te),i[1]=(s*fe-n*we-c*se)*Te,i[2]=(z*ue-R*te+j*Q)*Te,i[3]=(w*te-b*ue-E*Q)*Te,i[4]=(m*be-h*we-_*me)*Te,i[5]=(r*we-s*be+c*me)*Te,i[6]=(R*Y-M*ue-j*W)*Te,i[7]=(x*ue-w*Y+E*W)*Te,i[8]=(h*fe-d*be+_*pe)*Te,i[9]=(n*be-r*fe-c*pe)*Te,i[10]=(M*te-z*Y+j*H)*Te,i[11]=(b*Y-x*te-E*H)*Te,i[12]=(d*me-h*se-m*pe)*Te,i[13]=(r*se-n*me+s*pe)*Te,i[14]=(z*W-M*Q-R*H)*Te,i[15]=(x*Q-b*W+w*H)*Te,i):null},a.isLngLatBehindGlobe=function(i,e){return Pd(i,e)>Math.PI/2*1.01},a.isMapAuthenticated=function(i){return jr.has(i)},a.isMapboxURL=cr,a.isSafariWithAntialiasingBug=function(i){const e=i.navigator?i.navigator.userAgent:null;return!!Pn(i)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},a.latFromMercatorY=ti,a.len=Gf,a.length=pl,a.length$1=function(i){return Math.hypot(i[0],i[1],i[2],i[3])},a.loadVectorTile=af,a.makeRequest=ie,a.mapValue=function(i,e,r,n,s){return Qe((i-e)/(r-e)*(s-n)+n,n,s)},a.mercatorXfromLng=Ko,a.mercatorYfromLat=Jo,a.mercatorZfromAltitude=fr,a.mul=jf,a.mul$1=Nf,a.multiply=no,a.multiply$1=function(i,e,r){var n=e[0],s=e[1],c=e[2],h=e[3],d=e[4],m=e[5],_=e[6],x=e[7],b=e[8],w=r[0],E=r[1],M=r[2],z=r[3],R=r[4],j=r[5],H=r[6],W=r[7],Y=r[8];return i[0]=w*n+E*h+M*_,i[1]=w*s+E*d+M*x,i[2]=w*c+E*m+M*b,i[3]=z*n+R*h+j*_,i[4]=z*s+R*d+j*x,i[5]=z*c+R*m+j*b,i[6]=H*n+W*h+Y*_,i[7]=H*s+W*d+Y*x,i[8]=H*c+W*m+Y*b,i},a.multiply$2=wp,a.nextPowerOfTwo=us,a.normalize=Si,a.normalize$1=function(i,e){var r=e[0],n=e[1],s=e[2],c=e[3],h=r*r+n*n+s*s+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=r*h,i[1]=n*h,i[2]=s*h,i[3]=c*h,i},a.number=dt,a.ortho=function(i,e,r,n,s,c,h){var d=1/(e-r),m=1/(n-s),_=1/(c-h);return i[0]=-2*d,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*m,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*_,i[11]=0,i[12]=(e+r)*d,i[13]=(s+n)*m,i[14]=(h+c)*_,i[15]=1,i},a.pbf=El,a.perspective=function(i,e,r,n,s){var c,h=1/Math.tan(e/2);return i[0]=h/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,s!=null&&s!==1/0?(i[10]=(s+n)*(c=1/(n-s)),i[14]=2*s*n*c):(i[10]=-1,i[14]=-2*n),i},a.pick=function(i,e){const r={};for(let n=0;n<e.length;n++){const s=e[n];s in i&&(r[s]=i[s])}return r},a.plugin=D,a.pointGeometry=Me,a.polygonContainsPoint=es,a.polygonIntersectsBox=_p,a.polygonIntersectsPolygon=pp,a.polygonizeBounds=function(i,e,r=0,n=!0){const s=new Me(r,r),c=i.sub(s),h=e.add(s),d=[c,new Me(h.x,c.y),h,new Me(c.x,h.y)];return n&&d.push(c.clone()),d},a.posAttributes=Il,a.postMapLoadEvent=ms,a.postTurnstileEvent=wo,a.potpack=ph,a.prevPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log(i)/Math.LN2))},a.radToDeg=ni,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.registerForPluginStateChange=function(i){return i({pluginStatus:S,pluginURL:A}
8),B.on("pluginStateChange",i),i},a.removeAuthState=function(i){jr.delete(i)},a.renderColorRamp=rh,a.resample=up,a.rotateX=Vc,a.rotateX$1=Ip,a.rotateY=jc,a.rotateY$1=Ap,a.rotateZ=function(i,e,r){var n=Math.sin(r),s=Math.cos(r),c=e[0],h=e[1],d=e[2],m=e[3],_=e[4],x=e[5],b=e[6],w=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=c*s+_*n,i[1]=h*s+x*n,i[2]=d*s+b*n,i[3]=m*s+w*n,i[4]=_*s-c*n,i[5]=x*s-h*n,i[6]=b*s-d*n,i[7]=w*s-m*n,i},a.rotateZ$1=function(i,e,r){r*=.5;var n=e[0],s=e[1],c=e[2],h=e[3],d=Math.sin(r),m=Math.cos(r);return i[0]=n*m+s*d,i[1]=s*m-n*d,i[2]=c*m+h*d,i[3]=h*m-c*d,i},a.scale=qr,a.scale$1=Ep,a.scale$2=Xr,a.scaleAndAdd=Zc,a.setCacheLimits=function(i,e){Bn=i,gs=e},a.setColumn=function(i,e,r){i[4*e+0]=r[0],i[4*e+1]=r[1],i[4*e+2]=r[2],i[4*e+3]=r[3]},a.setRTLTextPlugin=function(i,e,r=!1){if(S===g||S===y||S===v)throw new Error("setRTLTextPlugin cannot be called multiple times.");A=Ui.resolveURL(i),S=g,T=e,L(),r||G()},a.smoothstep=sr,a.spec=re,a.storeAuthState=function(i,e){e?jr.add(i):jr.delete(i)},a.sub=_r,a.subtract=Ku,a.symbolSize=Fm,a.tileAABB=function(i,e,r,n,s,c,h,d,m){if(m.name==="globe")return __(i,e,new Jc(r,n,s));const _=os({z:r,x:n,y:s},m);return new rr([(c+_.x/_.scale)*e,e*(_.y/_.scale),h],[(c+_.x2/_.scale)*e,e*(_.y2/_.scale),d])},a.tileTransform=os,a.transformMat3=function(i,e,r){var n=e[0],s=e[1],c=e[2];return i[0]=n*r[0]+s*r[3]+c*r[6],i[1]=n*r[1]+s*r[4]+c*r[7],i[2]=n*r[2]+s*r[5]+c*r[8],i},a.transformMat4=_i,a.transformMat4$1=is,a.transformQuat=Tp,a.translate=ts,a.transpose=function(i,e){if(i===e){var r=e[1],n=e[2],s=e[5];i[1]=e[3],i[2]=e[6],i[3]=r,i[5]=e[7],i[6]=n,i[7]=s}else i[0]=e[0],i[1]=e[3],i[2]=e[6],i[3]=e[1],i[4]=e[4],i[5]=e[7],i[6]=e[2],i[7]=e[5],i[8]=e[8];return i},a.triggerPluginCompletionEvent=k,a.uniqueId=Cn,a.updateGlobeVertexNormal=function(i,e,r,n,s){const c=5*e+2;i.float32[c+0]=r,i.float32[c+1]=n,i.float32[c+2]=s},a.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},a.validateFilter=i=>tr(Ka(i)),a.validateFog=i=>tr(mc(i)),a.validateLayer=i=>tr(dc(i)),a.validateLight=i=>tr(Ja(i)),a.validateSource=i=>tr(fc(i)),a.validateStyle=gc,a.validateTerrain=i=>tr(Qa(i)),a.values=An,a.vectorTile=rs,a.version=on,a.warnOnce=Nt,a.window=Se,a.wrap=Fr}),zi(["./shared"],function(a){function Se(V){if(typeof V=="number"||typeof V=="boolean"||typeof V=="string"||V==null)return JSON.stringify(V);if(Array.isArray(V)){let C="[";for(const U of V)C+=`${Se(U)},`;return`${C}]`}let I="{";for(const C of Object.keys(V).sort())I+=`${C}:${Se(V[C])},`;return`${I}}`}function or(V){let I="";for(const C of a.refProperties)I+=`/${Se(V[C])}`;return I}class di{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,C){for(const $ of I)this._layerConfigs[$.id]=$,(this._layers[$.id]=a.createStyleLayer($)).compileFilter(),this.keyCache[$.id]&&delete this.keyCache[$.id];for(const $ of C)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const U=function($,J){const ne={};for(let ee=0;ee<$.length;ee++){const oe=J&&J[$[ee].id]||or($[ee]);J&&(J[$[ee].id]=oe);let ye=ne[oe];ye||(ye=ne[oe]=[]),ye.push($[ee])}const ie=[];for(const ee in ne)ie.push(ne[ee]);return ie}(a.values(this._layerConfigs),this.keyCache);for(const $ of U){const J=$.map(Le=>this._layers[Le.id]),ne=J[0];if(ne.visibility==="none")continue;const ie=ne.source||"";let ee=this.familiesBySource[ie];ee||(ee=this.familiesBySource[ie]={});const oe=ne.sourceLayer||"_geojsonTileLayer";let ye=ee[oe];ye||(ye=ee[oe]=[]),ye.push(J)}}}class Me{loadTile(I,C){const{uid:U,encoding:$,rawImageData:J,padding:ne,buildQuadTree:ie}=I,ee=a.window.ImageBitmap&&J instanceof a.window.ImageBitmap?this.getImageData(J,ne):J;C(null,new a.DEMData(U,ee,$,ne<1,ie))}getImageData(I,C){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);const U=this.offscreenCanvasContext.getImageData(-C,-C,I.width+2*C,I.height+2*C);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),U}}var Xe=function V(I,C){var U,$=I&&I.type;if($==="FeatureCollection")for(U=0;U<I.features.length;U++)V(I.features[U],C);else if($==="GeometryCollection")for(U=0;U<I.geometries.length;U++)V(I.geometries[U],C);else if($==="Feature")V(I.geometry,C);else if($==="Polygon")kt(I.coordinates,C);else if($==="MultiPolygon")for(U=0;U<I.coordinates.length;U++)kt(I.coordinates[U],C);return I};function kt(V,I){if(V.length!==0){Lt(V[0],I);for(var C=1;C<V.length;C++)Lt(V[C],!I)}}function Lt(V,I){for(var C=0,U=0,$=0,J=V.length,ne=J-1;$<J;ne=$++){var ie=(V[$][0]-V[ne][0])*(V[ne][1]+V[$][1]),ee=C+ie;U+=Math.abs(C)>=Math.abs(ie)?C-ee+ie:ie-ee+C,C=ee}C+U>=0!=!!I&&V.reverse()}const Ye=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;
8class ni{constructor(I){this._feature=I,this.extent=a.EXTENT,this.type=I.type,this.properties=I.tags,"id"in I&&!isNaN(I.id)&&(this.id=parseInt(I.id,10))}loadGeometry(){if(this._feature.type===1){const I=[];for(const C of this._feature.geometry)I.push([new a.pointGeometry(C[0],C[1])]);return I}{const I=[];for(const C of this._feature.geometry){const U=[];for(const $ of C)U.push(new a.pointGeometry($[0],$[1]));I.push(U)}return I}}toGeoJSON(I,C,U){return Ye.call(this,I,C,U)}}class en{constructor(I){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=I.length,this._features=I}feature(I){return new ni(this._features[I])}}var mo=a.vectorTile.VectorTileFeature,tn=In;function In(V,I){this.options=I||{},this.features=V,this.length=V.length}function Qe(V,I){this.id=typeof V.id=="number"?V.id:void 0,this.type=V.type,this.rawGeometry=V.type===1?[V.geometry]:V.geometry,this.properties=V.tags,this.extent=I||4096}In.prototype.feature=function(V){return new Qe(this.features[V],this.options.extent)},Qe.prototype.loadGeometry=function(){var V=this.rawGeometry;this.geometry=[];for(var I=0;I<V.length;I++){for(var C=V[I],U=[],$=0;$<C.length;$++)U.push(new a.pointGeometry(C[$][0],C[$][1]));this.geometry.push(U)}return this.geometry},Qe.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var V=this.geometry,I=1/0,C=-1/0,U=1/0,$=-1/0,J=0;J<V.length;J++)for(var ne=V[J],ie=0;ie<ne.length;ie++){var ee=ne[ie];I=Math.min(I,ee.x),C=Math.max(C,ee.x),U=Math.min(U,ee.y),$=Math.max($,ee.y)}return[I,U,C,$]},Qe.prototype.toGeoJSON=mo.prototype.toGeoJSON;var sr=Or,Fr=tn;function Or(V){var I=new a.pbf;return function(C,U){for(var $ in C.layers)U.writeMessage(3,An,C.layers[$])}(V,I),I.finish()}function An(V,I){var C;I.writeVarintField(15,V.version||1),I.writeStringField(1,V.name||""),I.writeVarintField(5,V.extent||4096);var U={keys:[],values:[],keycache:{},valuecache:{}};for(C=0;C<V.length;C++)U.feature=V.feature(C),I.writeMessage(2,oi,U);var $=U.keys;for(C=0;C<$.length;C++)I.writeStringField(3,$[C]);var J=U.values;for(C=0;C<J.length;C++)I.writeMessage(4,hs,J[C])}function oi(V,I){var C=V.feature;C.id!==void 0&&I.writeVarintField(1,C.id),I.writeMessage(2,wa,V),I.writeVarintField(3,C.type),I.writeMessage(4,us,C)}function wa(V,I){var C=V.feature,U=V.keys,$=V.values,J=V.keycache,ne=V.valuecache;for(var ie in C.properties){var ee=C.properties[ie],oe=J[ie];if(ee!==null){oe===void 0&&(U.push(ie),J[ie]=oe=U.length-1),I.writeVarint(oe);var ye=typeof ee;ye!=="string"&&ye!=="boolean"&&ye!=="number"&&(ee=JSON.stringify(ee));var Le=ye+":"+ee,ve=ne[Le];ve===void 0&&($.push(ee),ne[Le]=ve=$.length-1),I.writeVarint(ve)}}}function Cn(V,I){return(I<<3)+(7&V)}function zn(V){return V<<1^V>>31}function us(V,I){for(var C=V.loadGeometry(),U=V.type,$=0,J=0,ne=C.length,ie=0;ie<ne;ie++){var ee=C[ie],oe=1;U===1&&(oe=ee.length),I.writeVarint(Cn(1,oe));for(var ye=U===3?ee.length-1:ee.length,Le=0;Le<ye;Le++){Le===1&&U!==1&&I.writeVarint(Cn(2,ye-1));var ve=ee[Le].x-$,Ge=ee[Le].y-J;I.writeVarint(zn(ve)),I.writeVarint(zn(Ge)),$+=ve,J+=Ge}U===3&&I.writeVarint(Cn(7,1))}}function hs(V,I){var C=typeof V;C==="string"?I.writeStringField(1,V):C==="boolean"?I.writeBooleanField(7,V):C==="number"&&(V%1!=0?I.writeDoubleField(3,V):V<0?I.writeSVarintField(6,V):I.writeVarintField(5,V))}function Ur(V,I,C,U,$,J){if($-U<=C)return;const ne=U+$>>1;kn(V,I,ne,U,$,J%2),Ur(V,I,C,U,ne-1,J+1),Ur(V,I,C,ne+1,$,J+1)}function kn(V,I,C,U,$,J){for(;$>U;){if($-U>600){const oe=$-U+1,ye=C-U+1,Le=Math.log(oe),ve=.5*Math.exp(2*Le/3),Ge=.5*Math.sqrt(Le*ve*(oe-ve)/oe)*(ye-oe/2<0?-1:1);kn(V,I,C,Math.max(U,Math.floor(C-ye*ve/oe+Ge)),Math.min($,Math.floor(C+(oe-ye)*ve/oe+Ge)),J)}const ne=I[2*C+J];let ie=U,ee=$;for(ar(V,I,U,C),I[2*$+J]>ne&&ar(V,I,U,$);ie<ee;){for(ar(V,I,ie,ee),ie++,ee--;I[2*ie+J]<ne;)ie++;for(;I[2*ee+J]>ne;)ee--}I[2*U+J]===ne?ar(V,I,U,ee):(ee++,ar(V,I,ee,$)),ee<=C&&(U=ee+1),C<=ee&&($=ee-1)}}function ar(V,I,C,U){rn(V,C,U),rn(I,2*C,2*U),rn(I,2*C+1,2*U+1)}function rn(V,I,C){const U=V[I];V[I]=V[C],V[C]=U}function Oi(V,I,C,U){const $=V-C,J=I-U;return $*$+J*J}sr.fromVectorTileJs=Or,sr.fromGeojsonVt=function(V,I){I=I||{};var C={};for(var U in V)C[U]=new tn(V[U].features,I),C[U].name=U,C[U].version=I.version,C[U].extent=I.extent;return Or({layers:C})},sr.GeoJSONWrapper=Fr;const _o=V=>V[0],Nt=V=>V[1];class fi{constructor(I,C=_o,U=Nt,$=64,J=Float64Array){this.nodeSize=$,this.points=I;const ne=I.length<65536?Uint16Array:Uint32Array,ie=this.ids=new ne(I.length),ee=this.coords=new J(2*I.length);for(let oe=0;oe<I.length;oe++)ie[oe]=oe,ee[2*oe]=C(I[oe]),ee[2*oe+1]=U(I[oe]);Ur(ie,ee,$,0,ie.length-1,0)}range(I,C,U,$){return function(J,ne,ie,ee,oe,ye,Le){const ve=[0,J.length-1,0],Ge=[];let $e,Ze;for(;ve.length;){const We=ve.pop(),rt=ve.pop(),_t=ve.pop();if(rt-_t<=Le){for(let re=_t;re<=rt;re++)$e=ne[2*re],Ze=ne[2*re+1],$e>=ie&&$e<=oe&&Ze>=ee&&Ze<=ye&&Ge.push(J[re]);continue}const zt=Math.floor((_t+rt)/2);$e=ne[2*zt],Ze=ne[2*zt+1],$e>=ie&&$e<=oe&&Ze>=ee&&Ze<=ye&&Ge.push(J[zt]);const bt=(We+1)%2;
8(We===0?ie<=$e:ee<=Ze)&&(ve.push(_t),ve.push(zt-1),ve.push(bt)),(We===0?oe>=$e:ye>=Ze)&&(ve.push(zt+1),ve.push(rt),ve.push(bt))}return Ge}(this.ids,this.coords,I,C,U,$,this.nodeSize)}within(I,C,U){return function($,J,ne,ie,ee,oe){const ye=[0,$.length-1,0],Le=[],ve=ee*ee;for(;ye.length;){const Ge=ye.pop(),$e=ye.pop(),Ze=ye.pop();if($e-Ze<=oe){for(let bt=Ze;bt<=$e;bt++)Oi(J[2*bt],J[2*bt+1],ne,ie)<=ve&&Le.push($[bt]);continue}const We=Math.floor((Ze+$e)/2),rt=J[2*We],_t=J[2*We+1];Oi(rt,_t,ne,ie)<=ve&&Le.push($[We]);const zt=(Ge+1)%2;(Ge===0?ne-ee<=rt:ie-ee<=_t)&&(ye.push(Ze),ye.push(We-1),ye.push(zt)),(Ge===0?ne+ee>=rt:ie+ee>=_t)&&(ye.push(We+1),ye.push($e),ye.push(zt))}return Le}(this.ids,this.coords,I,C,U,this.nodeSize)}}const xr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:V=>V},ki=Math.fround||(vr=new Float32Array(1),V=>(vr[0]=+V,vr[0]));var vr;class br{constructor(I){this.options=Tr(Object.create(xr),I),this.trees=new Array(this.options.maxZoom+1)}load(I){const{log:C,minZoom:U,maxZoom:$,nodeSize:J}=this.options;C&&console.time("total time");const ne=`prepare ${I.length} points`;C&&console.time(ne),this.points=I;let ie=[];for(let ee=0;ee<I.length;ee++)I[ee].geometry&&ie.push(go(I[ee],ee));this.trees[$+1]=new fi(ie,sn,lr,J,Float32Array),C&&console.timeEnd(ne);for(let ee=$;ee>=U;ee--){const oe=+Date.now();ie=this._cluster(ie,ee),this.trees[ee]=new fi(ie,sn,lr,J,Float32Array),C&&console.log("z%d: %d clusters in %dms",ee,ie.length,+Date.now()-oe)}return C&&console.timeEnd("total time"),this}getClusters(I,C){let U=((I[0]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,I[1]));let J=I[2]===180?180:((I[2]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)U=-180,J=180;else if(U>
vendor: 5,236 bytes, line 8
8J){const ye=this.getClusters([U,$,180,ne],C),Le=this.getClusters([-180,$,J,ne],C);return ye.concat(Le)}const ie=this.trees[this._limitZoom(C)],ee=ie.range(nn(U),on(ne),nn(J),on($)),oe=[];for(const ye of ee){const Le=ie.points[ye];oe.push(Le.numPoints?wr(Le):this.points[Le.index])}return oe}getChildren(I){const C=this._getOriginId(I),U=this._getOriginZoom(I),$="No cluster with the specified id.",J=this.trees[U];if(!J)throw new Error($);const ne=J.points[C];if(!ne)throw new Error($);const ie=this.options.radius/(this.options.extent*Math.pow(2,U-1)),ee=J.within(ne.x,ne.y,ie),oe=[];for(const ye of ee){const Le=J.points[ye];Le.parentId===I&&oe.push(Le.numPoints?wr(Le):this.points[Le.index])}if(oe.length===0)throw new Error($);return oe}getLeaves(I,C,U){const $=[];return this._appendLeaves($,I,C=C||10,U=U||0,0),$}getTile(I,C,U){const $=this.trees[this._limitZoom(I)],J=Math.pow(2,I),{extent:ne,radius:ie}=this.options,ee=ie/ne,oe=(U-ee)/J,ye=(U+1+ee)/J,Le={features:[]};return this._addTileFeatures($.range((C-ee)/J,oe,(C+1+ee)/J,ye),$.points,C,U,J,Le),C===0&&this._addTileFeatures($.range(1-ee/J,oe,1,ye),$.points,J,U,J,Le),C===J-1&&this._addTileFeatures($.range(0,oe,ee/J,ye),$.points,-1,U,J,Le),Le.features.length?Le:null}getClusterExpansionZoom(I){let C=this._getOriginZoom(I)-1;for(;C<=this.options.maxZoom;){const U=this.getChildren(I);if(C++,U.length!==1)break;I=U[0].properties.cluster_id}return C}_appendLeaves(I,C,U,$,J){const ne=this.getChildren(C);for(const ie of ne){const ee=ie.properties;if(ee&&ee.cluster?J+ee.point_count<=$?J+=ee.point_count:J=this._appendLeaves(I,ee.cluster_id,U,$,J):J<$?J++:I.push(ie),I.length===U)break}return J}_addTileFeatures(I,C,U,$,J,ne){for(const ie of I){const ee=C[ie],oe=ee.numPoints;let ye,Le,ve;if(oe)ye=ps(ee),Le=ee.x,ve=ee.y;else{const Ze=this.points[ee.index];ye=Ze.properties,Le=nn(Ze.geometry.coordinates[0]),ve=on(Ze.geometry.coordinates[1])}const Ge={type:1,geometry:[[Math.round(this.options.extent*(Le*J-U)),Math.round(this.options.extent*(ve*J-$))]],tags:ye};let $e;oe?$e=ee.id:this.options.generateId?$e=ee.index:this.points[ee.index].id&&($e=this.points[ee.index].id),$e!==void 0&&(Ge.id=$e),ne.features.push(Ge)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(+I,this.options.maxZoom+1))}_cluster(I,C){const U=[],{radius:$,extent:J,reduce:ne,minPoints:ie}=this.options,ee=$/(J*Math.pow(2,C));for(let oe=0;oe<I.length;oe++){const ye=I[oe];if(ye.zoom<=C)continue;ye.zoom=C;const Le=this.trees[C+1],ve=Le.within(ye.x,ye.y,ee),Ge=ye.numPoints||1;let $e=Ge;for(const Ze of ve){const We=Le.points[Ze];We.zoom>C&&($e+=We.numPoints||1)}if($e>Ge&&$e>=ie){let Ze=ye.x*Ge,We=ye.y*Ge,rt=ne&&Ge>1?this._map(ye,!0):null;const _t=(oe<<5)+(C+1)+this.points.length;for(const zt of ve){const bt=Le.points[zt];if(bt.zoom<=C)continue;bt.zoom=C;const re=bt.numPoints||1;Ze+=bt.x*re,We+=bt.y*re,bt.parentId=_t,ne&&(rt||(rt=this._map(ye,!0)),ne(rt,this._map(bt)))}ye.parentId=_t,U.push(Pn(Ze/$e,We/$e,_t,$e,rt))}else if(U.push(ye),$e>1)for(const Ze of ve){const We=Le.points[Ze];We.zoom<=C||(We.zoom=C,U.push(We))}}return U}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,C){if(I.numPoints)return C?Tr({},I.properties):I.properties;const U=this.points[I.index].properties,$=this.options.map(U);return C&&$===U?Tr({},$):$}}function Pn(V,I,C,U,$){return{x:ki(V),y:ki(I),zoom:1/0,id:C,parentId:-1,numPoints:U,properties:$}}function go(V,I){const[C,U]=V.geometry.coordinates;return{x:ki(nn(C)),y:ki(on(U)),zoom:1/0,index:I,parentId:-1}}function wr(V){return{type:"Feature",id:V.id,properties:ps(V),geometry:{type:"Point",coordinates:[(I=V.x,360*(I-.5)),pt(V.y)]}};var I}function ps(V){const I=V.numPoints,C=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?Math.round(I/100)/10+"k":I;return Tr(Tr({},V.properties),{cluster:!0,cluster_id:V.id,point_count:I,point_count_abbreviated:C})}function nn(V){return V/360+.5}function on(V){const I=Math.sin(V*Math.PI/180),C=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return C<0?0:C>1?1:C}function pt(V){const I=(180-360*V)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Tr(V,I){for(const C in I)V[C]=I[C];return V}function sn(V){return V.x}function lr(V){return V.y}function Ui(V,I,C,U){for(var $,J=U,ne=C-I>>1,ie=C-I,ee=V[I],oe=V[I+1],ye=V[C],Le=V[C+1],ve=I+3;ve<C;ve+=3){var Ge=Dn(V[ve],V[ve+1],ee,oe,ye,Le);if(Ge>J)$=ve,J=Ge;else if(Ge===J){var $e=Math.abs(ve-ne);$e<ie&&($=ve,ie=$e)}}J>U&&($-I>3&&Ui(V,I,$,U),V[$+2]=J,C-$>3&&Ui(V,$,C,U))}function Dn(V,I,C,U,$,J){var ne=$-C,ie=J-U;if(ne!==0||ie!==0){var ee=((V-C)*ne+(I-U)*ie)/(ne*ne+ie*ie);ee>1?(C=$,U=J):ee>0&&(C+=ne*ee,U+=ie*ee)}return(ne=V-C)*ne+(ie=I-U)*ie}function ut(V,I,C,U){var $={id:V===void 0?null:V,type:I,geometry:C,tags:U,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(J){var ne=J.geometry,ie=J.type;if(ie==="Point"||ie==="MultiPoint"||ie==="LineString")Vr(J,ne);else if(ie==="Polygon"||ie==="MultiLineString")for(var ee=0;ee<ne.length;ee++)Vr(J,ne[ee]);else if(ie==="MultiPolygon")for(ee=0;ee<ne.length;ee++)for(var oe=0;oe<ne[ee].length;oe++)Vr(J,ne[ee][oe])}($),$}function Vr(V,I){for(var C=0;C<I.length;C+=3)V.minX=Math.min(V.minX,I[C]),V.minY=Math.min(V.minY,I[C+1]),V.maxX=Math.max(V.maxX,I[C]),V.maxY=M
vendor: 10,140 bytes, line 8
8ath.max(V.maxY,I[C+1])}function Er(V,I,C,U){if(I.geometry){var $=I.geometry.coordinates,J=I.geometry.type,ne=Math.pow(C.tolerance/((1<<C.maxZoom)*C.extent),2),ie=[],ee=I.id;if(C.promoteId?ee=I.properties[C.promoteId]:C.generateId&&(ee=U||0),J==="Point")Sr($,ie);else if(J==="MultiPoint")for(var oe=0;oe<$.length;oe++)Sr($[oe],ie);else if(J==="LineString")an($,ie,ne,!1);else if(J==="MultiLineString"){if(C.lineMetrics){for(oe=0;oe<$.length;oe++)an($[oe],ie=[],ne,!1),V.push(ut(ee,"LineString",ie,I.properties));return}Ln($,ie,ne,!1)}else if(J==="Polygon")Ln($,ie,ne,!0);else{if(J!=="MultiPolygon"){if(J==="GeometryCollection"){for(oe=0;oe<I.geometry.geometries.length;oe++)Er(V,{id:ee,geometry:I.geometry.geometries[oe],properties:I.properties},C,U);return}throw new Error("Input data is not a valid GeoJSON object.")}for(oe=0;oe<$.length;oe++){var ye=[];Ln($[oe],ye,ne,!0),ie.push(ye)}}V.push(ut(ee,J,ie,I.properties))}}function Sr(V,I){I.push(yo(V[0])),I.push(xo(V[1])),I.push(0)}function an(V,I,C,U){for(var $,J,ne=0,ie=0;ie<V.length;ie++){var ee=yo(V[ie][0]),oe=xo(V[ie][1]);I.push(ee),I.push(oe),I.push(0),ie>0&&(ne+=U?($*oe-ee*J)/2:Math.sqrt(Math.pow(ee-$,2)+Math.pow(oe-J,2))),$=ee,J=oe}var ye=I.length-3;I[2]=1,Ui(I,0,ye,C),I[ye+2]=1,I.size=Math.abs(ne),I.start=0,I.end=I.size}function Ln(V,I,C,U){for(var $=0;$<V.length;$++){var J=[];an(V[$],J,C,U),I.push(J)}}function yo(V){return V/360+.5}function xo(V){var I=Math.sin(V*Math.PI/180),C=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return C<0?0:C>1?1:C}function Pi(V,I,C,U,$,J,ne,ie){if(U/=I,J>=(C/=I)&&ne<U)return V;if(ne<C||J>=U)return null;for(var ee=[],oe=0;oe<V.length;oe++){var ye=V[oe],Le=ye.geometry,ve=ye.type,Ge=$===0?ye.minX:ye.minY,$e=$===0?ye.maxX:ye.maxY;if(Ge>=C&&$e<U)ee.push(ye);else if(!($e<C||Ge>=U)){var Ze=[];if(ve==="Point"||ve==="MultiPoint")cr(Le,Ze,C,U,$);else if(ve==="LineString")ln(Le,Ze,C,U,$,!1,ie.lineMetrics);else if(ve==="MultiLineString")Di(Le,Ze,C,U,$,!1);else if(ve==="Polygon")Di(Le,Ze,C,U,$,!0);else if(ve==="MultiPolygon")for(var We=0;We<Le.length;We++){var rt=[];Di(Le[We],rt,C,U,$,!0),rt.length&&Ze.push(rt)}if(Ze.length){if(ie.lineMetrics&&ve==="LineString"){for(We=0;We<Ze.length;We++)ee.push(ut(ye.id,ve,Ze[We],ye.tags));continue}ve!=="LineString"&&ve!=="MultiLineString"||(Ze.length===1?(ve="LineString",Ze=Ze[0]):ve="MultiLineString"),ve!=="Point"&&ve!=="MultiPoint"||(ve=Ze.length===3?"Point":"MultiPoint"),ee.push(ut(ye.id,ve,Ze,ye.tags))}}}return ee.length?ee:null}function cr(V,I,C,U,$){for(var J=0;J<V.length;J+=3){var ne=V[J+$];ne>=C&&ne<=U&&(I.push(V[J]),I.push(V[J+1]),I.push(V[J+2]))}}function ln(V,I,C,U,$,J,ne){for(var ie,ee,oe=ds(V),ye=$===0?fs:vo,Le=V.start,ve=0;ve<V.length-3;ve+=3){var Ge=V[ve],$e=V[ve+1],Ze=V[ve+2],We=V[ve+3],rt=V[ve+4],_t=$===0?Ge:$e,zt=$===0?We:rt,bt=!1;ne&&(ie=Math.sqrt(Math.pow(Ge-We,2)+Math.pow($e-rt,2))),_t<C?zt>C&&(ee=ye(oe,Ge,$e,We,rt,C),ne&&(oe.start=Le+ie*ee)):_t>U?zt<U&&(ee=ye(oe,Ge,$e,We,rt,U),ne&&(oe.start=Le+ie*ee)):Mr(oe,Ge,$e,Ze),zt<C&&_t>=C&&(ee=ye(oe,Ge,$e,We,rt,C),bt=!0),zt>U&&_t<=U&&(ee=ye(oe,Ge,$e,We,rt,U),bt=!0),!J&&bt&&(ne&&(oe.end=Le+ie*ee),I.push(oe),oe=ds(V)),ne&&(Le+=ie)}var re=V.length-3;Ge=V[re],$e=V[re+1],Ze=V[re+2],(_t=$===0?Ge:$e)>=C&&_t<=U&&Mr(oe,Ge,$e,Ze),re=oe.length-3,J&&re>=3&&(oe[re]!==oe[0]||oe[re+1]!==oe[1])&&Mr(oe,oe[0],oe[1],oe[2]),oe.length&&I.push(oe)}function ds(V){var I=[];return I.size=V.size,I.start=V.start,I.end=V.end,I}function Di(V,I,C,U,$,J){for(var ne=0;ne<V.length;ne++)ln(V[ne],I,C,U,$,J,!1)}function Mr(V,I,C,U){V.push(I),V.push(C),V.push(U)}function fs(V,I,C,U,$,J){var ne=(J-I)/(U-I);return V.push(J),V.push(C+($-C)*ne),V.push(1),ne}function vo(V,I,C,U,$,J){var ne=(J-C)/($-C);return V.push(I+(U-I)*ne),V.push(J),V.push(1),ne}function bo(V,I){for(var C=[],U=0;U<V.length;U++){var $,J=V[U],ne=J.type;if(ne==="Point"||ne==="MultiPoint"||ne==="LineString")$=wo(J.geometry,I);else if(ne==="MultiLineString"||ne==="Polygon"){$=[];for(var ie=0;ie<J.geometry.length;ie++)$.push(wo(J.geometry[ie],I))}else if(ne==="MultiPolygon")for($=[],ie=0;ie<J.geometry.length;ie++){for(var ee=[],oe=0;oe<J.geometry[ie].length;oe++)ee.push(wo(J.geometry[ie][oe],I));$.push(ee)}C.push(ut(J.id,ne,$,J.tags))}return C}function wo(V,I){var C=[];C.size=V.size,V.start!==void 0&&(C.start=V.start,C.end=V.end);for(var U=0;U<V.length;U+=3)C.push(V[U]+I,V[U+1],V[U+2]);return C}function To(V,I){if(V.transformed)return V;var C,U,$,J=1<<V.z,ne=V.x,ie=V.y;for(C=0;C<V.features.length;C++){var ee=V.features[C],oe=ee.geometry,ye=ee.type;if(ee.geometry=[],ye===1)for(U=0;U<oe.length;U+=2)ee.geometry.push(ms(oe[U],oe[U+1],I,J,ne,ie));else for(U=0;U<oe.length;U++){var Le=[];for($=0;$<oe[U].length;$+=2)Le.push(ms(oe[U][$],oe[U][$+1],I,J,ne,ie));ee.geometry.push(Le)}}return V.transformed=!0,V}function ms(V,I,C,U,$,J){return[Math.round(C*(V*U-$)),Math.round(C*(I*U-J))]}function _s(V,I,C,U,$){for(var J=I===$.maxZoom?0:$.tolerance/((1<<I)*$.extent),ne={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:C,y:U,z:I,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},ie=0;ie<V.length;ie++){ne.numFeatures++,Ta(ne,V[ie],J,$);var ee=V[ie].minX,oe=V[ie].minY,ye=V[ie].maxX,Le=V[ie].maxY;ee<ne.minX&&(ne.minX=ee),oe<ne.minY&&(ne.minY=oe),ye>ne.maxX&&(ne.maxX=ye),Le>ne.maxY&&(ne.maxY=Le)}return ne}function Ta(V,I,C,U){var $=I.geometry,J=I.type,ne=[];if(J==="Point"||J==="MultiPoint")for(var ie=0;ie<$.length;ie+=3)ne.push($[ie]),ne.push($[ie+1]),V.numPoints++,V.numSimplified++;else if(J==="LineString")jr(ne,$,V,C,!1,!1);else if(J==="MultiLineString"||J==="Polygon")for(ie=0;ie<$.length;ie++)jr(ne,$[ie],V,C,J==="Polygon",ie===0);else if(J==="MultiPolygon")for(var ee=0;ee<$.length;ee++){var oe=$[ee];for(ie=0;ie<oe.length;ie++)jr(ne,oe[ie],V,C,!0,ie===0)}if(ne.length){var ye=I.tags||null;if(J==="LineString"&&U.lineMetrics){for(var Le in ye={},I.tags)ye[Le]=I.tags[Le];ye.mapbox_clip_start=$.start/$.size,ye.mapbox_clip_end=$.end/$.size}var ve={geometry:ne,type:J==="Polygon"||J==="MultiPolygon"?3:J==="LineString"||J==="MultiLineString"?2:1,tags:ye};I.id!==null&&(ve.id=I.id),V.features.push(ve)}}function jr(V,I,C,U,$,J){var ne=U*U;if(U>0&&I.size<($?ne:U))C.numPoints+=I.length/3;else{for(var ie=[],ee=0;ee<I.length;ee+=3)(U===0||I[ee+2]>ne)&&(C.numSimplified++,ie.push(I[ee]),ie.push(I[ee+1])),C.numPoints++;$&&function(oe,ye){for(var Le=0,ve=0,Ge=oe.length,$e=Ge-2;ve<Ge;$e=ve,ve+=2)Le+=(oe[ve]-oe[$e])*(oe[ve+1]+oe[$e+1]);if(Le>0===ye)for(ve=0,Ge=oe.length;ve<Ge/2;ve+=2){var Ze=oe[ve],We=oe[ve+1];oe[ve]=oe[Ge-2-ve],oe[ve+1]=oe[Ge-1-ve],oe[Ge-2-ve]=Ze,oe[Ge-1-ve]=We}}(ie,J),V.push(ie)}}function Ir(V,I){var C=(I=this.options=function($,J){for(var ne in J)$[ne]=J[ne];return $}(Object.create(this.options),I)).debug;if(C&&console.time("preprocess data"),I.maxZoom<0||I.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var U=function($,J){var ne=[];if($.type==="FeatureCollection")for(var ie=0;ie<$.features.length;ie++)Er(ne,$.features[ie],J,ie);else Er(ne,$.type==="Feature"?$:{geometry:$},J);return ne}(V,I);this.tiles={},this.tileCoords=[],C&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(U=function($,J){var ne=J.buffer/J.extent,ie=$,ee=Pi($,1,-1-ne,ne,0,-1,2,J),oe=Pi($,1,1-ne,2+ne,0,-1,2,J);return(ee||oe)&&(ie=Pi($,1,-ne,1+ne,0,-1,2,J)||[],ee&&(ie=bo(ee,1).concat(ie)),oe&&(ie=ie.concat(bo(oe,-1)))),ie}(U,I)).length&&this.splitTile(U,0,0,0),C&&(U.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Bn(V,I,C){return 32*((1<<V)*C+I)+V}function gs(V,I){const C=V.tileID.canonical;if(!this._geoJSONIndex)return I(null,null);const U=this._geoJSONIndex.getTile(C.z,C.x,C.y);if(!U)return I(null,null);const $=new en(U.features);let J=sr($);J.byteOffset===0&&J.byteLength===J.buffer.byteLength||(J=new Uint8Array(J)),I(null,{vectorTile:$,rawData:J.buffer})}Ir.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Ir.prototype.splitTile=function(V,I,C,U,$,J,ne){for(var ie=[V,I,C,U],ee=this.options,oe=ee.debug;ie.length;){U=ie.pop(),C=ie.pop(),I=ie.pop(),V=ie.pop();var ye=1<<I,Le=Bn(I,C,U),ve=this.tiles[Le];if(!ve&&(oe>1&&console.time("creation"),ve=this.tiles[Le]=_s(V,I,C,U,ee),this.tileCoords.push({z:I,x:C,y:U}),oe)){oe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,C,U,ve.numFeatures,ve.numPoints,ve.numSimplified),console.timeEnd("creation"));var Ge="z"+I;this.stats[Ge]=(this.stats[Ge]||0)+1,this.total++}if(ve.source=V,$){if(I===ee.maxZoom||I===$)continue;var $e=1<<$-I;if(C!==Math.floor(J/$e)||U!==Math.floor(ne/$e))continue}else if(I===ee.indexMaxZoom||ve.numPoints<=ee.indexMaxPoints)continue;if(ve.source=null,V.length!==0){oe>1&&console.time("clipping");var Ze,We,rt,_t,zt,bt,re=.5*ee.buffer/ee.extent,Li=.5-re,Ft=.5+re,Vi=1+re;Ze=We=rt=_t=null,zt=Pi(V,ye,C-re,C+Ft,0,ve.minX,ve.maxX,ee),bt=Pi(V,ye,C+Li,C+Vi,0,ve.minX,ve.maxX,ee),V=null,zt&&(Ze=Pi(zt,ye,U-re,U+Ft,1,ve.minY,ve.maxY,ee),We=Pi(zt,ye,U+Li,U+Vi,1,ve.minY,ve.maxY,ee),zt=null),bt&&(rt=Pi(bt,ye,U-re,U+Ft,1,ve.minY,ve.maxY,ee),_t=Pi(bt,ye,U+Li,U+Vi,1,ve.minY,ve.maxY,ee),bt=null),oe>1&&console.timeEnd("clipping"),ie.push(Ze||[],I+1,2*C,2*U),ie.push(We||[],I+1,2*C,2*U+1),ie.push(rt||[],I+1,2*C+1,2*U),ie.push(_t||[],I+1,2*C+1,2*U+1)}}},Ir.prototype.getTile=function(V,I,C){var U=this.options,$=U.extent,J=U.debug;if(V<0||V>24)return null;var ne=1<<V,ie=Bn(V,I=(I%ne+ne)%ne,C);if(this.tiles[ie])return To(this.tiles[ie],$);J>1&&console.log("drilling down to z%d-%d-%d",V,I,C);for(var ee,oe=V,ye=I,Le=C;!ee&&oe>0;)oe--,ye=Math.floor(ye/2),Le=Math.floor(Le/2),ee=this.tiles[Bn(oe,ye,Le)];return ee&&ee.source?(J>1&&console.log("found parent tile z%d-%d-%d",oe,ye,Le),J>1&&console.time("drilling down"),this.splitTile(ee.source,oe,ye,Le,V,I,C),J>
81&&console.timeEnd("drilling down"),this.tiles[ie]?To(this.tiles[ie],$):null):null};class wi extends a.VectorTileWorkerSource{constructor(I,C,U,$,J){super(I,C,U,$,gs),J&&(this.loadGeoJSON=J)}loadData(I,C){const U=I&&I.request,$=U&&U.collectResourceTiming;this.loadGeoJSON(I,(J,ne)=>{if(J||!ne)return C(J);if(typeof ne!="object")return C(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));{Xe(ne,!0);try{if(I.filter){const ee=a.createExpression(I.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ee.result==="error")throw new Error(ee.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));const oe=ne.features.filter(ye=>ee.value.evaluate({zoom:0},ye));ne={type:"FeatureCollection",features:oe}}this._geoJSONIndex=I.cluster?new br(function({superclusterOptions:ee,clusterProperties:oe}){if(!oe||!ee)return ee;const ye={},Le={},ve={accumulated:null,zoom:0},Ge={properties:null},$e=Object.keys(oe);for(const Ze of $e){const[We,rt]=oe[Ze],_t=a.createExpression(rt),zt=a.createExpression(typeof We=="string"?[We,["accumulated"],["get",Ze]]:We);ye[Ze]=_t.value,Le[Ze]=zt.value}return ee.map=Ze=>{Ge.properties=Ze;const We={};for(const rt of $e)We[rt]=ye[rt].evaluate(ve,Ge);return We},ee.reduce=(Ze,We)=>{Ge.properties=We;
8for(const rt of $e)ve.accumulated=Ze[rt],Ze[rt]=Le[rt].evaluate(ve,Ge)},ee}(I)).load(ne.features):function(ee,oe){return new Ir(ee,oe)}(ne,I.geojsonVtOptions)}catch(ee){return C(ee)}this.loaded={};const ie={};if($){const ee=a.getPerformanceMeasurement(U);ee&&(ie.resourceTiming={},ie.resourceTiming[I.source]=JSON.parse(JSON.stringify(ee)))}C(null,ie)}})}reloadTile(I,C){const U=this.loaded;return U&&U[I.uid]?super.reloadTile(I,C):this.loadTile(I,C)}loadGeoJSON(I,C){if(I.request)a.getJSON(I.request,C);else{if(typeof I.data!="string")return C(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));try{return C(null,JSON.parse(I.data))}catch{return C(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(I,C){try{C(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(U){C(U)}}getClusterChildren(I,C){try{C(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(U){C(U)}}getClusterLeaves(I,C){try{C(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(U){C(U)}}}class Eo{constructor(I){this.self=I,this.actor=new a.Actor(I,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=a.getProjection({name:"mercator"}),this.workerSourceTypes={vector:a.VectorTileWorkerSource,geojson:wi},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(C,U)=>{if(this.workerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.workerSourceTypes[C]=U},this.self.registerRTLTextPlugin=C=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=C.applyArabicShaping,a.plugin.processBidirectionalText=C.processBidirectionalText,a.plugin.processStyledBidirectionalText=C.processStyledBidirectionalText}}clearCaches(I,C,U){delete this.layerIndexes[I],delete this.availableImages[I],delete this.workerSources[I],delete this.demWorkerSources[I],U()}checkIfReady(I,C,U){U()}setReferrer(I,C){this.referrer=C}spriteLoaded(I,C){this.isSpriteLoaded[I]=C;for(const U in this.workerSources[I]){const $=this.workerSources[I][U];for(const J in $)$[J]instanceof a.VectorTileWorkerSource&&($[J].isSpriteLoaded=C,$[J].fire(new a.Event("isSpriteLoaded")))}}setImages(I,C,U){this.availableImages[I]=C;for(const $ in this.workerSources[I]){const J=this.workerSources[I][$];for(const ne in J)J[ne].availableImages=C}U()}enableTerrain(I,C,U){this.terrain=C,U()}setProjection(I,C){this.projections[I]=a.getProjection(C)}setLayers(I,C,U){this.getLayerIndex(I).replace(C),U()}updateLayers(I,C,U){this.getLayerIndex(I).update(C.layers,C.removedIds),U()}loadTile(I,C,U){const $=this.enableTerrain?a.extend({enableTerrain:this.terrain},C):C;$.projection=this.projections[I]||this.defaultProjection,this.getWorkerSource(I,C.type,C.source).loadTile($,U)}loadDEMTile(I,C,U){const $=this.enableTerrain?a.extend({buildQuadTree:this.terrain},C):C;this.getDEMWorkerSource(I,C.source).loadTile($,U)}reloadTile(I,C,U){const $=this.enableTerrain?a.extend({enableTerrain:this.terrain},C):C;$.projection=this.projections[I]||this.defaultProjection,this.getWorkerSource(I,C.type,C.source).reloadTile($,U)}abortTile(I,C,U){this.getWorkerSource(I,C.type,C.source).abortTile(C,U)}removeTile(I,C,U){this.getWorkerSource(I,C.type,C.source).removeTile(C,U)}removeSource(I,C,U){if(!this.workerSources[I]||!this.workerSources[I][C.type]||!this.workerSources[I][C.type][C.source])return;const $=this.workerSources[I][C.type][C.source];delete this.workerSources[I][C.type][C.source],$.removeSource!==void 0?$.removeSource(C,U):U()}loadWorkerSource(I,C,U){try{this.self.importScripts(C.url),U()}catch($){U($.toString())}}syncRTLPluginState(I,C,U){try{a.plugin.setState(C);const $=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&$!=null){this.self.importScripts($);const J=a.plugin.isParsed();U(J?void 0:new Error(`RTL Text Plugin failed to import scripts from ${$}`),J)}}catch($){U($.toString())}}getAvailableImages(I){let C=this.availableImages[I];return C||(C=[]),C}getLayerIndex(I){let C=this.layerIndexes[I];return C||(C=this.layerIndexes[I]=new di),C}getWorkerSource(I,C,U){return this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][C]||(this.workerSources[I][C]={}),this.workerSources[I][C][U]||(this.workerSources[I][C][U]=new this.workerSourceTypes[C]({send:($,J,ne,ie,ee,oe)=>{this.actor.send($,J,ne,I,ee,oe)},scheduler:this.actor.scheduler},this.getLayerIndex(I),this.getAvailableImages(I),this.isSpriteLoaded[I])),this.workerSources[I][C][U]}getDEMWorkerSource(I,C){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][C]||(this.demWorkerSources[I][C]=new Me),this.demWorkerSources[I][C]}enforceCacheSizeLimit(I,C){a.enforceCacheSizeLimit(C)}getWorkerPerformanceMetrics(I,C,U){U(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new Eo(self)),Eo}),zi(["./shared"],function(a){function Se(l,t){if(Array.isArray(l)){if(!Array.isArray(t)||l.length!==t.length)return!1;for(let o=0;o<l.length;o++)if(!Se(l[o],t[o]))return!1;return!0}if(typeof l=="object"&&l!==null&&t!==null){if(typeof t!="object"||Object.keys(l).length!==Object.keys(t).length)return!1;for(const o in l)if(!Se(l[o],t[o]))return!1;return!0}return l===t}var or=di;function di(l){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var u,p,f=new Blob([""],{type:"text/javascript"}),g=URL.createObjectURL(f);try{p=new Worker(g),u=!0}catch{u=!1}return p&&p.terminate(),URL.revokeObjectURL(g),u}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var u=document.createElement("canvas");u.width=u.height=1;var p=u.getContext("2d");if(!p)return!1;var f=p.getImageData(0,0,1,1);return f&&f.width===u.width}()?(Me[o=t&&t.failIfMajorPerformanceCaveat]===void 0&&(Me[o]=function(u){var p,f=function(g){var y=document.createElement("canvas"),v=Object.create(di.webGLContextAttributes);return v.failIfMajorPerformanceCaveat=g,y.getContext("webgl",v)||y.getContext("experimental-webgl",v)}(u);if(!f)return!1;try{p=f.createShader(f.VERTEX_SHADER)}catch{return!1}return!(!p||f.isContextLost())&&(f.shaderSource(p,"void main() {}"),f.compileShader(p),f.getShaderParameter(p,f.COMPILE_STATUS)===!0)}(o)),Me[o]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray supp
8ort":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var o}(l)}var Me={};function Xe(l,t,o){const u=a.window.document.createElement(l);return t!==void 0&&(u.className=t),o&&o.appendChild(u),u}function kt(l,t,o){const u=a.window.document.createElementNS("http://www.w3.org/2000/svg",l);for(const p of Object.keys(t))u.setAttributeNS(null,p,t[p]);return o&&o.appendChild(u),u}di.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const Lt=a.window.document&&a.window.document.documentElement.style,Ye=Lt&&Lt.userSelect!==void 0?"userSelect":"WebkitUserSelect";let ni;function en(){Lt&&Ye&&(ni=Lt[Ye],Lt[Ye]="none")}function mo(){Lt&&Ye&&(Lt[Ye]=ni)}function tn(l){l.preventDefault(),l.stopPropagation(),a.window.removeEventListener("click",tn,!0)}function In(){a.window.addEventListener("click",tn,!0),a.window.setTimeout(()=>{a.window.removeEventListener("click",tn,!0)},0)}function Qe(l,t){const o=l.getBoundingClientRect();return Or(l,o,t)}function sr(l,t){const o=l.getBoundingClientRect(),u=[];for(let p=0;p<t.length;p++)u.push(Or(l,o,t[p]));return u}function Fr(l){return a.window.InstallTrigger!==void 0&&l.button===2&&l.ctrlKey&&a.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:l.button}function Or(l,t,o){const u=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new a.pointGeometry((o.clientX-t.left)*u,(o.clientY-t.top)*u)}function An(l,t){var o=t[0],u=t[1],p=t[2],f=t[3],g=o*f-p*u;return g?(l[0]=f*(g=1/g),l[1]=-u*g,l[2]=-p*g,l[3]=o*g,l):null}function oi(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class wa extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.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:o,callback:u}of this.requestors)this._notify(o,u);this.requestors=[]}}hasImage(t){return!!this.getImage(t)}getImage(t){return this.images[t]}addImage(t,o){this._validate(t,o)&&(this.images[t]=o)}_validate(t,o){let u=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),u=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),u=!1),this._validateContent(o.content,o)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),u=!1),u}_validateStretch(t,o){if(!t)return!0;let u=0;for(const p of t){if(p[0]<u||p[1]<p[0]||o<p[1])return!1;u=p[1]}return!0}_validateContent(t,o){return!(t&&(t.length!==4||t[0]<0||o.data.width<t[0]||t[1]<0||o.data.height<t[1]||t[2]<0||o.data.width<t[2]||t[3]<0||o.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,o){o.version=this.images[t].version+1,this.images[t]=o,this.updatedImages[t]=!0}removeImage(t){const o=this.images[t];delete this.images[t],delete this.patterns[t],o.userImage&&o.userImage.onRemove&&o.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,o){let u=!0;if(!this.isLoaded())for(const p of t)this.images[p]||(u=!1);this.isLoaded()||u?this._notify(t,o):this.requestors.push({ids:t,callback:o})}_notify(t,o){const u={};for(const p of t){this.images[p]||this.fire(new a.Event("styleimagemissing",{id:p}));const f=this.images[p];f?u[p]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,hasRenderCallback:Boolean(f.userImage&&f.userImage.render)}:a.warnOnce(`Image "${p}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}o(null,u)}getPixelSize(){const{width:t,height:o}=this.atlasImage;return{width:t,height:o}}getPattern(t){const o=this.patterns[t],u=this.getImage(t);if(!u)return null;if(o&&o.position.version===u.version)return o.position;if(o)o.position.version=u.version;else{const p={w:u.data.width+2,h:u.data.height+2,x:0,y:0},f=new a.ImagePosition(p,u);
vendor: 4,669 bytes, line 8
8this.patterns[t]={bin:p,position:f}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const o=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new a.Texture(t,this.atlasImage,o.RGBA),this.atlasTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const f in this.patterns)t.push(this.patterns[f].bin);const{w:o,h:u}=a.potpack(t),p=this.atlasImage;p.resize({width:o||1,height:u||1});for(const f in this.patterns){const{bin:g}=this.patterns[f],y=g.x+1,v=g.y+1,T=this.images[f].data,S=T.width,A=T.height;a.RGBAImage.copy(T,p,{x:0,y:0},{x:y,y:v},{width:S,height:A}),a.RGBAImage.copy(T,p,{x:0,y:A-1},{x:y,y:v-1},{width:S,height:1}),a.RGBAImage.copy(T,p,{x:0,y:0},{x:y,y:v+A},{width:S,height:1}),a.RGBAImage.copy(T,p,{x:S-1,y:0},{x:y-1,y:v},{width:1,height:A}),a.RGBAImage.copy(T,p,{x:0,y:0},{x:y+S,y:v},{width:1,height:A})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const o of t){if(this.callbackDispatchedThisFrame[o])continue;this.callbackDispatchedThisFrame[o]=!0;const u=this.images[o];oi(u)&&this.updateImage(o,u)}}}const Cn=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(l,t){return function([o,u,p]){const f=a.degToRad(u+90),g=a.degToRad(p);return{x:o*Math.cos(f)*Math.sin(g),y:o*Math.sin(f)*Math.sin(g),z:o*Math.cos(g),azimuthal:u,polar:p}}(l.expression.evaluate(t))}interpolate(l,t,o){return{x:a.number(l.x,t.x,o),y:a.number(l.y,t.y,o),z:a.number(l.z,t.z,o),azimuthal:a.number(l.azimuthal,t.azimuthal,o),polar:a.number(l.polar,t.polar,o)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),zn="-transition";class us extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(Cn),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o={}){if(!this._validate(a.validateLight,t,o))for(const u in t){const p=t[u];a.endsWith(u,zn)?this._transitionable.setTransition(u.slice(0,-zn.length),p):this._transitionable.setValue(u,p)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,u){return(!u||u.validate!==!1)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}const hs=new a.Properties({source:new a.DataConstantProperty(a.spec.terrain.source),exaggeration:new a.DataConstantProperty(a.spec.terrain.exaggeration)}),Ur="-transition";class kn extends a.Evented{constructor(t,o){super(),this._transitionable=new a.Transitionable(hs),this.set(t),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=o}get(){return this._transitionable.serialize()}set(t){for(const o in t){const u=t[o];a.endsWith(o,Ur)?this._transitionable.setTransition(o.slice(0,-Ur.length),u):this._transitionable.setValue(o,u)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}}function ar(l,t,o,u){const p=a.smoothstep(45,65,o),[f,g]=rn(l,u),y=a.length(t);let v=1-Math.min(1,Math.exp((y-f)/(g-f)*-6));return v*=v*v,v=Math.min(1,1.00747*v),v*p*l.alpha}function rn(l,t){const o=.5/Math.tan(.5*t);return[l.range[0]+o,l.range[1]+o]}const Oi=new a.Properties({range:new a.DataConstantProperty(a.spec.fog.range),color:new a.DataConstantProperty(a.spec.fog.color),"high-color":new a.DataConstantProperty(a.spec.fog["high-color"]),"space-color":new a.DataConstantProperty(a.spec.fog["space-color"]),"horizon-blend":new a.DataConstantProperty(a.spec.fog["horizon-blend"]),"star-intensity":new a.DataConstantProperty(a.spec.fog["star-intensity"])}),_o="-transition";class Nt extends a.Evented{constructor(t,o){super(),this._transitionable=new a.Transitionable(Oi),this.set(t),this._transitioning=this._transitionable.untransitioned(),this._transform=o}get state(){const t=this._transform,o=t.projection.name==="globe",u=a.globeToMercatorTransition(t.zoom),p=this.properties.get("range"),f=[.5,3];return{range:o?[a.number(f[0],p[0],u),a.number(f[1],p[1],u)]:p,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,o={}
8){if(!this._validate(a.validateFog,t,o)){for(const u of Object.keys(a.spec.fog))t&&t[u]===void 0&&(t[u]=a.spec.fog[u].default);for(const u in t){const p=t[u];a.endsWith(u,_o)?this._transitionable.setTransition(u.slice(0,-_o.length),p):this._transitionable.setValue(u,p)}}}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.smoothstep(45,65,t))*o.a}getOpacityAtLatLng(t,o){return this._transform.projection.supportsFog?function(u,p,f){const g=a.MercatorCoordinate.fromLngLat(p),y=f.elevation?f.elevation.getAtPointOrZero(g):0,v=[g.x,g.y,y];return a.transformMat4(v,v,f.mercatorFogMatrix),ar(u,v,f.pitch,f._fov)}(this.state,t,o):0}getFovAdjustedRange(t){return this._transform.projection.supportsFog?rn(this.state,t):[0,1]}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,u){return(!u||u.validate!==!1)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class fi{constructor(t,o){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a.uniqueId();const u=this.workerPool.acquire(this.id);for(let p=0;p<u.length;p++){const f=new fi.Actor(u[p],o,this.id);f.name=`Worker ${p}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(t,o,u){a.asyncAll(this.actors,(p,f)=>{p.send(t,o,f)},u=u||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function xr(l,t,o){return t*(a.EXTENT/(l.tileSize*Math.pow(2,o-l.tileID.overscaledZ)))}fi.Actor=a.Actor;class ki{constructor(t,o,u,p){this.screenBounds=t,this.cameraPoint=o,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=u,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,p)}static createFromScreenPoints(t,o){let u,p;if(t instanceof a.pointGeometry||typeof t[0]=="number"){const f=a.pointGeometry.convert(t);u=[a.pointGeometry.convert(t)],p=o.isPointAboveHorizon(f)}else{const f=a.pointGeometry.convert(t[0]),g=a.pointGeometry.convert(t[1]);u=[f,g],p=a.polygonizeBounds(f,g).every(y=>o.isPointAboveHorizon(y))}return new ki(u,o.getCameraPoint(),p,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return a.polygonizeBounds(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.pointGeometry(1,1)):this.screenBounds[1],p=a.polygonizeBounds(o,u,0,!1);return this.cameraPoint.y>u.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<u.x?p.splice(3,0,this.cameraPoint):this.cameraPoint.x>=u.x?p[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(p[3]=this.cameraPoint)),a.bufferConvexPolygon(p,t)}bufferedCameraGeometryGlobe(t){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.pointGeometry(1,1)):this.screenBounds[1],p=a.polygonizeBounds(o,u,t),f=this.cameraPoint.clone();switch(3*((f.y>o.y)+(f.y>u.y))+((f.x>o.x)+(f.x>u.x))){case 0:p[0]=f,p[4]=f.clone();break;case 1:p.splice(1,0,f);break;case 2:p[1]=f;break;case 3:p.splice(4,0,f);break;case 5:p.splice(2,0,f);break;case 6:p[3]=f;break;case 7:p.splice(3,0,f);break;case 8:p[2]=f}return p}containsTile(t,o,u,p=0){const f=t.queryPadding/o._projectionScaler+1,g=u?this._bufferedCameraMercator(f,o):this._bufferedScreenMercator(f,o);let y=t.tileID.wrap+(g.unwrapped?p:0);const v=g.polygon.map(G=>a.getTilePoint(t.tileTransform,G,y));if(!a.polygonIntersectsBox(v,0,0,a.EXTENT,a.EXTENT))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?p:0);const T=this.screenGeometryMercator.polygon.map(G=>a.getTileVec3(t.tileTransform,G,y)),S=T.map(G=>new a.pointGeometry(G[0],G[1])),A=o.getFreeCameraOptions().position||new a.MercatorCoordinate(0,0,0),k=a.getTileVec3(t.tileTransform,A,y),L=T.map(G=>{const D=a.sub(G,G,k);return a.normalize(D,D),new a.Ray(k,D)}),B=xr(t,1,o.zoom)*o._projectionScaler;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:L,bufferedTilespaceGeometry:v,bufferedTilespaceBounds:(P=a.getBounds(v),P.min.x=a.clamp(P.min.x,0,a.EXTENT),P.min.y=a.clamp(P.min.y,0,a.EXTENT),P.max.x=a.clamp(P.max.x,0,a.EXTENT),P.max.y=a.clamp(P.max.y,0,a.EXTENT),P),tile:t,t
8ileID:t.tileID,pixelToTileUnitsFactor:B};var P}_bufferedScreenMercator(t,o){const u=Pn(t);if(this._screenRaycastCache[u])return this._screenRaycastCache[u];{let p;return p=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),o):{polygon:this.bufferedScreenGeometry(t).map(f=>o.pointCoordinate3D(f)),unwrapped:!0},this._screenRaycastCache[u]=p,p}}_bufferedCameraMercator(t,o){const u=Pn(t);if(this._cameraRaycastCache[u])return this._cameraRaycastCache[u];{let p;return p=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),o):{polygon:this.bufferedCameraGeometry(t).map(f=>o.pointCoordinate3D(f)),unwrapped:!0},this._cameraRaycastCache[u]=p,p}}_projectAndResample(t,o){const u=function(f,g){const y=a.multiply([],g.pixelMatrix,g.globeMatrix),v=[0,-a.GLOBE_RADIUS,0,1],T=[0,a.GLOBE_RADIUS,0,1],S=[0,0,0,1];a.transformMat4$1(v,v,y),a.transformMat4$1(T,T,y),a.transformMat4$1(S,S,y);const A=new a.pointGeometry(v[0]/v[3],v[1]/v[3]),k=new a.pointGeometry(T[0]/T[3],T[1]/T[3]),L=a.polygonContainsPoint(f,A)&&v[3]<S[3],B=a.polygonContainsPoint(f,k)&&T[3]<S[3];if(!L&&!B)return null;const P=function(K,le,he){for(let ce=1;ce<K.length;ce++){const ae=br(le.pointCoordinate3D(K[ce-1]).x),q=br(le.pointCoordinate3D(K[ce]).x);if(he<0){if(ae<q)return{idx:ce,t:-ae/(q-1-ae)}}else if(q<ae)return{idx:ce,t:(1-ae)/(q+1-ae)}}return null}(f,g,L?-1:1);if(!P)return null;const{idx:G,t:D}=P;let F=G>1?vr(f.slice(0,G),g):[],O=G<f.length?vr(f.slice(G),g):[];F=F.map(K=>new a.pointGeometry(br(K.x),K.y)),O=O.map(K=>new a.pointGeometry(br(K.x),K.y));const X=[...F];X.length===0&&X.push(O[O.length-1]);const N=a.number(X[X.length-1].y,(O.length===0?F[0]:O[0]).y,D);let Z;return Z=L?[new a.pointGeometry(0,N),new a.pointGeometry(0,0),new a.pointGeometry(1,0),new a.pointGeometry(1,N)]:[new a.pointGeometry(1,N),new a.pointGeometry(1,1),new a.pointGeometry(0,1),new a.pointGeometry(0,N)],X.push(...Z),O.length===0?X.push(F[0]):X.push(...O),{polygon:X.map(K=>new a.MercatorCoordinate(K.x,K.y)),unwrapped:!1}}(t,o);if(u)return u;const p=function(f,g){let y=!1,v=-1/0,T=0;for(let A=0;A<f.length-1;A++)f[A].x>v&&(v=f[A].x,T=A);for(let A=0;A<f.length-1;A++){const k=(T+A)%(f.length-1),L=f[k],B=f[k+1];Math.abs(L.x-B.x)>.5&&(L.x<B.x?(L.x+=1,k===0&&(f[f.length-1].x+=1)):(B.x+=1,k+1===f.length-1&&(f[0].x+=1)),y=!0)}const S=a.mercatorXfromLng(g.center.lng);return y&&S<Math.abs(S-1)&&f.forEach(A=>{A.x-=1}),{polygon:f,unwrapped:y}}(vr(t,o).map(f=>new a.pointGeometry(br(f.x),f.y)),o);return{polygon:p.polygon.map(f=>new a.MercatorCoordinate(f.x,f.y)),unwrapped:p.unwrapped}}}function vr(l,t){return a.resample(l,o=>{const u=t.pointCoordinate3D(o);o.x=u.x,o.y=u.y},1/256)}function br(l){return l<0?1+l%1:l%1}function Pn(l){return 100*l|0}function go(l,t,o,u,p){const f=function(g,y){if(g)return p(g);if(y){const v=a.pick(a.extend(y,l),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);y.vector_layers&&(v.vectorLayers=y.vector_layers,v.vectorLayerIds=v.vectorLayers.map(T=>T.id)),y.language_options&&(v.languageOptions=y.language_options),y.language&&y.language[y.id]&&(v.language=y.language[y.id]),y.worldview_options&&(v.worldviewOptions=y.worldview_options),y.worldview?v.worldview=y.worldview[y.id]:y.worldview_default&&(v.worldview=y.worldview_default),v.tiles=t.canonicalizeTileset(v,l.url),p(null,v)}};return l.url?a.getJSON(t.transformRequest(t.normalizeSourceURL(l.url,null,o,u),a.ResourceType.Source),f):a.exported.frame(()=>f(null,l))}class wr{constructor(t,o,u){this.bounds=a.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=o||0,this.maxzoom=u||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 o=Math.pow(2,t.z),u=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*o),p=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*o),f=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*o),g=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*o);return t.x>=u&&t.x<f&&t.y>=p&&t.y<g}}class ps{constructor(t,o,u){this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=Boolean(u),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const nn={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class on{constructor(t,o,u,p){this.length=o.length,this.attributes=u,this.itemSize=o.bytesPerElement,this.dynamicDraw=p,this.context=t;const f=t.gl;this.buffer=f.createBuffer(),t.bindVertexBuffer.set(this.buffer),f.bufferData(f.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}
vendor: 13,905 bytes, line 8
8enableAttributes(t,o){for(let u=0;u<this.attributes.length;u++){const p=o.attributes[this.attributes[u].name];p!==void 0&&t.enableVertexAttribArray(p)}}setVertexAttribPointers(t,o,u){for(let p=0;p<this.attributes.length;p++){const f=this.attributes[p],g=o.attributes[f.name];g!==void 0&&t.vertexAttribPointer(g,f.components,t[nn[f.type]],!1,this.itemSize,f.offset+this.itemSize*(u||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class pt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Tr extends pt{getDefault(){return a.Color.transparent}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class sn extends pt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class lr extends pt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ui extends pt{getDefault(){return[!0,!0,!0,!0]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Dn extends pt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class ut extends pt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Vr extends pt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Er extends pt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Sr extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class an extends pt{getDefault(){return[0,1]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ln extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class yo extends pt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class xo extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class Pi extends pt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class cr extends pt{getDefault(){return a.Color.transparent}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ln extends pt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ds extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class Di extends pt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Mr extends pt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class fs extends pt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class vo extends pt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class bo extends pt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class wo extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class To extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ms extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class _s extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ta extends pt{getDefault(){return null}set(t){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class jr extends pt{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Ir extends pt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Bn extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class gs extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class wi extends pt{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class Eo extends wi{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class V extends wi{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class I extends V{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class C{constructor(t,o,u,p){this.context=t,this.width=o,this.height=u;const f=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new Eo(t,f),p&&(this.depthAttachment=new V(t,f))}destroy(){const t=this.context.gl,o=this.colorAttachment.get();if(o&&t.deleteTexture(o),this.depthAttachment){const u=this.depthAttachment.get();u&&t.deleteRenderbuffer(u)}t.deleteFramebuffer(this.framebuffer)}}class U{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Tr(this),this.clearDepth=new sn(this),this.clearStencil=new lr(this),this.colorMask=new Ui(this),this.depthMask=new Dn(this),this.stencilMask=new ut(this),this.stencilFunc=new Vr(this),this.stencilOp=new Er(this),this.stencilTest=new Sr(this),this.depthRange=new an(this),this.depthTest=new Ln(this),this.depthFunc=new yo(this),this.blend=new xo(this),this.blendFunc=new Pi(this),this.blendColor=new cr(this),this.blendEquation=new ln(this),this.cullFace=new ds(this),this.cullFaceSide=new Di(this),this.frontFace=new Mr(this),this.program=new fs(this),this.activeTexture=new vo(this),this.viewport=new bo(this),this.bindFramebuffer=new wo(this),this.bindRenderbuffer=new To(this),this.bindTexture=new ms(this),this.bindVertexBuffer=new _s(this),this.bindElementBuffer=new Ta(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new jr(this),this.pixelStoreUnpack=new Ir(this),this.pixelStoreUnpackPremultiplyAlpha=new Bn(this),this.pixelStoreUnpackFlipY=new gs(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=t.getExtension("OES_standard_derivatives"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,o){return new ps(this,t,o)}createVertexBuffer(t,o,u){return new on(this,t,o,u)}createRenderbuffer(t,o,u){const p=this.gl,f=p.createRenderbuffer();return this.bindRenderbuffer.set(f),p.renderbufferStorage(p.RENDERBUFFER,t,o,u),this.bindRenderbuffer.set(null),f}createFramebuffer(t,o,u){return new C(this,t,o,u)}clear({color:t,depth:o,stencil:u}){const p=this.gl;let f=0;t&&(f|=p.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),o!==void 0&&(f|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),u!==void 0&&(f|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),p.clear(f)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){Se(t.blendFunction,a.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class $ extends a.Evented{constructor(t,o,u,p){super(),this.id=t,this.dispatcher=u,this.setEventedParent(p),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},o),a.extend(this,a.pick(o,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=go(this._options,this.map._requestManager,null,null,(t,o)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):o&&(a.extend(this,o),o.bounds&&(this.tileBounds=new wr(o.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(o.tiles),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.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 a.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,o){const u=a.exported.devicePixelRatio>=2,p=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),u,this.tileSize);t.request=a.getImage(this.map._requestManager.transformRequest(p,a.ResourceType.Tile),(f,g,y,v)=>(delete t.request,t.aborted?(t.state="unloaded",o(null)):f?(t.state="errored",o(f)):g?(this.map._refreshExpiredTiles&&t.setExpiryData({cac
8heControl:y,expires:v}),t.setTexture(g,this.map.painter),t.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),void o(null)):o(null)))}static loadTileData(t,o,u){t.setTexture(o,u)}static unloadTileData(t,o){t.texture&&o.saveTileTexture(t.texture)}abortTile(t,o){t.request&&(t.request.cancel(),delete t.request),o()}unloadTile(t,o){t.texture&&this.map.painter.saveTileTexture(t.texture),o()}hasTransition(){return!1}}let J;function ne(l,t,o,u,p,f,g,y){const v=[l,o,p,t,u,f,1,1,1],T=[g,y,1],S=a.adjoint([],v),[A,k,L]=a.transformMat3(T,T,a.transpose(S,S));return a.multiply$1(v,[A,0,0,0,k,0,0,0,L],v)}class ie extends a.Evented{constructor(t,o,u,p){super(),this.id=t,this.dispatcher=u,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(p),this.options=o}load(t,o){this._loaded=o||!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(u,p)=>{if(this._loaded=!0,u)this.fire(new a.ErrorEvent(u));else if(p){const{HTMLImageElement:f}=a.window;this.image=p instanceof f?a.exported.getImageData(p):p,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading()}})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this.texture&&this.texture.destroy()}setCoordinates(t){this.coordinates=t,this._boundsArray=void 0;const o=t.map(a.MercatorCoordinate.fromLngLat);return this.tileID=function(u){let p=1/0,f=1/0,g=-1/0,y=-1/0;for(const A of u)p=Math.min(p,A.x),f=Math.min(f,A.y),g=Math.max(g,A.x),y=Math.max(y,A.y);const v=Math.max(g-p,y-f),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),S=Math.pow(2,T);return new a.CanonicalTileID(T,Math.floor((p+g)/2*S),Math.floor((f+y)/2*S))}(o),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(t){for(const v in this.tiles){const T=this.tiles[v];T.state!=="loaded"&&(T.state="loaded",T.texture=this.texture)}if(this._boundsArray)return;const o=a.tileTransform(this.tileID,this.map.transform.projection),[u,p,f,g]=this.coordinates.map(v=>{const T=o.projection.project(v[0],v[1]);return a.getTilePoint(o,T)._round()});this.perspectiveTransform=function(v,T,S,A,k,L,B,P,G,D){const F=ne(0,0,v,0,0,T,v,T),O=ne(S,A,k,L,B,P,G,D);return a.multiply$1(O,a.adjoint(F,F),O),[O[6]/O[8]*v/a.EXTENT,O[7]/O[8]*T/a.EXTENT]}(this.width,this.height,u.x,u.y,p.x,p.y,g.x,g.y,f.x,f.y);const y=this._boundsArray=new a.StructArrayLayout4i8;y.emplaceBack(u.x,u.y,0,0),y.emplaceBack(p.x,p.y,a.EXTENT,0),y.emplaceBack(g.x,g.y,0,a.EXTENT),y.emplaceBack(f.x,f.y,a.EXTENT,a.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(y,a.boundsAttributes.members),this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,o=t.gl;this.texture?this.texture.update(this.image):(this.texture=new a.Texture(t,this.image,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE)),this._prepareData(t)}loadTile(t,o){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},o(null)):(t.state="errored",o(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const ee={vector:class extends a.Evented{constructor(l,t,o,u){if(super(),this.id=l,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(t,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u),this._tileWorkers={},this._deduped=new a.DedupedRequest}load(l){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"}));const t=this.language||this.map._language,o=this.worldview||this.map._worldview;this._tileJSONRequest=go(this._options,this.map._requestManager,t,o,(u,p)=>{this._tileJSONRequest=null,this._loaded=!0,u?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code. Found: ${t}`),o&&o.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new a.ErrorEvent(u))):p&&(a.extend(this,p),p.bounds&&(this.tileBounds=new wr(p.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(p.tiles,this.map._requestManager._customAccessToken),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"}))),l&&l(u)})}loaded(){return this._loaded}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}onAdd(l){this.map=l,this.load()}setSourceProperty(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),l(),this.load(()=>{const t=this.map.style._getSourceCaches(this.id);for(const o of t)o.clearTiles()})}setTiles(l){return this.setSourceProperty(()=>{this._options.tiles=l}),this}setUrl(l){return this.setSourceProperty(()=>{this.url=l,this._options.url=l}),this}_setLanguage(l){return l===this.language||this.setSourceProperty(()=>{this.language=l}),this}_setWorldview(l){return l===this.worldview?this:this.worldviewOptions&&l&&!this.worldviewOptions[l]?(console.warn(`Vector tile source "${this.id}" does not support worldview "${l}".`),this):(this.setSourceProperty(()=>{this.worldview=l}),this)}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(l,t){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),u={request:this.map._requestManager.transformRequest(o,a.ResourceType.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:l.isSymbolTile};if(u.request.collectResourceTiming=this._collectResourceTiming,l.actor&&l.state!=="expired")l.state==="loading"?l.reloadCallback=t:l.request=l.actor.send("reloadTile",u,p.bind(this));else if(l.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready)l.request=l.actor.send("loadTile",u,p.bind(this),void 0,!0);else{const f=a.loadVectorTile.call({deduped:this._deduped},u,(g,y)=>{g||!y?p.call(this,g):(u.data={cacheControl:y.cacheControl,expires:y.expires,rawData:y.rawData.slice(0)},l.actor&&l.actor.send("loadTile",u,p.bind(this),void 0,!0))},!0);l.request={cancel:f}}function p(f,g){return delete l.request,l.aborted?t(null):f&&f.status!==404?t(f):(g&&g.resourceTiming&&(l.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&g&&l.setExpiryData(g),l.loadVectorData(g,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),t(null),void(l.reloadCallback&&(this.loadTile(l,l.reloadCallback),l.reloadCallback=null)))}}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.actor&&l.actor.send("abortTile",{uid:l.uid,type:this.t
8ype,source:this.id})}unloadTile(l){l.unloadVectorData(),l.actor&&l.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:$,"raster-dem":class extends ${constructor(l,t,o,u){super(l,t,o,u),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function u(p,f){p&&(l.state="errored",t(p)),f&&(l.dem=f,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=a.getImage(this.map._requestManager.transformRequest(o,a.ResourceType.Tile),function(p,f,g,y){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(p)l.state="errored",t(p);else if(f){this.map._refreshExpiredTiles&&l.setExpiryData({cacheControl:g,expires:y});const v=a.window.ImageBitmap&&f instanceof a.window.ImageBitmap&&(J==null&&(J=a.window.OffscreenCanvas&&new a.window.OffscreenCanvas(1,1).getContext("2d")&&typeof a.window.createImageBitmap=="function"),J),T=1-(f.width-a.prevPowerOfTwo(f.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=v?f:a.exported.getImageData(f,T),A={uid:l.uid,coord:l.tileID,source:this.id,rawImageData:S,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadDEMTile",A,u.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(l){const t=l.canonical,o=Math.pow(2,t.z),u=(t.x-1+o)%o,p=t.x===0?l.wrap-1:l.wrap,f=(t.x+1+o)%o,g=t.x+1===o?l.wrap+1:l.wrap,y={};return y[new a.OverscaledTileID(l.overscaledZ,p,t.z,u,t.y).key]={backfilled:!1},y[new a.OverscaledTileID(l.overscaledZ,g,t.z,f,t.y).key]={backfilled:!1},t.y>0&&(y[new a.OverscaledTileID(l.overscaledZ,p,t.z,u,t.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(l.overscaledZ,g,t.z,f,t.y-1).key]={backfilled:!1}),t.y+1<o&&(y[new a.OverscaledTileID(l.overscaledZ,p,t.z,u,t.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(l.overscaledZ,g,t.z,f,t.y+1).key]={backfilled:!1}),y}unloadTile(l){l.demTexture&&this.map.painter.saveTileTexture(l.demTexture),l.fbo&&(l.fbo.destroy(),delete l.fbo),l.dem&&delete l.dem,delete l.neighboringTiles,l.state="unloaded"}},geojson:class extends a.Evented{constructor(l,t,o,u){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(u),this._data=t.data,this._options=a.extend({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const p=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*p,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*p,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:a.EXTENT,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*p,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id},t),this}getClusterLeaves(l,t,o,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:l,limit:t,offset:o},u),this}
8_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new a.Event("dataloading",{dataType:"source"})),this._loaded=!1;const l=a.extend({},this.workerOptions),t=this._data;typeof t=="string"?(l.request=this.map._requestManager.transformRequest(a.exported.resolveURL(t),a.ResourceType.Source),l.request.collectResourceTiming=this._collectResourceTiming):l.data=JSON.stringify(t),this._pendingLoad=this.actor.send(`${this.type}.loadData`,l,(o,u)=>{if(this._loaded=!0,this._pendingLoad=null,o)this.fire(new a.ErrorEvent(o));else{const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&u&&u.resourceTiming&&u.resourceTiming[this.id]&&(p.resourceTiming=u.resourceTiming[this.id]),this.fire(new a.Event("data",p)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(l,t){const o=l.actor?"reloadTile":"loadTile";l.actor=this.actor,l.request=this.actor.send(o,{type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(u,p)=>(delete l.request,l.unloadVectorData(),l.aborted?t(null):u?t(u):(l.loadVectorData(p,this.map.painter,o==="reloadTile"),t(null))),void 0,o==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l){l.unloadVectorData(),this.actor.send("removeTile",{uid:l.uid,type:this.t
8ype,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends ie{constructor(l,t,o,u){super(l,t,o,u),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,a.ResourceType.Source).url);a.getVideo(this.urls,(t,o)=>{this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):o&&(this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new a.Texture(l,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:ie,canvas:class extends ie{constructor(l,t,o,u){super(l,t,o,u),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(f=>typeof f!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof a.window.HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${l}`,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 a.ErrorEvent(new a.ValidationError(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof a.window.HTMLCanvasElement?this.options.canvas:a.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?(l||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.Texture(t,this.canvas,t.gl.RGBA,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends a.Evented{constructor(l,t,o,u){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=t,this.setEventedParent(u),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new wr(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.coveringTiles=this._coveringTiles.bind(this),a.extend(this,a.pick(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileC
8acheSize"]))}serialize(){return a.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this._map=l,this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:o,z:u}=l.canonical;return this._implementation.hasTile({x:t,y:o,z:u})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:o,y:u,z:p}=l.tileID.canonical,f=new a.window.AbortController,g=this._implementation.loadTile({x:o,y:u,z:p},{signal:f.signal});if(!g)return this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null);g.cancel=()=>f.abort(),l.request=g.then(function(y){return delete l.request,l.aborted?(l.state="unloaded",t(null)):y?function(v){return v instanceof a.window.ImageData||v instanceof a.window.ImageBitmap||v instanceof a.window.HTMLCanvasElement}(y)?(this.loadTileData(l,y),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`))):(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null))}.bind(this)).catch(y=>{y.code!==20&&(l.state="errored",t(y))})}loadTileData(l,t){$.loadTileData(l,t,this._map.painter)}unloadTileData(l){$.unloadTileData(l,this._map.painter)}prepareTile(l){if(!this._implementation.prepareTile)return null;const{x:t,y:o,z:u}=l.tileID.canonical,p=this._implementation.prepareTile({x:t,y:o,z:u});return p?(this.loadTileData(l,p),l.state="loaded",p):null}unloadTile(l,t){if(this.unloadTileData(l),this._implementation.unloadTile){const{x:o,y:u,z:p}=l.tileID.canonical;this._implementation.unloadTile({x:o,y:u,z:p})}t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_update(){this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"}))}}},oe=function(l,t,o,u){const p=new ee[t.type](l,t,o,u);if(p.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${p.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],p),p};function ye(l,t){const o=a.identity([]);return a.scale(o,o,[.5*l.width,.5*-l.height,1]),a.translate(o,o,[1,-1,0]),a.multiply(o,o,l.calculateProjMatrix(t.toUnwrapped())),Float32Array.from(o)}function Le(l,t,o,u,p,f,g,y=!1){const v=l.tilesIn(u,g,y);v.sort(Ge);const T=[];for(const A of v)T.push({wrappedTileID:A.tile.tileID.wrapped().key,queryResults:A.tile.queryRenderedFeatures(t,o,l._state,A,p,f,ye(l.transform,A.tile.tileID),y)});const S=function(A){const k={},L={};for(const B of A){const P=B.queryResults,G=B.wrappedTileID,D=L[G]=L[G]||{};for(const F in P){const O=P[F],X=D[F]=D[F]||{},N=k[F]=k[F]||[];for(const Z of O)X[Z.featureIndex]||(X[Z.featureIndex]=!0,N.push(Z))}}return k}(T);for(const A in S)S[A].forEach(k=>{const L=k.feature,B=L.layer;B&&B.type!=="background"&&B.type!=="sky"&&(L.source=B.source,B["source-layer"]&&(L.sourceLayer=B["source-layer"]),L.state=L.id!==void 0?l.getFeatureState(B["source-layer"],L.id):{})});return S}function ve(l,t){const o=l.getRenderableIds().map(f=>l.getTileByID(f)),u=[],p={};for(let f=0;f<o.length;f++){const g=o[f],y=g.tileID.canonical.key;p[y]||(p[y]=!0,g.querySourceFeatures(u,t))}return u}function Ge(l,t){const o=l.tileID,u=t.tileID;return o.overscaledZ-u.overscaledZ||o.canonical.y-u.canonical.y||o.wrap-u.wrap||o.canonical.x-u.canonical.x}function $e(){return na.workerClass!=null?new na.workerClass:new a.window.Worker(na.workerUrl)}const Ze="mapboxgl_preloaded_worker_pool";class We{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<We.workerCount;)this.workers.push(new $e);return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEac
vendor: 13,420 bytes, line 8
8h(o=>{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ze]}numActive(){return Object.keys(this.active).length}}let rt;function _t(){return rt||(rt=new We),rt}function zt(l,t){const o={};for(const u in l)u!=="ref"&&(o[u]=l[u]);return a.refProperties.forEach(u=>{u in t&&(o[u]=t[u])}),o}function bt(l){l=l.slice();const t=Object.create(null);for(let o=0;o<l.length;o++)t[l[o].id]=l[o];for(let o=0;o<l.length;o++)"ref"in l[o]&&(l[o]=zt(l[o],t[l[o].ref]));return l}We.workerCount=2;const re={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setProjection:"setProjection"};function Li(l,t,o){o.push({command:re.addSource,args:[l,t[l]]})}function Ft(l,t,o){t.push({command:re.removeSource,args:[l]}),o[l]=!0}function Vi(l,t,o,u){Ft(l,o,u),Li(l,t,o)}function xu(l,t,o){let u;for(u in l[o])if(l[o].hasOwnProperty(u)&&u!=="data"&&!Se(l[o][u],t[o][u]))return!1;for(u in t[o])if(t[o].hasOwnProperty(u)&&u!=="data"&&!Se(l[o][u],t[o][u]))return!1;return!0}function Bi(l,t,o,u,p,f){let g;for(g in t=t||{},l=l||{})l.hasOwnProperty(g)&&(Se(l[g],t[g])||o.push({command:f,args:[u,g,t[g],p]}));for(g in t)t.hasOwnProperty(g)&&!l.hasOwnProperty(g)&&(Se(l[g],t[g])||o.push({command:f,args:[u,g,t[g],p]}))}function ys(l){return l.id}function Ul(l,t){return l[t.id]=t,l}class So{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=a.clamp(t,0,1);let o=1,u=this._distances[o];const p=t*this.paddedLength+this.padding;for(;u<p&&o<this._distances.length;)u=this._distances[++o];const f=o-1,g=this._distances[f],y=u-g,v=y>0?(p-g)/y:0;return this.points[f].mult(1-v).add(this.points[o].mult(v))}}class Pe{constructor(t,o,u){const p=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/u),this.yCellCount=Math.ceil(o/u);for(let g=0;g<this.xCellCount*this.yCellCount;g++)p.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=o,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,o,u,p,f){this._forEachCell(o,u,p,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(p),this.bboxes.push(f)}insertCircle(t,o,u,p){this._forEachCell(o-p,u-p,o+p,u+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(o),this.circles.push(u),this.circles.push(p)}_insertBoxCell(t,o,u,p,f,g){this.boxCells[f].push(g)}_insertCircleCell(t,o,u,p,f,g){this.circleCells[f].push(g)}_query(t,o,u,p,f,g){if(u<0||t>this.width||p<0||o>this.height)return!f&&[];const y=[];if(t<=0&&o<=0&&this.width<=u&&this.height<=p){if(f)return!0;for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const T=this.circles[3*v],S=this.circles[3*v+1],A=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:T-A,y1:S-A,x2:T+A,y2:S+A})}return g?y.filter(g):y}return this._forEachCell(t,o,u,p,this._queryCell,y,{hitTest:f,seenUids:{box:{},circle:{}}},g),f?y.length>0:y}_queryCircle(t,o,u,p,f){const g=t-u,y=t+u,v=o-u,T=o+u;if(y<0||g>this.width||T<0||v>this.height)return!p&&[];const S=[];return this._forEachCell(g,v,y,T,this._queryCellCircle,S,{hitTest:p,circle:{x:t,y:o,radius:u},seenUids:{box:{},circle:{}}},f),p?S.length>0:S}query(t,o,u,p,f){return this._query(t,o,u,p,!1,f)}hitTest(t,o,u,p,f){return this._query(t,o,u,p,!0,f)}hitTestCircle(t,o,u,p){return this._queryCircle(t,o,u,!0,p)}_queryCell(t,o,u,p,f,g,y,v){const T=y.seenUids,S=this.boxCells[f];if(S!==null){const k=this.bboxes;for(const L of S)if(!T.box[L]){T.box[L]=!0;const B=4*L;if(t<=k[B+2]&&o<=k[B+3]&&u>=k[B+0]&&p>=k[B+1]&&(!v||v(this.boxKeys[L]))){if(y.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[L],x1:k[B],y1:k[B+1],x2:k[B+2],y2:k[B+3]})}}}const A=this.circleCells[f];if(A!==null){const k=this.circles;for(const L of A)if(!T.circle[L]){T.circle[L]=!0;const B=3*L;if(this._circleAndRectCollide(k[B],k[B+1],k[B+2],t,o,u,p)&&(!v||v(this.circleKeys[L]))){if(y.hitTest)return g.push(!0),!0;{const P=k[B],G=k[B+1],D=k[B+2];g.push({key:this.circleKeys[L],x1:P-D,y1:G-D,x2:P+D,y2:G+D})}}}}}_queryCellCircle(t,o,u,p,f,g,y,v){const T=y.circle,S=y.seenUids,A=this.boxCells[f];if(A!==null){const L=this.bboxes;for(const B of A)if(!S.box[B]){S.box[B]=!0;const P=4*B;if(this._circleAndRectCollide(T.x,T.y,T.radius,L[P+0],L[P+1],L[P+2],L[P+3])&&(!v||v(this.boxKeys[B])))return g.push(!0),!0}}const k=this.circleCells[f];if(k!==null){const L=this.circles;for(const B of k)if(!S.circle[B]){S.circle[B]=!0;const P=3*B;if(this._circlesCollide(L[P],L[P+1],L[P+2],T.x,T.y,T.radius)&&(!v||v(this.circleKeys[B])))return g.push(!0),!0}}}_forEachCell(t,o,u,p,f,g,y,v){const T=this._convertToXCellCoord(t),S=this._convertToYCellCoord(o),A=this._convertToXCellCoord(u),k=this._convertToYCellCoord(p);for(let L=T;L<=A;L++)for(let B=S;B<=k;B++)if(f.call(this,t,o,u,p,this.xCellCount*B+L,g,y,v))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,o,u,p,f,g){const y=p-t,v=f-o,T=u+g;return T*T>y*y+v*v}_circleAndRectCollide(t,o,u,p,f,g,y){const v=(g-p)/2,T=Math.abs(t-(p+v));if(T>v+u)return!1;const S=(y-f)/2,A=Math.abs(o-(f+S));if(A>S+u)return!1;if(T<=v||A<=S)return!0;const k=T-v,L=A-S;return k*k+L*L<=u*u}}const lt=Math.tan(85*Math.PI/180);function nt(l,t,o,u,p,f,g){const y=a.create();if(o)if(f.name==="globe"){const v=a.calculateGlobeLabelMatrix(p,t);a.multiply(y,y,v)}else{const v=An([],g);y[0]=v[0],y[1]=v[1],y[4]=v[2],y[5]=v[3],u||a.rotateZ(y,y,p.angle)}else a.multiply(y,p.labelPlaneMatrix,l);return y}function Qi(l,t,o,u,p,f,g){const y=nt(l,t,o,u,p,f,g);return f.name==="globe"&&o||(y[2]=y[6]=y[10]=y[14]=0),y}function cn(l,t,o,u,p,f,g){if(o){if(f.name==="globe"){const y=nt(l,t,o,u,p,f,g);return a.invert(y,y),a.multiply(y,l,y),y}{const y=a.clone(l),v=a.identity([]);return v[0]=g[0],v[1]=g[1],v[4]=g[2],v[5]=g[3],a.multiply(y,y,v),u||a.rotateZ(y,y,-p.angle),y}}return p.glCoordMatrix}function et(l,t,o=0){const u=[l.x,l.y,o,1];o?a.transformMat4$1(u,u,t):Gt(u,u,t);const p=u[3];return{point:[u[0]/p,u[1]/p,u[2]/p],signedDistanceFromCamera:p}}function Ar(l,t){const o=[l[0],l[1],l[2],1];a.transformMat4$1(o,o,t);const u=o[3];return{point:[o[0]/u,o[1]/u,o[2]/u],signedDistanceFromCamera:u}}function Rn(l,t){return Math.min(.5+l/t*.5,1.5)}function Mo(l,t){const o=l[0]/l[3],u=l[1]/l[3];return o>=-t[0]&&o<=t[0]&&u>=-t[1]&&u<=t[1]}function ji(l,t,o,u,p,f,g,y,v,T){const S=o.transform,A=u?l.textSizeData:l.iconSizeData,k=a.evaluateSizeForZoom(A,o.transform.zoom),L=S.projection.name==="globe",B=[256/o.width*2+1,256/o.height*2+1],P=u?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;P.clear();let G=null;L&&(G=u?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const D=l.lineVertexArray,F=u?l.text.placedSymbolArray:l.icon.placedSymbolArray,O=o.transform.width/o.transform.height;let X=!1;for(let N=0;N<F.length;N++){const Z=F.get(N);if(Z.writingMode!==a.WritingMode.vertical||X||N!==0&&F.get(N-1).writingMode===a.WritingMode.horizontal||(X=!0),(Z.hidden||Z.writingMode===a.WritingMode.vertical)&&!X){ei(Z.numGlyphs,P);continue}X=!1;const K=new a.pointGeometry(Z.tileAnchorX,Z.tileAnchorY),le=v?v(K):[0,0,0],he=S.projection.projectTilePoint(K.x,K.y,T.canonical),ce=[he.x+le[0],he.y+le[1],he.z+le[2]],ae=[...ce,1];if(a.transformMat4$1(ae,ae,t),!Mo(ae,B)){ei(Z.numGlyphs,P);continue}const q=Rn(o.transform.cameraToCenterDistance,ae[3]),ge=a.evaluateSizeForFeature(A,k,Z),_e=g?ge/q:ge*q,ze=et(new a.pointGeometry(ce[0],ce[1]),p,ce[2]);if(ze.signedDistanceFromCamera<=0){ei(Z.numGlyphs,P);continue}let de={};const Ve=g?null:v,Ce=Fn(Z,_e,!1,y,t,p,f,l.glyphOffsetArray,D,P,G,ze.point,K,de,O,Ve,S.projection,T,g);X=Ce.useVertical,Ve&&Ce.needsFlipping&&(de={}),(Ce.notEnoughRoom||X||Ce.needsFlipping&&Fn(Z,_e,!0,y,t,p,f,l.glyphOffsetArray,D,P,G,ze.point,K,de,O,Ve,S.projection,T,g).notEnoughRoom)&&ei(Z.numGlyphs,P)}u?(l.text.dynamicLayoutVertexBuffer.updateData(P),G&&l.text.globeExtVertexBuffer.updateData(G)):(l.icon.dynamicLayoutVertexBuffer.updateData(P),G&&l.icon.globeExtVertexBuffer.updateData(G))}function Ot(l,t,o,u,p,f,g,y,v,T,S,A,k,L,B,P){const G=y.glyphStartIndex+y.numGlyphs,D=y.lineStartIndex,F=y.lineStartIndex+y.lineLength,O=t.getoffsetX(y.glyphStartIndex),X=t.getoffsetX(G-1),N=Un(l*O,o,u,p,f,g,y.segment,D,F,v,T,S,A,k,!0,L,B,P);if(!N)return null;const Z=Un(l*X,o,u,p,f,g,y.segment,D,F,v,T,S,A,k,!0,L,B,P);return Z?{first:N,last:Z}:null}function Vl(l,t,o,u){return l.writingMode===a.WritingMode.horizontal&&Math.abs(o.y-t.y)>Math.abs(o.x-t.x)*u?{useVertical:!0}:l.writingMode===a.WritingMode.vertical?t.y<o.y?{needsFlipping:!0}:null:l.flipState!==0&&function(p,f,g){const y=(f.x-p.x)*g;return y===0||Math.abs((f.y-p.y)/y)>lt}(t,o,u)?l.flipState===1?{needsFlipping:!0}:null:t.x>o.x?{needsFlipping:!0}:null}function Fn(l,t,o,u,p,f,g,y,v,T,S,A,k,L,B,P,G,D,F){const O=t/24,X=l.lineOffsetX*O,N=l.lineOffsetY*O;let Z;if(l.numGlyphs>1){const K=l.glyphStartIndex+l.numGlyphs,le=l.lineStartIndex,he=l.lineStartIndex+l.lineLength,ce=Ot(O,y,X,N,o,A,k,l,v,f,L,P,!1,G,D,F);if(!ce)return{notEnoughRoom:!0};const ae=Ar(ce.first.point,g).point,q=Ar(ce.last.point,g).point,ge=new a.pointGeometry(ae[0],ae[1]),_e=new a.pointGeometry(q[0],q[1]);if(u&&!o){const ze=Vl(l,ge,_e,B);if(l.flipState=ze&&ze.needsFlipping?1:2,ze)return ze}Z=[ce.first];for(let ze=l.glyphStartIndex+1;ze<K-1;ze++)Z.push(Un(O*y.getoffsetX(ze),X,N,o,A,k,l.segment,le,he,v,f,L,P,!1,!1,G,D,F));Z.push(ce.last)}else{if(u&&!o){const le=et(k,p).point,he=l.lineStartIndex+l.segment+1,ce=new a.pointGeometry(v.getx(he),v.gety(he)),ae=et(ce,p),q=ae.signedDistanceFromCamera>0?ae.point:On(k,ce,le,1,p,void 0,G,D.canonical),ge=Vl(l,new a.pointGeometry(le[0],le[1]),new a.pointGeometry(q[0],q[1]),B);if(l.flipState=ge&&ge.needsFlipping?1:2,ge)return ge}const K=Un(O*y.getoffsetX(l.glyphStartIndex),X,N,o,A,k,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,v,f,L,P,!1,!1,G,D,F);if(!K)return{notEnoughRoom:!0};Z=[K]}if(S)for(const K of Z)a.updateGlobeVertexNormal(S,T.length+0,K.up[0],K.up[1],K.up[2]),a.updateGlobeVertexNormal(S,T.length+1,K.up[0],K.up[1],K.up[2]),a.updateGlobeVertexNormal(S,T.length+2,K.up[0],K.up[1],K.up[2]),a.updateGlobeVertexNormal(S,T.length+3,K.up[0],K.up[1],K.up[2]),a.addDynamicAttributes(T,K.point[0],K.point[1],K.point[2],K.angle);else for(const K of Z)a.addDynamicAttributes(T,K.point[0],K.point[1],K.point[2],K.angle);return{}}function xs(l,t,o,u,p){const f=u.projectTilePoint(l.x,l.y,t);if(!p)return et(f,o,f.z);const g=p(l);return et(new a.pointGeometry(f.x+g[0],f.y+g[1]),o,f.z+g[2])}function On(l,t,o,u,p,f,g,y){const v=xs(l.add(l.sub(t)._unit()),y,p,g,f).point,T=a.sub([],o,v);return a.scaleAndAdd([],o,T,u/a.length(T))}function Un(l,t,o,u,p,f,g,y,v,T,S,A,k,L,B,P,G,D){const F=u?l-t:l+t;let O=F>0?1:-1,X=0;u&&(O*=-1,X=Math.PI),O<0&&(X+=Math.PI);let N=O>0?y+g:y+g+1,Z=p,K=p,le=0,he=0;const ce=Math.abs(F),ae=[],q=[];let ge=f;const _e=()=>{const Ue=N-O;return le===0?f:new a.pointGeometry(T.getx(Ue),T.gety(Ue))},ze=()=>On(_e(),ge,K,ce-le+1,S,k,P,G.canonical);for(;le+he<=ce;){if(N+=O,N<y||N>=v)return null;if(K=Z,ae.push(Z),L&&q.push(ge||_e()),Z=A[N],Z===void 0){ge=new a.pointGeometry(T.getx(N),T.gety(N));const Ue=xs(ge,G.canonical,S,P,k);Z=Ue.signedDistanceFromCamera>0?A[N]=Ue.point:ze()}else ge=null;le+=he,he=a.distance(K,Z)}ge=ge||new a.pointGeometry(T.getx(N),T.gety(N));const de=_e();B&&k&&(A[N]=Z=A[N]===void 0?Z:ze(),he=a.distance(K,Z));const Ve=(ce-le)/he,Ce=ge.sub(de).mult(Ve)._add(de),Ae=a.sub([],Z,K),Ee=a.scaleAndAdd([],K,Ae,Ve);let Ie=[0,0,1],He=Ae[0],Ne=Ae[1];if(D&&(Ie=P.upVector(G.canonical,Ce.x,Ce.y),Ie[0]!==0||Ie[1]!==0||Ie[2]!==1)){const Ue=[1,0,0],Ke=[0,1,0];Ue[0]=Ie[2],Ue[1]=0,Ue[2]=-Ie[0],a.cross(Ke,Ie,Ue),a.normalize(Ue,Ue),a.normalize(Ke,Ke),He=a.dot(Ae,Ue),Ne=a.dot(Ae,Ke)}if(o){const Ue=a.cross([],Ie,Ae);a.normalize(Ue,Ue),a.scaleAndAdd(Ee,Ee,Ue,o*O)}const tt=X+Math.atan2(Ne,He);return ae.push(Ee),L&&q.push(Ce),{point:Ee,angle:tt,path:ae,tilePath:q,up:Ie}}const jl=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ei(l,t){for(let o=0;o<l;o++){const u=t.length;t.resize(u+4),t.float32.set(jl,4*u)}}function Gt(l,t,o){const u=t[0],p=t[1];return l[0]=o[0]*u+o[4]*p+o[12],l[1]=o[1]*u+o[5]*p+o[13],l[3]=o[3]*u+o[7]*p+o[15],l}const Ni=100;class Ea{constructor(t,o,u=new Pe(t.width+200,t.height+200,25),p=new Pe
8(t.width+200,t.height+200,25)){this.transform=t,this.grid=u,this.ignoredGrid=p,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Ni,this.screenBottomBoundary=t.height+Ni,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=o}placeCollisionBox(t,o,u,p,f,g,y,v){let T=u.projectedAnchorX,S=u.projectedAnchorY,A=u.projectedAnchorZ;const k=u.elevation,L=u.tileID;if(k&&L){const N=t.getProjection().upVector(L.canonical,u.tileAnchorX,u.tileAnchorY),Z=t.getProjection().upVectorScale(L.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=N[0]*k*Z,S+=N[1]*k*Z,A+=N[2]*k*Z}const B=this.projectAndGetPerspectiveRatio(y,[T,S,A],u.tileID,t.projection.name==="globe"||!!k||this.transform.pitch>0,t.getProjection()),P=g*B.perspectiveRatio,G=(u.x1*o+p.x-u.padding)*P+B.point.x,D=(u.y1*o+p.y-u.padding)*P+B.point.y,F=(u.x2*o+p.x+u.padding)*P+B.point.x,O=(u.y2*o+p.y+u.padding)*P+B.point.y,X=B.perspectiveRatio<=.55||B.occluded;return!this.isInsideGrid(G,D,F,O)||!f&&this.grid.hitTest(G,D,F,O,v)||X?{box:[],offscreen:!1,occluded:B.occluded}:{box:[G,D,F,O],offscreen:this.isOffscreen(G,D,F,O),occluded:!1}}placeCollisionCircles(t,o,u,p,f,g,y,v,T,S,A,k,L,B,P){const G=[],D=this.transform.elevation,F=D?D.getAtTileOffsetFunc(P,this.transform.center.lat,this.transform.worldSize,t.getProjection()):de=>[0,0,0],O=new a.pointGeometry(u.tileAnchorX,u.tileAnchorY),X=t.getProjection().projectTilePoint(u.tileAnchorX,u.tileAnchorY,P.canonical),N=F(O),Z=[X.x+N[0],X.y+N[1],X.z+N[2]],K=t.projection.name==="globe",le=this.projectAndGetPerspectiveRatio(y,[Z[0],Z[1],Z[2]],P,K||!!D||this.transform.pitch>0,t.getProjection()),{perspectiveRatio:he}=le,ce=(A?g/he:g*he)/a.ONE_EM,ae=et(new a.pointGeometry(Z[0],Z[1]),v,Z[2]).point,q=le.signedDistanceFromCamera>0?Ot(ce,f,u.lineOffsetX*ce,u.lineOffsetY*ce,!1,ae,O,u,p,v,{},D&&!A?F:null,A&&!!D,t.getProjection(),P,A):null;let ge=!1,_e=!1,ze=!0;if(q&&!le.occluded){const de=.5*L*he+B,Ve=new a.pointGeometry(-100,-100),Ce=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Ae=new So,Ee=q.first,Ie=q.last;let He=[];for(let Ue=Ee.path.length-1;Ue>=1;Ue--)He.push(Ee.path[Ue]);for(let Ue=1;Ue<Ie.path.length;Ue++)He.push(Ie.path[Ue]);const Ne=2.5*de;if(T){const Ue=He.map(D&&!K?(Ke,yt)=>{const Tt=F(yt<Ee.path.length-1?Ee.tilePath[Ee.path.length-1-yt]:Ie.tilePath[yt-Ee.path.length+2]);return Ke[2]=Tt[2],Ar(Ke,T)}:Ke=>Ar(Ke,T));He=Ue.some(Ke=>Ke.signedDistanceFromCamera<=0)?[]:Ue.map(Ke=>Ke.point)}let tt=[];if(He.length>0){const Ue=He.map(Mt=>new a.pointGeometry(Mt[0],Mt[1]));let Ke=1/0,yt=-1/0,Tt=1/0,qt=-1/0;for(let Mt=0;Mt<Ue.length;Mt++)Ke=Math.min(Ke,Ue[Mt].x),Tt=Math.min(Tt,Ue[Mt].y),yt=Math.max(yt,Ue[Mt].x),qt=Math.max(qt,Ue[Mt].y);tt=Ke>=Ve.x&&yt<=Ce.x&&Tt>=Ve.y&&qt<=Ce.y?[Ue]:yt<Ve.x||Ke>Ce.x||qt<Ve.y||Tt>Ce.y?[]:a.clipLine([Ue],Ve.x,Ve.y,Ce.x,Ce.y)}for(const Ue of tt){Ae.reset(Ue,.25*de);let Ke=0;Ke=Ae.length<=.5*de?1:Math.ceil(Ae.paddedLength/Ne)+1;for(let yt=0;yt<Ke;yt++){const Tt=yt/Math.max(Ke-1,1),qt=Ae.lerp(Tt),Mt=qt.x+Ni,Ri=qt.y+Ni;G.push(Mt,Ri,de,0);const pr=Mt-de,Pr=Ri-de,Pt=Mt+de,Bt=Ri+de;if(ze=ze&&this.isOffscreen(pr,Pr,Pt,Bt),_e=_e||this.isInsideGrid(pr,Pr,Pt,Bt),!o&&this.grid.hitTestCircle(Mt,Ri,de,k)&&(ge=!0,!S))return{circles:[],offscreen:!1,collisionDetected:ge,occluded:!1}}}}return{circles:!S&&ge||!_e?[]:G,offscreen:ze,collisionDetected:ge,occluded:le.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let u=1/0,p=1/0,f=-1/0,g=-1/0;for(const S of t){const A=new a.pointGeometry(S.x+Ni,S.y+Ni);u=Math.min(u,A.x),p=Math.min(p,A.y),f=Math.max(f,A.x),g=Math.max(g,A.y),o.push(A)}const y=this.grid.query(u,p,f,g).concat(this.ignoredGrid.query(u,p,f,g)),v={},T={};for(const S of y){const A=S.key;if(v[A.bucketInstanceId]===void 0&&(v[A.bucketInstanceId]={}),v[A.bucketInstanceId][A.featureIndex])continue;const k=[new a.pointGeometry(S.x1,S.y1),new a.pointGeometry(S.x2,S.y1),new a.pointGeometry(S.x2,S.y2),new a.pointGeometry(S.x1,S.y2)];a.polygonIntersectsPolygon(o,k)&&(v[A.bucketInstanceId][A.featureIndex]=!0,T[A.bucketInstanceId]===void 0&&(T[A.bucketInstanceId]=[]),T[A.bucketInstanceId].push(A.featureIndex))}return T}insertCollisionBox(t,o,u,p,f){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:f},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,u,p,f){const g=o?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:p,collisionGroupID:f};for(let v=0;v<t.length;
vendor: 9,243 bytes, line 8
8v+=4)g.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,o,u,p,f){const g=[o[0],o[1],o[2],1];let y=!1;if(o[2]||this.transform.pitch>0){a.transformMat4$1(g,g,t);const v=f.name==="globe";this.fogState&&u&&!v&&(y=function(T,S,A,k,L,B){const P=B.calculateFogTileMatrix(L),G=[S,A,k];return a.transformMat4(G,G,P),ar(T,G,B.pitch,B._fov)}(this.fogState,o[0],o[1],o[2],u.toUnwrapped(),this.transform)>.9)}else Gt(g,g,t);return{point:new a.pointGeometry((g[0]/g[3]+1)/2*this.transform.width+Ni,(-g[1]/g[3]+1)/2*this.transform.height+Ni),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(f)/g[3]*.5,1.5),signedDistanceFromCamera:g[3],occluded:p&&g[2]>g[3]||y}}isOffscreen(t,o,u,p){return u<Ni||t>=this.screenRightBoundary||p<Ni||o>this.screenBottomBoundary}isInsideGrid(t,o,u,p){return u>=0&&t<this.gridRightBoundary&&p>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const t=a.identity([]);return a.translate(t,t,[-100,-100,0]),t}}function mi(l,t,o){const u=t.createTileMatrix(l,l.worldSize,o.toUnwrapped());return a.multiply(new Float32Array(16),l.projMatrix,u)}function Gi(l,t,o){if(t.projection.name===o.projection.name)return l.projMatrix;const u=o.clone();return u.setProjection(t.projection),mi(u,t.getProjection(),l)}function vs(l,t,o){return t.name===o.projection.name?l.projMatrix:mi(o,t,l)}class Io{constructor(t,o,u,p){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):p&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class jt{constructor(t,o,u,p,f,g=!1){this.text=new Io(t?t.text:null,o,u,f),this.icon=new Io(t?t.icon:null,o,p,f),this.clipped=g}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class un{constructor(t,o,u,p=!1){this.text=t,this.icon=o,this.skipFade=u,this.clipped=p}}class Sa{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class Ao{constructor(t,o,u,p,f){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=u,this.bucketIndex=p,this.tileID=f}}class li{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:u=>u.collisionGroupID===o}}return this.collisionGroups[t]}}function bs(l,t,o,u,p){const{horizontalAlign:f,verticalAlign:g}=a.getAnchorAlignment(l),y=-(f-.5)*t,v=-(g-.5)*o,T=a.evaluateVariableOffset(l,u);return new a.pointGeometry(y+T[0]*p,v+T[1]*p)}function Co(l,t,o,u,p){const f=new a.pointGeometry(l,t);return o&&f._rotate(u?p:-p),f}class Cr{constructor(t,o,u,p,f){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new Ea(this.transform,f),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new li(u),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,o,u,p){const f=u.getBucket(o),g=u.latestFeatureIndex;if(!f||!g||o.id!==f.layerIds[0])return;const y=f.layers[0].layout,v=u.collisionBoxArray,T=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),S=u.tileSize/a.EXTENT,A=u.tileID.toUnwrapped();this.transform.setProjection(f.projection);const k=(L=u.tileID,B=f.getProjection(),P=this.transform,B.name===this.projection?P.calculateProjMatrix(L.toUnwrapped()):mi(P,B,L));var L,B,P;const G=y.get("text-pitch-alignment")==="map",D=y.get("text-rotation-alignment")==="map";o.compileFilter();const F=o.dynamicFilter(),O=o.dynamicFilterNeedsFeature(),X=this.transform.calculatePixelsToTileUnitsMatrix(u),N=Qi(k,u.tileID.canonical,G,D,this.transform,f.getProjection(),X);let Z=null;if(G){const he=cn(k,u.tileID.canonical,G,D,this.transform,f.getProjection(),X);Z=a.multiply([],this.transform.labelPlaneMatrix,he)}let K=null;F&&u.latestFeatureIndex&&(K={unwrappedTileID:A,dynamicFilter:F,dynamicFilterNeedsFeature:O,featureIndex:u.latestFeatureIndex}),this.retainedQueryData[f.bucketInstanceId]=new Ao(f.bucketInstanceId,g,f.sourceLayerIndex,f.index,u.tileID);const le={bucket:f,layout:y,posMatrix:k,textLabelPlaneMatrix:N,labelToScreenMatrix:Z,clippingData:K,scale:T,textPixelRatio:S,holdingForFade:u.holdingForFade(),collisionBoxArray:v,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(f.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:a.evaluateSizeForZoom(f.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(p)for(const he of f.sortKeyRanges){const{sortKey:ce,symbolInstanceStart:ae,symbolInstanceEnd:q}=he;t.push({sortKey:ce,symbolInstanceStart:ae,symbolInstanceEnd:q,parameters:le})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:le})}attemptAnchorPlacement(t,o,u,p,f,g,y,v,T,S,A,k,L,B,P,G,D,F){const O=[k.textOffset0,k.textOffset1],X=bs(t,u,p,O,f),N=this.collisionIndex.placeCollisionBox(B,f,o,Co(X.x,X.y,g,y,this.transform.angle),A,v,T,S.predicate);if((!G||this.collisionIndex.placeCollisionBox(B,B.getSymbolInstanceIconSize(F,this.transform.zoom,L),G,Co(X.x,X.y,g,y,this.transform.angle),A,v,T,S.predicate).box.length!==0)&&N.box.length>0){let Z;return this.prevPlacement&&this.prevPlacement.variableOffsets[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID].text&&(Z=this.prevPlacement.variableOffsets[k.crossTileID].anchor),this.variableOffsets[k.crossTileID]={textOffset:O,width:u,height:p,anchor:t,textScale:f,prevAnchor:Z},this.markUsedJustification(B,t,k,P),B.allowVerticalPlacement&&(this.markUsedOrientation(B,P,k),this.placedOrientations[k.crossTileID]=P),{shift:X,placedGlyphBoxes:N}}}placeLayerBucketPart(t,o,u,p){const{bucket:f,layout:g,posMatrix:y,textLabelPlaneMatrix:v,labelToScreenMatrix:T,clippingData:S,textPixelRatio:A,holdingForFade:k,collisionBoxArray:L,partiallyEvaluatedTextSize:B,partiallyEvaluatedIconSize:P,collisionGroup:G}=t.parameters,D=g.get("text-optional"),F=g.get("icon-optional"),O=g.get("text-allow-overlap"),X=g.get("icon-allow-overlap"),N=g.get("text-rotation-alignment")==="map",Z=g.get("text-pitch-alignment")==="map",K=g.get("icon-text-fit")!=="none",le=g.get("symbol-z-order")==="viewport-y";this.transform.setProjection(f.projection);let he=O&&(X||!f.hasIconData()||F),ce=X&&(O||!f.hasTextData()||D);!f.collisionArrays&&L&&f.deserializeCollisionBoxes(L),u&&p&&f.updateCollisionDebugBuffers(this.transform.zoom,L);const ae=(q,ge,_e)=>{if(S){const Pt={zoom:this.transform.zoom,pitch:this.transform.pitch};let Bt=null;if(S.dynamicFilterNeedsFeature){const xt=this.retainedQueryData[f.bucketInstanceId];Bt=S.featureIndex.loadFeature({featureIndex:q.featureIndex,bucketIndex:xt.bucketIndex,sourceLayerIndex:xt.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,S.dynamicFilter)(Pt,Bt,this.retainedQueryData[f.bucketInstanceId].tileID.canonical,new a.pointGeometry(q.tileAnchorX,q.tileAnchorY),this.transform.calculateDistanceTileData(S.unwrappedTileID)))return this.placements[q.crossTileID]=new un(!1,!1,!1,!0),void(o[q.crossTileID]=!0)}if(o[q.crossTileID])return;if(k)return void(this.placements[q.crossTileID]=new un(!1,!1,!1));let ze=!1,de=!1,Ve=!0,Ce=!1,Ae=!1,Ee=null,Ie={box:null,offscreen:null,occluded:null},He={box:null,offscreen:null,occluded:null},Ne=null,tt=null,Ue=null,Ke=0,yt=0,Tt=0;_e.textFeatureIndex?Ke=_e.textFeatureIndex:q.useRuntimeCollisionCircles&&(Ke=q.featureIndex),_e.verticalTextFeatureIndex&&(yt=_e.verticalTextFeatureIndex);const qt=Pt=>{Pt.tileID=this.retainedQueryData[f.bucketInstanceId].tileID,(this.transform.elevation||Pt.elevation)&&(Pt.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[f.bucketInstanceId].tileID,Pt.tileAnchorX,Pt.tileAnchorY):0)},Mt=_e.textBox;if(Mt){qt(Mt);const Pt=xt=>{let Yt=a.WritingMode.horizontal;if(f.allowVerticalPlacement&&!xt&&this.prevPlacement){const ci=this.prevPlacement.placedOrientations[q.crossTileID];ci&&(this.placedOrientations[q.crossTileID]=ci,Yt=ci,this.markUsedOrientation(f,Yt,q))}return Yt},Bt=(xt,Yt)=>{if(f.allowVerticalPlacement&&q.numVerticalGlyphVertices>0&&_e.verticalTextBox){for(const ci of f.writingModes)if(ci===a.WritingMode.vertical?(Ie=Yt(),He=Ie):Ie=xt(),Ie&&Ie.box&&Ie.box.length)break}else Ie=xt()};if(g.get("text-variable-anchor")){let xt=g.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[q.crossTileID]){const ht=this.prevPlacement.variableOffsets[q.crossTileID];xt.indexOf(ht.anchor)>0&&(xt=xt.filter(Ti=>Ti!==ht.anchor),xt.unshift(ht.anchor))}const Yt=(ht,Ti,xn)=>{const ir=f.getSymbolInstanceTextSize(B,q,this.transform.zoom,ge),Qn=(ht.x2-ht.x1)*ir+2*ht.padding,eo=(ht.y2-ht.y1)*ir+2*ht.padding,Zr=K&&!X?Ti:null;Zr&&qt(Zr);let Kt={box:[],offscreen:!1,occluded:!1};const dr=O?2*xt.length:xt.length;for(let Dr=0;Dr<dr;++Dr){const Ho=this.attemptAnchorPlacement(xt[Dr%xt.length],ht,Qn,eo,ir,N,Z,A,y,G,Dr>=xt.length,q,ge,f,xn,Zr,B,P);if(Ho&&(Kt=Ho.placedGlyphBoxes,Kt&&Kt.box&&Kt.box.length)){ze=!0,Ee=Ho.shift;break}}return Kt};Bt(()=>Yt(Mt,_e.iconBox,a.WritingMode.horizontal),()=>{const ht=_e.verticalTextBox;return ht&&qt(ht),f.allowVerticalPlacement&&!(Ie&&Ie.box&&Ie.box.length)&&q.
8numVerticalGlyphVertices>0&&ht?Yt(ht,_e.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),Ie&&(ze=Ie.box,Ve=Ie.offscreen,Ce=Ie.occluded);const ci=Pt(Ie&&Ie.box);if(!ze&&this.prevPlacement){const ht=this.prevPlacement.variableOffsets[q.crossTileID];ht&&(this.variableOffsets[q.crossTileID]=ht,this.markUsedJustification(f,ht.anchor,q,ci))}}else{const xt=(Yt,ci)=>{const ht=f.getSymbolInstanceTextSize(B,q,this.transform.zoom,ge),Ti=this.collisionIndex.placeCollisionBox(f,ht,Yt,new a.pointGeometry(0,0),O,A,y,G.predicate);return Ti&&Ti.box&&Ti.box.length&&(this.markUsedOrientation(f,ci,q),this.placedOrientations[q.crossTileID]=ci),Ti};Bt(()=>xt(Mt,a.WritingMode.horizontal),()=>{const Yt=_e.verticalTextBox;return f.allowVerticalPlacement&&q.numVerticalGlyphVertices>0&&Yt?(qt(Yt),xt(Yt,a.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),Pt(Ie&&Ie.box&&Ie.box.length)}}if(Ne=Ie,ze=Ne&&Ne.box&&Ne.box.length>0,Ve=Ne&&Ne.offscreen,Ce=Ne&&Ne.occluded,q.useRuntimeCollisionCircles){const Pt=f.text.placedSymbolArray.get(q.centerJustifiedTextSymbolIndex>=0?q.centerJustifiedTextSymbolIndex:q.verticalPlacedTextSymbolIndex),Bt=a.evaluateSizeForFeature(f.textSizeData,B,Pt),xt=g.get("text-padding");tt=this.collisionIndex.placeCollisionCircles(f,O,Pt,f.lineVertexArray,f.glyphOffsetArray,Bt,y,v,T,u,Z,G.predicate,q.collisionCircleDiameter*Bt/a.ONE_EM,xt,this.retainedQueryData[f.bucketInstanceId].tileID),ze=O||tt.circles.length>0&&!tt.collisionDetected,Ve=Ve&&tt.offscreen,Ce=tt.occluded}if(_e.iconFeatureIndex&&(Tt=_e.iconFeatureIndex),_e.iconBox){const Pt=Bt=>{qt(Bt);const xt=K&&Ee?Co(Ee.x,Ee.y,N,Z,this.transform.angle):new a.pointGeometry(0,0),Yt=f.getSymbolInstanceIconSize(P,this.transform.zoom,ge);return this.collisionIndex.placeCollisionBox(f,Yt,Bt,xt,X,A,y,G.predicate)};He&&He.box&&He.box.length&&_e.verticalIconBox?(Ue=Pt(_e.verticalIconBox),de=Ue.box.length>0):(Ue=Pt(_e.iconBox),de=Ue.box.length>0),Ve=Ve&&Ue.offscreen,Ae=Ue.occluded}const Ri=D||q.numHorizontalGlyphVertices===0&&q.numVerticalGlyphVertices===0,pr=F||q.numIconVertices===0;if(Ri||pr?pr?Ri||(de=de&&ze):ze=de&&ze:de=ze=de&&ze,ze&&Ne&&Ne.box&&this.collisionIndex.insertCollisionBox(Ne.box,g.get("text-ignore-placement"),f.bucketInstanceId,He&&He.box&&yt?yt:Ke,G.ID),de&&Ue&&this.collisionIndex.insertCollisionBox(Ue.box,g.get("icon-ignore-placement"),f.bucketInstanceId,Tt,G.ID),tt&&(ze&&this.collisionIndex.insertCollisionCircles(tt.circles,g.get("text-ignore-placement"),f.bucketInstanceId,Ke,G.ID),u)){const Pt=f.bucketInstanceId;let Bt=this.collisionCircleArrays[Pt];Bt===void 0&&(Bt=this.collisionCircleArrays[Pt]=new Sa);for(let xt=0;xt<tt.circles.length;
vendor: 10,103 bytes, line 8
8xt+=4)Bt.circles.push(tt.circles[xt+0]),Bt.circles.push(tt.circles[xt+1]),Bt.circles.push(tt.circles[xt+2]),Bt.circles.push(tt.collisionDetected?1:0)}const Pr=f.projection.name!=="globe";he=he&&(Pr||!Ce),ce=ce&&(Pr||!Ae),this.placements[q.crossTileID]=new un(ze||he,de||ce,Ve||f.justReloaded),o[q.crossTileID]=!0};if(le){const q=f.getSortedSymbolIndexes(this.transform.angle);for(let ge=q.length-1;ge>=0;--ge){const _e=q[ge];ae(f.symbolInstances.get(_e),_e,f.collisionArrays[_e])}}else for(let q=t.symbolInstanceStart;q<t.symbolInstanceEnd;q++)ae(f.symbolInstances.get(q),q,f.collisionArrays[q]);if(u&&f.bucketInstanceId in this.collisionCircleArrays){const q=this.collisionCircleArrays[f.bucketInstanceId];a.invert(q.invProjMatrix,y),q.viewportMatrix=this.collisionIndex.getViewportMatrix()}f.justReloaded=!1}markUsedJustification(t,o,u,p){let f;f=p===a.WritingMode.vertical?u.verticalPlacedTextSymbolIndex:{left:u.leftJustifiedTextSymbolIndex,center:u.centerJustifiedTextSymbolIndex,right:u.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(o)];const g=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex,u.verticalPlacedTextSymbolIndex];for(const y of g)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=f>=0&&y!==f?0:u.crossTileID)}markUsedOrientation(t,o,u){const p=o===a.WritingMode.horizontal||o===a.WritingMode.horizontalOnly?o:0,f=o===a.WritingMode.vertical?o:0,g=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex];for(const y of g)t.text.placedSymbolArray.get(y).placedOrientation=p;u.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(u.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let u=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const p=o?o.symbolFadeChange(t):1,f=o?o.opacities:{},g=o?o.variableOffsets:{},y=o?o.placedOrientations:{};for(const v in this.placements){const T=this.placements[v],S=f[v];S?(this.opacities[v]=new jt(S,p,T.text,T.icon,null,T.clipped),u=u||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[v]=new jt(null,p,T.text,T.icon,T.skipFade,T.clipped),u=u||T.text||T.icon)}for(const v in f){const T=f[v];if(!this.opacities[v]){const S=new jt(T,p,!1,!1);S.isHidden()||(this.opacities[v]=S,u=u||T.text.placed||T.icon.placed)}}for(const v in g)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=g[v]);for(const v in y)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=y[v]);u?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o){const u={};for(const p of o){const f=p.getBucket(t);f&&p.latestFeatureIndex&&t.id===f.layerIds[0]&&this.updateBucketOpacities(f,u,p.collisionBoxArray)}}updateBucketOpacities(t,o,u){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const p=t.layers[0].layout,f=!!t.layers[0].dynamicFilter(),g=new jt(null,0,!1,!1,!0),y=p.get("text-allow-overlap"),v=p.get("icon-allow-overlap"),T=p.get("text-variable-anchor"),S=p.get("text-rotation-alignment")==="map",A=p.get("text-pitch-alignment")==="map",k=p.get("icon-text-fit")!=="none",L=new jt(null,0,y&&(v||!t.hasIconData()||p.get("icon-optional")),v&&(y||!t.hasTextData()||p.get("text-optional")),!0);!t.collisionArrays&&u&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(u);const B=(G,D,F)=>{for(let O=0;O<D/4;O++)G.opacityVertexArray.emplaceBack(F)};let P=0;for(let G=0;G<t.symbolInstances.length;G++){const D=t.symbolInstances.get(G),{numHorizontalGlyphVertices:F,numVerticalGlyphVertices:O,crossTileID:X}=D;let N=this.opacities[X];o[X]?N=g:N||(N=L,this.opacities[X]=N),o[X]=!0;const Z=F>0||O>0,K=D.numIconVertices>0,le=this.placedOrientations[D.crossTileID],he=le===a.WritingMode.vertical,ce=le===a.WritingMode.horizontal||le===a.WritingMode.horizontalOnly;if(!Z&&!K||N.isHidden()||P++,Z){const ae=zr(N.text);B(t.text,F,he?hn:ae),B(t.text,O,ce?hn:ae);const q=N.text.isHidden();[D.rightJustifiedTextSymbolIndex,D.centerJustifiedTextSymbolIndex,D.leftJustifiedTextSymbolIndex].forEach(ze=>{ze>=0&&(t.text.placedSymbolArray.get(ze).hidden=q||he?1:0)}),D.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(D.verticalPlacedTextSymbolIndex).hidden=q||ce?1:0);const ge=this.variableOffsets[D.crossTileID];ge&&this.markUsedJustification(t,ge.anchor,D,le);const _e=this.placedOrientations[D.crossTileID];_e&&(this.markUsedJustification(t,"left",D,_e),this.markUsedOrientation(t,_e,D))}if(K){const ae=zr(N.icon);D.placedIconSymbolIndex>=0&&(B(t.icon,D.numIconVertices,he?hn:ae),t.icon.placedSymbolArray.get(D.placedIconSymbolIndex).hidden=N.icon.isHidden()),D.verticalPlacedIconSymbolIndex>=0&&(B(t.icon,D.numVerticalIconVertices,ce?hn:ae),t.icon.placedSymbolArray.get(D.verticalPlacedIconSymbolIndex).hidden=N.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ae=t.collisionArrays[G];if(ae){let q=new a.pointGeometry(0,0),ge=!0;if(ae.textBox||ae.verticalTextBox){if(T){const ze=this.variableOffsets[X];ze?(q=bs(ze.anchor,ze.width,ze.height,ze.textOffset,ze.textScale),S&&q._rotate(A?this.transform.angle:-this.transform.angle)):ge=!1}f&&(ge=!N.clipped),ae.textBox&&Nr(t.textCollisionBox.collisionVertexArray,N.text.placed,!ge||he,q.x,q.y),ae.verticalTextBox&&Nr(t.textCollisionBox.collisionVertexArray,N.text.placed,!ge||ce,q.x,q.y)}const _e=ge&&Boolean(!ce&&ae.verticalIconBox);ae.iconBox&&Nr(t.iconCollisionBox.collisionVertexArray,N.icon.placed,_e,k?q.x:0,k?q.y:0),ae.verticalIconBox&&Nr(t.iconCollisionBox.collisionVertexArray,N.icon.placed,!_e,k?q.x:0,k?q.y:0)}}}if(t.fullyClipped=P===0,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.bucketInstanceId in this.collisionCircleArrays){const G=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=G.invProjMatrix,t.placementViewportMatrix=G.viewportMatrix,t.collisionCircleArray=G.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,o){const u=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*u>t}setStale(){this.stale=!0}}function Nr(l,t,o,u,p){l.emplaceBack(t?1:0,o?1:0,u||0,p||0),l.emplaceBack(t?1:0,o?1:0,u||0,p||0),l.emplaceBack(t?1:0,o?1:0,u||0,p||0),l.emplaceBack(t?1:0,o?1:0,u||0,p||0)}const ws=Math.pow(2,25),vu=Math.pow(2,24),Ma=Math.pow(2,17),Vn=Math.pow(2,16),bu=Math.pow(2,9),Nl=Math.pow(2,8),jn=Math.pow(2,1);function zr(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,o=Math.floor(127*l.opacity);return o*ws+t*vu+o*Ma+t*Vn+o*bu+t*Nl+o*jn+t}const hn=0;class Gr{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,o,u,p,f){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(g,p,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((y,v)=>y.sortKey-v.sortKey));this._currentPartIndex<g.length;){const y=g[this._currentPartIndex];if(o.placeLayerBucketPart(y,this._seenCrossTileIDs,u,y.symbolInstanceStart===0),this._currentPartIndex++,f())return!0}return!1}}class Ia{constructor(t,o,u,p,f,g,y,v){this.placement=new Cr(t,f,g,y,v),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,o,u){const p=a.exported.now(),f=()=>{const g=a.exported.now()-p;return!this._forceFullPlacement&&g>2};for(;this._currentPlacementIndex>=0;){const g=o[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(g.type==="symbol"&&(!g.minzoom||g.minzoom<=y)&&(!g.maxzoom||g.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new Gr(g)),this._inProgressLayer.continuePlacement(u[g.source],this.placement,this._showCollisionBoxes,g,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ts=512/a.EXTENT/2;class wu{constructor(t,o,u){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=u;for(let p=0;p<o.length;p++){const f=o.get(p),g=f.key;this.indexedSymbolInstances[g]||(this.indexedSymbolInstances[g]=[]),this.indexedSymbolInstances[g].push({crossTileID:f.crossTileID,coord:this.getScaledCoordinates(f,t)})}}getScaledCoordinates(t,o){const u=Ts/Math.pow(2,o.canonical.z-this.tileID.canonical.z);return{x:Math.floor((o.canonical.x*a.EXTENT+t.tileAnchorX)*u),y:Math.floor((o.canonical.y*a.EXTENT+t.tileAnchorY)*u)}}
8findMatches(t,o,u){const p=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z);for(let f=0;f<t.length;f++){const g=t.get(f);if(g.crossTileID)continue;const y=this.indexedSymbolInstances[g.key];if(!y)continue;const v=this.getScaledCoordinates(g,o);for(const T of y)if(Math.abs(T.coord.x-v.x)<=p&&Math.abs(T.coord.y-v.y)<=p&&!u[T.crossTileID]){u[T.crossTileID]=!0,g.crossTileID=T.crossTileID;break}}}}class Tu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Aa{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const o=Math.round((t-this.lng)/360);if(o!==0)for(const u in this.indexes){const p=this.indexes[u],f={};for(const g in p){const y=p[g];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),f[y.tileID.key]=y}this.indexes[u]=f}this.lng=t}addBucket(t,o,u){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let f=0;f<o.symbolInstances.length;f++)o.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const p=this.usedCrossTileIDs[t.overscaledZ];for(const f in this.indexes){const g=this.indexes[f];if(Number(f)>t.overscaledZ)for(const y in g){const v=g[y];v.tileID.isChildOf(t)&&v.findMatches(o.symbolInstances,t,p)}else{const y=g[t.scaledTo(Number(f)).key];y&&y.findMatches(o.symbolInstances,t,p)}}for(let f=0;f<o.symbolInstances.length;f++){const g=o.symbolInstances.get(f);g.crossTileID||(g.crossTileID=u.generate(),p[g.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new wu(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(const u in o.indexedSymbolInstances)for(const p of o.indexedSymbolInstances[u])delete this.usedCrossTileIDs[t][p.crossTileID]}removeStaleBuckets(t){let o=!1;for(const u in this.indexes){const p=this.indexes[u];for(const f in p)t[p[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,p[f]),delete p[f],o=!0)}return o}}class Gl{constructor(){this.layerIndexes={},this.crossTileIDs=new Tu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,u,p){let f=this.layerIndexes[t.id];f===void 0&&(f=this.layerIndexes[t.id]=new Aa);let g=!1;const y={};p.name!=="globe"&&f.handleWrapJump(u);for(const v of o){const T=v.getBucket(t);T&&t.id===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),f.addBucket(v.tileID,T,this.crossTileIDs)&&(g=!0),y[T.bucketInstanceId]=!0)}return f.removeStaleBuckets(y)&&(g=!0),g}pruneUnusedLayers(t){const o={};t.forEach(u=>{o[u]=!0});for(const u in this.layerIndexes)o[u]||delete this.layerIndexes[u]}}const zo=(l,t)=>a.emitValidationErrors(l,t&&t.filter(o=>o.identifier!=="source.canvas")),Eu=a.pick(re,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Zl=a.pick(re,["setCenter","setZoom","setBearing","setPitch"]),Su={version:8,layers:[],sources:{}},Ca={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class er extends a.Evented{constructor(t,o={}){super(),this.map=t,this.dispatcher=new fi(_t(),this),this.imageManager=new wa,this.imageManager.setEventedParent(this),this.glyphManager=new a.GlyphManager(t._requestManager,o.localFontFamily?a.LocalGlyphMode.all:o.localIdeographFontFamily?a.LocalGlyphMode.ideographs:a.LocalGlyphMode.none,o.localFontFamily||o.localIdeographFontFamily),this.lineAtlas=new a.LineAtlas(256,512),this.crossTileSymbolIndex=new Gl,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedU
8pdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const u=this;this._rtlTextPluginCallback=er.registerForPluginStateChange(p=>{u.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:p.pluginStatus,pluginURL:p.pluginURL},(f,g)=>{if(a.triggerPluginCompletionEvent(f),g&&g.every(y=>y))for(const y in u._sourceCaches){const v=u._sourceCaches[y],T=v.getSource().type;T!=="vector"&&T!=="geojson"||v.reload()}})}),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const f=this.getSource(p.sourceId);if(f&&f.vectorLayerIds)for(const g in this._layers){const y=this._layers[g];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,o={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const u=typeof o.validate=="boolean"?o.validate:!a.isMapboxURL(t);t=this.map._requestManager.normalizeStyleURL(t,o.accessToken);const p=this.map._requestManager.transformRequest(t,a.ResourceType.Style);this._request=a.getJSON(p,(f,g)=>{this._request=null,f?this.fire(new a.ErrorEvent(f)):g&&this._load(g,u)})}loadJSON(t,o={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(t,o.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(Su,!1)}_updateLayerCount(t,o){const u=o?1:-1;t.is3D()&&(this._num3DLayers+=u),t.type==="circle"&&(this._numCircleLayers+=u),t.type==="symbol"&&(this._numSymbolLayers+=u)}_load(t,o){if(o&&zo(this,a.validateStyle(t)))return;this._loaded=!0,this.stylesheet=a.clone$1(t),this._updateMapProjection();for(const p in t.sources)this.addSource(p,t.sources[p],{validate:!1});this._changed=!1,t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(t.glyphs);const u=bt(this.stylesheet.layers);this._order=u.map(p=>p.id),this._layers={},this._serializedLayers={};for(let p of u)p=a.createStyleLayer(p),p.setEventedParent(this,{layer:{id:p.id}}),this._layers[p.id]=p,this._serializedLayers[p.id]=p.serialize(),this._updateLayerCount(p,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new us(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.map._explicitProjection||this.map._updateProjection()}_updateMapProjection(){this.map._explicitProjection?this.applyProjectionUpdate():this.map._updateProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_loadSprite(t){this._spriteRequest=function(o,u,p){let f,g,y;const v=a.exported.devicePixelRatio>1?"@2x":"";let T=a.getJSON(u.transformRequest(u.normalizeSpriteURL(o,v,".json"),a.ResourceType.SpriteJSON),(k,L)=>{T=null,y||(y=k,f=L,A())}),S=a.getImage(u.transformRequest(u.normalizeSpriteURL(o,v,".png"),a.ResourceType.SpriteImage),(k,L)=>{S=null,y||(y=k,g=L,A())});function A(){if(y)p(y);else if(f&&g){const k=a.exported.getImageData(g),L={};for(const B in f){const{width:P,height:G,x:D,y:F,sdf:O,pixelRatio:X,stretchX:N,stretchY:Z,content:K}=f[B],le=new a.RGBAImage({width:P,height:G});a.RGBAImage.copy(k,le,{x:D,y:F},{x:0,y:0},{width:P,height:G}),L[B]={data:le,pixelRatio:X,sdf:O,stretchX:N,stretchY:Z,content:K}}p(null,L)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(t,this.map._requestManager,(o,u)=>{if(this._spriteRequest=null,o)this.fire(new a.ErrorEvent(o));else if(u)for(const p in u)this.imageManager.addImage(p,u[p]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(t){const o=this.getSource(t.source);if(!o)return;const u=t.sourceLayer;u&&(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(u)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${u}" does not exist on source "${o.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const o=[];for(const u of t){const p=this._layers[u];p.type!=="custom"&&o.push(p.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.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}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(t){return!!this.terrain&&Ca[t.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(t){if(!this._loaded)return;const o=this._changed;if(this._changed){const p=Object.keys(this._updatedLayers),f=Object.keys(this._removedLayers);(p.length||f.length)&&this._updateWorkerLayers(p,f);for(const g in this._updatedSources){const y=this._updatedSources[g];y==="reload"?this._reloadSource(g):y==="clear"&&this._clearSource(g)}this._updateTilesForChangedImages();for(const g in this._updatedPaintProps)this._layers[g].updateTransitions(t);this.light.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._resetUpdates()}const u={};for(const p in this._sourceCaches){const f=this._sourceCaches[p];u[p]=f.used,f.used=!1}for(const p of this._order){const f=this._layers[p];if(f.recalculate(t,this._availableImages),!f.isHidden(t.zoom)){const y=this._getLayerSourceCache(f);y&&(y.used=!0)}const g=this.map.painter;if(g){const y=f.getProgramIds();if(!y)continue;const v=f.getProgramConfiguration(t.zoom);for(const T of y)g.useProgram(T,v)}}for(const p in u){const f=this._sourceCaches[p];u[p]!==f.used&&f.getSource().fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:f.getSource().id}))}this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedU
8pdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),o&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const o in this._sourceCaches)this._sourceCaches[o].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,o){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:o})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(t){if(this._checkLoaded(),zo(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=bt(t.layers);const o=function(p,f){if(!p)return[{command:re.setStyle,args:[f]}];let g=[];try{if(!Se(p.version,f.version))return[{command:re.setStyle,args:[f]}];Se(p.center,f.center)||g.push({command:re.setCenter,args:[f.center]}),Se(p.zoom,f.zoom)||g.push({command:re.setZoom,args:[f.zoom]}),Se(p.bearing,f.bearing)||g.push({command:re.setBearing,args:[f.bearing]}),Se(p.pitch,f.pitch)||g.push({command:re.setPitch,args:[f.pitch]}),Se(p.sprite,f.sprite)||g.push({command:re.setSprite,args:[f.sprite]}),Se(p.glyphs,f.glyphs)||g.push({command:re.setGlyphs,args:[f.glyphs]}),Se(p.transition,f.transition)||g.push({command:re.setTransition,args:[f.transition]}),Se(p.light,f.light)||g.push({command:re.setLight,args:[f.light]}),Se(p.fog,f.fog)||g.push({command:re.setFog,args:[f.fog]}),Se(p.projection,f.projection)||g.push({command:re.setProjection,args:[f.projection]});const y={},v=[];(function(A,k,L,B){let P;for(P in k=k||{},A=A||{})A.hasOwnProperty(P)&&(k.hasOwnProperty(P)||Ft(P,L,B));for(P in k)k.hasOwnProperty(P)&&(A.hasOwnProperty(P)?Se(A[P],k[P])||(A[P].type==="geojson"&&k[P].type==="geojson"&&xu(A,k,P)?L.push({command:re.setGeoJSONSourceData,args:[P,k[P].data]}):Vi(P,k,L,B)):Li(P,k,L))})(p.sources,f.sources,v,y);const T=[];p.layers&&p.layers.forEach(A=>{A.source&&y[A.source]?g.push({command:re.removeLayer,args:[A.id]}):T.push(A)});let S=p.terrain;S&&y[S.source]&&(g.push({command:re.setTerrain,args:[void 0]}),S=void 0),g=g.concat(v),Se(S,f.terrain)||g.push({command:re.setTerrain,args:[f.terrain]}),function(A,k,L){k=k||[];const B=(A=A||[]).map(ys),P=k.map(ys),G=A.reduce(Ul,{}),D=k.reduce(Ul,{}),F=B.slice(),O=Object.create(null);let X,N,Z,K,le,he,ce;for(X=0,N=0;X<B.length;X++)Z=B[X],D.hasOwnProperty(Z)?N++:(L.push({command:re.removeLayer,args:[Z]}),F.splice(F.indexOf(Z,N),1));for(X=0,N=0;X<P.length;X++)Z=P[P.length-1-X],F[F.length-1-X]!==Z&&(G.hasOwnProperty(Z)?(L.push({command:re.removeLayer,args:[Z]}),F.splice(F.lastIndexOf(Z,F.length-N),1)):N++,he=F[F.length-X],L.push({command:re.addLayer,args:[D[Z],he]}),F.splice(F.length-X,0,Z),O[Z]=!0);for(X=0;X<P.length;X++)if(Z=P[X],K=G[Z],le=D[Z],!O[Z]&&!Se(K,le))if(Se(K.source,le.source)&&Se(K["source-layer"],le["source-layer"])&&Se(K.type,le.type)){for(ce in Bi(K.layout,le.layout,L,Z,null,re.setLayoutProperty),Bi(K.paint,le.paint,L,Z,null,re.setPaintProperty),Se(K.filter,le.filter)||L.push({command:re.setFilter,args:[Z,le.filter]}),Se(K.minzoom,le.minzoom)&&Se(K.maxzoom,le.maxzoom)||L.push({command:re.setLayerZoomRange,args:[Z,le.minzoom,le.maxzoom]}),K)K.hasOwnProperty(ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?Bi(K[ce],le[ce],L,Z,ce.slice(6),re.setPaintProperty):Se(K[ce],le[ce])||L.push({command:re.setLayerProperty,args:[Z,ce,le[ce]]}));for(ce in le)le.hasOwnProperty(ce)&&!K.hasOwnProperty(ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?Bi(K[ce],le[ce],L,Z,ce.slice(6),re.setPaintProperty):Se(K[ce],le[ce])||L.push({command:re.setLayerProperty,args:[Z,ce,le[ce]]}))}else L.push({command:re.removeLayer,args:[Z]}),he=F[F.lastIndexOf(Z)+1],L.push({command:re.addLayer,args:[le,he]})}(T,f.layers,g)}catch(y){console.warn("Unable to compute style diff:",y),g=[{command:re.setStyle,args:[f]}]}return g}(this.serialize(),t).filter(p=>!(p.command in Zl));if(o.length===0)return!1;const u=o.filter(p=>!(p.command in Eu));if(u.length>0)throw new Error(`Unimplemented: ${u.map(p=>p.command).join(", ")}.`);return o.forEach(p=>{p.command!=="setTransition"&&this[p.command].apply(this,p.args)}),this.stylesheet=t,this._updateMapProjection(),!0}addImage(t,o){return this.getImage(t)?this.fire(new a.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,o),this._afterImageUpdated(t),this)}updateImage(t,o){this.imageManager.updateImage(t,o)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t),this):this.fire(new a.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(t,o,u={}
8){if(this._checkLoaded(),this.getSource(t)!==void 0)throw new Error("There is already a source with this ID");if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(a.validateSource,`sources.${t}`,o,null,u))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const p=oe(t,o,this.dispatcher,this);p.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(t),source:p.serialize(),sourceId:t}));const f=g=>{const y=(g?"symbol:":"other:")+t,v=this._sourceCaches[y]=new a.SourceCache(y,p,g);(g?this._symbolSourceCaches:this._otherSourceCaches)[t]=v,v.style=this,v.onAdd(this.map)};f(!1),o.type!=="vector"&&o.type!=="geojson"||f(!0),p.onAdd&&p.onAdd(this.map),this._changed=!0}removeSource(t){this._checkLoaded();const o=this.getSource(t);if(!o)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===t)return this.fire(new a.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${p}" is using it.`)));if(this.terrain&&this.terrain.get().source===t)return this.fire(new a.ErrorEvent(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const u=this._getSourceCaches(t);for(const p of u)delete this._sourceCaches[p.id],delete this._updatedSources[p.id],p.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:p.getSource().id})),p.setEventedParent(null),p.clearTiles();return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this._changed=!0,this}
8setGeoJSONSourceData(t,o){this._checkLoaded(),this.getSource(t).setData(o),this._changed=!0}getSource(t){const o=this._getSourceCache(t);return o&&o.getSource()}addLayer(t,o,u={}){this._checkLoaded();const p=t.id;if(this.getLayer(p))return void this.fire(new a.ErrorEvent(new Error(`Layer with id "${p}" already exists on this map`)));let f;if(t.type==="custom"){if(zo(this,a.validateCustomStyleLayer(t)))return;f=a.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(p,t.source),t=a.clone$1(t),t=a.extend(t,{source:p})),this._validate(a.validateLayer,`layers.${p}`,t,{arrayIndex:-1},u))return;f=a.createStyleLayer(t),this._validateLayer(f),f.setEventedParent(this,{layer:{id:p}}),this._serializedLayers[f.id]=f.serialize(),this._updateLayerCount(f,!0)}const g=o?this._order.indexOf(o):this._order.length;if(o&&g===-1)return void this.fire(new a.ErrorEvent(new Error(`Layer with id "${o}" does not exist on this map.`)));this._order.splice(g,0,p),this._layerOrderChanged=!0,this._layers[p]=f;const y=this._getLayerSourceCache(f);if(this._removedLayers[p]&&f.source&&y&&f.type!=="custom"){const v=this._removedLayers[p];delete this._removedLayers[p],v.type!==f.type?this._updatedSources[f.source]="clear":(this._updatedSources[f.source]="reload",y.pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(t,o){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===o)return;const u=this._order.indexOf(t);this._order.splice(u,1);const p=o?this._order.indexOf(o):this._order.length;
8o&&p===-1?this.fire(new a.ErrorEvent(new Error(`Layer with id "${o}" does not exist on this map.`))):(this._order.splice(p,0,t),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(t){this._checkLoaded();const o=this._layers[t];if(!o)return void this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be removed.`)));o.setEventedParent(null),this._updateLayerCount(o,!1);const u=this._order.indexOf(t);this._order.splice(u,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=o,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],o.onRemove&&o.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}hasLayerType(t){for(const o in this._layers)if(this._layers[o].type===t)return!0;return!1}setLayerZoomRange(t,o,u){this._checkLoaded();const p=this.getLayer(t);p?p.minzoom===o&&p.maxzoom===u||(o!=null&&(p.minzoom=o),u!=null&&(p.maxzoom=u),this._updateLayer(p)):this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(t,o,u={}){this._checkLoaded();const p=this.getLayer(t);if(p){if(!Se(p.filter,o))return o==null?(p.filter=void 0,void this._updateLayer(p)):void(this._validate(a.validateFilter,`layers.${p.id}.filter`,o,{layerType:p.type},u)||(p.filter=a.clone$1(o),this._updateLayer(p)))}else this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be filtered.`)))}getFilter(t){const o=this.getLayer(t);return o&&a.clone$1(o.filter)}setLayoutProperty(t,o,u,p={}){this._checkLoaded();const f=this.getLayer(t);f?Se(f.getLayoutProperty(o),u)||(f.setLayoutProperty(o,u,p),this._updateLayer(f)):this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(t,o){const u=this.getLayer(t);if(u)return u.getLayoutProperty(o);this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style.`)))}setPaintProperty(t,o,u,p={}){this._checkLoaded();const f=this.getLayer(t);f?Se(f.getPaintProperty(o),u)||(f.setPaintProperty(o,u,p)&&this._updateLayer(f),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(t,o){const u=this.getLayer(t);return u&&u.getPaintProperty(o)}setFeatureState(t,o){this._checkLoaded();const u=t.source,p=t.sourceLayer,f=this.getSource(u);if(!f)return void this.fire(new a.ErrorEvent(new Error(`The source '${u}' does not exist in the map's style.`)));const g=f.type;if(g==="geojson"&&p)return void this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(g==="vector"&&!p)return void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided.")));const y=this._getSourceCaches(u);for(const v of y)v.setFeatureState(p,t.id,o)}removeFeatureState(t,o){this._checkLoaded();const u=t.source,p=this.getSource(u);if(!p)return void this.fire(new a.ErrorEvent(new Error(`The source '${u}' does not exist in the map's style.`)));const f=p.type,g=f==="vector"?t.sourceLayer:void 0;if(f==="vector"&&!g)return void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const y=this._getSourceCaches(u);for(const v of y)v.removeFeatureState(g,t.id,o)}getFeatureState(t){this._checkLoaded();const o=t.source,u=t.sourceLayer,p=this.getSource(o);if(p){if(p.type!=="vector"||u)return t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(o)[0].getFeatureState(u,t.id);this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new a.ErrorEvent(new Error(`The source '${o}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t={};for(const o in this._sourceCaches){const u=this._sourceCaches[o].getSource();
8t[u.id]||(t[u.id]=u.serialize())}return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:t,layers:this._serializeLayers(this._order)},o=>o!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0;const o=this._getLayerSourceCache(t);t.source&&!this._updatedSources[t.source]&&o&&o.getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",o.pause()),this._changed=!0,t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const o=g=>this._layers[g].type==="fill-extrusion",u={},p=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(o(y)){u[y]=g;for(const v of t){const T=v[y];if(T)for(const S of T)p.push(S)}}}p.sort((g,y)=>y.intersectionZ-g.intersectionZ);const f=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(o(y))for(let v=p.length-1;v>=0;v--){const T=p[v].feature;if(u[T.layer.id]<g)break;f.push(T),p.pop()}else for(const v of t){const T=v[y];if(T)for(const S of T)f.push(S.feature)}}return f}queryRenderedFeatures(t,o,u){o&&o.filter&&this._validate(a.validateFilter,"queryRenderedFeatures.filter",o.filter,null,o);const p={};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const v of o.layers){const T=this._layers[v];if(!T)return this.fire(new a.ErrorEvent(new Error(`The layer '${v}' does not exist in the map's style and cannot be queried for features.`))),[];p[T.source]=!0}}const f=[];o.availableImages=this._availableImages;const g=o&&o.layers?o.layers.some(v=>{const T=this.getLayer(v);return T&&T.is3D()}):this.has3DLayers(),y=ki.createFromScreenPoints(t,u);for(const v in this._sourceCaches){const T=this._sourceCaches[v].getSource().id;o.layers&&!p[T]||f.push(Le(this._sourceCaches[v],this._layers,this._serializedLayers,y,o,u,g,!!this.map._showQueryGeometry))}return this.placement&&f.push(function(v,T,S,A,k,L,B){const P={},G=L.queryRenderedSymbols(A),D=[];for(const F of Object.keys(G).map(Number))D.push(B[F]);D.sort(Ge);for(const F of D){const O=F.featureIndex.lookupSymbolFeatures(G[F.bucketInstanceId],T,F.bucketIndex,F.sourceLayerIndex,k.filter,k.layers,k.availableImages,v);for(const X in O){const N=P[X]=P[X]||[],Z=O[X];Z.sort((K,le)=>{const he=F.featureSortOrder;if(he){const ce=he.indexOf(K.featureIndex);return he.indexOf(le.featureIndex)-ce}return le.featureIndex-K.featureIndex});for(const K of Z)N.push(K)}}for(const F in P)P[F].forEach(O=>{const X=O.feature,N=S(v[F]).getFeatureState(X.layer["source-layer"],X.id);X.source=X.layer.source,X.layer["source-layer"]&&(X.sourceLayer=X.layer["source-layer"]),X.state=N});return P}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),y.screenGeometry,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(f)}querySourceFeatures(t,o){o&&o.filter&&this._validate(a.validateFilter,"querySourceFeatures.filter",o.filter,null,o);const u=this._getSourceCaches(t);let p=[];for(const f of u)p=p.concat(ve(f,o));return p}addSourceType(t,o,u){return er.getSourceType(t)?u(new Error(`A source type called "${t}" already exists.`)):(er.setSourceType(t,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:o.workerSourceURL},u):u(null,null))}getLight(){return this.light.getLight()}setLight(t,o={}){this._checkLoaded();const u=this.light.getLight();let p=!1;for(const g in t)if(!Se(t[g],u[g])){p=!0;break}if(!p)return;const f=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(t,o),this.light.updateTransitions(f)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(t,o=1){if(this._checkLoaded(),!t)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedU
8pdate=!0);if(o===1){if(typeof t.source=="object"){const u="terrain-dem-src";this.addSource(u,t.source),t=a.clone$1(t),t=a.extend(t,{source:u})}if(this._validate(a.validateTerrain,"terrain",t))return}if(!this.terrain||this.terrain&&o!==this.terrain.drapeRenderMode)this._createTerrain(t,o);else{const u=this.terrain,p=u.get();for(const f of Object.keys(a.spec.terrain))!t.hasOwnProperty(f)&&a.spec.terrain[f].default&&(t[f]=a.spec.terrain[f].default);for(const f in t)if(!Se(t[f],p[f])){u.set(t),this.stylesheet.terrain=t;const g=this._setTransitionParameters({duration:0});u.updateTransitions(g);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const o=this.fog=new Nt(t,this.map.transform);this.stylesheet.fog=t;const u=this._setTransitionParameters({duration:0});o.updateTransitions(u)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const o=this.fog,u=o.get();Object.keys(t).length===0&&o.set(t);for(const p in t)if(!Se(t[p],u[p])){o.set(t),this.stylesheet.fog=t;const f=this._setTransitionParameters({duration:0});o.updateTransitions(f);break}}else this._createFog(t);this._markersNeedUpdate=!0}_setTransitionParameters(t){return{now:a.exported.now(),transition:a.extend(t,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const t=this._order.filter(u=>this.isLayerDraped(this._layers[u])),o=this._order.filter(u=>!this.isLayerDraped(this._layers[u]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...o)}_createTerrain(t,o){const u=this.terrain=new kn(t,o);this.stylesheet.terrain=t,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const p=this._setTransitionParameters({duration:0});u.updateTransitions(p)}_force3DLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="symbol"&&this._updateLayer(o)}}_validate(t,o,u,p,f={}){return(!f||f.validate!==!1)&&zo(this,t.call(a.validateStyle,a.extend({key:o,style:this.serialize(),value:u,styleSpec:a.spec},p)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this._sourceCaches)this._sourceCaches[t].clearTiles(),this._sourceCaches[t].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){const o=this._getSourceCaches(t);for(const u of o)u.clearTiles()}_reloadSource(t){const o=this._getSourceCaches(t);for(const u of o)u.resume(),u.reload()}_updateSources(t){for(const o in this._sourceCaches)this._sourceCaches[o].update(t)}_generateCollisionBoxes(){for(const t in this._sourceCaches){const o=this._sourceCaches[t];o.resume(),o.reload()}}_updatePlacement(t,o,u,p,f=!1){let g=!1,y=!1;const v={};for(const T of this._order){const S=this._layers[T];if(S.type!=="symbol")continue;if(!v[S.source]){const k=this._getLayerSourceCache(S);if(!k)continue;v[S.source]=k.getRenderableIds(!0).map(L=>k.getTileByID(L)).sort((L,B)=>B.tileID.overscaledZ-L.tileID.overscaledZ||(L.tileID.isLessThan(B.tileID)?-1:1))}const A=this.crossTileSymbolIndex.addLayer(S,v[S.source],t.center.lng,t.projection);g=g||A}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),f=f||this._layerOrderChanged||u===0,this._layerOrderChanged&&this.fire(new a.Event("neworder")),(f||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),t.zoom))&&(this.pauseablePlacement=new Ia(t,this._order,f,o,u,p,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,v),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),y=!0),g&&this.pauseablePlacement.placement.setStale()),y||g)for(const T of this._order){const S=this._layers[T];S.type==="symbol"&&this.placement.updateLayerOpacities(S,v[S.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,o,u){this.imageManager.getImages(o.icons,u),this._updateTilesForChangedImages();const p=f=>{f&&f.setDependencies(o.tileID.key,o.type,o.icons)};p(this._otherSourceCaches[o.source]),p(this._symbolSourceCaches[o.source])}getGlyphs(t,o,u){this.glyphManager.getGlyphs(o.stacks,u)}
8getResource(t,o,u){return a.makeRequest(o,u)}_getSourceCache(t){return this._otherSourceCaches[t]}_getLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}_getSourceCaches(t){const o=[];return this._otherSourceCaches[t]&&o.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&o.push(this._symbolSourceCaches[t]),o}_isSourceCacheLoaded(t){const o=this._getSourceCaches(t);return o.length===0?(this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${t}'`))),!1):o.every(u=>u.loaded())}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}er.getSourceType=function(l){return ee[l]},er.setSourceType=function(l,t){ee[l]=t},er.registerForPluginStateChange=a.registerForPluginStateChange;var za=` 9#define EPSILON 0.0000001 10#define PI 3.141592653589793 11#define EXTENT 8192.0 12#define HALF_PI PI/2.0 13#define QUARTER_PI PI/4.0 14#define RAD_TO_DEG 180.0/PI 15#define DEG_TO_RAD PI/180.0 16#define GLOBE_RADIUS EXTENT/PI/2.0`,ka="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}";let ko={},kr={};ko=gt("",` 17#define ELEVATION_SCALE 7.0 18#define ELEVATION_OFFSET 450.0 19#ifdef PROJECTION_GLOBE_VIEW 20uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 21mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} 22#else 23vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 24#endif 25#ifdef TERRAIN 26#ifdef TERRAIN_DEM_FLOAT_FORMAT 27uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev; 28#else 29uniform sampler2D u_dem;uniform sampler2D u_dem_prev; 30#endif 31uniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) { 32#ifdef TERRAIN_DEM_FLOAT_FORMAT 33vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a; 34#else 35float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos)); 36#ifdef TERRAIN_DEM_NEAREST_FILTER 37return u_exaggeration*tl; 38#endif 39float tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 40#endif 41}float prevElevation(vec2 apos) { 42#ifdef TERRAIN_DEM_FLOAT_FORMAT 43vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a; 44#else 45float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 46#endif 47} 48#ifdef TERRAIN_VERTEX_MORPHING 49float elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 50#else 51float elevation(vec2 apos) {return currentElevation(apos);} 52#endif 53float unpack_depth(vec4 rgba_depth) 54{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0,1.0
54);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4( 55unpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy)) 56);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) { 57#ifdef TERRAIN_DEM_FLOAT_FORMAT 58float tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a; 59#else 60vec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack); 61#endif 62return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} 63#else 64float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; } 65#endif`,!0),kr=gt(`#ifdef FOG 66uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 67mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} 68#endif`,`#ifdef FOG 69uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} 70#endif`,!0);const Es=gt(` 71highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}
71vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;} 72#ifdef TERRAIN 73highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 74#endif`,` 75float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 76#ifdef PROJECTION_GLOBE_VIEW 77vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 78#ifndef PROJECTED_POS_ON_VIEWPORT 79float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; 80#else 81return vec3(0.0); 82#endif 83}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} 84#endif 85vec2 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( 86unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 87);}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;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.`),Nn=za,Gn=` 88#ifdef GL_ES 89precision mediump float; 90#else 91 92#if !defined(lowp) 93#define lowp 94#endif 95 96#if !defined(mediump) 97#define mediump 98#endif 99 100#if !defined(highp) 101#define highp 102#endif 103 104#endif`;var Ss={background:gt(`uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color; 105#ifdef FOG 106out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 107#endif 108gl_FragColor=out_color*u_opacity; 109#ifdef OVERDRAW_INSPECTOR 110gl_FragColor=vec4(1.0); 111#endif 112}`,`attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 113#ifdef FOG 114v_fog_pos=fog_position(a_pos); 115#endif 116}`),backgroundPattern:gt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix); 117#ifdef FOG 118out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 119#endif 120gl_FragColor=out_color*u_opacity; 121#ifdef OVERDRAW_INSPECTOR 122gl_FragColor=vec4(1.0); 123#endif 124}`,`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); 125#ifdef FOG 126v_fog_pos=fog_position(a_pos); 127#endif 128}`),circle:gt(`varying vec3 v_data;varying float v_visibility; 129#pragma mapbox: define highp vec4 color 130#pragma mapbox: define mediump float radius 131#pragma mapbox: define lowp float blur 132#pragma mapbox: define lowp float opacity 133#pragma mapbox: define highp vec4 stroke_color 134#pragma mapbox: define mediump float stroke_width 135#pragma mapbox: define lowp float stroke_opacity 136void main() { 137#pragma mapbox: initialize highp vec4 color 138#pragma mapbox: initialize mediump float radius 139#pragma mapbox: initialize lowp float blur 140#pragma mapbox: initialize lowp float opacity 141#pragma mapbox: initialize highp vec4 stroke_color 142#pragma mapbox: initialize mediump float stroke_width 143#pragma mapbox: initialize lowp float stroke_opacity 144vec2 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(
145antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 146);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 147#ifdef FOG 148out_color=fog_apply_premultiplied(out_color,v_fog_pos); 149#endif 150gl_FragColor=out_color*(v_visibility*opacity_t); 151#ifdef OVERDRAW_INSPECTOR 152gl_FragColor=vec4(1.0); 153#endif 154}`,`#define NUM_VISIBILITY_RINGS 2 155#define INV_SQRT2 0.70710678 156#define ELEVATION_BIAS 0.0001 157#define NUM_SAMPLES_PER_RING 16 158uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos; 159#ifdef PROJECTION_GLOBE_VIEW 160attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 161#endif 162varying vec3 v_data;varying float v_visibility; 163#pragma mapbox: define highp vec4 color 164#pragma mapbox: define mediump float radius 165#pragma mapbox: define lowp float blur 166#pragma mapbox: define lowp float opacity 167#pragma mapbox: define highp vec4 stroke_color 168#pragma mapbox: define mediump float stroke_width 169#pragma mapbox: define lowp float stroke_opacity 170vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 171#if defined(TERRAIN) 172return elevation(pos)+ELEVATION_BIAS; 173#else 174return 0.0; 175#endif 176}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); 177#ifdef PITCH_WITH_MAP 178#ifdef PROJECTION_GLOBE_VIEW 179return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 180#else 181return u_matrix*( world_center+vec4(sample_offset,0,0) ); 182#endif 183#else 184return projected_center+vec4(sample_offset,0,0); 185#endif 186}float get_sample_step() { 187#ifdef PITCH_WITH_MAP 188return 2.0*PI/float(NUM_SAMPLES_PER_RING); 189#else 190return PI/float(NUM_SAMPLES_PER_RING); 191#endif 192}void main(void) { 193#pragma mapbox: initialize highp vec4 color 194#pragma mapbox: initialize mediump float radius 195#pragma mapbox: initialize lowp float blur 196#pragma mapbox: initialize lowp float opacity 197#pragma mapbox: initialize highp vec4 stroke_color 198#pragma mapbox: initialize mediump float stroke_width 199#pragma mapbox: initialize lowp float stroke_opacity 200vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5); 201#ifdef PROJECTION_GLOBE_VIEW 202vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);vec4 world_center=vec4(pos,1); 203#else 204mat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1); 205#endif 206vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 207#ifdef PITCH_WITH_MAP 208#ifdef SCALE_WITH_MAP 209view_scale=1.0; 210#else 211view_scale=projected_center.w/u_camera_to_center_distance; 212#endif 213#else 214#ifdef SCALE_WITH_MAP 215view_scale=u_camera_to_center_distance; 216#else 217view_scale=projected_center.w; 218#endif 219#endif 220gl_Position=project_vertex(extrude,world_center,projected_center,radiu
220s,stroke_width,view_scale,surface_vectors);float visibility=0.0; 221#ifdef TERRAIN 222float step=get_sample_step(); 223#ifdef PITCH_WITH_MAP 224float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center; 225#else 226vec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center; 227#endif 228for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); 229#else 230visibility=1.0; 231#endif 232#ifdef PROJECTION_GLOBE_VIEW 233visibility=1.0; 234#endif 235v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 236#ifdef FOG 237v_fog_pos=fog_position(world_center.xyz); 238#endif 239}`),clippingMask:gt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:gt(`uniform highp float u_intensity;varying vec2 v_extrude; 240#pragma mapbox: define highp float weight 241#define GAUSS_COEF 0.3989422804014327 242void main() { 243#pragma mapbox: initialize highp float weight 244float 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); 245#ifdef FOG 246if (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 247#endif 248#ifdef OVERDRAW_INSPECTOR 249gl_FragColor=vec4(1.0); 250#endif 251}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos; 252#ifdef PROJECTION_GLOBE_VIEW 253attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 254#endif 255varying vec2 v_extrude; 256#pragma mapbox: define highp float weight 257#pragma mapbox: define mediump float radius 258const highp float ZERO=1.0/255.0/16.0; 259#define GAUSS_COEF 0.3989422804014327 260void main(void) { 261#pragma mapbox: initialize highp float weight 262#pragma mapbox: initialize mediump float radius 263vec2 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;vec2 tilePos=floor(a_pos*0.5); 264#ifdef PROJECTION_GLOBE_VIEW 265vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 266#else 267vec3 pos=vec3(tilePos+extrude,elevation(tilePos)); 268#endif 269gl_Position=u_matrix*vec4(pos,1); 270#ifdef FOG 271v_fog_pos=fog_position(pos); 272#endif 273}`),heatmapTexture:gt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; 274#ifdef OVERDRAW_INSPECTOR 275gl_FragColor=vec4(0.0); 276#endif 277}`,"attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:gt("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;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_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 2780.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:gt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}",`attribute vec2 a_pos_2f;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_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( 279mix(-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( 2800.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:gt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}",`attribute vec2 a_pos; 281#ifdef PROJECTION_GLOBE_VIEW 282attribute vec3 a_pos_3; 283#endif 284varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; 285#ifdef PROJECTION_GLOBE_VIEW
286gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 287#else 288gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 289#endif 290}`),fill:gt(`#pragma mapbox: define highp vec4 color 291#pragma mapbox: define lowp float opacity 292void main() { 293#pragma mapbox: initialize highp vec4 color 294#pragma mapbox: initialize lowp float opacity 295vec4 out_color=color; 296#ifdef FOG 297out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 298#endif 299gl_FragColor=out_color*opacity; 300#ifdef OVERDRAW_INSPECTOR 301gl_FragColor=vec4(1.0); 302#endif 303}`,`attribute vec2 a_pos;uniform mat4 u_matrix; 304#pragma mapbox: define highp vec4 color 305#pragma mapbox: define lowp float opacity 306void main() { 307#pragma mapbox: initialize highp vec4 color 308#pragma mapbox: initialize lowp float opacity 309gl_Position=u_matrix*vec4(a_pos,0,1); 310#ifdef FOG 311v_fog_pos=fog_position(a_pos); 312#endif 313}`),fillOutline:gt(`varying vec2 v_pos; 314#pragma mapbox: define highp vec4 outline_color 315#pragma mapbox: define lowp float opacity 316void main() { 317#pragma mapbox: initialize highp vec4 outline_color 318#pragma mapbox: initialize lowp float opacity 319float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 320#ifdef FOG 321out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 322#endif 323gl_FragColor=out_color*(alpha*opacity); 324#ifdef OVERDRAW_INSPECTOR 325gl_FragColor=vec4(1.0); 326#endif 327}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; 328#pragma mapbox: define highp vec4 outline_color 329#pragma mapbox: define lowp float opacity 330void main() { 331#pragma mapbox: initialize highp vec4 outline_color 332#pragma mapbox: initialize lowp float opacity 333gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 334#ifdef FOG 335v_fog_pos=fog_position(a_pos); 336#endif 337}`),fillOutlinePattern:gt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; 338#pragma mapbox: define lowp float opacity 339#pragma mapbox: define lowp vec4 pattern_from 340#pragma mapbox: define lowp vec4 pattern_to 341void main() { 342#pragma mapbox: initialize lowp float opacity 343#pragma mapbox: initialize mediump vec4 pattern_from 344#pragma mapbox: initialize mediump vec4 pattern_to 345vec2 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);vec4 out_color=mix(color1,color2,u_fade); 346#ifdef FOG 347out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 348#endif 349gl_FragColor=out_color*(alpha*opacity); 350#ifdef OVERDRAW_INSPECTOR 351gl_FragColor=vec4(1.0); 352#endif 353}`,`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; 354#pragma mapbox: define lowp float opacity 355#pragma mapbox: define lowp vec4 pattern_from 356#pragma mapbox: define lowp vec4 pattern_to 357#pragma mapbox: define lowp float pixel_ratio_from 358#pragma mapbox: define lowp float pixel_ratio_to 359void main() { 360#pragma mapbox: initialize lowp float opacity 361#pragma mapbox: initialize mediump vec4 pattern_from 362#pragma mapbox: initialize mediump vec4 pattern_to 363#pragma mapbox: initialize lowp float pixel_ratio_from 364#pragma mapbox: initialize lowp float pixel_ratio_to 365vec2 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; 366#ifdef FOG 367v_fog_pos=fog_position(a_pos); 368#endif 369}`),fillPattern:gt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; 370#pragma mapbox: define lowp float opacity 371#pragma mapbox: define lowp vec4 pattern_from 372#pragma mapbox: define lowp vec4 pattern_to 373void main() { 374#pragma mapbox: initialize lowp float opacity 375#pragma mapbox: initialize mediump vec4 pattern_from 376#pragma mapbox: initialize mediump vec4 pattern_to 377vec2 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 out_color=mix(color1,color2,u_fade); 378#ifdef FOG 379out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 380#endif 381gl_FragColor=out_color*opacity; 382#ifdef OVERDRAW_INSPECTOR 383gl_FragColor=vec4(1.0); 384#endif 385}`,`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; 386#pragma mapbox: define lowp float opacity 387#pragma mapbox: define lowp vec4 pattern_from 388#pragma mapbox: define lowp vec4 pattern_to 389#pragma mapbox: define lowp float pixel_ratio_from 390#pragma mapbox: define lowp float pixel_ratio_to 391void main() { 392#pragma mapbox: initialize lowp float opacity 393#pragma mapbox: initialize mediump vec4 pattern_from 394#pragma mapbox: initialize mediump vec4 pattern_to 395#pragma mapbox: initialize lowp float pixel_ratio_from 396#pragma mapbox: initialize lowp float pixel_ratio_to 397vec2 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); 398#ifdef FOG 399v_fog_pos=fog_position(a_pos); 400#endif 401}`),fillExtrusion:gt(`varying vec4 v_color;void main() {vec4 color=v_color; 402#ifdef FOG 403color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 404#endif 405gl_FragColor=color; 406#ifdef OVERDRAW_INSPECTOR 407gl_FragColor=vec4(1.0); 408#endif 409}`,`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 vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos; 410#ifdef PROJECTION_GLOBE_VIEW 411attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 412#endif 413varying vec4 v_color; 414#pragma mapbox: define highp float base 415#pragma mapbox: define highp float height 416#pragma mapbox: define highp vec4 color 417void main() { 418#pragma mapbox: initialize highp float base 419#pragma mapbox: initialize highp float height 420#pragma mapbox: initialize highp vec4 color 421vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 422#if defined(HAS_CENTROID) || defined(TERRAIN) 423centroid_pos=a_centroid_pos; 424#endif 425#ifdef TERRAIN 426bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h); 427#else 428vec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 429#endif 430#ifdef PROJECTION_GLOBE_VIEW 431float lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(pos.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 432#endif 433float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);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,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*=( 434(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.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; 435#ifdef FOG 436v_fog_pos=fog_position(pos); 437#endif 438}`),fillExtrusionPattern:gt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; 439#pragma mapbox: define lowp float base 440#pragma mapbox: define lowp float height 441#pragma mapbox: define lowp vec4 pattern_from 442#pragma mapbox: define lowp vec4 pattern_to 443#pragma mapbox: define lowp float pixel_ratio_from 444#pragma mapbox: define lowp float pixel_ratio_to 445void main() { 446#pragma mapbox: initialize lowp float base 447#pragma mapbox: initialize lowp float height 448#pragma mapbox: initialize mediump vec4 pattern_from 449#pragma mapbox: initialize mediump vec4 pattern_to 450#pragma mapbox: initialize lowp float pixel_ratio_from 451#pragma mapbox: initialize lowp float pixel_ratio_to 452vec2 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 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting; 453#ifdef FOG 454out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 455#endif 456gl_FragColor=out_color; 457#ifdef OVERDRAW_INSPECTOR 458gl_FragColor=vec4(1.0); 459#endif 460}`,`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 vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos; 461#ifdef PROJECTION_GLOBE_VIEW 462attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 463#endif 464varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; 465#pragma mapbox: define lowp float base 466#pragma mapbox: define lowp float height 467#pragma mapbox: define lowp vec4 pattern_from 468#pragma mapbox: define lowp vec4 pattern_to 469#pragma mapbox: define lowp float pixel_ratio_from 470#pragma mapbox: define lowp float pixel_ratio_to 471void main() { 472#pragma mapbox: initialize lowp float base 473#pragma mapbox: initialize lowp float height 474#pragma mapbox: initialize mediump vec4 pattern_from 475#pragma mapbox: initialize mediump vec4 pattern_to 476#pragma mapbox: initialize lowp float pixel_ratio_from 477#pragma mapbox: initialize lowp float pixel_ratio_to 478vec2 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 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_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;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); 479#if defined(HAS_CENTROID) || defined(TERRAIN) 480centroid_pos=a_centroid_pos; 481#endif 482#ifdef TERRAIN 483bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h); 484#else 485vec3 p=vec3(pos_nx.xy,z); 486#endif 487#ifdef PROJECTION_GLOBE_VIEW 488float lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 489#endif 490float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 491? pos_nx.xy 492: 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,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*=( 493(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; 494#ifdef FOG 495v_fog_pos=fog_position(p); 496#endif 497}`),hillshadePrepare:gt(`#ifdef GL_ES 498precision highp float; 499#endif 500uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) { 501#ifdef TERRAIN_DEM_FLOAT_FORMAT 502return texture2D(u_image,coord).a/4.0; 503#else 504vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0; 505#endif 506}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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( 507(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c) 508)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4( 509deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); 510#ifdef OVERDRAW_INSPECTOR 511gl_FragColor=vec4(1.0); 512#endif 513}`,"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);high
513p vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:gt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;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; 514#ifdef FOG 515gl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos)); 516#endif 517#ifdef OVERDRAW_INSPECTOR 518gl_FragColor=vec4(1.0); 519#endif 520}`,`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; 521#ifdef FOG 522v_fog_pos=fog_position(a_pos); 523#endif 524}`),line:gt(`uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv; 525#ifdef RENDER_LINE_DASH 526uniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b; 527#endif 528#ifdef RENDER_LINE_GRADIENT 529uniform sampler2D u_gradient_image; 530#endif 531#pragma mapbox: define highp vec4 color 532#pragma mapbox: define lowp float floorwidth 533#pragma mapbox: define lowp vec4 dash_from 534#pragma mapbox: define lowp vec4 dash_to 535#pragma mapbox: define lowp float blur 536#pragma mapbox: define lowp float opacity 537void main() { 538#pragma mapbox: initialize highp vec4 color 539#pragma mapbox: initialize lowp float floorwidth 540#pragma mapbox: initialize lowp vec4 dash_from 541#pragma mapbox: initialize lowp vec4 dash_to 542#pragma mapbox: initialize lowp float blur 543#pragma mapbox: initialize lowp float opacity 544float 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); 545#ifdef RENDER_LINE_DASH 546float sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);
546float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist); 547#endif 548#ifdef RENDER_LINE_GRADIENT 549highp vec4 out_color=texture2D(u_gradient_image,v_uv.xy); 550#else 551vec4 out_color=color; 552#endif 553#ifdef RENDER_LINE_TRIM_OFFSET 554highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);}} 555#endif 556#ifdef FOG 557out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 558#endif 559#ifdef RENDER_LINE_ALPHA_DISCARD 560if (alpha < u_alpha_discard_threshold) {discard;} 561#endif 562gl_FragColor=out_color*(alpha*opacity); 563#ifdef OVERDRAW_INSPECTOR 564gl_FragColor=vec4(1.0); 565#endif 566}`,` 567#define EXTRUDE_SCALE 0.015873016 568attribute vec2 a_pos_normal;attribute vec4 a_data; 569#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 570attribute highp vec4 a_packed; 571#endif 572#ifdef RENDER_LINE_DASH 573attribute float a_linesofar; 574#endif 575uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;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 vec4 v_uv; 576#ifdef RENDER_LINE_DASH 577uniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b; 578#endif 579#ifdef RENDER_LINE_GRADIENT 580uniform float u_image_height; 581#endif 582#pragma mapbox: define highp vec4 color 583#pragma mapbox: define lowp float floorwidth 584#pragma mapbox: define lowp vec4 dash_from 585#pragma mapbox: define lowp vec4 dash_to 586#pragma mapbox: define lowp float blur 587#pragma mapbox: define lowp float opacity 588#pragma mapbox: define mediump float gapwidth 589#pragma mapbox: define lowp float offset 590#pragma mapbox: define mediump float width 591void main() { 592#pragma mapbox: initialize highp vec4 color 593#pragma mapbox: initialize lowp float floorwidth 594#pragma mapbox: initialize lowp vec4 dash_from 595#pragma mapbox: initialize lowp vec4 dash_to 596#pragma mapbox: initialize lowp float blur 597#pragma mapbox: initialize lowp float opacity 598#pragma mapbox: initialize mediump float gapwidth 599#pragma mapbox: initialize lowp float offset 600#pragma mapbox: initialize mediump float width 601float 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;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; 602#ifndef RENDER_TO_TEXTURE 603float 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; 604#else 605v_gamma_scale=1.0; 606#endif 607#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 608float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3]; 609#ifdef RENDER_LINE_GRADIENT 610highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end); 611#else 612v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); 613#endif 614#endif 615#ifdef RENDER_LINE_DASH 616float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y); 617#endif 618v_width2=vec2(outset,inset); 619#ifdef FOG 620v_fog_pos=fog_position(pos); 621#endif 622}`),linePattern:gt(`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; 623#pragma mapbox: define lowp vec4 pattern_from 624#pragma mapbox: define lowp vec4 pattern_to 625#pragma mapbox: define lowp float pixel_ratio_from 626#pragma mapbox: define lowp float pixel_ratio_to 627#pragma mapbox: define lowp float blur 628#pragma mapbox: define lowp float opacity 629void main() { 630#pragma mapbox: initialize mediump vec4 pattern_from 631#pragma mapbox: initialize mediump vec4 pattern_to 632#pragma mapbox: initialize lowp float pixel_ratio_from 633#pragma mapbox: initialize lowp float pixel_ratio_to 634#pragma mapbox: initialize lowp float blur 635#pragma mapbox: initialize lowp float opacity 636vec2 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); 637#ifdef FOG 638color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 639#endif 640gl_FragColor=color*(alpha*opacity); 641#ifdef OVERDRAW_INSPECTOR 642gl_FragColor=vec4(1.0); 643#endif 644}`,` 645#define scale 0.015873016 646attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;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; 647#pragma mapbox: define lowp float blur 648#pragma mapbox: define lowp float opacity 649#pragma mapbox: define lowp float offset 650#pragma mapbox: define mediump float gapwidth 651#pragma mapbox: define mediump float width 652#pragma mapbox: define lowp float floorwidth 653#pragma mapbox: define lowp vec4 pattern_from 654#pragma mapbox: define lowp vec4 pattern_to 655#pragma mapbox: define lowp float pixel_ratio_from 656#pragma mapbox: define lowp float pixel_ratio_to 657void main() { 658#pragma mapbox: initialize lowp float blur 659#pragma mapbox: initialize lowp float opacity 660#pragma mapbox: initialize lowp float offset 661#pragma mapbox: initialize mediump float gapwidth 662#pragma mapbox: initialize mediump float width 663#pragma mapbox: initialize lowp float floorwidth 664#pragma mapbox: initialize mediump vec4 pattern_from 665#pragma mapbox: initialize mediump vec4 pattern_to 666#pragma mapbox: initialize lowp float pixel_ratio_from 667#pragma mapbox: initialize lowp float pixel_ratio_to 668float 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;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_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; 669#ifndef RENDER_TO_TEXTURE 670float 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; 671#else 672v_gamma_scale=1.0; 673#endif 674v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth; 675#ifdef FOG 676v_fog_pos=fog_position(pos); 677#endif 678}`),raster:gt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3( 679dot(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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); 680#ifdef FOG 681out_color=fog_dither(fog_apply(out_color,v_fog_pos)); 682#endif 683gl_FragColor=vec4(out_color*color.a,color.a); 684#ifdef OVERDRAW_INSPECTOR 685gl_FragColor=vec4(1.0); 686#endif 687}`,`uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent; 688#ifdef FOG 689v_fog_pos=fog_position(a_pos); 690#endif 691}`),symbolIcon:gt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; 692#pragma mapbox: define lowp float opacity 693void main() { 694#pragma mapbox: initialize lowp float opacity 695lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; 696#ifdef OVERDRAW_INSPECTOR 697gl_FragColor=vec4(1.0); 698#endif 699}`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity; 700#ifdef PROJECTION_GLOBE_VIEW 701attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; 702#endif 703uniform 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 bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector; 704#ifdef PROJECTION_GLOBE_VIEW 705uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 706#endif 707varying vec2 v_tex;varying float v_fade_opacity; 708#pragma mapbox: define lowp float opacity 709void main() { 710#pragma mapbox: initialize lowp float opacity 711vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor); 712#ifdef PROJECTION_GLOBE_VIEW 713vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 714#else 715vec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0; 716#endif 717vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 718camera_to_anchor_distance/u_camera_to_center_distance : 719u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 7200.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) { 721#ifdef PROJECTION_GLOBE_VIEW 722vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1); 723#else 724vec4 offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); 725#endif 726vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);} 727#ifdef PROJECTION_GLOBE_VIEW 728vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 729#else 730vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 731#endif 732highp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); 733#ifdef PITCH_WITH_MAP_TERRAIN 734vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 735#endif 736float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; 737#ifdef PROJECTION_GLOBE_VIEW 738vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); 739#else 740gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); 741#endif 742float projection_transition_fade=1.0; 743#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) 744projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); 745#endif 746v_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;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}`),symbolSDF:gt(`#define SDF_PX 8.0 747uniform 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; 748#pragma mapbox: define highp vec4 fill_color 749#pragma mapbox: define highp vec4 halo_color 750#pragma mapbox: define lowp float opacity 751#pragma mapbox: define lowp float halo_width 752#pragma mapbox: define lowp float halo_blur 753void main() { 754#pragm
754a mapbox: initialize highp vec4 fill_color 755#pragma mapbox: initialize highp vec4 halo_color 756#pragma mapbox: initialize lowp float opacity 757#pragma mapbox: initialize lowp float halo_width 758#pragma mapbox: initialize lowp float halo_blur 759float 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 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); 760#ifdef OVERDRAW_INSPECTOR 761gl_FragColor=vec4(1.0); 762#endif 763}`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity; 764#ifdef PROJECTION_GLOBE_VIEW 765attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; 766#endif 767uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_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 vec3 u_up_vector; 768#ifdef PROJECTION_GLOBE_VIEW 769uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 770#endif 771varying vec2 v_data0;varying vec3 v_data1; 772#pragma mapbox: define highp vec4 fill_color 773#pragma mapbox: define highp vec4 halo_color 774#pragma mapbox: define lowp float opacity 775#pragma mapbox: define lowp float halo_width 776#pragma mapbox: define lowp float halo_blur 777void main() { 778#pragma mapbox: initialize highp vec4 fill_color 779#pragma mapbox: initialize highp vec4 halo_color 780#pragma mapbox: initialize lowp float opacity 781#pragma mapbox: initialize lowp float halo_width 782#pragma mapbox: initialize lowp float halo_blur 783vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor); 784#ifdef PROJECTION_GLOBE_VIEW 785vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 786#else 787vec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0; 788#endif 789vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 790camera_to_anchor_distance/u_camera_to_center_distance : 791u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 7920.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) { 793#ifdef PROJECTION_GLOBE_VIEW 794vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1); 795#else 796vec4 offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); 797#endif 798vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);} 799#ifdef PROJECTION_GLOBE_VIEW 800vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 801#else 802vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 803#endif 804highp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset); 805#ifdef PITCH_WITH_MAP_TERRAIN 806vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 807#endif 808float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; 809#ifdef PROJECTION_GLOBE_VIEW 810vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); 811#else 812gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); 813#endif 814float gamma_scale=gl_Position.w;float projection_transition_fade=1.0; 815#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) 816projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); 817#endif 818vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}`),symbolTextAndIcon:gt(`#define SDF_PX 8.0 819#define SDF 1.0 820#define ICON 0.0 821uniform 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; 822#pragma mapbox: define highp vec4 fill_color 823#pragma mapbox: define highp vec4 halo_color 824#pragma mapbox: define lowp float opacity 825#pragma mapbox: define lowp float halo_width 826#pragma mapbox: define lowp float halo_blur 827void main() { 828#pragma mapbox: initialize highp vec4 fill_color 829#pragma mapbox: initialize highp vec4 halo_color 830#pragma mapbox: initialize lowp float opacity 831#pragma mapbox: initialize lowp float halo_width 832#pragma mapbox: initialize lowp float halo_blur 833float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
833gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; 834#ifdef OVERDRAW_INSPECTOR 835gl_FragColor=vec4(1.0); 836#endif 837return;}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); 838#ifdef OVERDRAW_INSPECTOR 839gl_FragColor=vec4(1.0); 840#endif 841}`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity; 842#ifdef PROJECTION_GLOBE_VIEW 843attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; 844#endif 845uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_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 vec3 u_up_vector;uniform vec2 u_texsize_icon; 846#ifdef PROJECTION_GLOBE_VIEW 847uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 848#endif 849varying vec4 v_data0;varying vec4 v_data1; 850#pragma mapbox: define highp vec4 fill_color 851#pragma mapbox: define highp vec4 halo_color 852#pragma mapbox: define lowp float opacity 853#pragma mapbox: define lowp float halo_width 854#pragma mapbox: define lowp float halo_blur 855void main() { 856#pragma mapbox: initialize highp vec4 fill_color 857#pragma mapbox: initialize highp vec4 halo_color 858#pragma mapbox: initialize lowp float opacity 859#pragma mapbox: initialize lowp float halo_width 860#pragma mapbox: initialize lowp float halo_blur 861vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor); 862#ifdef PROJECTION_GLOBE_VIEW 863vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 864#else 865vec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0; 866#endif 867vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 868camera_to_anchor_distance/u_camera_to_center_distance : 869u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 8700.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);} 871#ifdef PROJECTION_GLOBE_VIEW 872vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 873#else 874vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 875#endif 876highp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale); 877#ifdef PITCH_WITH_MAP_TERRAIN 878vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 879#endif 880float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; 881#ifdef PROJECTION_GLOBE_VIEW 882vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); 883#else 884gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); 885#endif 886float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0; 887#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) 888projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); 889#endif 890v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_s
890df);}`),terrainRaster:gt(`uniform sampler2D u_image0;varying vec2 v_pos0; 891#ifdef FOG 892varying float v_fog_opacity; 893#endif 894void main() {vec4 color=texture2D(u_image0,v_pos0); 895#ifdef FOG 896color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 897#endif 898gl_FragColor=color; 899#ifdef TERRAIN_WIREFRAME 900gl_FragColor=vec4(1.0,0.0,0.0,0.8); 901#endif 902#ifdef OVERDRAW_INSPECTOR 903gl_FragColor=vec4(1.0); 904#endif 905}`,`uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0; 906#ifdef FOG 907varying float v_fog_opacity; 908#endif 909const float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height; 910#ifdef TERRAIN_WIREFRAME 911elevation+=u_skirt_height*u_skirt_height*wireframeOffset; 912#endif 913vec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); 914#ifdef FOG 915v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 916#endif 917}`),terrainDepth:gt(`#ifdef GL_ES 918precision highp float; 919#endif 920varying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:gt(` 921varying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( 922cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
922nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb; 923#ifdef FOG 924sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 925#endif 926sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity); 927#ifdef OVERDRAW_INSPECTOR 928gl_FragColor=vec4(1.0); 929#endif 930}`,ka),skyboxGradient:gt(`varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5)); 931#ifdef FOG 932color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 933#endif 934color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color; 935#ifdef OVERDRAW_INSPECTOR 936gl_FragColor=vec4(1.0); 937#endif 938}`,ka),skyboxCapture:gt(` 939varying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m; 940#ifdef GL_ES 941precision highp float; 942#endif 943#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 944#define BETA_M vec3(21e-6,21e-6,21e-6) 945#define MIE_G 0.76 946#define DENSITY_HEIGHT_SCALE_R 8000.0 947#define DENSITY_HEIGHT_SCALE_M 1200.0 948#define PLANET_RADIUS 6360e3 949#define ATMOSPHERE_RADIUS 6420e3 950#define SAMPLE_STEPS 10 951#define DENSITY_STEPS 4 952float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}
952float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}`,"attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
952nd-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:gt(`uniform sampler2D u_image0;varying vec2 v_pos0; 953#ifndef FOG 954uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; 955#endif 956void main() { 957#ifdef CUSTOM_ANTIALIASING 958vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 959mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);vec4 color=vec4(raster.rgb*antialias,raster.a*antialias); 960#else 961vec4 color=texture2D(u_image0,v_pos0); 962#endif 963#ifdef FOG 964color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 965#endif 966gl_FragColor=color; 967#ifdef TERRAIN_WIREFRAME 968gl_FragColor=vec4(1.0,0.0,0.0,0.8); 969#endif 970#ifdef OVERDRAW_INSPECTOR 971gl_FragColor=vec4(1.0); 972#endif 973}`,`uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix; 974#ifdef GLOBE_POLES 975attribute vec3 a_globe_pos;attribute vec2 a_merc_pos;attribute vec2 a_uv; 976#else 977attribute vec2 a_pos; 978#endif 979varying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() { 980#ifdef GLOBE_POLES 981vec3 globe_pos=a_globe_pos;vec2 merc_pos=a_merc_pos;vec2 uv=a_uv; 982#else 983float tiles=u_grid_matrix[0][2];float idy=u_grid_matrix[1][2];float S=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=a_pos[0]*S;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); 984#endif 985v_pos0=uv;uv=uv*EXTENT;vec4 up_vector=vec4(elevationVector(uv),1.0);float height=elevation(uv); 986#ifdef TERRAIN_WIREFRAME 987height+=wireframeOffset; 988#endif 989globe_pos+=up_vector.xyz*height;vec4 globe=u_globe_matrix*vec4(globe_pos,1.0);vec4 mercator=vec4(0.0);if (u_zoom_transition > 0.0) {mercator=vec4(merc_pos,height,1.0);mercator.xy-=u_merc_center;mercator.x=wrap(mercator.x,-0.5,0.5);mercator=u_merc_matrix*mercator;}vec3 position=mix(globe.xyz,mercator.xyz,u_zoom_transition);gl_Position=u_proj_matrix*vec4(position,1.0); 990#ifdef FOG 991v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 992#endif 993}`),globeAtmosphere:gt(`uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));
993return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir); 994#ifdef PROJECTION_GLOBE_VIEW 995float globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;} 996#endif 997highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 9980.0 : max(acos(dot(dir,horizon_dir)),0.0); 999#ifdef PROJECTION_GLOBE_VIEW 1000highp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));float horizon_angle=globe_pos_dot_dir < 0.0 ? 1001PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); 1002#else 1003float horizon_angle=horizon_angle_mercator; 1004#endif 1005horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x: 1006(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y: 1007uv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}`,`attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( 1008mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( 1009mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`)};function gt(l,t,o){const u=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,p=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,f=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),g=l.match(p),y=t.match(p),v=za.match(p);let T=y?y.concat(g):g;o||(ko.staticUniforms&&(T=ko.staticUniforms.concat(T)),kr.staticUniforms&&(T=kr.staticUniforms.concat(T))),T&&(T=T.concat(v));const S={};return{fragmentSource:l=l.replace(u,(A,k,L,B,P)=>(S[P]=!0,k==="define"?` 1010#ifndef HAS_UNIFORM_u_${P} 1011varying ${L} ${B} ${P}; 1012#else 1013uniform ${L} ${B} u_${P}; 1014#endif 1015`:` 1016#ifdef HAS_UNIFORM_u_${P} 1017 ${L} ${B} ${P} = u_${P}; 1018#endif 1019`)),vertexSource:t=t.replace(u,(A,k,L,B,P)=>{const G=B==="float"?"vec2":"vec4",D=P.match(/color/)?"color":G;return S[P]?k==="define"?` 1020#ifndef HAS_UNIFORM_u_${P} 1021uniform lowp float u_${P}_t; 1022attribute ${L} ${G} a_${P}; 1023varying ${L} ${B} ${P}; 1024#else 1025uniform ${L} ${B} u_${P}; 1026#endif 1027`:D==="vec4"?` 1028#ifndef HAS_UNIFORM_u_${P} 1029 ${P} = a_${P}; 1030#else 1031 ${L} ${B} ${P} = u_${P}; 1032#endif 1033`:` 1034#ifndef HAS_UNIFORM_u_${P} 1035 ${P} = unpack_mix_${D}(a_${P}, u_${P}_t); 1036#else 1037 ${L} ${B} ${P} = u_${P}; 1038#endif 1039`:k==="define"?` 1040#ifndef HAS_UNIFORM_u_${P} 1041uniform lowp float u_${P}_t; 1042attribute ${L} ${G} a_${P}; 1043#else 1044uniform ${L} ${B} u_${P}; 1045#endif 1046`:D==="vec4"?` 1047#ifndef HAS_UNIFORM_u_${P} 1048 ${L} ${B} ${P} = a_${P}; 1049#else 1050 ${L} ${B} ${P} = u_${P}; 1051#endif 1052`:` 1053#ifndef HAS_UNIFORM_u_${P} 1054 ${L} ${B} ${P} = unpack_mix_${D}(a_${P}, u_${P}_t); 1055#else 1056 ${L} ${B} ${P} = u_${P}; 1057#endif 1058`}),staticAttributes:f,staticUniforms:T}}class $l{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,o,u,p,f,g,y,v,T){this.context=t;let S=this.boundPaintVertexBuffers.length!==p.length;for(let A=0;!S&&A<p.length;A++)this.boundPaintVertexBuffers[A]!==p[A]&&(S=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===o&&this.boundLayoutVertexBuffer===u&&!S&&this.boundIndexBuffer===f&&this.boundVertexOffset===g&&this.boundDynamicVertexBuffer===y&&this.boundDynamicVertexBuffer2===v&&this.boundDynamicVertexBuffer3===T?(t.bindVertexArrayOES.set(this.vao),y&&y.bind(),f&&f.dynamicDraw&&f.bind(),v&&v.bind(),T&&T.bind()):this.freshBind(o,u,p,f,g,y,v,T)}freshBind(t,o,u,p,f,g,y,v){let T;const S=t.numAttributes,A=this.context,k=A.gl;if(A.extVertexArrayObject)this.vao&&this.destroy(),this.vao=A.extVertexArrayObject.createVertexArrayOES(),A.bindVertexArrayOES.set(this.vao),T=0,this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=u,this.boundIndexBuffer=p,this.boundVertexOffset=f,this.boundDynamicVertexBuffer=g,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=v;else{T=A.currentNumAttributes||0;for(let L=S;L<T;L++)k.disableVertexAttribArray(L)}o.enableAttributes(k,t);for(const L of u)L.enableAttributes(k,t);g&&g.enableAttributes(k,t),y&&y.enableAttributes(k,t),v&&v.enableAttributes(k,t),o.bind(),o.setVertexAttribPointers(k,t,f);for(const L of u)L.bind(),L.setVertexAttribPointers(k,t,f);g&&(g.bind(),g.setVertexAttribPointers(k,t,f)),p&&p.bind(),y&&(y.bind(),y.setVertexAttribPointers(k,t,f)),v&&(v.bind(),v.setVertexAttribPointers(k,t,f)),A.currentNumAttributes=S}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Pa(l,t){const o=Math.pow(2,t.canonical.z),u=t.canonical.y;return[new a.MercatorCoordinate(0,u/o).toLngLat().lat,new a.MercatorCoordinate(0,(u+1)/o).toLngLat().lat]}function ql(l,t,o,u,p,f,g){const y=l.context,v=y.gl,T=o.fbo;if(!T)return;l.prepareDrawTile();const S=l.useProgram("hillshade");y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,T.colorAttachment.get());const A=((P,G,D,F)=>{const O=D.paint.get("hillshade-shadow-color"),X=D.paint.get("hillshade-highlight-color"),N=D.paint.get("hillshade-accent-color");let Z=D.paint.get("hillshade-illumination-direction")*(Math.PI/180);D.paint.get("hillshade-illumination-anchor")==="viewport"&&(Z-=P.transform.angle);
vendor: 5,570 bytes, line 1058
1058const K=!P.options.moving;return{u_matrix:F||P.transform.calculateProjMatrix(G.tileID.toUnwrapped(),K),u_image:0,u_latrange:Pa(0,G.tileID),u_light:[D.paint.get("hillshade-exaggeration"),Z],u_shadow:O,u_highlight:X,u_accent:N}})(l,o,u,l.terrain?t.projMatrix:null);l.prepareDrawProgram(y,S,t.toUnwrapped());const{tileBoundsBuffer:k,tileBoundsIndexBuffer:L,tileBoundsSegments:B}=l.getTileBoundsBuffers(o);S.draw(y,v.TRIANGLES,p,f,g,a.CullFaceMode.disabled,A,u.id,k,L,B)}function Ms(l,t,o){if(!t.needsDEMTextureUpload)return;const u=l.context,p=u.gl;u.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(o.stride);const f=o.getPixels();t.demTexture?t.demTexture.update(f,{premultiply:!1}):t.demTexture=new a.Texture(u,f,p.RGBA,{premultiply:!1}),t.needsDEMTextureUpload=!1}function Is(l,t,o,u,p,f){const g=l.context,y=g.gl;if(!t.dem)return;const v=t.dem;if(g.activeTexture.set(y.TEXTURE1),Ms(l,t,v),!t.demTexture)return;t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);const T=v.dim;g.activeTexture.set(y.TEXTURE0);let S=t.fbo;if(!S){const B=new a.Texture(g,{width:T,height:T,data:null},y.RGBA);B.bind(y.LINEAR,y.CLAMP_TO_EDGE),S=t.fbo=g.createFramebuffer(T,T,!0),S.colorAttachment.set(B.texture)}g.bindFramebuffer.set(S.framebuffer),g.viewport.set([0,0,T,T]);const{tileBoundsBuffer:A,tileBoundsIndexBuffer:k,tileBoundsSegments:L}=l.getMercatorTileBoundsBuffers();l.useProgram("hillshadePrepare").draw(g,y.TRIANGLES,u,p,f,a.CullFaceMode.disabled,((B,P)=>{const G=P.stride,D=a.create();return a.ortho(D,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(D,D,[0,-a.EXTENT,0]),{u_matrix:D,u_image:1,u_dimension:[G,G],u_zoom:B.overscaledZ,u_unpack:P.unpackVector}})(t.tileID,v),o.id,A,k,L),t.needsHillshadePrepare=!1}const As=(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image0:new a.Uniform1i(l,t.u_image0),u_skirt_height:new a.Uniform1f(l,t.u_skirt_height)}),Cs=(l,t)=>({u_matrix:l,u_image0:0,u_skirt_height:t}),dt=(l,t,o,u,p,f,g,y,v,T,S,A,k,L)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(u),u_merc_matrix:o,u_zoom_transition:p,u_merc_center:f,u_image0:0,u_frustum_tl:g,u_frustum_tr:y,u_frustum_br:v,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:A,u_viewport:k,u_grid_matrix:L?Float32Array.from(L):new Float32Array(9)});function Po(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const pn=new class{constructor(){this.operations={}}newMorphing(l,t,o,u,p){if(l in this.operations){const f=this.operations[l];f.to.tileID.key!==o.tileID.key&&(f.queued=o)}else this.operations[l]={startTime:u,phase:0,duration:p,from:t,to:o,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const t=this.operations[l];return{from:t.from,to:t.to,phase:t.phase}}update(l){for(const t in this.operations){const o=this.operations[t];for(o.phase=(l-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,l)){delete this.operations[t];break}}}_nextOp(l,t){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=t,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},Do={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Xl(l,t){const o=1<<l.z;return!t&&(l.x===0||l.x===o-1)||l.y===0||l.y===o-1}const Lo=l=>({u_matrix:l});function Da(l,t,o,u,p){if(p>0){const f=a.exported.now(),g=(f-l.timeAdded)/p,y=t?(f-t.timeAdded)/p:-1,v=o.getSource(),T=u.coveringZoomLevel({tileSize:v.tileSize,roundZoom:v.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),A=S&&l.refreshedUponExpiration?1:a.clamp(S?g:1-y,0,1);return l.refreshedUponExpiration&&g>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-A}:{opacity:A,mix:0}}return{opacity:1,mix:0}}class Mu extends a.SourceCache{constructor(t){const o={type:"raster-dem",maxzoom:t.transform.maxZoom},u=new fi(_t(),null),p=oe("mock-dem",o,u,t.style);super("mock-dem",p,!1),p.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,o){t.state="loaded",o(null)}}class Iu extends a.SourceCache{constructor(t){const o=oe("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new fi(_t(),null),t.style);super("proxy",o,!1),o.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,o,u){if(t.freezeTileCoverage)return;this.transform=t;const p=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((f,g)=>{if(f[g.key]="",!this._tiles[g.key]){const y=new a.Tile(g,this._source.tileSize*g.overscaleFactor(),t.tileZoom);y.state="loaded",this._tiles[g.key]=y}return f},{});for(const f in this._tiles)f in p||(this.freeFBO(f),this._tiles[f].unloadVectorData(),delete this._tiles[f])}freeFBO(t){const o=this.proxyCachedFBO[t];if(o!==void 0){const u=Object.values(o);this.renderCachePool.push(...u),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class zs extends a.OverscaledTileID{constructor(t,o,u){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=o,this.projMatrix=u}}class La extends a.Elevation{constructor(t,o){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[u,p,f]=function(v){const T=new a.StructArrayLayout4i8,S=new a.StructArrayLayout3ui6,A=131;
1058T.reserve(17161),S.reserve(33800);const k=a.EXTENT/128,L=a.EXTENT+k/2,B=L+k;for(let G=-k;G<B;G+=k)for(let D=-k;D<B;D+=k){const F=D<0||D>L||G<0||G>L?24575:0,O=a.clamp(Math.round(D),0,a.EXTENT),X=a.clamp(Math.round(G),0,a.EXTENT);T.emplaceBack(O+F,X,O,X)}const P=(G,D)=>{const F=D*A+G;S.emplaceBack(F+1,F,F+A),S.emplaceBack(F+A,F+A+1,F+1)};for(let G=1;G<129;G++)for(let D=1;D<129;D++)P(D,G);return[0,129].forEach(G=>{for(let D=0;D<130;D++)P(D,G),P(G,D)}),[T,S,32768]}(),g=t.context;this.gridBuffer=g.createVertexBuffer(u,a.boundsAttributes.members),this.gridIndexBuffer=g.createIndexBuffer(p),this.gridSegments=a.SegmentVector.simpleSegment(0,0,u.length,p.length),this.gridNoSkirtSegments=a.SegmentVector.simpleSegment(0,0,u.length,f),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Iu(o.map),this.orthoMatrix=a.create(),a.ortho(this.orthoMatrix,0,a.EXTENT,0,a.EXTENT,0,1);const y=g.gl;this._overlapStencilMode=new a.StencilMode({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Mu(o.map)}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),t.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=t,this._checkRenderCacheEfficiency()}update(t,o,u){if(t&&t.terrain){this._style!==t&&(this.style=t),this.enabled=!0;const p=t.terrain.properties;this.sourceCache=t.terrain.drapeRenderMode===0?this._mockSourceCache:t._getSourceCache(p.get("source")),this._exaggeration=p.get("exaggeration");const f=()=>{this.sourceCache.used&&a.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 1059This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const g=this.getScaledDemTileSize();this.sourceCache.update(o,g,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,f(),this._initializing=!0),f(),o.updateElevation(!u),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const t=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||t.efficiency!==100&&a.warnOnce(`Terrain render cache efficiency is not optimal (${t.efficiency}%) and performance 1060 may be affected negatively, consider placing all background, fill and line layers before layer 1061 with id '${t.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(t){t.coord&&t.dataType==="source"?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._sourceCaches)this._style._sourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,u=this.painter.transform;this._initializing&&(this._initializing=u._centerAltitude===0&&this.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(u.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const p=this.proxyCoords=o.getIds().map(v=>{const T=o.getTileByID(v).tileID;return T.projMatrix=u.calculateProjMatrix(T.toUnwrapped()),T});(function(v,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),A=new a.pointGeometry(S.x,S.y);v.sort((k,L)=>
1061{if(L.overscaledZ-k.overscaledZ)return L.overscaledZ-k.overscaledZ;const B=new a.pointGeometry(k.canonical.x+(1<<k.canonical.z)*k.wrap,k.canonical.y),P=new a.pointGeometry(L.canonical.x+(1<<L.canonical.z)*L.wrap,L.canonical.y),G=A.mult(1<<k.canonical.z);return G.x-=.5,G.y-=.5,G.distSqr(B)-G.distSqr(P)})})(p,this.painter),this._previousZoom=u.zoom;const f=this.proxyToSource||{};this.proxyToSource={},p.forEach(v=>{this.proxyToSource[v.key]={}}),this.terrainTileForTile={};const g=this._style._sourceCaches;for(const v in g){const T=g[v];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[v],f),T.usedForTerrain))continue;const S=t[v];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[o.id]=p.map(v=>new zs(v,v.key,this.orthoMatrix)),this._assignTerrainTiles(p),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(f),this.renderingToTexture=!1,this._updateTimestamp=a.exported.now();const y={};this._visibleDemTiles=[];for(const v of this.proxyCoords){const T=this.terrainTileForTile[v.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(t){this._initializing||t.forEach(o=>{if(this.terrainTileForTile[o.key])return;const u=this._findTileCoveringTileID(o,this.sourceCache);u&&(this.terrainTileForTile[o.key]=u)})}_prepareDEMTextures(){const t=this.painter.context,o=t.gl;for(const u in this.terrainTileForTile){const p=this.terrainTileForTile[u],f=p.dem;!f||p.demTexture&&!p.needsDEMTextureUpload||(t.activeTexture.set(o.TEXTURE1),Ms(this.painter,p,f))}}_prepareDemTileUniforms(t,o,u,p){if(!o||o.demTexture==null)return!1;const f=t.tileID.canonical,g=Math.pow(2,o.tileID.canonical.z-f.z),y=p||"";return u[`u_dem_tl${y}`]=[f.x*g%1,f.y*g%1],u[`u_dem_scale${y}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const t=this.painter.context,o=t.gl;if(!this._emptyDepthBufferTexture){const u=new a.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new a.Texture(t,u,o.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let t=0;const o=this._visibleDemTiles.reduce((u,p)=>{if(!p.dem)return u;const f=p.dem.tree.minimums[0];return f>0&&t++,u+f},0);return t?o/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,o=t.gl;t.activeTexture.set(o.TEXTURE2);const u=this._getLoadedAreaMinimum(),p=new a.RGBAImage({width:1,height:1},new Uint8Array(a.DEMData.pack(u,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let f=this._emptyDEMTexture;return f?f.update(p,{premultiply:!1}):f=this._emptyDEMTexture=new a.Texture(t,p,o.RGBA,{premultiply:!1}),f}setupElevationDraw(t,o,u){const p=this.painter.context,f=p.gl,g=(y=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:a.DEMData.getUnpackVector(y),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});var y;g.u_dem_size=this.sourceCache.getSource().tileSize,g.u_exaggeration=this.exaggeration();const v=this.painter.transform,T=v.projection,S=t.tileID.canonical;g.u_tile_tl_up=T.upVector(S,0,0),g.u_tile_tr_up=T.upVector(S,a.EXTENT,0),g.u_tile_br_up=T.upVector(S,a.EXTENT,a.EXTENT),g.u_tile_bl_up=T.upVector(S,0,a.EXTENT),g.u_tile_up_scale=u&&u.useDenormalizedUpVectorScale?a.GLOBE_METERS_TO_ECEF:T.upVectorScale(S,v.center.lat,v.worldSize).metersToTile;let A=null,k=null,L=1;if(u&&u.morphing&&this._useVertexMorphing){const B=u.morphing.srcDemTile,P=u.morphing.dstDemTile;L=u.morphing.phase,B&&P&&(this._prepareDemTileUniforms(t,B,g,"_prev")&&(k=B),this._prepareDemTileUniforms(t,P,g)&&(A=P))}if(k&&A?(p.activeTexture.set(f.TEXTURE2),A.demTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE,f.NEAREST),p.activeTexture.set(f.TEXTURE4),k.demTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE,f.NEAREST),g.u_dem_lerp=L):(A=this.terrainTileForTile[t.tileID.key],p.activeTexture.set(f.TEXTURE2),(this._prepareDemTileUniforms(t,A,g)?A.demTexture:this.empty
1061DEMTexture).bind(f.NEAREST,f.CLAMP_TO_EDGE)),p.activeTexture.set(f.TEXTURE3),u&&u.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE),this._depthFBO&&(g.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE),g.u_depth_size_inv=[1,1]),u&&u.useMeterToDem&&A){const B=(1<<A.tileID.canonical.z)*a.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;g.u_meter_to_dem=B}u&&u.labelPlaneMatrixInv&&(g.u_label_plane_matrix_inv=u.labelPlaneMatrixInv),o.setTerrainUniformValues(p,g)}renderToBackBuffer(t){const o=this.painter,u=this.painter.context;t.length!==0&&(u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(p,f,g,y,v){if(p.transform.projection.name==="globe")(function(T,S,A,k,L){const B=T.context,P=B.gl;let G,D;const F=T.options.showTerrainWireframe?2:0,O=T.transform,X=a.globeUseCustomAntiAliasing(T,B,O),N=(q,ge)=>{if(D===q)return;const _e=[Do[q],"PROJECTION_GLOBE_VIEW"];X&&_e.push("CUSTOM_ANTIALIASING"),ge&&_e.push(Do[F]),G=T.useProgram("globeRaster",null,_e),D=q},Z=T.colorModeForRenderPass(),K=new a.DepthMode(P.LEQUAL,a.DepthMode.ReadWrite,T.depthRangeFor3D);pn.update(L);const le=a.calculateGlobeMercatorMatrix(O),he=[a.mercatorXfromLng(O.center.lng),a.mercatorYfromLat(O.center.lat)],ce=T.globeSharedBuffers,ae=[O.width*a.exported.devicePixelRatio,O.height*a.exported.devicePixelRatio];if((F?[!1,!0]:[!1]).forEach(q=>{D=-1;const ge=q?P.LINES:P.TRIANGLES;for(const _e of k){const ze=A.getTile(_e),de=a.StencilMode.disabled,Ve=S.prevTerrainTileForTile[_e.key],Ce=S.terrainTileForTile[_e.key];Po(Ve,Ce)&&pn.newMorphing(_e.key,Ve,Ce,L,250),B.activeTexture.set(P.TEXTURE0),ze.texture.bind(P.LINEAR,P.CLAMP_TO_EDGE);const Ae=pn.getMorphValuesForProxy(_e.key),Ee=Ae?1:0,Ie={useDenormalizedUpVectorScale:!0};Ae&&a.extend$1(Ie,{morphing:{srcDemTile:Ae.from,dstDemTile:Ae.to,phase:a.easeCubicInOut(Ae.phase)}});const He=Float32Array.from(O.globeMatrix),Ne=a.globeTileLatLngCorners(_e.canonical),tt=a.getLatitudinalLod((Ne[0][0]+Ne[1][0])/2),Ue=a.getGridMatrix(_e.canonical,Ne,tt),Ke=a.globeNormalizeECEF(a.globeTileBounds(_e.canonical)),yt=dt(O.projMatrix,He,le,Ke,a.globeToMercatorTransition(O.zoom),he,O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.globeCenterInViewSpace,O.globeRadius,ae,Ue);if(N(Ee,q),S.setupElevationDraw(ze,G,Ie),T.prepareDrawProgram(B,G,_e.toUnwrapped()),ce){const[Tt,qt,Mt]=q?ce.getWirefameBuffers(T.context,tt):ce.getGridBuffers(tt);G.draw(B,ge,K,de,Z,a.CullFaceMode.backCCW,yt,"globe_raster",Tt,qt,Mt)}}}),ce){const q=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];X&&q.push("CUSTOM_ANTIALIASING"),G=T.useProgram("globeRaster",null,q);for(const ge of k){const{x:_e,y:ze,z:de}=ge.canonical,Ve=ze===0,Ce=ze===(1<<de)-1,[Ae,Ee,Ie,He]=ce.getPoleBuffers(de);if(He&&(Ve||Ce)){const Ne=A.getTile(ge);B.activeTexture.set(P.TEXTURE0),Ne.texture.bind(P.LINEAR,P.CLAMP_TO_EDGE);let tt=a.globePoleMatrixForTile(de,_e,O);const Ue=a.globeNormalizeECEF(a.globeTileBounds(ge.canonical)),Ke=(yt,Tt)=>yt.draw(B,P.TRIANGLES,K,a.StencilMode.disabled,Z,a.CullFaceMode.disabled,dt(O.projMatrix,tt,tt,Ue,0,he,O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.globeCenterInViewSpace,O.globeRadius,ae),"globe_pole_raster",Tt,Ie,He);S.setupElevationDraw(Ne,G,{}),T.prepareDrawProgram(B,G,ge.toUnwrapped()),Ve&&Ke(G,Ae),Ce&&(tt=a.scale(a.create(),tt,[1,-1,1]),Ke(G,Ee))}}}})(p,f,g,y,v);else{const T=p.context,S=T.gl;let A,k;const L=p.options.showTerrainWireframe?2:0,B=(O,X)=>{if(k===O)return;const N=[Do[O]];X&&N.push(Do[L]),A=p.useProgram("terrainRaster",null,N),k=O},P=p.colorModeForRenderPass(),G=new a.DepthMode(S.LEQUAL,a.DepthMode.ReadWrite,p.depthRangeFor3D);pn.update(v);const D=p.transform,F=6*Math.pow(1.5,22-D.zoom)*f.exaggeration();(L?[!1,!0]:[!1]).forEach(O=>{k=-1;const X=O?S.LINES:S.TRIANGLES,[N,Z]=O?f.getWirefameBuffer():[f.gridIndexBuffer,f.gridSegments];for(const K of y){const le=g.getTile(K),he=a.StencilMode.disabled,ce=f.prevTerrainTileForTile[K.key],ae=f.terrainTileForTile[K.key];Po(ce,ae)&&pn.newMorphing(K.key,ce,ae,v,250),T.activeTexture.set(S.TEXTURE0),le.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST);const q=pn.getMorphValuesForProxy(K.key),ge=q?1:0;let _e;q&&(_e={morphing:{srcDemTile:q.from,dstDemTile:q.to,phase:a.easeCubicInOut(q.phase)}});const ze=Cs(K.projMatrix,Xl(K.canonical,D.renderWorldCopies)?F/10:F);B(ge,O),f.setupElevationDraw(le,A,_e),p.prepareDrawProgram(T,A,K.toUnwrapped()),A.draw(T,X,G,he,P,a.CullFaceMode.backCCW,ze,"terrain_raster",f.gridBuffer,N,Z)}})}}(o,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const o=this.painter,u=this.painter.context,p=this.proxySourceCache,f=this.proxiedCoords[p.id],g=this._drapedRenderBatches.shift(),y=[],v=o.style.order;let T=0;for(const S of f){const A=p.getTileByID(S.proxyTileKey),k=p.proxyCachedFBO[S.key]?p.proxyCachedFBO[S.key][t]:void 0,L=k!==void 0?p.renderCache[k]:this.pool[T++],B=k!==void 0;if(A.texture=L.tex,B&&!L.dirty){y.push(A.tileID);continue}let P;u.bindFramebuffer.set(L.fb.framebuffer),this.renderedToTile=!1,L.dirty&&(u.clear({color:a.Color.transparent,stencil:0}),L.dirty=!1);
1061for(let G=g.start;G<=g.end;++G){const D=o.style._layers[v[G]];if(D.isHidden(o.transform.zoom))continue;const F=o.style._getLayerSourceCache(D),O=F?this.proxyToSource[S.key][F.id]:[S];if(!O)continue;const X=O;u.viewport.set([0,0,L.fb.width,L.fb.height]),P!==(F?F.id:null)&&(this._setupStencil(L,O,D,F),P=F?F.id:null),o.renderLayer(o,F,D,X)}this.renderedToTile?(L.dirty=!0,y.push(A.tileID)):B||--T,T===5&&(T=0,this.renderToBackBuffer(y))}return this.renderToBackBuffer(y),this.renderingToTexture=!1,u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),g.end+1}postRender(){}renderCacheEfficiency(t){const o=t.order.length;if(o===0)return{efficiency:100};let u,p=0,f=0,g=!1;for(let y=0;y<o;++y){const v=t._layers[t.order[y]];this._style.isLayerDraped(v)?(g&&++p,++f):g||(g=!0,u=v.id)}return f===0?{efficiency:100}:{efficiency:100*(1-p/f),firstUndrapedLayer:u}}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{t=Math.min(t,o.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,o,u){if(!this._visibleDemTiles)return null;const p=this._visibleDemTiles.filter(f=>f.dem).map(f=>{const g=f.tileID,y=Math.pow(2,g.overscaledZ),{x:v,y:T}=g.canonical,S=v/y,A=(v+1)/y,k=T/y,L=(T+1)/y;return{minx:S,miny:k,maxx:A,maxy:L,t:f.dem.tree.raycastRoot(S,k,A,L,t,o,u),tile:f}});p.sort((f,g)=>(f.t!==null?f.t:Number.MAX_VALUE)-(g.t!==null?g.t:Number.MAX_VALUE));for(const f of p){if(f.t==null)return null;const g=f.tile.dem.tree.raycast(f.minx,f.miny,f.maxx,f.maxy,t,o,u);if(g!=null)return g}return null}_createFBO(){const t=this.painter.context,o=t.gl,u=this.drapeBufferSize;t.activeTexture.set(o.TEXTURE0);const p=new a.Texture(t,{width:u[0],height:u[1],data:null},o.RGBA);p.bind(o.LINEAR,o.CLAMP_TO_EDGE);const f=t.createFramebuffer(u[0],u[1],!1);return f.colorAttachment.set(p.texture),f.depthAttachment=new I(t,f.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,u[0],u[1]),this._stencilRef=0,f.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):f.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&!t.extTextureFilterAnisotropicForceOff&&o.texParameterf(o.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:f,tex:p,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.light&&this._style.light.hasTransition())return!0;for(const t in this._style._sourceCaches)if(this._style._sourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const o=this._style._layers[t],u=o.isHidden(this.painter.transform.zoom),p=o.getCrossfadeParameters(),f=!!p&&p.t!==1,g=o.hasTransition();return o.type!=="custom"&&!u&&(f||g)})}_clearRasterFadeFromRenderCache(){let t=!1;for(const o in this._style._sourceCaches)if(this._style._sourceCaches[o]._source instanceof $){t=!0;break}if(t)for(let o=0;o<this._style.order.length;++o){const u=this._style._layers[this._style.order[o]],p=u.isHidden(this.painter.transform.zoom),f=this._style._getLayerSourceCache(u);if(u.type!=="raster"||p||!f)continue;const g=u.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const v=this.proxyToSource[y.key][f.id];if(v)for(const T of v){const S=Da(f.getTile(T),f.findLoadedParent(T,0),f,this.painter.transform,g);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(f.id,T)}}}}_setupDrapedRenderBatches(){const t=this._style.order,o=t.length;if(o===0)return;const u=[];let p,f=0,g=this._style._layers[t[f]];for(;!this._style.isLayerDraped(g)&&g.isHidden(this.painter.transform.zoom)&&++f<o;)g=this._style._layers[t[f]];for(;f<o;++f){const y=this._style._layers[t[f]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?p===void 0&&(p=f):p!==void 0&&(u.push({start:p,end:f-1}),p=void 0))}p!==void 0&&u.push({start:p,end:f-1}),this._drapedRenderBatches=u}_setupRenderCache(t){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,o.renderCache.length>
vendor: 13,126 bytes, lines 1061-1081
1061o.renderCachePool.length){const g=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let y=0;y<g.length;++y){const v=Object.values(g[y]);o.renderCachePool.push(...v)}}return}this._clearRasterFadeFromRenderCache();const u=this.proxyCoords,p=this._tilesDirty;for(let g=u.length-1;g>=0;g--){const y=u[g];if(o.getTileByID(y.key),o.proxyCachedFBO[y.key]!==void 0){const v=t[y.key],T=this.proxyToSource[y.key];let S=0;for(const A in T){const k=T[A],L=v[A];if(!L||L.length!==k.length||k.some((B,P)=>B!==L[P]||p[A]&&p[A].hasOwnProperty(B.key))){S=-1;break}++S}for(const A in o.proxyCachedFBO[y.key])o.renderCache[o.proxyCachedFBO[y.key][A]].dirty=S<0||S!==Object.values(v).length}}const f=[...this._drapedRenderBatches];f.sort((g,y)=>y.end-y.start-(g.end-g.start));for(const g of f)for(const y of u){if(o.proxyCachedFBO[y.key])continue;let v=o.renderCachePool.pop();v===void 0&&o.renderCache.length<50&&(v=o.renderCache.length,o.renderCache.push(this._createFBO())),v!==void 0&&(o.proxyCachedFBO[y.key]={},o.proxyCachedFBO[y.key][g.start]=v,o.renderCache[v].dirty=!0)}this._tilesDirty={}}_setupStencil(t,o,u,p){if(!p||!this._sourceTilesOverlap[p.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const f=this.painter.context,g=f.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let y;if(u.isTileClipped())y=o.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>o[o.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(f.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,u.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):a.StencilMode.disabled}_renderTileClippingMasks(t,o){const u=this.painter,p=this.painter.context,f=p.gl;u._tileClippingMaskIDs={},p.setColorMode(a.ColorMode.disabled),p.setDepthMode(a.DepthMode.disabled);const g=u.useProgram("clippingMask");for(const y of t){const v=u._tileClippingMaskIDs[y.key]=--o;g.draw(p,f.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:f.ALWAYS,mask:0},v,255,f.KEEP,f.KEEP,f.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,Lo(y.projMatrix),"$clipping",u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}}pointCoordinate(t){const o=this.painter.transform;if(t.x<0||t.x>o.width||t.y<0||t.y>o.height)return null;const u=[t.x,t.y,1,1];a.transformMat4$1(u,u,o.pixelMatrixInverse),a.scale$1(u,u,1/u[3]),u[0]/=o.worldSize,u[1]/=o.worldSize;const p=o._camera.position,f=a.mercatorZfromAltitude(1,o.center.lat),g=[p[0],p[1],p[2]/f,0],y=a.subtract([],u.slice(0,3),g);a.normalize(y,y);const v=this.raycast(g,y,this._exaggeration);return v!==null&&v?(a.scaleAndAdd(g,g,y,v),g[3]=g[2],g[2]*=f,g):null}drawDepth(){const t=this.painter,o=t.context,u=this.proxySourceCache,p=Math.ceil(t.width),f=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===p&&this._depthFBO.height===f||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const g=o.gl,y=o.createFramebuffer(p,f,!0);o.activeTexture.set(g.TEXTURE0);const v=new a.Texture(o,{width:p,height:f,data:null},g.RGBA);v.bind(g.NEAREST,g.CLAMP_TO_EDGE),y.colorAttachment.set(v.texture);const T=o.createRenderbuffer(o.gl.DEPTH_COMPONENT16,p,f);y.depthAttachment.set(T),this._depthFBO=y,this._depthTexture=v}o.bindFramebuffer.set(this._depthFBO.framebuffer),o.viewport.set([0,0,p,f]),function(g,y,v,T){if(g.transform.projection.name==="globe")return;const S=g.context,A=S.gl;S.clear({depth:1});const k=g.useProgram("terrainDepth"),L=new a.DepthMode(A.LESS,a.DepthMode.ReadWrite,g.depthRangeFor3D);for(const B of T){const P=v.getTile(B),G=Cs(B.projMatrix,0);y.setupElevationDraw(P,k),k.draw(S,A.TRIANGLES,L,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.backCCW,G,"terrain_depth",y.gridBuffer,y.gridIndexBuffer,y.gridNoSkirtSegments)}}(t,this,u,this.proxyCoords)}_setupProxiedCoordsForOrtho(t,o,u){if(t.getSource()instanceof ie)return this._setupProxiedCoordsForImageSource(t,o,u);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const p=this.proxiedCoords[t.id]=[],f=this.proxyCoords;for(let y=0;y<f.length;y++){const v=f[y],T=this._findTileCoveringTileID(v,t);if(T){const S=this._createProxiedId(v,T,u[v.key]&&u[v.key][t.id]);p.push(S),this.proxyToSource[v.key][t.id]=[S]}}let g=!1;for(let y=0;y<o.length;y++){const v=t.getTile(o[y]);if(!v||!v.hasData())continue;const T=this._findTileCoveringTileID(v.tileID,this.proxySourceCache);if(T&&T.tileID.canonical.z!==v.tileID.canonical.z){const S=this.proxyToSource[T.tileID.key][t.id],A=this._createProxiedId(T.tileID,v,u[T.tileID.key]&&u[T.tileID.key][t.id]);S?S.splice(S.length-1,0,A):this.proxyToSource[T.tileID.key][t.id]=[A],p.push(A),g=!0}}this._sourceTilesOverlap[t.id]=g}_setupProxiedCoordsForImageSource(t,o,u){if(!t.getSource().loaded())return;const p=this.proxiedCoords[t.id]=[],f=this.proxyCoords,g=t.getSource(),y=new a.pointGeometry(g.tileID.x,g.tileID.y)._div(1<<g.tileID.z),v=g.coordinates.map(a.MercatorCoordinate.fromLngLat).reduce((S,A)=>(S.min.x=Math.min(S.min.x,A.x-y.x),S.min.y=Math.min(S.min.y,A.y-y.y),S.max.x=Math.max(S.max.x,A.x-y.x),S.max.y=Math.max(S.max.y,A.y-y.y),S),{min:new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),T=(S,A)=>{const k=S.wrap+S.canonical.x/(1<<S.canonical.z),L=S.canonical.y/(1<<S.canonical.z),B=a.EXTENT/(1<<S.canonical.z),P=A.wrap+A.canonical.x/(1<<A.canonical.z),G=A.canonical.y/(1<<A.canonical.z);return k+B<P+v.min.x||k>P+v.max.x||L+B<G+v.min.y||L>G+v.max.y};for(let S=0;S<f.length;S++){const A=f[S];for(let k=0;k<o.length;k++){const L=t.getTile(o[k]);if(!L||!L.hasData()||T(A,L.tileID))continue;const B=this._createProxiedId(A,L,u[A.key]&&u[A.key][t.id]),P=this.proxyToSource[A.key][t.id];P?P.push(B):this.proxyToSource[A.key][t.id]=[B],p.push(B)}}}_createProxiedId(t,o,u){let p=this.orthoMatrix;if(u){const f=u.find(g=>g.key===o.tileID.key);if(f)return f}if(o.tileID.key!==t.key){const f=t.canonical.z-o.tileID.canonical.z;let g,y,v;p=a.create();const T=o.tileID.wrap-t.wrap<<t.overscaledZ;f>0?(g=a.EXTENT>>f,y=g*((o.tileID.canonical.x<<f)-t.canonical.x+T),v=g*((o.tileID.canonical.y<<f)-t.canonical.y)):(g=a.EXTENT<<-f,y=a.EXTENT*(o.tileID.canonical.x-(t.canonical.x+T<<-f)),v=a.EXTENT*(o.tileID.canonical.y-(t.canonical.y<<-f))),a.ortho(p,0,g,0,g,0,1),a.translate(p,p,[y,v,0])}return new zs(o.tileID,t.key,p)}_findTileCoveringTileID(t,o){let u=o.getTile(t);if(u&&u.hasData())return u;const p=this._findCoveringTileCache[o.id],f=p[t.key];if(u=f?o.getTileByID(f):null,u&&u.hasData()||f===null)return u;let g=u?u.tileID:t,y=g.overscaledZ;const v=o.getSource().minzoom,T=[];if(!f){const A=o.getSource().maxzoom;if(t.canonical.z>=A){const k=t.canonical.z-A;o.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,o.transform.tileZoom),g=new a.OverscaledTileID(y,t.wrap,A,t.canonical.x>>k,t.canonical.y>>k)):k!==0&&(y=A,g=new a.OverscaledTileID(y,t.wrap,A,t.canonical.x>>k,t.canonical.y>>k))}g.key!==t.key&&(T.push(g.key),u=o.getTile(g))}const S=A=>{T.forEach(k=>{p[k]=A}),T.length=0};for(y-=1;y>=v&&(!u||!u.hasData());y--){u&&S(u.tileID.key);const A=g.calculateScaledKey(y);if(u=o.getTileByID(A),u&&u.hasData())break;const k=p[A];if(k===null)break;k===void 0?T.push(A):u=o.getTileByID(k)}return S(u?u.tileID.key:null),u&&u.hasData()?u:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,o){let u=this._tilesDirty[t];u||(u=this._tilesDirty[t]={}),u[o.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const t=function(o){let u=0;const p=new a.StructArrayLayout2ui4,f=131;for(let g=1;g<129;g++){for(let y=1;y<129;y++)u=g*f+y,p.emplaceBack(u,u+1),p.emplaceBack(u,u+f),p.emplaceBack(u+1,u+f),g===128&&p.emplaceBack(u+f,u+f+1);p.emplaceBack(u+1,u+1+f)}return p}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(t),this.wireframeSegments=a.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,t.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}function ks(l){const t=[];for(let o=0;o<l.length;o++){if(l[o]===null)continue;const u=l[o].split(" ");t.push(u.pop())}return t}class Ps{static cacheKey(t,o,u){let p=`${t}${u?u.cacheKey:""}`;for(const f of o)p+=`/${f}`;return p}constructor(t,o,u,p,f,g){const y=t.gl;this.program=y.createProgram();const v=ks(u.staticAttributes),T=p?p.getBinderAttributes():[],S=v.concat(T),A=u.staticUniforms?ks(u.staticUniforms):[],k=p?p.getBinderUniforms():[],L=A.concat(k),B=[];for(const N of L)B.indexOf(N)<0&&B.push(N);let P=p?p.defines():[];P=P.concat(g.map(N=>`#define ${N}`));const G=P.concat(t.extStandardDerivatives?`#extension GL_OES_standard_derivatives : enable 1062`.concat(Gn):Gn,Gn,Nn,Es.fragmentSource,kr.fragmentSource,u.fragmentSource).join(` 1063`),D=P.concat(` 1064#ifdef GL_ES 1065precision highp float; 1066#else 1067 1068#if !defined(lowp) 1069#define lowp 1070#endif 1071 1072#if !defined(mediump) 1073#define mediump 1074#endif 1075 1076#if !defined(highp) 1077#define highp 1078#endif 1079 1080#endif`,Nn,Es.vertexSource,kr.vertexSource,ko.vertexSource,u.vertexSource).join(` 1081`),F=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(F,G),y.compileShader(F),y.attachShader(this.program,F);const O=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(O,D),y.compileShader(O),y.attachShader(this.program,O),this.attributes={};const X={};this.numAttributes=S.length;for(let N=0;N<this.numAttributes;N++)S[N]&&(y.bindAttribLocation(this.program,N,S[N]),this.attributes[S[N]]=N);y.linkProgram(this.program),y.deleteShader(O),y.deleteShader(F);for(let N=0;N<B.length;N++){const Z=B[N];if(Z&&!X[Z]){const K=y.getUniformLocation(this.program,Z);K&&(X[Z]=K)}}this.fixedUniforms=f(t,X),this.binderUniforms=p?p.getUniforms(t,X):[],g.indexOf("TERRAIN")!==-1&&(this.terrainUniforms=((N,Z)=>({u_dem:new a.Uniform1i(N,Z.u_dem),u_dem_prev:new a.Uniform1i(N,Z.u_dem_prev),u_dem_unpack:new a.Uniform4f(N,Z.u_dem_unpack),u_dem_tl:new a.Uniform2f(N,Z.u_dem_tl),u_dem_scale:new a.Uniform1f(N,Z.u_dem_scale),u_dem_tl_prev:new a.Uniform2f(N,Z.u_dem_tl_prev),u_dem_scale_prev:new a.Uniform1f(N,Z.u_dem_scale_prev),u_dem_size:new a.Uniform1f(N,Z.u_dem_size),u_dem_lerp:new a.Uniform1f(N,Z.u_dem_lerp),u_exaggeration:new a.Uniform1f(N,Z.u_exaggeration),u_depth:new a.Uniform1i(N,Z.u_depth),u_depth_size_inv:new a.Uniform2f(N,Z.u_depth_size_inv),u_meter_to_dem:new a.Uniform1f(N,Z.u_meter_to_dem),u_label_plane_matrix_inv:new a.UniformMatrix4f(N,Z.u_label_plane_matrix_inv),u_tile_tl_up:new a.Uniform3f(N,Z.u_tile_tl_up),u_tile_tr_up:new a.Uniform3f(N,Z.u_tile_tr_up),u_tile_br_up:new a.Uniform3f(N,Z.u_tile_br_up),u_tile_bl_up:new a.Uniform3f(N,Z.u_tile_bl_up),u_tile_up_scale:new a.Uniform1f(N,Z.u_tile_up_scale)}))(t,X)),g.indexOf("FOG")!==-1&&(this.fogUniforms=((N,Z)=>({u_fog_matrix:new a.UniformMatrix4f(N,Z.u_fog_matrix),u_fog_range:new a.Uniform2f(N,Z.u_fog_range),u_fog_color:new a.Uniform4f(N,Z.u_fog_color),u_fog_horizon_blend:new a.Uniform1f(N,Z.u_fog_horizon_blend),u_fog_temporal_offset:new a.Uniform1f(N,Z.u_fog_temporal_offset),u_frustum_tl:new a.Uniform3f(N,Z.u_frustum_tl),u_frustum_tr:new a.Uniform3f(N,Z.u_frustum_tr),u_frustum_br:new a.Uniform3f(N,Z.u_frustum_br),u_frustum_bl:new a.Uniform3f(N,Z.u_frustum_bl),u_globe_pos:new a.Uniform3f(N,Z.u_globe_pos),u_globe_radius:new a.Uniform1f(N,Z.u_globe_radius),u_globe_transition:new a.Uniform1f(N,Z.u_globe_transition),u_is_globe:new a.Uniform1i(N,Z.u_is_globe),u_viewport:new a.Uniform2f(N,Z.u_viewport)}))(t,X))}setTerrainUniformValues(t,o){if(!this.terrainUniforms)return;const u=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in o)u[p].set(o[p])}}setFogUniformValues(t,o){if(!this.fogUniforms)return;const u=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in o)u[p].location&&u[p].set(o[p])}}draw(t,o,u,p,f,g,y,v,T,S,A,k,L,B,P,G,D){const F=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(u),t.setStencilMode(p),t.setColorMode(f),t.setCullFace(g);for(const X of Object.keys(this.fixedUniforms))this.fixedUniforms[X].set(y[X]);B&&B.setUniforms(t,this.binderUniforms,k,{zoom:L});const O={[F.LINES]:2,[F.TRIANGLES]:3,[F.LINE_STRIP]:1}[o];for(const X of A.get()){const N=X.vaos||(X.vaos={});(N[v]||(N[v]=new $l)).bind(t,this,T,B?B.getPaintVertexBuffers():[],S,X.vertexOffset,P,G,D),F.drawElements(o,X.primitiveLength*O,F.UNSIGNED_SHORT,X.primitiveOffset*O*2)}}}function Ba(l,t,o){const u=1/xr(o,1,t.transform.tileZoom),p=Math.pow(2,o.tileID.overscaledZ
1081),f=o.tileSize*Math.pow(2,t.transform.tileZoom)/p,g=f*(o.tileID.canonical.x+o.tileID.wrap*p),y=f*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[u,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y]}}const Wl=a.create(),Hl=(l,t,o,u,p,f,g,y,v)=>{const T=t.style.light,S=T.properties.get("position"),A=[S.x,S.y,S.z],k=a.create$1();T.properties.get("anchor")==="viewport"&&(a.fromRotation(k,-t.transform.angle),a.transformMat3(A,A,k));const L=T.properties.get("color"),B=t.transform,P={u_matrix:l,u_lightpos:A,u_lightintensity:T.properties.get("intensity"),u_lightcolor:[L.r,L.g,L.b],u_vertical_gradient:+o,u_opacity:u,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Wl,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0};return B.projection.name==="globe"&&(P.u_tile_id=[p.canonical.x,p.canonical.y,1<<p.canonical.z],P.u_zoom_transition=g,P.u_inv_rot_matrix=v,P.u_merc_center=y,P.u_up_dir=B.projection.upVector(new a.CanonicalTileID(0,0,0),y[0]*a.EXTENT,y[1]*a.EXTENT),P.u_height_lift=f),P},Bo=(l,t,o,u,p,f,g,y,v,T,S)=>{const A=Hl(l,t,o,u,p,y,v,T,S),k={u_height_factor:-Math.pow(2,p.overscaledZ)/g.tileSize/8};return a.extend(A,Ba(f,t,g),k)},Zn=l=>({u_matrix:l}),Ra=(l,t,o,u)=>a.extend(Zn(l),Ba(o,t,u)),Ds=(l,t)=>({u_matrix:l,u_world:t}),Fa=(l,t,o,u,p)=>a.extend(Ra(l,t,o,u),{u_world:p}),ur=a.create(),Oa=(l,t,o,u,p,f)=>{const g=l.transform,y=g.projection.name==="globe";let v;if(f.paint.get("circle-pitch-alignment")==="map")if(y){const S=a.globePixelsToTileUnits(g.zoom,t.canonical)*g._projectionScaler;v=Float32Array.from([S,0,0,S])}else v=g.calculatePixelsToTileUnitsMatrix(o);else v=new Float32Array([g.pixelsToGLUnits[0],0,0,g.pixelsToGLUnits[1]]);const T={u_camera_to_center_distance:g.cameraToCenterDistance,u_matrix:l.translatePosMatrix(t.projMatrix,o,f.paint.get("circle-translate"),f.paint.get("circle-translate-anchor")),u_device_pixel_ratio:a.exported.devicePixelRatio,u_extrude_scale:v,u_inv_rot_matrix:ur,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(y){T.u_inv_rot_matrix=u,T.u_merc_center=p,T.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],T.u_zoom_transition=a.globeToMercatorTransition(g.zoom);const S=p[0]*a.EXTENT,A=p[1]*a.EXTENT;T.u_up_dir=g.projection.upVector(new a.CanonicalTileID(0,0,0),S,A)}return T},Yl=l=>{const t=[];return l.paint.get("circle-pitch-alignment")==="map"&&t.push("PITCH_WITH_MAP"),l.paint.get("circle-pitch-scale")==="map"&&t.push("SCALE_WITH_MAP"),t},Ua=(l,t,o,u)=>{const p=a.EXTENT/o.tileSize;return{u_matrix:l,u_camera_to_center_distance:t.getCameraToCenterDistance(u),u_extrude_scale:[t.pixelsToGLUnits[0]/p,t.pixelsToGLUnits[1]/p]}},Va=(l,t,o=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:o}),ja=a.create(),Au=(l,t,o,u,p,f,g)=>{const y=l.transform,v=y.projection.name==="globe",T=v?a.globePixelsToTileUnits(y.zoom,t.canonical)*y._projectionScaler:xr(o,1,f),S={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:g,u_inv_rot_matrix:ja,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(v){S.u_inv_rot_matrix=u,S.u_merc_center=p,S.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],S.u_zoom_transition=a.globeToMercatorTransition(y.zoom);const A=p[0]*a.EXTENT,k=p[1]*a.EXTENT;S.u_up_dir=y.projection.upVector(new a.CanonicalTileID(0,0,0),A,k)}return S},Na=(l,t,o,u,p,f,g,y)=>{const v=l.transform,T=v.calculatePixelsToTileUnitsMatrix(t),S={u_matrix:Kl(l,t,o,p),u_pixels_to_tile_units:T,u_device_pixel_ratio:g,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:f,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0,u_trim_offset:y};if(Ls(o)){const A=Ro(t,l.transform);S.u_texsize=t.lineAtlasTexture.size,S.u_scale=[A,u.fromScale,u.toScale],S.u_mix=u.t}return S},Cu=(l,t,o,u,p,f)=>{const g=l.transform,y=Ro(t,g);return{u_matrix:Kl(l,t,o,p),u_texsize:t.imageAtlasTexture.size,u_pixels_to_tile_units:g.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:f,u_image:0,u_scale:[y,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]],u_alph
vendor: 4,655 bytes, line 1081
1081a_discard_threshold:0}};function Ro(l,t){return 1/xr(l,1,t.tileZoom)}function Kl(l,t,o,u){return l.translatePosMatrix(u||t.tileID.projMatrix,t,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}function Ls(l){const t=l.paint.get("line-dasharray").value;return t.value||t.kind!=="constant"}const zu=(l,t,o,u,p,f)=>{return{u_matrix:l,u_tl_parent:t,u_scale_parent:o,u_fade_t:u.mix,u_opacity:u.opacity*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:(y=p.paint.get("raster-saturation"),y>0?1-1/(1.001-y):-y),u_contrast_factor:(g=p.paint.get("raster-contrast"),g>0?1/(1-g):1+g),u_spin_weights:Ga(p.paint.get("raster-hue-rotate")),u_perspective_transform:f};var g,y};function Ga(l){l*=Math.PI/180;const t=Math.sin(l),o=Math.cos(l);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const Jl=a.create(),Fo=(l,t,o,u,p,f,g,y,v,T,S,A,k,L,B,P)=>{const G=p.transform,D={u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_rotate_symbol:+o,u_aspect_ratio:G.width/G.height,u_fade_change:p.options.fadeDuration?p.symbolFadeChange:1,u_matrix:f,u_label_plane_matrix:g,u_coord_matrix:y,u_is_text:+v,u_pitch_with_map:+u,u_texsize:T,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Jl,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Jl,u_up_vector:[0,-1,0]};return P.name==="globe"&&(D.u_tile_id=[S.canonical.x,S.canonical.y,1<<S.canonical.z],D.u_zoom_transition=A,D.u_inv_rot_matrix=L,D.u_merc_center=k,D.u_camera_forward=G._camera.forward(),D.u_ecef_origin=a.globeECEFOrigin(G.globeMatrix,S.toUnwrapped()),D.u_tile_matrix=Float32Array.from(G.globeMatrix),D.u_up_vector=B),D},Ql=(l,t,o,u,p,f,g,y,v,T,S,A,k,L,B,P,G)=>a.extend(Fo(l,t,o,u,p,f,g,y,v,T,A,k,L,B,P,G),{u_gamma_scale:u?p.transform.cameraToCenterDistance*Math.cos(p.terrain?0:p.transform._pitch):1,u_device_pixel_ratio:a.exported.devicePixelRatio,u_is_halo:+S}),ec=(l,t,o,u,p,f,g,y,v,T,S,A,k,L,B,P)=>a.extend(Ql(l,t,o,u,p,f,g,y,!0,v,!0,S,A,k,L,B,P),{u_texsize_icon:T,u_texture_icon:1}),tc=(l,t,o)=>({u_matrix:l,u_opacity:t,u_color:o}),$n=(l,t,o,u,p,f)=>a.extend(function(g,y,v,T){const S=v.imageManager.getPattern(g.from.toString()),A=v.imageManager.getPattern(g.to.toString()),{width:k,height:L}=v.imageManager.getPixelSize(),B=Math.pow(2,T.tileID.overscaledZ),P=T.tileSize*Math.pow(2,v.transform.tileZoom)/B,G=P*(T.tileID.canonical.x+T.tileID.wrap*B),D=P*T.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:A.tl,u_pattern_br_b:A.br,u_texsize:[k,L],u_mix:y.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:A.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/xr(T,1,v.transform.tileZoom),u_pixel_coord_upper:[G>>16,D>>16],u_pixel_coord_lower:[65535&G,65535&D]}}(u,f,o,p),{u_matrix:l,u_opacity:t}),ku={fillExtrusion:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_opacity:new a.Uniform1f(l,t.u_opacity),u_tile_id:new a.Uniform3f(l,t.u_tile_id),u_zoom_transition:new a.Uniform1f(l,t.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(l,t.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(l,t.u_merc_center),u_up_dir:new a.Uniform3f(l,t.u_up_dir),u_height_lift:new a.Uniform1f(l,t.u_height_lift)}),fillExtrusionPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_height_factor:new a.Uniform1f(l,t.u_height_factor),u_tile_id:new a.Uniform3f(l,t.u_tile_id),u_zoom_transition:new a.Uniform1f(l,t.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(l,t.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(l,t.u_merc_center),u_up_dir:new a.Uniform3f(l,t.u_up_dir),u_height_lift:new a.Uniform1f(l,t.u_height_lift),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fill:(l,t)=>
1081({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),fillPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),fillOutline:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world)}),fillOutlinePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),circle:(l,t)=>({u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_extrude_scale:new a.UniformMatrix2f(l,t.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_rot_matrix:new a.UniformMatrix4f(l,t.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(l,t.u_merc_center),u_tile_id:new a.Uniform3f(l,t.u_tile_id),u_zoom_transition:new a.Uniform1f(l,t.u_zoom_transition),u_up_dir:new a.Uniform3f(l,t.u_up_dir)}),collisionBox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale)}),collisionCircle:(l,t)=>
1081({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_matrix:new a.UniformMatrix4f(l,t.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(l,t.u_viewport_size)}),debug:(l,t)=>({u_color:new a.UniformColor(l,t.u_color),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_overlay:new a.Uniform1i(l,t.u_overlay),u_overlay_scale:new a.Uniform1f(l,t.u_overlay_scale)}),clippingMask:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmap:(l,t)=>({u_extrude_scale:new a.Uniform1f(l,t.u_extrude_scale),u_intensity:new a.Uniform1f(l,t.u_intensity),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_rot_matrix:new a.UniformMatrix4f(l,t.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(l,t.u_merc_center),u_tile_id:new a.Uniform3f(l,t.u_tile_id),u_zoom_transition:new a.Uniform1f(l,t.u_zoom_transition),u_up_dir:new a.Uniform3f(l,t.u_up_dir)}),heatmapTexture:(l,t)=>({u_image:new a.Uniform1i(l,t.u_image),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_opacity:new a.Uniform1f(l,t.u_opacity)}),hillshade:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_latrange:new a.Uniform2f(l,t.u_latrange),u_light:new a.Uniform2f(l,t.u_light),u_shadow:new a.UniformColor(l,t.u_shadow),u_highlight:new a.UniformColor(l,t.u_highlight),u_accent:new a.UniformColor(l,t.u_accent)}),hillshadePrepare:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_dimension:new a.Uniform2f(l,t.u_dimension),u_zoom:new a.Uniform1f(l,t.u_zoom),u_unpack:new a.Uniform4f(l,t.u_unpack)}),line:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_pixels_to_tile_units:new a.UniformMatrix2f(l,t.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_dash_image:new a.Uniform1i(l,t.u_dash_image),u_gradient_image:new a.Uniform1i(l,t.u_gradient_image),u_image_height:new a.Uniform1f(l,t.u_image_height),u_texsize:new a.Uniform2f(l,t.u_texsize),u_scale:new a.Uniform3f(l,t.u_scale),u_mix:new a.Uniform1f(l,t.u_mix),u_alpha_discard_threshold:new a.Uniform1f(l,t.u_alpha_discard_threshold),u_trim_offset:new a.Uniform2f(l,t.u_trim_offset)}),linePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixels_to_tile_units:new a.UniformMatrix2f(l,t.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_image:new a.Uniform1i(l,t.u_image),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_alpha_discard_threshold:new a.Uniform1f(l,t.u_alpha_discard_threshold)}),raster:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_tl_parent:new a.Uniform2f(l,t.u_tl_parent),u_scale_parent:new a.Uniform1f(l,t.u_scale_parent),u_fade_t:new a.Uniform1f(l,t.u_fade_t),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image0:new a.Uniform1i(l,t.u_image0),u_image1:new a.Uniform1i(l,t.u_image1),u_brightness_low:new a.Uniform1f(l,t.u_brightness_low),u_brightness_high:new a.Uniform1f(l,t.u_brightness_high),u_saturation_factor:new a.Uniform1f(l,t.u_saturation_factor),u_contrast_factor:new a.Uniform1f(l,t.u_contrast_factor),u_spin_weights:new a.Uniform3f(l,t.u_spin_weights),u_perspective_transform:new a.Uniform2f(l,t.u_perspective_transform)}),symbolIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_tile_id:new a.Uniform3f(l,t.u_tile_id),u_zoom_transition:new a.Uniform1f(l,t.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(l,t.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(l,t.u_merc_center),u_camera_forward:new a.Uniform3f(l,t.u_camera_forward),u_tile_matrix:new a.UniformMatrix4f(l,t.u_tile_matrix),u_up_vector:new a.Uniform3f(l,t.u_up_vector),u_ecef_origin:new a.Uniform3f(l,t.u_ecef_origin),u_texture:new a.Uniform1i(l,t.u_texture)}),symbolSDF:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix
1081),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_tile_id:new a.Uniform3f(l,t.u_tile_id),u_zoom_transition:new a.Uniform1f(l,t.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(l,t.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(l,t.u_merc_center),u_camera_forward:new a.Uniform3f(l,t.u_camera_forward),u_tile_matrix:new a.UniformMatrix4f(l,t.u_tile_matrix),u_up_vector:new a.Uniform3f(l,t.u_up_vector),u_ecef_origin:new a.Uniform3f(l,t.u_ecef_origin),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),symbolTextAndIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texsize_icon:new a.Uniform2f(l,t.u_texsize_icon),u_texture:new a.Uniform1i(l,t.u_texture),u_texture_icon:new a.Uniform1i(l,t.u_texture_icon),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),background:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_color:new a.UniformColor(l,t.u_color)}),backgroundPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image:new a.Uniform1i(l,t.u_image),u_pattern_tl_a:new a.Uniform2f(l,t.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(l,t.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(l,t.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(l,t.u_pattern_br_b),u_texsize:new a.Uniform2f(l,t.u_texsize),u_mix:new a.Uniform1f(l,t.u_mix),u_pattern_size_a:new a.Uniform2f(l,t.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(l,t.u_pattern_size_b),u_scale_a:new a.Uniform1f(l,t.u_scale_a),u_scale_b:new a.Uniform1f(l,t.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(l,t.u_tile_units_to_pixels)}),terrainRaster:As,terrainDepth:As,skybox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_sun_direction:new a.Uniform3f(l,t.u_sun_direction),u_cubemap:new a.Uniform1i(l,t.u_cubemap),u_opacity:new a.Uniform1f(l,t.u_opacity),u_temporal_offset:new a.Uniform1f(l,t.u_temporal_offset)}),skyboxGradient:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_center_direction:new a.Uniform3f(l,t.u_center_direction),u_radius:new a.Uniform1f(l,t.u_radius),u_opacity:new a.Uniform1f(l,t.u_opacity),u_temporal_offset:new a.Uniform1f(l,t.u_temporal_offset)}),skyboxCapture:(l,t)=>({u_matrix_3f:new a.UniformMatrix3f(l,t.u_matrix_3f),u_sun_direction:new a.Uniform3f(l,t.u_sun_direction),u_sun_intensity:new a.Uniform1f(l,t.u_sun_intensity),u_color_tint_r:new a.Uniform4f(l,t.u_color_tint_r),u_color_tint_m:new a.Uniform4f(l,t.u_color_tint_m),u_luminance:new a.Uniform1f(l,t.u_luminance)}),globeRaster:(l,t)=>({u_proj_matrix:new a.UniformMatrix4f(l,t.u_proj_matrix),u_globe_matrix:new a.UniformMatrix4f(l,t.u_globe_matrix),u_normalize_matrix:new a.UniformMatrix4f(l,t.u_normalize_matrix),u_merc_matrix:new a.UniformMatrix4f(l,t.u_merc_matrix),u_zoom_transition:new a.Uniform1f(l,t.u_zoom_transition),u_merc_center:new a.Uniform2f(l,t.u_merc_center),u_image0:new a.Uniform1i(l,t.u_image0),u_grid_matrix:new a.UniformMatrix3f(l,t.u_grid_matrix),u_frustum_tl:new a.Uniform3f(l,t.u_frustum_tl),u_frustum_tr:new a.Uniform3f(l,t.u_frustum_tr),u_frustum_br:new a.Uniform3f(l,t.u_frustum_br),u_frustum_bl:new a.Uniform3f(l,t.u_frustum_bl),u_globe_pos:new a.Uniform3f(l,t.u_globe_pos),u_globe_radius:new a.Uniform1f(l,t.u_globe_radius),u_viewport:new a.Uniform2f(l,t.u_viewport)}),globeAtmosphere:(l,t)=>
vendor: 12,555 bytes, line 1081
1081({u_frustum_tl:new a.Uniform3f(l,t.u_frustum_tl),u_frustum_tr:new a.Uniform3f(l,t.u_frustum_tr),u_frustum_br:new a.Uniform3f(l,t.u_frustum_br),u_frustum_bl:new a.Uniform3f(l,t.u_frustum_bl),u_horizon:new a.Uniform1f(l,t.u_horizon),u_transition:new a.Uniform1f(l,t.u_transition),u_fadeout_range:new a.Uniform1f(l,t.u_fadeout_range),u_color:new a.Uniform4f(l,t.u_color),u_high_color:new a.Uniform4f(l,t.u_high_color),u_space_color:new a.Uniform4f(l,t.u_space_color),u_star_intensity:new a.Uniform1f(l,t.u_star_intensity),u_star_density:new a.Uniform1f(l,t.u_star_density),u_star_size:new a.Uniform1f(l,t.u_star_size),u_temporal_offset:new a.Uniform1f(l,t.u_temporal_offset),u_horizon_angle:new a.Uniform1f(l,t.u_horizon_angle),u_rotation_matrix:new a.UniformMatrix4f(l,t.u_rotation_matrix)})};let Bs;function ic(l,t,o,u,p,f,g){const y=l.context,v=y.gl,T=l.transform,S=l.useProgram("collisionBox"),A=[];let k=0,L=0;for(let X=0;X<u.length;X++){const N=u[X],Z=t.getTile(N),K=Z.getBucket(o);if(!K)continue;const le=Gi(N,K,T);let he=le;p[0]===0&&p[1]===0||(he=l.translatePosMatrix(le,Z,p,f));const ce=g?K.textCollisionBox:K.iconCollisionBox,ae=K.collisionCircleArray;if(ae.length>0){const q=a.create(),ge=he;a.mul(q,K.placementInvProjMatrix,T.glCoordMatrix),a.mul(q,q,K.placementViewportMatrix),A.push({circleArray:ae,circleOffset:L,transform:ge,invTransform:q,projection:K.getProjection()}),k+=ae.length/4,L=k}ce&&(l.terrain&&l.terrain.setupElevationDraw(Z,S),S.draw(y,v.LINES,a.DepthMode.disabled,a.StencilMode.disabled,l.colorModeForRenderPass(),a.CullFaceMode.disabled,Ua(he,T,Z,K.getProjection()),o.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,null,T.zoom,null,ce.collisionVertexBuffer,ce.collisionVertexBufferExt))}if(!g||!A.length)return;const B=l.useProgram("collisionCircle"),P=new a.StructArrayLayout2f1f2i16;P.resize(4*k),P._trim();let G=0;for(const X of A)for(let N=0;N<X.circleArray.length/4;N++){const Z=4*N,K=X.circleArray[Z+0],le=X.circleArray[Z+1],he=X.circleArray[Z+2],ce=X.circleArray[Z+3];P.emplace(G++,K,le,he,ce,0),P.emplace(G++,K,le,he,ce,1),P.emplace(G++,K,le,he,ce,2),P.emplace(G++,K,le,he,ce,3)}(!Bs||Bs.length<2*k)&&(Bs=function(X){const N=2*X,Z=new a.StructArrayLayout3ui6;Z.resize(N),Z._trim();for(let K=0;K<N;K++){const le=6*K;Z.uint16[le+0]=4*K+0,Z.uint16[le+1]=4*K+1,Z.uint16[le+2]=4*K+2,Z.uint16[le+3]=4*K+2,Z.uint16[le+4]=4*K+3,Z.uint16[le+5]=4*K+0}return Z}(k));const D=y.createIndexBuffer(Bs,!0),F=y.createVertexBuffer(P,a.collisionCircleLayout.members,!0);for(const X of A){const N={u_matrix:X.transform,u_inv_matrix:X.invTransform,u_camera_to_center_distance:(O=T).getCameraToCenterDistance(X.projection),u_viewport_size:[O.width,O.height]};B.draw(y,v.TRIANGLES,a.DepthMode.disabled,a.StencilMode.disabled,l.colorModeForRenderPass(),a.CullFaceMode.disabled,N,o.id,F,D,a.SegmentVector.simpleSegment(0,2*X.circleOffset,X.circleArray.length,X.circleArray.length/2),null,T.zoom)}var O;F.destroy(),D.destroy()}const rc=a.create();function Pu(l,t,o,u,p,f){const{horizontalAlign:g,verticalAlign:y}=a.getAnchorAlignment(l),v=-(g-.5)*t,T=-(y-.5)*o,S=a.evaluateVariableOffset(l,u);return new a.pointGeometry((v/p+S[0])*f,(T/p+S[1])*f)}function Du(l,t,o,u,p,f,g,y,v,T,S){const A=l.text.placedSymbolArray,k=l.text.dynamicLayoutVertexArray,L=l.icon.dynamicLayoutVertexArray,B={},P=vs(y,l.getProjection(),f),G=f.elevation,D=l.getProjection().upVectorScale(y.canonical,f.center.lat,f.worldSize);k.clear();for(let F=0;F<A.length;F++){const O=A.get(F),X=l.allowVerticalPlacement&&!O.placedOrientation,N=O.hidden||!O.crossTileID||X?null:u[O.crossTileID];if(N){const Z=new a.pointGeometry(O.tileAnchorX,O.tileAnchorY),K=l.getProjection().upVector(y.canonical,Z.x,Z.y),le=G?G.getAtTileOffset(y,Z.x,Z.y):0,he=Ar([O.projectedAnchorX+le*K[0]*D.metersToTile,O.projectedAnchorY+le*K[1]*D.metersToTile,O.projectedAnchorZ+le*K[2]*D.metersToTile],o?P:g),ce=Rn(f.getCameraToCenterDistance(l.getProjection()),he.signedDistanceFromCamera);let ae=p.evaluateSizeForFeature(l.textSizeData,T,O)*ce/a.ONE_EM;o&&(ae*=l.tilePixelRatio/v);const{width:q,height:ge,anchor:_e,textOffset:ze,textScale:de}=N,Ve=Pu(_e,q,ge,ze,de,ae);let Ce;if(o){const Ee=Z.add(Ve),{x:Ie,y:He,z:Ne}=l.getProjection().projectTilePoint(Ee.x,Ee.y,y.canonical);Ce=Ar([Ie+le*K[0]*D.metersToTile,He+le*K[1]*D.metersToTile,Ne+le*K[2]*D.metersToTile],g).point}else{const Ee=t?Ve.rotate(-f.angle):Ve;Ce=[he.point[0]+Ee.x,he.point[1]+Ee.y,0]}const Ae=l.allowVerticalPlacement&&O.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let Ee=0;Ee<O.numGlyphs;Ee++)a.addDynamicAttributes(k,Ce[0],Ce[1],Ce[2],Ae);S&&O.associatedIconIndex>=0&&(B[O.associatedIconIndex]={shiftedAnchor:Ce,angle:Ae})}else ei(O.numGlyphs,k)}if(S){L.clear();const F=l.icon.placedSymbolArray;for(let O=0;O<F.length;O++){const X=F.get(O);if(X.hidden)ei(X.numGlyphs,L);else{const N=B[O];if(N)for(let Z=0;Z<X.numGlyphs;Z++)a.addDynamicAttributes(L,N.shiftedAnchor[0],N.shiftedAnchor[1],N.shiftedAnchor[2],N.angle);else ei(X.numGlyphs,L)}}l.icon.dynamicLayoutVertexBuffer.updateData(L)}l.text.dynamicLayoutVertexBuffer.updateData(k)}function Za(l,t,o){return o.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Rs(l,t,o,u,p,f,g,y,v,T,S,A){const k=l.context,L=k.gl,B=l.transform,P=y==="map",G=v==="map",D=P&&o.layout.get("symbol-placement")!=="point",F=P&&!G&&!D,O=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let X=!1;const N=l.depthModeForSublayer(0,a.DepthMode.ReadOnly),Z=[a.mercatorXfromLng(B.center.lng),a.mercatorYfromLat(B.center.lat)],K=o.layout.get("text-variable-anchor"),le=B.projection.name==="globe",he=[],ce=[0,-1,0];let ae=ce;!le&&!B.mercatorFromTransition||P||(ae=function(q){const ge=q._camera.getWorldToCamera(q.worldSize,1),_e=a.multiply([],ge,q.globeMatrix);a.invert(_e,_e);const ze=[0,0,0],de=[0,1,0,0];return a.transformMat4$1(de,de,_e),ze[0]=de[0],ze[1]=de[1],ze[2]=de[2],a.normalize(ze,ze),ze}(B));for(const q of u){const ge=t.getTile(q),_e=ge.getBucket(o);if(!_e||_e.projection.name==="mercator"&&le)continue;const ze=p?_e.text:_e.icon;if(!ze||_e.fullyClipped||!ze.segments.get().length)continue;const de=ze.programConfigurations.get(o.id),Ve=p||_e.sdfIcons,Ce=p?_e.textSizeData:_e.iconSizeData,Ae=G||B.pitch!==0,Ee=a.evaluateSizeForZoom(Ce,B.zoom);let Ie,He,Ne,tt,Ue=[0,0],Ke=null;if(p){if(He=ge.glyphAtlasTexture,Ne=L.LINEAR,Ie=ge.glyphAtlasTexture.size,_e.iconsInText){Ue=ge.imageAtlasTexture.size,Ke=ge.imageAtlasTexture;const Kt=Ce.kind==="composite"||Ce.kind==="camera";tt=Ae||l.options.rotating||l.options.zooming||Kt?L.LINEAR:L.NEAREST}}else{const Kt=o.layout.get("icon-size").constantOr(0)!==1||_e.iconsNeedLinear;He=ge.imageAtlasTexture,Ne=Ve||l.options.rotating||l.options.zooming||Kt||Ae?L.LINEAR:L.NEAREST,Ie=ge.imageAtlasTexture.size}const yt=_e.projection.name==="globe",Tt=yt?ae:ce,qt=yt?a.globeToMercatorTransition(B.zoom):0,Mt=vs(q,_e.getProjection(),B),Ri=B.calculatePixelsToTileUnitsMatrix(ge),pr=nt(Mt,ge.tileID.canonical,G,P,B,_e.getProjection(),Ri),Pr=l.terrain&&G&&D?a.invert(a.create(),pr):rc,Pt=cn(Mt,ge.tileID.canonical,G,P,B,_e.getProjection(),Ri),Bt=K&&_e.hasTextData(),xt=o.layout.get("icon-text-fit")!=="none"&&Bt&&_e.hasIconData();if(D){const Kt=B.elevation,dr=Kt?Kt.getAtTileOffsetFunc(q,B.center.lat,B.worldSize,_e.getProjection()):Ho=>[0,0,0],Dr=Qi(Mt,ge.tileID.canonical,G,P,B,_e.getProjection(),Ri);ji(_e,Mt,l,p,Dr,Pt,G,T,dr,q)}const Yt=D||p&&K||xt,ci=l.translatePosMatrix(Mt,ge,f,g),ht=Yt?rc:pr,Ti=l.translatePosMatrix(Pt,ge,f,g,!0),xn=_e.getProjection().createInversionMatrix(B,q.canonical),ir=[];l.terrain&&G&&ir.push("PITCH_WITH_MAP_TERRAIN"),yt&&ir.push("PROJECTION_GLOBE_VIEW"),Yt&&ir.push("PROJECTED_POS_ON_VIEWPORT");const Qn=Ve&&o.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let eo;eo=Ve?_e.iconsInText?ec(Ce.kind,Ee,F,G,l,ci,ht,Ti,Ie,Ue,q,qt,Z,xn,Tt,_e.getProjection()):Ql(Ce.kind,Ee,F,G,l,ci,ht,Ti,p,Ie,!0,q,qt,Z,xn,Tt,_e.getProjection()):Fo(Ce.kind,Ee,F,G,l,ci,ht,Ti,p,Ie,q,qt,Z,xn,Tt,_e.getProjection());const Zr={program:l.useProgram(Za(Ve,p,_e),de,ir),buffers:ze,uniformValues:eo,atlasTexture:He,atlasTextureIcon:Ke,atlasInterpolation:Ne,atlasInterpolationIcon:tt,isSDF:Ve,hasHalo:Qn,tile:ge,labelPlaneMatrixInv:Pr};if(O&&_e.canOverlap){X=!0;const Kt=ze.segments.get();for(const dr of Kt)he.push({segments:new a.SegmentVector([dr]),sortKey:dr.sortKey,state:Zr})}else he.push({segments:ze.segments,sortKey:0,state:Zr})}X&&he.sort((q,ge)=>q.sortKey-ge.sortKey);for(const q of he){const ge=q.state;if(l.terrain&&l.terrain.setupElevationDraw(ge.tile,ge.program,{useDepthForOcclusion:!le,labelPlaneMatrixInv:ge.labelPlaneMatrixInv}),k.activeTexture.set(L.TEXTURE0),ge.atlasTexture.bind(ge.atlasInterpolation,L.CLAMP_TO_EDGE),ge.atlasTextureIcon&&(k.activeTexture.set(L.TEXTURE1),ge.atlasTextureIcon&&ge.atlasTextureIcon.bind(ge.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),ge.isSDF){const _e=ge.uniformValues;ge.hasHalo&&(_e.u_is_halo=1,$a(ge.buffers,q.segments,o,l,ge.program,N,S,A,_e)),_e.u_is_halo=0}$a(ge.buffers,q.segments,o,l,ge.program,N,S,A,ge.uniformValues)}}function $a(l,t,o,u,p,f,g,y,v){const T=u.context;p.draw(T,T.gl.TRIANGLES,f,g,y,a.CullFaceMode.disabled,v,o.id,l.layoutVertexBuffer,l.indexBuffer,t,o.paint,u.transform.zoom,l.programConfigurations.get(o.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.globeExtVertexBuffer)}function qa(l,t,o,u,p,f,g){const y=l.context.gl,v=o.paint.get("fill-pattern"),T=v&&v.constantOr(1),S=o.getCrossfadeParameters();let A,k,L,B,P;g?(k=T&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",A=y.LINES):(k=T?"fillPattern":"fill",A=y.TRIANGLES);for(const G of u){const D=t.getTile(G);if(T&&!D.patternsLoaded())continue;const F=D.getBucket(o);if(!F)continue;l.prepareDrawTile();const O=F.programConfigurations.get(o.id),X=l.useProgram(k,O);T&&(l.context.activeTexture.set(y.TEXTURE0),D.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),O.updatePaintBuffers(S));const N=v.constantOr(null);if(N&&D.imageAtlas){const K=D.imageAtlas,le=K.patternPositions[N.to.toString()],he=K.patternPositions[N.from.toString()];le&&he&&O.setConstantPatternPositions(le,he)}const Z=l.translatePosMatrix(G.projMatrix,D,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(g){B=F.indexBuffer2,P=F.segments2;const K=l.terrain&&l.terrain.renderingToTexture?l.terrain.drapeBufferSize:[y.drawingBufferWidth,y.drawingBufferHeight];L=k==="fillOutlinePattern"&&T?Fa(Z,l,S,D,K):Ds(Z,K)}else B=F.indexBuffer,P=F.segments,L=T?Ra(Z,l,S,D):Zn(Z);l.prepareDrawProgram(l.context,X,G.toUnwrapped()),X.draw(l.context,A,p,l.stencilModeForClipping(G),f,a.CullFaceMode.disabled,L,o.id,F.layoutVertexBuffer,B,P,o.paint,l.transform.zoom,O)}}function Fs(l,t,o,u,p,f,g){const y=l.context,v=y.gl,T=l.transform,S=o.paint.get("fill-extrusion-pattern"),A=S.constantOr(1),k=o.getCrossfadeParameters(),L=o.paint.get("fill-extrusion-opacity"),B=T.projection.name==="globe"?a.fillExtrusionHeightLift():0,P=T.projection.name==="globe",G=P?a.globeToMercatorTransition(T.zoom):0,D=[a.mercatorXfromLng(T.center.lng),a.mercatorYfromLat(T.center.lat)],F=[];P&&F.push("PROJECTION_GLOBE_VIEW");for(const O of u){const X=t.getTile(O),N=X.getBucket(o);if(!N||N.projection.name!==T.projection.name)continue;const Z=N.programConfigurations.get(o.id),K=l.useProgram(A?"fillExtrusionPattern":"fillExtrusion",Z,F);if(l.terrain){const ge=l.terrain;if(l.style.terrainSetForDrapingOnly())ge.setupElevationDraw(X,K,{useMeterToDem:!0});else{if(!N.enableTerrain)continue;if(ge.setupElevationDraw(X,K,{useMeterToDem:!0}),Xa(y,t,O,N,o,ge),!N.centroidVertexBuffer){const _e=K.attributes.a_centroid_pos;_e!==void 0&&v.vertexAttrib2f(_e,0,0)}}}A&&(l.context.activeTexture.set(v.TEXTURE0),X.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),Z.updatePaintBuffers(k));const le=S.constantOr(null);if(le&&X.imageAtlas){const ge=X.imageAtlas,_e=ge.patternPositions[le.to.toString()],ze=ge.patternPositions[le.from.toString()];_e&&ze&&Z.setConstantPatternPositions(_e,ze)}const he=l.translatePosMatrix(O.projMatrix,X,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),ce=T.projection.createInversionMatrix(T,O.canonical),ae=o.paint.get("fill-extrusion-vertical-gradient"),q=A?Bo(he,l,ae,L,O,k,X,B,G,D,ce):Hl(he,l,ae,L,O,B,G,D,ce);l.prepareDrawProgram(y,K,O.toUnwrapped()),K.draw(y,y.gl.TRIANGLES,p,f,g,a.CullFaceMode.backCCW,q,o.id,N.layoutVertexBuffer,N.indexBuffer,N.segments,o.paint,l.transform.zoom,Z,l.terrain?N.centroidVertexBuffer:null,P?N.layoutVertexExtBuffer:null)}}function Xa(l,t,o,u,p,f){const g=[D=>{let F=D.canonical.x-1,O=D.wrap;
1081return F<0&&(F=(1<<D.canonical.z)-1,O--),new a.OverscaledTileID(D.overscaledZ,O,D.canonical.z,F,D.canonical.y)},D=>{let F=D.canonical.x+1,O=D.wrap;return F===1<<D.canonical.z&&(F=0,O++),new a.OverscaledTileID(D.overscaledZ,O,D.canonical.z,F,D.canonical.y)},D=>new a.OverscaledTileID(D.overscaledZ,D.wrap,D.canonical.z,D.canonical.x,(D.canonical.y===0?1<<D.canonical.z:D.canonical.y)-1),D=>new a.OverscaledTileID(D.overscaledZ,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y===(1<<D.canonical.z)-1?0:D.canonical.y+1)],y=D=>{const F=t.getSource().minzoom,O=N=>{const Z=t.getTileByID(N);if(Z&&Z.hasData())return Z.getBucket(p)},X=[0,-1,1];for(const N of X){if(D.overscaledZ+N<F)continue;const Z=O(D.calculateScaledKey(D.overscaledZ+N));if(Z)return Z}},v=[0,0,0],T=(D,F)=>(v[0]=Math.min(D.min.y,F.min.y),v[1]=Math.max(D.max.y,F.max.y),v[2]=a.EXTENT-F.min.x>D.max.x?F.min.x-a.EXTENT:D.max.x,v),S=(D,F)=>(v[0]=Math.min(D.min.x,F.min.x),v[1]=Math.max(D.max.x,F.max.x),v[2]=a.EXTENT-F.min.y>D.max.y?F.min.y-a.EXTENT:D.max.y,v),A=[(D,F)=>T(D,F),(D,F)=>T(F,D),(D,F)=>S(D,F),(D,F)=>S(F,D)],k=new a.pointGeometry(0,0);let L,B,P;const G=(D,F,O,X,N)=>{const Z=[[X?O:D,X?D:O,0],[X?O:F,X?F:O,0]],K=N<0?a.EXTENT+N:N,le=[X?K:(D+F)/2,X?(D+F)/2:K,0];return O===0&&N<0||O!==0&&N>0?f.getForTilePoints(P,[le],!0,B):Z.push(le),f.getForTilePoints(o,Z,!0,L),Math.max(Z[0][2],Z[1][2],le[2])/f.exaggeration()};for(let D=0;D<4;D++){const F=(D<2?1:5)-D,O=u.borders[D];if(O.length===0)continue;const X=P=g[D](o),N=y(X);if(!(N&&N instanceof a.FillExtrusionBucket&&N.enableTerrain)||u.borderDoneWithNeighborZ[D]===N.canonical.z&&N.borderDoneWithNeighborZ[F]===u.canonical.z||(B=f.findDEMTileFor(X),!B||!B.dem))continue;if(!L){const he=f.findDEMTileFor(o);if(!he||!he.dem)return;L=he}const Z=N.borders[F];let K=0;const le=N.borderDoneWithNeighborZ[F]!==u.canonical.z;if(u.canonical.z===N.canonical.z){for(let he=0;he<O.length;he++){const ce=u.featuresOnBorder[O[he]],ae=ce.borders[D];let q;for(;K<Z.length&&(q=N.featuresOnBorder[Z[K]],!(q.borders[F][1]>ae[0]+3));)le&&N.encodeCentroid(void 0,q,!1),K++;if(q&&K<Z.length){const ge=K;let _e=0;for(;!(q.borders[F][0]>ae[1]-3)&&(_e++,++K!==Z.length);)q=N.featuresOnBorder[Z[K]];if(q=N.featuresOnBorder[Z[ge]],ce.intersectsCount()>1||q.intersectsCount()>1||_e!==1){_e!==1&&(K=ge),u.encodeCentroid(void 0,ce,!1),le&&N.encodeCentroid(void 0,q,!1);continue}const ze=A[D](ce,q),de=D%2?a.EXTENT-1:0;k.x=G(ze[0],Math.min(a.EXTENT-1,ze[1]),de,D<2,ze[2]),k.y=0,u.encodeCentroid(k,ce,!1),le&&N.encodeCentroid(k,q,!1)}else u.encodeCentroid(void 0,ce,!1)}u.borderDoneWithNeighborZ[D]=N.canonical.z,u.needsCentroidUpdate=!0,le&&(N.borderDoneWithNeighborZ[F]=u.canonical.z,N.needsCentroidUpdate=!0)}else{for(const he of O)u.encodeCentroid(void 0,u.featuresOnBorder[he],!1);if(le){for(const he of Z)N.encodeCentroid(void 0,N.featuresOnBorder[he],!1);N.borderDoneWithNeighborZ[F]=u.canonical.z,N.needsCentroidUpdate=!0}u.borderDoneWithNeighborZ[D]=N.canonical.z,u.needsCentroidUpdate=!0}}(u.needsCentroidUpdate||!u.centroidVertexBuffer&&u.centroidVertexArray.length!==0)&&u.uploadCentroid(l)}const dn=new a.Color(1,0,0,1),Oo=new a.Color(0,1,0,1),nc=new a.Color(0,0,1,1),qn=new a.Color(1,0,1,1),Xn=new a.Color(0,1,1,1);function Wa(l,t,o,u){ft(l,0,t+o/2,l.transform.width,o,u)}
vendor: 4,369 bytes, line 1081
1081function Os(l,t,o,u){ft(l,t-o/2,0,o,l.transform.height,u)}function ft(l,t,o,u,p,f){const g=l.context,y=g.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*a.exported.devicePixelRatio,o*a.exported.devicePixelRatio,u*a.exported.devicePixelRatio,p*a.exported.devicePixelRatio),g.clear({color:f}),y.disable(y.SCISSOR_TEST)}function Us(l,t,o){const u=l.context,p=u.gl,f=l.transform.projection.name==="globe",g=o.projMatrix,y=l.useProgram("debug",null,f?["PROJECTION_GLOBE_VIEW"]:null),v=t.getTileByID(o.key);l.terrain&&l.terrain.setupElevationDraw(v,y);const T=a.DepthMode.disabled,S=a.StencilMode.disabled,A=l.colorModeForRenderPass(),k="$debug";u.activeTexture.set(p.TEXTURE0),l.emptyTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),f?v._makeGlobeTileDebugBuffers(l.context,l.transform.projection):v._makeDebugTileBoundsBuffers(l.context,l.transform.projection);const L=v._tileDebugBuffer||l.debugBuffer,B=v._tileDebugIndexBuffer||l.debugIndexBuffer,P=v._tileDebugSegments||l.debugSegments;y.draw(u,p.LINE_STRIP,T,S,A,a.CullFaceMode.disabled,Va(g,a.Color.red),k,L,B,P,null,null,null,v._globeTileDebugBorderBuffer);const G=v.latestRawTileData,D=Math.floor((G&&G.byteLength||0)/1024),F=t.getTile(o).tileSize,O=512/Math.min(F,512)*(o.overscaledZ/l.transform.zoom)*.5;let X=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(X+=` => ${o.overscaledZ}`),function(le,he){le.initDebugOverlayCanvas();const ce=le.debugOverlayCanvas,ae=le.context.gl,q=le.debugOverlayCanvas.getContext("2d");q.clearRect(0,0,ce.width,ce.height),q.shadowColor="white",q.shadowBlur=2,q.lineWidth=1.5,q.strokeStyle="white",q.textBaseline="top",q.font="bold 36px Open Sans, sans-serif",q.fillText(he,5,5),q.strokeText(he,5,5),le.debugOverlayTexture.update(ce),le.debugOverlayTexture.bind(ae.LINEAR,ae.CLAMP_TO_EDGE)}(l,`${X} ${D}kb`);const N=v._tileDebugTextBuffer||l.debugBuffer,Z=v._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,K=v._tileDebugTextSegments||l.debugSegments;y.draw(u,p.TRIANGLES,T,S,a.ColorMode.alphaBlended,a.CullFaceMode.disabled,Va(g,a.Color.transparent,O),k,N,Z,K,null,null,null,v._globeTileDebugTextBuffer)}const Lu=a.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:oc}=Lu;function Zi(l,t,o,u){l.emplaceBack(t,o,u)}class sc{constructor(t){this.vertexArray=new a.StructArrayLayout3f12,this.indices=new a.StructArrayLayout3ui6,Zi(this.vertexArray,-1,-1,1),Zi(this.vertexArray,1,-1,1),Zi(this.vertexArray,-1,1,1),Zi(this.vertexArray,1,1,1),Zi(this.vertexArray,-1,-1,-1),Zi(this.vertexArray,1,-1,-1),Zi(this.vertexArray,-1,1,-1),Zi(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,oc),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=a.SegmentVector.simpleSegment(0,0,36,12)}}function Wn(l,t,o,u,p,f){const g=l.gl,y=t.paint.get("sky-atmosphere-color"),v=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),S=((A,k,L,B,P)=>({u_matrix_3f:A,u_sun_direction:k,u_sun_intensity:L,u_color_tint_r:[B.r,B.g,B.b,B.a],u_color_tint_m:[P.r,P.g,P.b,P.a],u_luminance:5e-5}))(a.fromMat4(a.create$1(),u),p,T,y,v);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+f,t.skyboxTexture,0),o.draw(l,g.TRIANGLES,a.DepthMode.disabled,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const ac=a.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Bu{constructor(t){const o=new a.StructArrayLayout5f20;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const u=new a.StructArrayLayout3ui6;u.emplaceBack(0,1,2),u.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(o,ac.members),this.indexBuffer=t.createIndexBuffer(u),this.segments=a.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}
1081const Vs={symbol:function(l,t,o,u,p){if(l.renderPass!=="translucent")return;const f=a.StencilMode.disabled,g=l.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(y,v,T,S,A,k,L){const B=v.transform,P=A==="map",G=k==="map";for(const D of y){const F=S.getTile(D),O=F.getBucket(T);if(!O||!O.text||!O.text.segments.get().length)continue;const X=a.evaluateSizeForZoom(O.textSizeData,B.zoom),N=vs(D,O.getProjection(),B),Z=B.calculatePixelsToTileUnitsMatrix(F),K=nt(N,F.tileID.canonical,G,P,B,O.getProjection(),Z),le=T.layout.get("icon-text-fit")!=="none"&&O.hasIconData();if(X){const he=Math.pow(2,B.zoom-F.tileID.overscaledZ);Du(O,P,G,L,a.symbolSize,B,K,D,he,X,le)}}}(u,l,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),p),o.paint.get("icon-opacity").constantOr(1)!==0&&Rs(l,t,o,u,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),f,g),o.paint.get("text-opacity").constantOr(1)!==0&&Rs(l,t,o,u,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),f,g),t.map.showCollisionBoxes&&(ic(l,t,o,u,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),ic(l,t,o,u,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,o,u){if(l.renderPass!=="translucent")return;const p=o.paint.get("circle-opacity"),f=o.paint.get("circle-stroke-width"),g=o.paint.get("circle-stroke-opacity"),y=o.layout.get("circle-sort-key").constantOr(1)!==void 0;if(p.constantOr(1)===0&&(f.constantOr(1)===0||g.constantOr(1)===0))return;const v=l.context,T=v.gl,S=l.transform,A=l.depthModeForSublayer(0,a.DepthMode.ReadOnly),k=a.StencilMode.disabled,L=l.colorModeForRenderPass(),B=S.projection.name==="globe",P=[a.mercatorXfromLng(S.center.lng),a.mercatorYfromLat(S.center.lat)],G=[];for(let F=0;F<u.length;F++){const O=u[F],X=t.getTile(O),N=X.getBucket(o);if(!N||N.projection.name!==S.projection.name)continue;const Z=N.programConfigurations.get(o.id),K=Yl(o);B&&K.push("PROJECTION_GLOBE_VIEW");const le=l.useProgram("circle",Z,K),he=N.layoutVertexBuffer,ce=N.globeExtVertexBuffer,ae=N.indexBuffer,q=S.projection.createInversionMatrix(S,O.canonical),ge={programConfiguration:Z,program:le,layoutVertexBuffer:he,globeExtVertexBuffer:ce,indexBuffer:ae,uniformValues:Oa(l,O,X,q,P,o),tile:X};if(y){const _e=N.segments.get();for(const ze of _e)G.push({segments:new a.SegmentVector([ze]),sortKey:ze.sortKey,state:ge})}else G.push({segments:N.segments,sortKey:0,state:ge})}y&&G.sort((F,O)=>F.sortKey-O.sortKey);const D={useDepthForOcclusion:!B};for(const F of G){const{programConfiguration:O,program:X,layoutVertexBuffer:N,globeExtVertexBuffer:Z,indexBuffer:K,uniformValues:le,tile:he}=F.state,ce=F.segments;l.terrain&&l.terrain.setupElevationDraw(he,X,D),l.prepareDrawProgram(v,X,he.tileID.toUnwrapped()),X.draw(v,T.TRIANGLES,A,k,L,a.CullFaceMode.disabled,le,o.id,N,K,ce,o.paint,S.zoom,O,B?Z:null)}},heatmap:function(l,t,o,u){if(o.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const p=l.context,f=p.gl,g=a.StencilMode.disabled,y=new a.ColorMode([f.ONE,f.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(L,B,P,G){const D=L.gl,F=B.width*G,O=B.height*G;L.activeTexture.set(D.TEXTURE1),L.viewport.set([0,0,F,O]);let X=P.heatmapFbo;if(!X||X&&(X.width!==F||X.height!==O)){X&&X.destroy();const N=D.createTexture();D.bindTexture(D.TEXTURE_2D,N),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,D.LINEAR),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,D.LINEAR),X=P.heatmapFbo=L.createFramebuffer(F,O,!1),function(Z,K,le,he,ce,ae){const q=Z.gl;q.texImage2D(q.TEXTURE_2D,0,q.RGBA,ce,ae,0,q.RGBA,Z.extRenderToTextureHalfFloat?Z.extTextureHalfFloat.HALF_FLOAT_OES:q.UNSIGNED_BYTE,null),he.colorAttachment.set(le)}(L,0,N,X,F,O)}else D.bindTexture(D.TEXTURE_2D,X.colorAttachment.get()),L.bindFramebuffer.set(X.framebuffer)})(p,l,o,l.transform.projection.name==="globe"?.5:.25),p.clear({color:a.Color.transparent});const v=l.transform,T=v.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:null,A=T?a.CullFaceMode.frontCCW:a.CullFaceMode.disabled,k=[a.mercatorXfromLng(v.center.lng),a.mercatorYfromLat(v.center.lat)];for(let L=0;L<u.length;L++){const B=u[L];if(t.hasRenderableParent(B))continue;const P=t.getTile(B),G=P.getBucket(o);if(!G||G.projection.name!==v.projection.name)continue;const D=G.programConfigurations.get(o.id),F=l.useProgram("heatmap",D,S),{zoom:O}=l.transform;l.terrain&&l.terrain.setupElevationDraw(P,F),l.prepareDrawProgram(p,F,B.toUnwrapped());const X=v.projection.createInversionMatrix(v,B.canonical);F.draw(p,f.TRIANGLES,a.DepthMode.disabled,g,y,A,Au(l,B,P,X,k,O,o.paint.get("heatmap-intensity")),o.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,o.paint,l.transform.zoom,D,T?G.globeExtVertexBuffer:null)}p.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(p,f){const g=p.context,y=g.gl,v=f.heatmapFbo;if(!v)return;g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),g.activeTexture.set(y.TEXTURE1);let T=f.colorRampTexture;T||(T=f.colorRampTexture=new a.Texture(g,f.colorRamp,y.RGBA)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),p.useProgram("heatmapTexture").draw(g,y.TRIANGLES,a.DepthMode.disabled,a.StencilMode.disabled,p.colorModeForRenderPass(),a.CullFaceMode.disabled,((S,A,k,L)=>({u_image:0,u_color_ramp:1,u_opacity:A.paint.get("heatmap-opacity")}))(0,f),f.id,p.viewportBuffer,p.quadTriangleIndexBuffer,p.viewportSegments,f.paint,p.transform.zoom)}(l,o))},line:function(l,t,o,u){if(l.renderPass!=="translucent")return;const p=o.paint.get("line-opacity"),f=o.paint.get("line-width");if(p.constantOr(1)===0||f.constantOr(1)===0)return;const g=l.depthModeForSublayer(0,a.DepthMode.ReadOnly),y=l.colorModeForRenderPass(),v=l.terrain&&l.terrain.renderingToTexture?1:a.exported.devicePixelRatio,T=o.paint.get("line-dasharray"),S=T.constantOr(1),A=o.layout.get("line-cap"),k=o.paint.get("line-pattern"),L=k.constantOr(1),B=o.paint.get("line-gradient"),P=o.getCrossfadeParameters(),G=L?"linePattern":"line",D=l.context,F=D.gl,O=(N=>{const Z=[];Ls(N)&&Z.push("RENDER_LINE_DASH"),N.paint.get("line-gradient")&&Z.push("RENDER_LINE_GRADIENT");const K=N.paint.get("line-trim-offset");K[0]===0&&K[1]===0||Z.push("RENDER_LINE_TRIM_OFFSET");const le=N.paint.get("line-pattern").constantOr(1),he=N.paint.get("line-opacity").constantOr(1)!==1;return!le&&he&&Z.push("RENDER_LINE_ALPHA_DISCARD"),Z})(o);let X=O.includes("RENDER_LINE_ALPHA_DISCARD");l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(X=!1);for(const N of u){const Z=t.getTile(N);if(L&&!Z.patternsLoaded())continue;const K=Z.getBucket(o);if(!K)continue;l.prepareDrawTile();const le=K.programConfigurations.get(o.id),he=l.useProgram(G,le,O),ce=k.constantOr(null);if(ce&&Z.imageAtlas){const Ce=Z.imageAtlas,Ae=Ce.patternPositions[ce.to.toString()],Ee=Ce.patternPositions[ce.from.toString()];Ae&&Ee&&le.setConstantPatternPositions(Ae,Ee)}const ae=T.constantOr(null),q=A.constantOr(null);if(!L&&ae&&q&&Z.lineAtlas){const Ce=Z.lineAtlas,Ae=Ce.getDash(ae.to,q),Ee=Ce.getDash(ae.from,q);Ae&&Ee&&le.setConstantPatternPositions(Ae,Ee)}let[ge,_e]=o.paint.get("line-trim-offset");(q==="round"||q==="square")&&ge!==_e&&(ge===0&&(ge-=1),_e===1&&(_e+=1));const ze=l.terrain?N.projMatrix:null,de=L?Cu(l,Z,o,P,ze,v):Na(l,Z,o,P,ze,K.lineClipsArray.length,v,[ge,_e]);
1081if(B){const Ce=K.gradients[o.id];let Ae=Ce.texture;if(o.gradientVersion!==Ce.version){let Ee=256;if(o.stepInterpolant){const Ie=t.getSource().maxzoom,He=N.canonical.z===Ie?Math.ceil(1<<l.transform.maxZoom-N.canonical.z):1;Ee=a.clamp(a.nextPowerOfTwo(K.maxLineLength/a.EXTENT*1024*He),256,D.maxTextureSize)}Ce.gradient=a.renderColorRamp({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:Ee,image:Ce.gradient||void 0,clips:K.lineClipsArray}),Ce.texture?Ce.texture.update(Ce.gradient):Ce.texture=new a.Texture(D,Ce.gradient,F.RGBA),Ce.version=o.gradientVersion,Ae=Ce.texture}D.activeTexture.set(F.TEXTURE1),Ae.bind(o.stepInterpolant?F.NEAREST:F.LINEAR,F.CLAMP_TO_EDGE)}S&&(D.activeTexture.set(F.TEXTURE0),Z.lineAtlasTexture.bind(F.LINEAR,F.REPEAT),le.updatePaintBuffers(P)),L&&(D.activeTexture.set(F.TEXTURE0),Z.imageAtlasTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),le.updatePaintBuffers(P)),l.prepareDrawProgram(D,he,N.toUnwrapped());const Ve=Ce=>{he.draw(D,F.TRIANGLES,g,Ce,y,a.CullFaceMode.disabled,de,o.id,K.layoutVertexBuffer,K.indexBuffer,K.segments,o.paint,l.transform.zoom,le,K.layoutVertexBuffer2)};if(X){const Ce=l.stencilModeForClipping(N).ref;Ce===0&&l.terrain&&D.clear({stencil:0});const Ae={func:F.EQUAL,mask:255};de.u_alpha_discard_threshold=.8,Ve(new a.StencilMode(Ae,Ce,255,F.KEEP,F.KEEP,F.INVERT)),de.u_alpha_discard_threshold=0,Ve(new a.StencilMode(Ae,Ce,255,F.KEEP,F.KEEP,F.KEEP))}else Ve(l.stencilModeForClipping(N))}X&&(l.resetStencilClippingMasks(),l.terrain&&D.clear({stencil:0}))},fill:function(l,t,o,u){const p=o.paint.get("fill-color"),f=o.paint.get("fill-opacity");if(f.constantOr(1)===0)return;const g=l.colorModeForRenderPass(),y=o.paint.get("fill-pattern"),v=l.opaquePassEnabledForLayer()&&!y.constantOr(1)&&p.constantOr(a.Color.transparent).a===1&&f.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===v){const T=l.depthModeForSublayer(1,l.renderPass==="opaque"?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly);qa(l,t,o,u,T,g,!1)}if(l.renderPass==="translucent"&&o.paint.get("fill-antialias")){const T=l.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,a.DepthMode.ReadOnly);qa(l,t,o,u,T,g,!0)}},"fill-extrusion":function(l,t,o,u){const p=o.paint.get("fill-extrusion-opacity");if(p!==0&&l.renderPass==="translucent"){const f=new a.DepthMode(l.context.gl.LEQUAL,a.DepthMode.ReadWrite,l.depthRangeFor3D);if(p!==1||o.paint.get("fill-extrusion-pattern").constantOr(1))Fs(l,t,o,u,f,a.StencilMode.disabled,a.ColorMode.disabled),Fs(l,t,o,u,f,l.stencilModeFor3D(),l.colorModeForRenderPass()),l.resetStencilClippingMasks();else{const g=l.colorModeForRenderPass();Fs(l,t,o,u,f,a.StencilMode.disabled,g)}}},hillshade:function(l,t,o,u){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const p=l.context,f=l.depthModeForSublayer(0,a.DepthMode.ReadOnly),g=l.colorModeForRenderPass(),y=l.terrain&&l.terrain.renderingToTexture,[v,T]=l.renderPass!=="translucent"||y?[{},u]:l.stencilConfigForOverlap(u);for(const S of T){const A=t.getTile(S);if(A.needsHillshadePrepare&&l.renderPass==="offscreen")Is(l,A,o,f,a.StencilMode.disabled,g);else if(l.renderPass==="translucent"){const k=y&&l.terrain?l.terrain.stencilModeForRTTOverlap(S):v[S.overscaledZ];ql(l,S,A,o,f,k,g)}}p.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,o,u,p,f){if(l.renderPass!=="translucent"||o.paint.get("raster-opacity")===0||!u.length)return;const g=l.context,y=g.gl,v=t.getSource(),T=l.useProgram("raster"),S=l.colorModeForRenderPass(),A=l.terrain&&l.terrain.renderingToTexture,[k,L]=v instanceof ie||A?[{},u]:l.stencilConfigForOverlap(u),B=L[L.length-1].overscaledZ,P=!l.options.moving;for(const G of L){const D=A?a.DepthMode.disabled:l.depthModeForSublayer(G.overscaledZ-B,o.paint.get("raster-opacity")===1?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly,y.LESS),F=G.toUnwrapped(),O=t.getTile(G);if(A&&(!O||!O.hasData()))continue;const X=A?G.projMatrix:l.transform.calculateProjMatrix(F,P),N=l.terrain&&A?l.terrain.stencilModeForRTTOverlap(G):k[G.overscaledZ],Z=f?0:o.paint.get("raster-fade-duration");O.registerFadeDuration(Z);const K=t.findLoadedParent(G,0),le=Da(O,K,t,l.transform,Z);let he,ce;l.terrain&&l.terrain.prepareDrawTile();const ae=o.paint.get("raster-resampling")==="nearest"?y.NEAREST:y.LINEAR;g.activeTexture.set(y.TEXTURE0),O.texture.bind(ae,y.CLAMP_TO_EDGE),g.activeTexture.set(y.TEXTURE1),K?(K.texture.bind(ae,y.CLAMP_TO_EDGE),he=Math.pow(2,K.tileID.overscaledZ-O.tileID.overscaledZ
1081),ce=[O.tileID.canonical.x*he%1,O.tileID.canonical.y*he%1]):O.texture.bind(ae,y.CLAMP_TO_EDGE);const q=zu(X,ce||[0,0],he||1,le,o,v instanceof ie?v.perspectiveTransform:[0,0]);if(l.prepareDrawProgram(g,T,F),v instanceof ie)v.boundsBuffer&&v.boundsSegments&&T.draw(g,y.TRIANGLES,D,a.StencilMode.disabled,S,a.CullFaceMode.disabled,q,o.id,v.boundsBuffer,l.quadTriangleIndexBuffer,v.boundsSegments);else{const{tileBoundsBuffer:ge,tileBoundsIndexBuffer:_e,tileBoundsSegments:ze}=l.getTileBoundsBuffers(O);T.draw(g,y.TRIANGLES,D,N,S,a.CullFaceMode.disabled,q,o.id,ge,_e,ze)}}l.resetStencilClippingMasks()},background:function(l,t,o,u){const p=o.paint.get("background-color"),f=o.paint.get("background-opacity");if(f===0)return;const g=l.context,y=g.gl,v=l.transform,T=v.tileSize,S=o.paint.get("background-pattern");if(l.isPatternMissing(S))return;const A=!S&&p.a===1&&f===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==A)return;const k=a.StencilMode.disabled,L=l.depthModeForSublayer(0,A==="opaque"?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly),B=l.colorModeForRenderPass(),P=l.useProgram(S?"backgroundPattern":"background");let G,D=u;D||(G=l.getBackgroundTiles(),D=Object.values(G).map(O=>O.tileID)),S&&(g.activeTexture.set(y.TEXTURE0),l.imageManager.bind(l.context));const F=o.getCrossfadeParameters();for(const O of D){const X=O.toUnwrapped(),N=u?O.projMatrix:l.transform.calculateProjMatrix(X);l.prepareDrawTile();const Z=t?t.getTile(O):G?G[O.key]:new a.Tile(O,T,v.zoom,l),K=S?$n(N,f,l,S,{tileID:O,tileSize:T},F):tc(N,f,p);l.prepareDrawProgram(g,P,X);const{tileBoundsBuffer:le,tileBoundsIndexBuffer:he,tileBoundsSegments:ce}=l.getTileBoundsBuffers(Z);P.draw(g,y.TRIANGLES,L,k,B,a.CullFaceMode.disabled,K,o.id,le,he,ce)}},sky:function(l,t,o){const u=l.transform,p=u.projection.name==="mercator"||u.projection.name==="globe"?1:a.smoothstep(7,8,u.zoom),f=o.paint.get("sky-opacity")*p;if(f===0)return;const g=l.context,y=o.paint.get("sky-type"),v=new a.DepthMode(g.gl.LEQUAL,a.DepthMode.ReadOnly,[0,1]),T=l.frameCounter/1e3%1;y==="atmosphere"?l.renderPass==="offscreen"?o.needsSkyboxCapture(l)&&(function(S,A,k,L){const B=S.context,P=B.gl;let G=A.skyboxFbo;if(!G){G=A.skyboxFbo=B.createFramebuffer(32,32,!1),A.skyboxGeometry=new sc(B),A.skyboxTexture=B.gl.createTexture(),P.bindTexture(P.TEXTURE_CUBE_MAP,A.skyboxTexture),P.texParameteri(P.TEXTURE_CUBE_MAP,P.TEXTURE_WRAP_S,P.CLAMP_TO_EDGE),P.texParameteri(P.TEXTURE_CUBE_MAP,P.TEXTURE_WRAP_T,P.CLAMP_TO_EDGE),P.texParameteri(P.TEXTURE_CUBE_MAP,P.TEXTURE_MIN_FILTER,P.LINEAR),P.texParameteri(P.TEXTURE_CUBE_MAP,P.TEXTURE_MAG_FILTER,P.LINEAR);for(let X=0;X<6;++X)P.texImage2D(P.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,P.RGBA,32,32,0,P.RGBA,P.UNSIGNED_BYTE,null)}B.bindFramebuffer.set(G.framebuffer),B.viewport.set([0,0,32,32]);const D=A.getCenter(S,!0),F=S.useProgram("skyboxCapture"),O=new Float64Array(16);a.identity(O),a.rotateY(O,O,.5*-Math.PI),Wn(B,A,F,O,D,0),a.identity(O),a.rotateY(O,O,.5*Math.PI),Wn(B,A,F,O,D,1),a.identity(O),a.rotateX(O,O,.5*-Math.PI),Wn(B,A,F,O,D,2),a.identity(O),a.rotateX(O,O,.5*Math.PI),Wn(B,A,F,O,D,3),a.identity(O),Wn(B,A,F,O,D,4),a.identity(O),a.rotateY(O,O,Math.PI),Wn(B,A,F,O,D,5),B.viewport.set([0,0,S.width,S.height])}(l,o),o.markSkyboxValid(l)):l.renderPass==="sky"&&function(S,A,k,L,B){const P=S.context,G=P.gl,D=S.transform,F=S.useProgram("skybox");P.activeTexture.set(G.TEXTURE0),G.bindTexture(G.TEXTURE_CUBE_MAP,A.skyboxTexture);const O=((X,N,Z,K,le)=>({u_matrix:X,u_sun_direction:N,u_cubemap:0,u_opacity:K,u_temporal_offset:le}))(D.skyboxMatrix,A.getCenter(S,!1),0,L,B);S.prepareDrawProgram(P,F),F.draw(P,G.TRIANGLES,k,a.StencilMode.disabled,S.colorModeForRenderPass(),a.CullFaceMode.backCW,O,"skybox",A.skyboxGeometry.vertexBuffer,A.skyboxGeometry.indexBuffer,A.skyboxGeometry.segment)}(l,o,v,f,T):y==="gradient"&&l.renderPass==="sky"&&function(S,A,k,L,B){const P=S.context,G=P.gl,D=S.transform,F=S.useProgram("skyboxGradient");A.skyboxGeometry||(A.skyboxGeometry=new sc(P)),P.activeTexture.set(G.TEXTURE0);let O=A.colorRampTexture;O||(O=A.colorRampTexture=new a.Texture(P,A.colorRamp,G.RGBA)),O.bind(G.LINEAR,G.CLAMP_TO_EDGE);const X=((N,Z,K,le,he)=>({u_matrix:N,u_color_ramp:0,u_center_direction:Z,u_radius:a.degToRad(K),u_opacity:le,u_temporal_offset:he}))(D.skyboxMatrix,A.getCenter(S,!1),A.paint.get("sky-gradient-radius"),L,B);S.prepareDrawProgram(P,F),F.draw(P,G.TRIANGLES,k,a.StencilMode.disabled,S.colorModeForRenderPass(),a.CullFaceMode.backCW,X,"skyboxGradient",A.skyboxGeometry.vertexBuffer,A.skyboxGeometry.indexBuffer,A.skyboxGeometry.segment)}(l,o,v,f,T)},debug:function(l,t,o){for(let u=0;u<o.length;u++)Us(l,t,o[u])},custom:function(l,t,o){const u=l.context,p=o.implementation;if(l.transform.projection.unsupportedLayers&&l.transform.projection.unsupportedLayers.includes("custom"))a.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if(l.renderPass==="offscreen"){const f=p.prerender;f&&(l.setCustomLayerDefaults(),u.setColorMode(l.colorModeForRenderPass()),f.call(p,u.gl,l.transform.customLayerMatrix()),u.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),u.setColorMode(l.colorModeForRenderPass()),u.setStencilMode(a.StencilMode.disabled);const f=p.renderingMode==="3d"?new a.DepthMode(l.context.gl.LEQUAL,a.DepthMode.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,a.DepthMode.ReadOnly);u.setDepthMode(f),p.render(u.gl,l.transform.customLayerMatrix()),u.setDirty(),l.setBaseState(),u.bindFramebuffer.set(null)}}};
vendor: 8,966 bytes, line 1081
1081class js{constructor(t,o){this.context=new U(t),this.transform=o,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=a.SourceCache.maxUnderzooming+a.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Gl,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(t,o){const u=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(u||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new La(this,t));const p=this._terrain;this.transform.elevation=u?p:null,p.update(t,this.transform,o)}_updateFog(t){const o=t.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[u,p]=o.getFovAdjustedRange(this.transform._fov);if(u>p)return void(this.transform.fogCullDistSq=null);const f=u+.78*(p-u);this.transform.fogCullDistSq=f*f}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(t,o){if(this.width=t*a.exported.devicePixelRatio,this.height=o*a.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style.order)this.style._layers[u].resize()}setup(){const t=this.context,o=new a.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(a.EXTENT,0),o.emplaceBack(0,a.EXTENT),o.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(o,a.posAttributes.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const u=new a.StructArrayLayout2i4;u.emplaceBack(0,0),u.emplaceBack(a.EXTENT,0),u.emplaceBack(0,a.EXTENT),u.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=t.createVertexBuffer(u,a.posAttributes.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const p=new a.StructArrayLayout2i4;p.emplaceBack(-1,-1),p.emplaceBack(1,-1),p.emplaceBack(-1,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,a.posAttributes.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.StructArrayLayout4i8;f.emplaceBack(0,0,0,0),f.emplaceBack(a.EXTENT,0,a.EXTENT,0),f.emplaceBack(0,a.EXTENT,0,a.EXTENT),f.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.mercatorBoundsBuffer=t.createVertexBuffer(f,a.boundsAttributes.members),this.mercatorBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const g=new a.StructArrayLayout3ui6;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(g);const y=new a.StructArrayLayout1ui2;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new a.Texture(t,new a.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=a.create();const v=this.context.gl;this.stencilClearMode=new a.StencilMode({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO),this.loadTimeStamps.push(a.window.performance.now()),this.atmosphereBuffer=new Bu(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context,o=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(t,o.TRIANGLES,a.DepthMode.disabled,this.stencilClearMode,a.ColorMode.disabled,a.CullFaceMode.disabled,Lo(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,o,u){if(!o||this.currentStencilSource===o.id||!t.isTileClipped()||!u||u.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const v of u)if(this._tileClippingMaskIDs[v.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=o.id;const p=this.context,f=p.gl;this.nextStencilID+u.length>256&&this.clearStencil(),p.setColorMode(a.ColorMode.disabled),p.setDepthMode(a.DepthMode.disabled);const g=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of u){const v=o.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:A,tileBoundsSegments:k}=this.getTileBoundsBuffers(v);g.draw(p,f.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:f.ALWAYS,mask:0},T,255,f.KEEP,f.KEEP,f.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,Lo(y.projMatrix),"$clipping",S,A,k)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new a.StencilMode({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const o=this.context.gl;return new a.StencilMode({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,u=t.sort((g,y)=>y.overscaledZ-g.overscaledZ),p=u[u.length-1].overscaledZ,f=u[0].overscaledZ-p+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const g={};for(let y=0;y<f;y++)g[y+p]=new a.StencilMode({func:o.GEQUAL,mask:255},y+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=f,[g,u]}return[{[p]:a.StencilMode.disabled},u]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new a.ColorMode([t.CONSTANT_COLOR,t.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?a.ColorMode.unblended:a.ColorMode.alphaBlended}depthModeForSublayer(t,o,u){if(!this.opaquePassEnabledForLayer())return a.DepthMode.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new a.DepthMode(u||this.context.gl.LEQUAL,o,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,o){this.style=t,this.options=o,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();const u=this.style.order,p=this.style._sourceCaches;for(const v in p){const T=p[v];T.used&&T.prepare(this.context)}const f={},g={},y={};for(const v in p){const T=p[v];f[v]=T.getVisibleCoordinates(),g[v]=f[v].slice().reverse(),y[v]=T.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<u.length;v++)if(this.style._layers[u[v]].is3D()){this.opaquePassCutoff=v;break}if(this.terrain&&(this.terrain.updateTileBinding(y),this.opaquePassCutoff=0),this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.GlobeSharedBuffers(this.context)),a.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";for(const v of u){const T=this.style._layers[v],S=t._getLayerSourceCache(T);if(!T.hasOffscreenPass()||T.isHidden(this.transform.zoom))continue;const A=S?g[S.id]:void 0;(T.type==="custom"||T.isSky()||A&&A.length)&&this.renderLayer(this,S,T,A)}if(this.depthRangeFor3D=[0,1-(t.order.length+2)*this.numSublayers*this.depthEpsilon],this.terrain&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&this.terrain.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]),this.context.clear({color:o.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[u[this.currentLayer]],T=t._getLayerSourceCache(v);if(v.isSky())continue;const S=T?g[T.id]:void 0;this._renderTileClippingMasks(v,T,S),this.renderLayer(this,T,v,S)}if(this.style.fog&&this.transform.projection.supportsFog&&function(v,T){const S=v.context,A=S.gl,k=v.transform,L=new a.DepthMode(A.LEQUAL,a.DepthMode.ReadOnly,[0,1]),B=v.useProgram("globeAtmosphere",null,k.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),P=a.globeToMercatorTransition(k.zoom),G=T.properties.get("color").toArray01(),D=T.properties.get("high-color").toArray01(),F=T.properties.get("space-color").toArray01PremultipliedAlpha(),O=a.identity$1([]);a.rotateY$1(O,O,-a.degToRad(k._center.lng)),a.rotateX$1(O,O,a.degToRad(k._center.lat)),a.rotateZ$1(O,O,k.angle),a.rotateX$1(O,O,-k._pitch);const X=a.fromQuat(new Float32Array(16),O),N=a.mapValue(T.properties.get("star-intensity"),0,1,0,.25),Z=5e
1081-4,K=a.mapValue(T.properties.get("horizon-blend"),0,1,Z,.25),le=a.globeUseCustomAntiAliasing(v,S,k)&&K===Z?k.worldSize/(2*Math.PI*1.025)-1:k.globeRadius,he=v.frameCounter/1e3%1,ce=a.length(k.globeCenterInViewSpace),ae=Math.sqrt(Math.pow(ce,2)-Math.pow(le,2)),q=Math.acos(ae/ce),ge=((ze,de,Ve,Ce,Ae,Ee,Ie,He,Ne,tt,Ue,Ke,yt,Tt)=>({u_frustum_tl:ze,u_frustum_tr:de,u_frustum_br:Ve,u_frustum_bl:Ce,u_horizon:Ae,u_transition:Ee,u_fadeout_range:Ie,u_color:He,u_high_color:Ne,u_space_color:tt,u_star_intensity:Ue,u_star_size:5*a.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:Ke,u_horizon_angle:yt,u_rotation_matrix:Tt}))(k.frustumCorners.TL,k.frustumCorners.TR,k.frustumCorners.BR,k.frustumCorners.BL,k.frustumCorners.horizon,P,K,G,D,F,N,he,q,X);v.prepareDrawProgram(S,B);const _e=v.atmosphereBuffer;_e&&B.draw(S,A.TRIANGLES,L,a.StencilMode.disabled,a.ColorMode.alphaBlended,a.CullFaceMode.backCW,ge,"skybox",_e.vertexBuffer,_e.indexBuffer,_e.segments)}(this,this.style.fog),this.renderPass="sky",(a.globeToMercatorTransition(this.transform.zoom)>0||this.transform.projection.name!=="globe")&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<u.length;this.currentLayer++){const v=this.style._layers[u[this.currentLayer]],T=t._getLayerSourceCache(v);v.isSky()&&this.renderLayer(this,T,v,T?g[T.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<u.length;){const v=this.style._layers[u[this.currentLayer]],T=t._getLayerSourceCache(v);if(v.isSky()){++this.currentLayer;continue}if(this.terrain&&this.style.isLayerDraped(v)){if(v.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer);continue}const S=T?(v.type==="symbol"?y:g)[T.id]:void 0;this._renderTileClippingMasks(v,T,T?f[T.id]:void 0),this.renderLayer(this,T,v,S),++this.currentLayer}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry){let v=null;a.values(this.style._layers).forEach(T=>{const S=t._getLayerSourceCache(T);S&&!T.isHidden(this.transform.zoom)&&(!v||v.getSource().maxzoom<S.getSource().maxzoom)&&(v=S)}),v&&this.options.showTileBoundaries&&Vs.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const T=v.transform.padding;Wa(v,v.transform.height-(T.top||0),3,dn),Wa(v,T.bottom||0,3,Oo),Os(v,T.left||0,3,nc),Os(v,v.transform.width-(T.right||0),3,qn);const S=v.transform.centerPoint;(function(A,k,L,B){ft(A,k-1,L-10,2,20,B),ft(A,k-10,L-1,20,2,B)})(v,S.x,v.transform.height-S.y,Xn)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(a.window.performance.now()),this.saveC
vendor: 51,427 bytes, line 1081
1081anvasCopy())}}renderLayer(t,o,u,p){u.isHidden(this.transform.zoom)||(u.type==="background"||u.type==="sky"||u.type==="custom"||p&&p.length)&&(this.id=u.id,this.gpuTimingStart(u),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(u.type)||Vs[u.type](t,o,u,p,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery;let u=this.gpuTimers[t.id];u||(u=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:o.createQueryEXT()}),u.calls++,o.beginQueryEXT(o.TIME_ELAPSED_EXT,u.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,o=t.createQueryEXT();this.deferredRenderGpuTimeQueries.push(o),t.beginQueryEXT(t.TIME_ELAPSED_EXT,o)}}gpuTimingDeferredRenderEnd(){if(!this.options.gpuTimingDeferredRender)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const o={};for(const u in t){const p=t[u],f=this.context.extTimerQuery,g=f.getQueryObjectEXT(p.query,f.QUERY_RESULT_EXT)/1e6;f.deleteQueryEXT(p.query),o[u]=g}return o}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.extTimerQuery;let u=0;for(const p of t)u+=o.getQueryObjectEXT(p,o.QUERY_RESULT_EXT)/1e6,o.deleteQueryEXT(p);return u}translatePosMatrix(t,o,u,p,f){if(!u[0]&&!u[1])return t;const g=f?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(g){const T=Math.sin(g),S=Math.cos(g);u=[u[0]*S-u[1]*T,u[0]*T+u[1]*S]}const y=[f?u[0]:xr(o,u[0],this.transform.zoom),f?u[1]:xr(o,u[1],this.transform.zoom),0],v=new Float32Array(16);return a.translate(v,t,y),v}saveTileTexture(t){const o=this._tileTextures[t.size[0]];o?o.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const o=this._tileTextures[t];return o&&o.length>0?o.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const o=this.imageManager.getPattern(t.from.toString()),u=this.imageManager.getPattern(t.to.toString());return!o||!u}currentGlobalDefines(){const t=this.terrain&&this.terrain.renderingToTexture,o=this.style&&this.style.fog,u=[];return this.terrain&&!this.terrain.renderingToTexture&&u.push("TERRAIN"),o&&!t&&o.getOpacity(this.transform.pitch)!==0&&u.push("FOG"),t&&u.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&u.push("OVERDRAW_INSPECTOR"),u}useProgram(t,o,u){this.cache=this.cache||{};const p=u||[],f=this.currentGlobalDefines().concat(p),g=Ps.cacheKey(t,f,o);return this.cache[g]||(this.cache[g]=new Ps(this.context,t,Ss[t],o,ku[t],f)),this.cache[g]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.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=a.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(t,o,u){if(this.terrain&&this.terrain.renderingToTexture)return;const p=this.style.fog;if(p){const f=p.getOpacity(this.transform.pitch),g=((y,v,T,S,A,k,L,B,P,G,D)=>{const F=y.transform,O=v.properties.get("color").toArray01();O[3]=S;const X=y.frameCounter/1e3%1;return{u_fog_matrix:T?F.calculateFogTileMatrix(T):y.identityMat,u_fog_range:v.getFovAdjustedRange(F._fov),u_fog_color:O,u_fog_horizon_blend:v.properties.get("horizon-blend"),u_fog_temporal_offset:X,u_frustum_tl:A,u_frustum_tr:k,u_frustum_br:L,u_frustum_bl:B,u_globe_pos:P,u_globe_radius:G,u_viewport:D,u_globe_transition:a.globeToMercatorTransition(F.zoom),u_is_globe:+(F.projection.name==="globe")}})(this,p,u,f,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*a.exported.devicePixelRatio,this.transform.height*a.exported.devicePixelRatio]);o.setFogUniformValues(t,g)}}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const t=this.context.gl,o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const t=this._backgroundTiles,o=this._backgroundTiles={},u=this.transform.coveringTiles({tileSize:512});for(const p of u)o[p.key]=t[p.key]||new a.Tile(p,512,this.transform.tileZoom,this);return o}clearBackgroundTiles(){this._backgroundTiles={}}}class fn{constructor(t=0,o=0,u=0,p=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(u)||u<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=u,this.right=p}interpolate(t,o,u){return o.top!=null&&t.top!=null&&(this.top=a.number(t.top,o.top,u)),o.bottom!=null&&t.bottom!=null&&(this.bottom=a.number(t.bottom,o.bottom,u)),o.left!=null&&t.left!=null&&(this.left=a.number(t.left,o.left,u)),o.right!=null&&t.right!=null&&(this.right=a.number(t.right,o.right,u)),this}getCenter(t,o){const u=a.clamp((this.left+t-this.right)/2,0,t),p=a.clamp((this.top+o-this.bottom)/2,0,o);return new a.pointGeometry(u,p)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new fn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ns(l,t){const o=a.getColumn(l,3);a.fromQuat(l,t),a.setColumn(l,3,o)}function Uo(l,t){const o=a.identity$1([]);return a.rotateZ$1(o,o,-t),a.rotateX$1(o,o,-l),o}function Gs(l,t){const o=[l[0],l[1],0],u=[t[0],t[1],0];if(a.length(o)>=1e-15){const g=a.normalize([],o);a.scale$2(u,g,a.dot(u,g)),t[0]=u[0],t[1]=u[1]}const p=a.cross([],t,l);if(a.len(p)<1e-15)return null;const f=Math.atan2(-p[1],p[0]);return Uo(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),f)}class Vo{constructor(t,o){this.position=t,this.orientation=o}get position(){return this._position}set position(t){if(t){const o=t instanceof a.MercatorCoordinate?t:new a.MercatorCoordinate(t[0],t[1],t[2]);this._renderWorldCopies&&(o.x=a.wrap(o.x,0,1)),this._position=o}else this._position=null}lookAtPoint(t,o){if(this.orientation=null,!this.position)return;const u=this._elevation?this._elevation.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(t)):0,p=this.position,f=a.MercatorCoordinate.fromLngLat(t,u),g=[f.x-p.x,f.y-p.y,f.z-p.z];o||(o=[0,0,1]),o[2]=Math.abs(o[2]),this.orientation=Gs(g,o)}setPitchBearing(t,o){this.orientation=Uo(a.degToRad(t),a.degToRad(-o))}}class Hn{constructor(t,o){this._transform=a.identity([]),this.orientation=o,this.position=t}get mercatorPosition(){const t=this.position;return new a.MercatorCoordinate(t[0],t[1],t[2])}get position(){const t=a.getColumn(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var o;t&&a.setColumn(this._transform,3,[(o=t)[0],o[1],o[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||a.identity$1([]),t&&Ns(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),o=this.right();return{bearing:Math.atan2(-o[1],o[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,o){this._orientation=Uo(t,o),Ns(this._transform,this._orientation)}forward(){const t=a.getColumn(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=a.getColumn(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=a.getColumn(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,o){const u=new Float64Array(16);return a.invert(u,this.getWorldToCamera(t,o)),u}getWorldToCameraPosition(t,o,u){const p=this.position;a.scale$2(p,p,-t);const f=new Float64Array(16);return a.fromScaling(f,[u,u,u]),a.translate(f,f,p),f[10]*=o,f}getWorldToCamera(t,o){const u=new Float64Array(16),p=new Float64Array(4),f=this.position;return a.conjugate(p,this._orientation),a.scale$2(f,f,-t),a.fromQuat(u,p),a.translate(u,u,f),u[1]*=-1,u[5]*=-1,u[9]*=-1,u[13]*=-1,u[8]*=o,u[9]*=o,u[10]*=o,u[11]*=o,u}getCameraToClipPerspective(t,o,u,p){const f=new Float64Array(16);return a.perspective(f,t,o,u,p),f}getDistanceToElevation(t){const o=t===0?0:a.mercatorZfromAltitude(t,this.position[1]),u=this.forward();return(o-this.position[2])/u[2]}clone(){return new Hn([...this.position],[...this.orientation])}}function Be(l,t){const o=jo(l.projection,l.zoom,l.width,l.height),u=function(f,g,y,v,T){const S=new a.LngLat(y.lng-180*mn,y.lat),A=new a.LngLat(y.lng+180*mn,y.lat),k=f.project(S.lng,S.lat),L=f.project(A.lng,A.lat),B=-Math.atan2(L.y-k.y,L.x-k.x),P=a.MercatorCoordinate.fromLngLat(y);P.y=a.clamp(P.y,-.999975,.999975);const G=P.toLngLat(),D=f.project(G.lng,G.lat),F=a.MercatorCoordinate.fromLngLat(G);F.x+=mn;const O=F.toLngLat(),X=f.project(O.lng,O.lat),N=_n(X.x-D.x,X.y-D.y,B),Z=a.MercatorCoordinate.fromLngLat(G);Z.y+=mn;const K=Z.toLngLat(),le=f.project(K.lng,K.lat),he=_n(le.x-D.x,le.y-D.y,B),ce=Math.abs(N.x)/Math.abs(he.y),ae=a.identity([]);a.rotateZ(ae,ae,-B*(1-(T?0:v)));const q=a.identity([]);return a.scale(q,q,[1,1-(1-ce)*v,1]),q[4]=-he.x/he.y*v,a.rotateZ(q,q,B),a.multiply(q,ae,q),q}(l.projection,0,l.center,o,t),p=$i(l);return a.scale(u,u,[p,p,1]),u}function $i(l){const t=l.projection,o=jo(l.projection,l.zoom,l.width,l.height),u=Ha(t,l.center),p=Ha(t,a.LngLat.convert(t.center));return Math.pow(2,u*o+(1-o)*p)}function jo(l,t,o,u,p=1/0){const f=l.range;if(!f)return 0;const g=Math.min(p,Math.max(o,u)),y=Math.log(g/1024)/Math.LN2;return a.smoothstep(f[0]+y,f[1]+y,t)}const mn=1/4e4;function Ha(l,t){const o=a.clamp(t.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),u=new a.LngLat(t.lng-180*mn,o),p=new a.LngLat(t.lng+180*mn,o),f=l.project(u.lng,o),g=l.project(p.lng,o),y=a.MercatorCoordinate.fromLngLat(u),v=a.MercatorCoordinate.fromLngLat(p),T=g.x-f.x,S=g.y-f.y,A=v.x-y.x,k=v.y-y.y,L=Math.sqrt((A*A+k*k)/(T*T+S*S));return Math.log(L)/Math.LN2}function _n(l,t,o){const u=Math.cos(o),p=Math.sin(o);return{x:l*u-t*p,y:l*p+t*u}}class Zs{constructor(t,o,u,p,f,g,y){this.tileSize=512,this._renderWorldCopies=f===void 0||f,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=u==null?0:u,this._maxPitch=p==null?60:p,this.setProjection(g),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new fn,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Hn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const t=new Zs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(t){const o=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||o)&&this._updateCameraOnTerrain(),(t||o)&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return a.pick(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const o=this.projection?this.getProjection():void 0;this.projection=a.getProjection(this.projectionOptions);const u=!Se(o,this.getProjection());return u&&this._calcMatrices(),u}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&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return a.mercatorZfromAltitude(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return a.wrap(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const o=-t*Math.PI/180;var u;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=(u=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u),function(p,f,g){var y=f[0],v=f[1],T=f[2],S=f[3],A=Math.sin(g),k=Math.cos(g);p[0]=y*k+T*A,p[1]=v*k+S*A,p[2]=y*-A+T*k,p[3]=v*-A+S*k}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=a.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,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 averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._setZoom(o),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const t=this._elevation;this._centerAltitude=t.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=t.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,o=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],u=this.horizonLineFromTop();let p=0,f=0;for(let g=0;g<o.length;g++){const y=new a.pointGeometry(o[g][0]*this.width,u+o[g][1]*(this.height-u)),v=t.pointCoordinate(y);if(!v)continue;const T=1/Math.hypot(v[0]-this._camera.position[0],v[1]-this._camera.position[1]);p+=v[3]*T,f+=T}return f===0?NaN:p/f}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._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,o=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),u=this.pixelsPerMeter/this.worldSize*o,p=this._mercatorZfromZoom(t),f=this._mercatorZfromZoom(this._maxZoom),g=Math.max(p-u,f);this._setZoom(this._zoomFromMercatorZ(g))}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())}computeZoomRelativeTo(t){const o=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let u;u=t.z<this._camera.position[2]?[o.x,o.y,o.z]:[t.x,t.y,t.z];const p=a.length(a.sub([],this._camera.position,u));return a.clamp(this._zoomFromMercatorZ(p),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let o=!1;if(t.orientation&&!a.exactEquals(t.orientation,this._camera.orientation)&&(o=this._setCameraOrientation(t.orientation)),t.position){const u=[t.position.x,t.position.y,t.position.z];a.exactEquals$1(u,this._camera.position)||(this._setCameraPosition(u),o=!0)}o&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,o=new Vo;return o.position=new a.MercatorCoordinate(t[0],t[1],t[2]),o.orientation=this._camera.orientation,o._elevation=this.elevation,o._renderWorldCopies=this.renderWorldCopies,o}_setCameraOrientation(t){if(!a.length$1(t))return!1;a.normalize$1(t,t);const o=a.transformQuat([],[0,0,-1],t),u=a.transformQuat([],[0,-1,0],t);if(u[2]<0)return!1;const p=Gs(o,u);return!!p&&(this._camera.orientation=p,!0)}_setCameraPosition(t){const o=this.zoomScale(this.minZoom)*this.tileSize,u=this.zoomScale(this.maxZoom)*this.tileSize,p=this.cameraToCenterDistance;t[2]=a.clamp(t[2],p/u,p/o),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,u){this._unmodified=!1,this._edgeInsets.interpolate(t,o,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new a.UnwrappedTileID(0,t)];if(this.renderWorldCopies){const u=this.pointCoordinate(new a.pointGeometry(0,0)),p=this.pointCoordinate(new a.pointGeometry(this.width,0)),f=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),g=this.pointCoordinate(new a.pointGeometry(0,this.height)),y=Math.floor(Math.min(u.x,p.x,f.x,g.x)),v=Math.floor(Math.max(u.x,p.x,f.x,g.x)),T=1;for(let S=y-T;S<=v+T;S++)S!==0&&o.push(new a.UnwrappedTileID(S,t))}return o}coveringTiles(t){let o=this.coveringZoomLevel(t);const u=o,p=this.elevation&&!t.isTerrainDEM,f=this.projection.name==="mercator";if(t.minzoom!==void 0&&o<t.minzoom)return[];t.maxzoom!==void 0&&o>t.maxzoom&&(o=t.maxzoom);const g=this.locationCoordinate(this.center),y=this.center.lat,v=1<<o,T=[v*g.x,v*g.y,0],S=this.projection.name==="globe",A=!S,k=a.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o,A),L=S?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),B=v*a.mercatorZfromAltitude(1,this.center.lat),P=this._camera.position[2]/a.mercatorZfromAltitude(1,this.center.lat),G=[v*L.x,v*L.y,P*(A?1:B)],D=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),F=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?o:0,O=t.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,X=t.isTerrainDEM?-O:this._elevation?this._elevation.getMinElevationBelowMSL():0,N=this.projection.isReprojectedInTileSpace?$i(this):1,Z=de=>{const Ce=new a.MercatorCoordinate(de.x+25e-6,de.y,de.z),Ae=new a.MercatorCoordinate(de.x,de.y+25e-6,de.z),Ee=de.toLngLat(),Ie=Ce.toLngLat(),He=Ae.toLngLat(),Ne=this.locationCoordinate(Ee),tt=this.locationCoordinate(Ie),Ue=this.locationCoordinate(He),Ke=Math.hypot(tt.x-Ne.x,tt.y-Ne.y),yt=Math.hypot(Ue.x-Ne.x,Ue.y-Ne.y);return Math.sqrt(Ke*yt)*N/25e-6},K=de=>{const Ve=O,Ce=X;return{aabb:a.tileAABB(this,v,0,0,0,de,Ce,Ve,this.projection),zoom:0,x:0,y:0,minZ:Ce,maxZ:Ve,wrap:de,fullyVisible:!1}},le=[];let he=[];const ce=o,ae=t.reparseOverscaled?u:o,q=de=>de*de,ge=q((P-this._centerAltitude)*B),_e=de=>{if(!this._elevation||!de.tileID||!f)return;const Ve=this._elevation.getMinMaxForTile(de.tileID),Ce=de.aabb;Ve?(Ce.min[2]=Ve.min,Ce.max[2]=Ve.max,Ce.center[2]=(Ce.min[2]+Ce.max[2])/2):(de.shouldSplit=ze(de),de.shouldSplit||(Ce.min[2]=Ce.max[2]=Ce.center[2]=this._centerAltitude))},ze=de=>{if(de.zoom<F)return!0;if(de.zoom===ce)return!1;if(de.shouldSplit!=null)return de.shouldSplit;const Ve=de.aabb.distanceX(G),Ce=de.aabb.distanceY(G);let Ae=ge,Ee=1;if(S){Ae=q(de.aabb.distanceZ(G));const He=Math.pow(2,de.zoom),Ne=a.latFromMercatorY((de.y+1)/He),tt=a.latFromMercatorY(de.y/He),Ue=Math.min(Math.max(y,Ne),tt),Ke=a.circumferenceAtLatitude(Ue)/a.circumferenceAtLatitude(y);if(Ee=Ue===y?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Ke/this._mercatorScaleRatio),this.zoom<=a.GLOBE_ZOOM_THRESHOLD_MIN&&de.zoom===ce-1&&Ke>=.9)return!0}else if(p&&(Ae=q(de.aabb.distanceZ(G)*B)),this.projection.isReprojectedInTileSpace&&u<=5){const He=Math.pow(2,de.zoom),Ne=Z(new a.MercatorCoordinate((de.x+.5)/He,(de.y+.5)/He));Ee=Ne>.85?1:Ne}const Ie=Ve*Ve+Ce*Ce+Ae;return Ie<q((1<<ce-de.zoom)*D*Ee*((He,Ne)=>{if(Ne*q(.707)<He)return 1;const tt=Math.sqrt(Ne/He);return tt/(1.4144271570014144+(Math.pow(1.1,tt-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(Ae,ge),Ie))};if(this.renderWorldCopies)for(let de=1;de<=3;de++)le.push(K(-de)),le.push(K(de));for(le.push(K(0));le.length>0;){const de=le.pop(),Ve=de.x,Ce=de.y;let Ae=de.fullyVisible;if(!Ae){const Ee=de.aabb.intersects(k);if(Ee===0)continue;Ae=Ee===2}if(de.zoom!==ce&&ze(de))for(let Ee=0;Ee<4;Ee++){const Ie=(Ve<<1)+Ee%2,He=(Ce<<1)+(Ee>>1),Ne={aabb:f?de.aabb.quadrant(Ee):a.tileAABB(this,v,de.zoom+1,Ie,He,de.wrap,de.minZ,de.maxZ,this.projection),zoom:de.zoom+1,x:Ie,y:He,wrap:de.wrap,fullyVisible:Ae,tileID:void 0,shouldSplit:void 0,minZ:de.minZ,maxZ:de.maxZ};p&&!S&&(Ne.tileID=new a.OverscaledTileID(de.zoom+1===ce?ae:de.zoom+1,de.wrap,de.zoom+1,Ie,He),_e(Ne)),le.push(Ne)}else{const Ee=de.zoom===ce?ae:de.zoom;if(t.minzoom&&t.minzoom>Ee)continue;const Ie=T[0]-(.5+Ve+(de.wrap<<de.zoom))*(1<<o-de.zoom),He=T[1]-.5-Ce,Ne=de.tileID?de.tileID:new a.OverscaledTileID(Ee,de.wrap,de.zoom,Ve,Ce);he.push({tileID:Ne,distanceSq:Ie*Ie+He*He})}}if(this.fogCullDistSq){const de=this.fogCullDistSq,Ve=this.horizonLineFromTop();he=he.filter(Ce=>{const Ae=[0,0,0,1],Ee=[a.EXTENT,a.EXTENT,0,1],Ie=this.calculateFogTileMatrix(Ce.tileID.toUnwrapped());a.transformMat4$1(Ae,Ae,Ie),a.transformMat4$1(Ee,Ee,Ie);const He=a.getAABBPointSquareDist(Ae,Ee);if(He===0)return!0;let Ne=!1;const tt=this._elevation;if(tt&&He>de&&Ve!==0){const Ue=this.calculateProjMatrix(Ce.tileID.toUnwrapped());let Ke;t.isTerrainDEM||(Ke=tt.getMinMaxForTile(Ce.tileID)),Ke||(Ke={min:X,max:O});const yt=a.furthestTileCorner(this.rotation),Tt=[yt[0]*a.EXTENT,yt[1]*a.EXTENT,Ke.max];a.transformMat4(Tt,Tt,Ue),Ne=(1-Tt[1])*this.height*.5<Ve}return He<de||Ne})}return he.sort((de,Ve)=>de.distanceSq-Ve.distanceSq).map(de=>de.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],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 o=a.clamp(t.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),u=this.projection.project(t.lng,o);return new a.pointGeometry(u.x*this.worldSize,u.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(t,o){let u,p;const f=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;u=(o.x-f.x)/y,p=(o.y-f.y)/y}else{const y=this.pointCoordinate(o),v=this.pointCoordinate(f);u=y.x-v.x,p=y.y-v.y}const g=this.locationCoordinate(t);this.setLocation(new a.MercatorCoordinate(g.x-u,g.y-p))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t){return this.projection.locationPoint(this,t)}locationPoint3D(t){return this.projection.locationPoint(this,t,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t){return this.coordinateLocation(this.pointCoordinate3D(t))}locationCoordinate(t,o){const u=o?a.mercatorZfromAltitude(o,t.lat):void 0,p=this.projection.project(t.lng,t.lat);return new a.MercatorCoordinate(p.x,p.y,u)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,o){const u=o!=null?o:this._centerAltitude,p=[t.x,t.y,0,1],f=[t.x,t.y,1,1];a.transformMat4$1(p,p,this.pixelMatrixInverse),a.transformMat4$1(f,f,this.pixelMatrixInverse);const g=f[3];a.scale$1(p,p,1/p[3]),a.scale$1(f,f,1/g);const y=p[2],v=f[2];return{p0:p,p1:f,t:y===v?0:(u-y)/(v-y)}}screenPointToMercatorRay(t){const o=[t.x,t.y,0,1],u=[t.x,t.y,1,1];return a.transformMat4$1(o,o,this.pixelMatrixInverse),a.transformMat4$1(u,u,this.pixelMatrixInverse),a.scale$1(o,o,1/o[3]),a.scale$1(u,u,1/u[3]),o[2]=a.mercatorZfromAltitude(o[2],this._center.lat)*this.worldSize,u[2]=a.mercatorZfromAltitude(u[2],this._center.lat)*this.worldSize,a.scale$1(o,o,1/this.worldSize),a.scale$1(u,u,1/this.worldSize),new a.Ray([o[0],o[1],o[2]],a.normalize([],a.sub([],u,o)))}rayIntersectionCoordinate(t){const{p0:o,p1:u,t:p}=t,f=a.mercatorZfromAltitude(o[2],this._center.lat),g=a.mercatorZfromAltitude(u[2],this._center.lat);return new a.MercatorCoordinate(a.number(o[0],u[0],p)/this.worldSize,a.number(o[1],u[1],p)/this.worldSize,a.number(f,g,p))}pointCoordinate(t,o=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,o)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let o=this.projection.pointCoordinate3D(this,t.x,t.y);if(o)return new a.MercatorCoordinate(o[0],o[1],o[2]);let u=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t);const f=.02*p,g=t.clone();for(let y=0;y<10&&p-u>f;y++){g.y=a.number(u,p,.66);const v=this.projection.pointCoordinate3D(this,g.x,g.y);v?(p=g.y,o=v):u=g.y}return o?new a.MercatorCoordinate(o[0],o[1],o[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}_coordinatePoint(t,o){const u=o&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,p=[t.x*this.worldSize,t.y*this.worldSize,u+t.toAltitude(),1];return a.transformMat4$1(p,p,this.pixelMatrix),p[3]>0?new a.pointGeometry(p[0]/p[3],p[1]/p[3]):new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(t,o){const u=new a.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),p=new a.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),f=new a.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),g=new a.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let y=this.pointCoordinate(u,t),v=this.pointCoordinate(p,t);const T=this.pointCoordinate(f,o),S=this.pointCoordinate(g,o),A=(k,L)=>(L.y-k.y)/(L.x-k.x);return y.y>1&&v.y>=0?y=new a.MercatorCoordinate((1-S.y)/A(S,y)+S.x,1):y.y<0&&v.y<=1&&(y=new a.MercatorCoordinate(-S.y/A(S,y)+S.x,0)),v.y>1&&y.y>=0?v=new a.MercatorCoordinate((1-T.y)/A(T,v)+T.x,1):v.y<0&&y.y<=1&&(v=new a.MercatorCoordinate(-T.y/A(T,v)+T.x,0)),new a.LngLatBounds().extend(this.coordinateLocation(y)).extend(this.coordinateLocation(v)).extend(this.coordinateLocation(S)).extend(this.coordinateLocation(T))}_getBounds3D(){const t=this.elevation;if(!t.visibleDemTiles.length)return this._getBounds(0,0);const o=t.visibleDemTiles.reduce((u,p)=>{if(p.dem){const f=p.dem.tree;u.min=Math.min(u.min,f.minimums[0]),u.max=Math.max(u.max,f.maximums[0])}return u},{min:Number.MAX_VALUE,max:0});return this._getBounds(o.min*t.exaggeration(),o.max*t.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(t=!0){const o=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,u=this.height/2-o*(1-this._horizonShift);return t?Math.max(0,u):u}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-a.MAX_MERCATOR_LATITUDE,this.maxLat=a.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=a.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=a.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=a.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=a.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,o){return this.projection.createTileMatrix(this,o,t)}calculateDistanceTileData(t){const o=t.key,u=this._distanceTileDataCache;if(u[o])return u[o];const p=t.canonical,f=1/this.height,g=this.cameraWorldSize/this.zoomScale(p.z),y=(p.x+Math.pow(2,p.z)*t.wrap)*g,v=p.y*g,T=this.point,S=this.angle,A=Math.sin(-S),k=-Math.cos(-S);return u[o]={bearing:[A,k],center:[(T.x-y)*f,(T.y-v)*f],scale:g/a.EXTENT*f},u[o]}calculateFogTileMatrix(t){const o=t.key,u=this._fogTileMatrixCache;if(u[o])return u[o];const p=this.projection.createTileMatrix(this,this.cameraWorldSize,t);return a.multiply(p,this.worldToFogMatrix,p),u[o]=new Float32Array(p),u[o]}calculateProjMatrix(t,o=!1){const u=t.key,p=o?this._alignedProjMatrixCache:this._projMatrixCache;if(p[u])return p[u];const f=this.calculatePosMatrix(t,this.worldSize);return a.multiply(f,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:o?this.alignedProjMatrix:this.projMatrix,f),p[u]=new Float32Array(f),p[u]}calculatePixelsToTileUnitsMatrix(t){const o=t.tileID.key,u=this._pixelsToTileUnitsCache;if(u[o])return u[o];const p=function(f,g){const{scale:y}=f.tileTransform,v=y*a.EXTENT/(f.tileSize*Math.pow(2,g.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return T=new Float32Array(4),k=(S=g.inverseAdjustmentMatrix)[1],L=S[2],B=S[3],G=(A=[v,v])[1],T[0]=S[0]*(P=A[0]),T[1]=k*P,T[2]=L*G,T[3]=B*G,T;var T,S,A,k,L,B,P,G}(t,this);return u[o]=p,u[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const o=a.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,u=this._computeCameraPosition(o),p=this._camera.forward(),f=a.mercatorZfromAltitude(1,this._center.lat);u[2]/=f,p[2]/=f,a.normalize(p,p);const g=t.raycast(u,p,t.exaggeration());if(g){const y=a.scaleAndAdd([],u,p,g),v=new a.MercatorCoordinate(y[0],y[1],a.mercatorZfromAltitude(y[2],a.latFromMercatorY(y[1]))),T=(v.z+a.length([v.x-u[0],v.y-u[1],v.z-u[2]*f]))*this._projectionScaler;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=v.toAltitude(),this._center=this.coordinateLocation(v),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCameraAltitude(){if(!this._elevation)return;const t=this._elevation;this._updateCameraState();const o=a.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,u=this._computeCameraPosition(o),p=t.getAtPointOrZero(new a.MercatorCoordinate(...u)),f=this._minimumHeightOverTerrain()*Math.cos(a.degToRad(this._maxPitch)),g=this._camera.position[2]-this.pixelsPerMeter/this.worldSize*p;if(g<f){const y=this.locationCoordinate(this._center,this._centerAltitude),v=[y.x-u[0],y.y-u[1],y.z-u[2]],T=a.length(v);v[2]-=(f-g)/this._projectionScaler;const S=a.length(v);if(S===0)return;a.scale$2(v,v,T/S*this._projectionScaler),this._camera.position=[y.x-v[0],y.y-v[1],y.z*this._projectionScaler-v[2]],this._camera.orientation=Gs(v,this._camera.up()),this._updateStateFromCamera()}}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;if(this._constraining=!0,this.projection.isReprojectedInTileSpace){const A=this.center;return A.lat=a.clamp(A.lat,this.minLat,this.maxLat),!this.maxBounds&&this.renderWorldCopies||(A.lng=a.clamp(A.lng,this.minLng,this.maxLng)),this.center=A,void(this._constraining=!1)}const t=this._unmodified,{x:o,y:u}=this.point;let p=0,f=o,g=u;const y=this.width/2,v=this.height/2,T=this.worldMinY*this.scale,S=this.worldMaxY*this.scale;if(u-v<T&&(g=T+v),u+v>S&&(g=S-v),S-T<this.height&&(p=Math.max(p,this.height/(S-T)),g=(S+T)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const A=this.worldMinX*this.scale,k=this.worldMaxX*this.scale,L=this.worldSize/2-(A+k)/2;f=(o+L+this.worldSize)%this.worldSize-L,f-y<A&&(f=A+y),f+y>k&&(f=k-y),k-A<this.width&&(p=Math.max(p,this.width/(k-A)),f=(k+A)/2)}f===o&&g===u||(this.center=this.unproject(new a.pointGeometry(f,g))),p&&(this.zoom+=this.scaleZoom(p)),this._constrainCameraAltitude(),this._unmodified=t,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,o=this.pixelsPerMeter;if(this.projection.name==="globe"){const N=a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,Z=a.mercatorZfromAltitude(1,a.GLOBE_SCALE_MATCH_LATITUDE)*this.worldSize;this._mercatorScaleRatio=N/Z}const u=jo(this.projection,this.zoom,this.width,this.height,1024);this._projectionScaler=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,u),this.cameraToCenterDistance=this.getCameraToCenterDistance(this.projection),this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?o:1),f=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);f[8]=2*-t.x/this.width,f[9]=2*t.y/this.height;let g=a.mul([],f,p);if(this.projection.isReprojectedInTileSpace){const N=this.locationCoordinate(this.center),Z=a.identity([]);a.translate(Z,Z,[N.x*this.worldSize,N.y*this.worldSize,0]),a.multiply(Z,Z,Be(this)),a.translate(Z,Z,[-N.x*this.worldSize,-N.y*this.worldSize,0]),a.multiply(g,g,Z),this.inverseAdjustmentMatrix=function(K){const le=Be(K,!0);return An([],[le[0],le[1],le[4],le[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=a.scale([],g,[this.worldSize,this.worldSize,this.worldSize/o,1]),this.projMatrix=g,this.invProjMatrix=a.invert(new Float64Array(16),this.projMatrix);const y=a.invert([],f);this.frustumCorners=a.FrustumCorners.fromInvProjectionMatrix(y,this.horizonLineFromTop(),this.height);const v=new Float32Array(16);a.identity(v),a.scale(v,v,[1,-1,1]),a.rotateX(v,v,this._pitch),a.rotateZ(v,v,this.angle);const T=a.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),S=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;T[8]=2*-t.x/this.width,T[9]=2*(t.y+S)/this.height,this.skyboxMatrix=a.multiply(v,T,v);const A=this.point,k=A.x,L=A.y,B=this.width%2/2,P=this.height%2/2,G=Math.cos(this.angle),D=Math.sin(this.angle),F=k-Math.round(k)+G*B+D*P,O=L-Math.round(L)+G*P+D*B,X=new Float64Array(g);if(a.translate(X,X,[F>.5?F-1:F,O>.5?O-1:O,0]),this.alignedProjMatrix=X,g=a.create(),a.scale(g,g,[this.width/2,-this.height/2,1]),a.translate(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=a.create(),a.scale(g,g,[1,-1,1]),a.translate(g,g,[-1,-1,0]),a.scale(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g,this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},g=a.invert(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=g,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.calculateGlobeMatrix(this);const N=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.transformMat4(N,N,p),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=g;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSize,o=this.cameraPixelsPerMeter,u=this._camera.position,p=1/this.height/this._projectionScaler,f=[t,t,o];a.scale$2(f,f,p),a.scale$2(u,u,-1),a.multiply$2(u,u,f);const g=a.create();a.translate(g,g,u),a.scale(g,g,f),this.mercatorFogMatrix=g,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,o,p)}_computeCameraPosition(t){const o=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,u=this._camera.forward(),p=this.point,f=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*o-t/this.worldSize*this._centerAltitude;return[p.x/this.worldSize-u[0]*f,p.y/this.worldSize-u[1]*f,t/this.worldSize*this._centerAltitude-u[2]*f]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const o=this._maxCameraBoundsDistance()*Math.cos(this._pitch),u=t[2];let p=1;u>0&&(p=Math.min((o-this._camera.position[2])/u,1)),this._camera.position=a.scaleAndAdd([],this._camera.position,t,p),this._updateStateFromCamera(),this.projection.wrap&&(this.center=this.center.wrap())}_updateStateFromCamera(){const t=this._camera.position,o=this._camera.forward(),{pitch:u,bearing:p}=this._camera.getPitchBearing(),f=a.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,g=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.degToRad(this._maxPitch)),y=Math.max((t[2]-f)/Math.cos(u),g),v=this._zoomFromMercatorZ(y);a.scaleAndAdd(t,t,o,y),this._pitch=a.clamp(u,a.degToRad(this.minPitch),a.degToRad(this.maxPitch)),this.angle=a.wrap(p,-Math.PI,Math.PI),this._setZoom(a.clamp(v,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.MercatorCoordinate(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min((this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(a.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,o){const u=Math.min(t.x,o.x),p=Math.max(t.x,o.x),f=Math.min(t.y,o.y),g=Math.max(t.y,o.y);if(f<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const y=[new a.pointGeometry(u,f),new a.pointGeometry(p,g),new a.pointGeometry(u,g),new a.pointGeometry(p,f)],v=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const A=this.pointRayIntersection(S);if(A.t<0)return!0;const k=this.rayIntersectionCoordinate(A);if(k.x<v||k.y<0||k.x>T||k.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.pointGeometry(0,0),new a.pointGeometry(this.width,this.height))}zoomDeltaToMovement(t,o){const u=a.length(a.sub([],this._camera.position,t)),p=this._zoomFromMercatorZ(u)+o;return u-this._mercatorZfromZoom(p)}getCameraPoint(){if(this.projection.name==="globe"){const t=function(o,u){const p=[o[0],o[1],o[2],1];a.transformMat4$1(p,p,u);const f=Math.max(p[3],1e-6);return[p[0]/f,p[1]/f,p[2]/f,f]}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.pointGeometry(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,t))}}getCameraToCenterDistance(t){const o=jo(t,this.zoom,this.width,this.height,1024),u=t.pixelSpaceConversion(this.center.lat,this.worldSize,o);return .5/Math.tan(.5*this._fov)*this.height*u}}function No(l,t){let o=!1,u=null;const p=()=>{u=null,o&&(l(),u=setTimeout(p,t),o=!1)};return()=>(o=!0,u||p(),u)}class Ya{constructor(t){this._hashName=t&&encodeURIComponent(t),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=No(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,a.window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),a.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(t){const o=this._map;if(!o)return"";const u=o.getCenter(),p=Math.round(100*o.getZoom())/100,f=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,f),y=Math.round(u.lng*g)/g,v=Math.round(u.lat*g)/g,T=o.getBearing(),S=o.getPitch();let A="";if(A+=t?`/${y}/${v}/${p}`:`${p}/${v}/${y}`,(T||S)&&(A+="/"+Math.round(10*T)/10),S&&(A+=`/${Math.round(S)}`),this._hashName){const k=this._hashName;let L=!1;const B=a.window.location.hash.slice(1).split("&").map(P=>{const G=P.split("=")[0];return G===k?(L=!0,`${G}=${A}`):P}).filter(P=>P);return L||B.push(`${k}=${A}`),`#${B.join("&")}`}return`#${A}`}_getCurrentHash(){const t=a.window.location.hash.replace("#","");if(this._hashName){let o;return t.split("&").map(u=>u.split("=")).forEach(u=>{u[0]===this._hashName&&(o=u)}),(o&&o[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(u=>isNaN(u))){const u=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(o[3]||0):t.getBearing();return t.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:u,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=a.window.location.href.replace(/(#.+)?$/,this.getHashString());a.window.history.replaceState(a.window.history.state,null,t)}}const gn={linearity:.3,easing:a.bezier(0,0,.3,1)},lc=a.extend({deceleration:2500,maxSpeed:1400},gn),cc=a.extend({deceleration:20,maxSpeed:1400},gn),Yn=a.extend({deceleration:1e3,maxSpeed:360},gn),Ru=a.extend({deceleration:1e3,maxSpeed:90},gn);class Fu{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=a.exported.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const o={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)o.zoom+=f.zoomDelta||0,o.bearing+=f.bearingDelta||0,o.pitch+=f.pitchDelta||0,f.panDelta&&o.pan._add(f.panDelta),f.around&&(o.around=f.around),f.pinchAround&&(o.pinchAround=f.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(o.pan.mag()){const f=yn(o.pan.mag(),u,a.extend({},lc,t||{}));p.offset=o.pan.mult(f.amount/o.pan.mag()),p.center=this._map.transform.center,Go(p,f)}if(o.zoom){const f=yn(o.zoom,u,cc);p.zoom=this._map.transform.zoom+f.amount,Go(p,f)}if(o.bearing){const f=yn(o.bearing,u,Yn);p.bearing=this._map.transform.bearing+a.clamp(f.amount,-179,179),Go(p,f)}if(o.pitch){const f=yn(o.pitch,u,Ru);p.pitch=this._map.transform.pitch+f.amount,Go(p,f)}if(p.zoom||p.bearing){const f=o.pinchAround===void 0?o.around:o.pinchAround;p.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),p.noMoveStart=!0,p}}function Go(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function yn(l,t,o){const{maxSpeed:u,linearity:p,deceleration:f}=o,g=a.clamp(l*p/(t/1e3),-u,u),y=Math.abs(g)/(f*p);return{easing:o.easing,duration:1e3*y,amount:g*(y/2)}}class vi extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,u,p={}){const f=Qe(o.getCanvasContainer(),u),g=o.unproject(f);super(t,a.extend({point:f,lngLat:g,originalEvent:u},p)),this._defaultPrevented=!1,this.target=o}}class Zo extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,u){const p=t==="touchend"?u.changedTouches:u.touches,f=sr(o.getCanvasContainer(),p),g=f.map(v=>o.unproject(v)),y=f.reduce((v,T,S,A)=>v.add(T.div(A.length)),new a.pointGeometry(0,0));super(t,{points:f,point:y,lngLats:g,lngLat:o.unproject(y),originalEvent:u}),this._defaultPrevented=!1}}class uc extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,u){super(t,{originalEvent:u}),this._defaultPrevented=!1}}class $s{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new uc(t.type,this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new vi(t.type,this._map,t))}mouseup(t){this._map.fire(new vi(t.type,this._map,t))}preclick(t){const o=a.extend({},t);o.type="preclick",this._map.fire(new vi(o.type,this._map,o))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(t),this._map.fire(new vi(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new vi(t.type,this._map,t))}mouseover(t){this._map.fire(new vi(t.type,this._map,t))}mouseout(t){this._map.fire(new vi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Zo(t.type,this._map,t))}touchmove(t){this._map.fire(new Zo(t.type,this._map,t))}touchend(t){this._map.fire(new Zo(t.type,this._map,t))}touchcancel(t){this._map.fire(new Zo(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ka{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new vi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new vi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hc{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(en(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const u=o;if(this._lastPos.equals(u)||!this._box&&u.dist(this._startPos)<this._clickTolerance)return;const p=this._startPos;this._lastPos=u,this._box||(this._box=Xe("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const f=Math.min(p.x,u.x),g=Math.max(p.x,u.x),y=Math.min(p.y,u.y),v=Math.max(p.y,u.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${f}px,${y}px)`,this._box.style.width=g-f+"px",this._box.style.height=v-y+"px")})}mouseupWindow(t,o){if(!this._active||t.button!==0)return;const u=this._startPos,p=o;if(this.reset(),In(),u.x!==p.x||u.y!==p.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:f=>f.fitScreenCoordinates(u,p,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),mo(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new a.Event(t,{originalEvent:o}))}}function qs(l,t){const o={};for(let u=0;u<l.length;u++)o[l[u].identifier]=t[u];return o}class pc{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,o,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),u.length===this.numTouches&&(this.centroid=function(p){const f=new a.pointGeometry(0,0);for(const g of p)f._add(g);return f.div(p.length)}(o),this.touches=qs(u,o)))}touchmove(t,o,u){if(this.aborted||!this.centroid)return;const p=qs(u,o);for(const f in this.touches){const g=this.touches[f],y=p[f];(!y||y.dist(g)>30)&&(this.aborted=!0)}}touchend(t,o,u){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class Xs{constructor(t){this.singleTap=new pc(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,o,u){this.singleTap.touchstart(t,o,u)}touchmove(t,o,u){this.singleTap.touchmove(t,o,u)}touchend(t,o,u){const p=this.singleTap.touchend(t,o,u);
vendor: 5,274 bytes, line 1081
1081if(p){const f=t.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(p)<30;if(f&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class dc{constructor(){this._zoomIn=new Xs({numTouches:1,numTaps:2}),this._zoomOut=new Xs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,u){this._zoomIn.touchstart(t,o,u),this._zoomOut.touchstart(t,o,u)}touchmove(t,o,u){this._zoomIn.touchmove(t,o,u),this._zoomOut.touchmove(t,o,u)}touchend(t,o,u){const p=this._zoomIn.touchend(t,o,u),f=this._zoomOut.touchend(t,o,u);return p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()+1,around:g.unproject(p)},{originalEvent:t})}):f?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()-1,around:g.unproject(f)},{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}}const Kn={0:1,2:2};class Ws{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,o){return!1}_move(t,o){return{}}mousedown(t,o){if(this._lastPoint)return;const u=Fr(t);this._correctButton(t,u)&&(this._lastPoint=o,this._eventButton=u)}mousemoveWindow(t,o){const u=this._lastPoint;if(u){if(t.preventDefault(),this._eventButton!=null&&function(p,f){const g=Kn[f];return p.buttons===void 0||(p.buttons&g)!==g}(t,this._eventButton))this.reset();else if(this._moved||!(o.dist(u)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(u,o)}}mouseupWindow(t){this._lastPoint&&Fr(t)===this._eventButton&&(this._moved&&In(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fc extends Ws{mousedown(t,o){super.mousedown(t,o),this._lastPoint&&(this._active=!0)}_correctButton(t,o){return o===0&&!t.ctrlKey}_move(t,o){return{around:o,panDelta:o.sub(t)}}}class Ja extends Ws{_correctButton(t,o){return o===0&&t.ctrlKey||o===2}_move(t,o){const u=.8*(o.x-t.x);if(u)return this._active=!0,{bearingDelta:u}}contextmenu(t){t.preventDefault()}}class Qa extends Ws{_correctButton(t,o){return o===0&&t.ctrlKey||o===2}_move(t,o){const u=-.5*(o.y-t.y);if(u)return this._active=!0,{pitchDelta:u}}contextmenu(t){t.preventDefault()}}class mc{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),a.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0)}touchstart(t,o,u){return this._calculateTransform(t,o,u)}touchmove(t,o,u){if(this._active&&!(u.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(u.length===1)return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.preventDefault(),this._calculateTransform(t,o,u)}}touchend(t,o,u){this._calculateTransform(t,o,u),this._active&&u.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,u){u.length>0&&(this._active=!0);const p=qs(u,o),f=new a.pointGeometry(0,0),g=new a.pointGeometry(0,0);let y=0;for(const T in p){const S=p[T],A=this._touches[T];A&&(f._add(S),g._add(S.sub(A)),y++,p[T]=S)}if(this._touches=p,y<this._minTouches||!g.mag())return;const v=g.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(y),panDelta:v}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Xe("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility==="hidden"&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class Hs{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,o,u){return{}}touchstart(t,o,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([o[0],o[1]])
vendor: 20,127 bytes, line 1081
1081)}touchmove(t,o,u){const p=this._firstTwoTouches;if(!p)return;t.preventDefault();const[f,g]=p,y=si(u,o,f),v=si(u,o,g);if(!y||!v)return;const T=this._aroundCenter?null:y.add(v).div(2);return this._move([y,v],T,t)}touchend(t,o,u){if(!this._firstTwoTouches)return;const[p,f]=this._firstTwoTouches,g=si(u,o,p),y=si(u,o,f);g&&y||(this._active&&In(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function si(l,t,o){for(let u=0;u<l.length;u++)if(l[u].identifier===o)return t[u]}function _c(l,t){return Math.log(l/t)/Math.LN2}class gc extends Hs{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){const u=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(_c(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:_c(this._distance,u),pinchAround:o}}}function yc(l,t){return 180*l.angleWith(t)/Math.PI}class Ou extends Hs{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,o){const u=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:yc(this._vector,u),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const o=25/(Math.PI*this._minDiameter)*360,u=yc(t,this._startVector);return Math.abs(u)<o}}function tr(l){return Math.abs(l.y)>Math.abs(l.x)}class xc extends Hs{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,tr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,u){const p=this._lastPoints;if(!p)return;const f=t[0].sub(p[0]),g=t[1].sub(p[1]);return this._map._cooperativeGestures&&u.touches.length<3||(this._valid=this.gestureBeginsVertically(f,g,u.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(f.y+g.y)/2*-.5})}gestureBeginsVertically(t,o,u){if(this._valid!==void 0)return this._valid;const p=t.mag()>=2,f=o.mag()>=2;if(!p&&!f)return;if(!p||!f)return this._firstMove==null&&(this._firstMove=u),u-this._firstMove<100&&void 0;const g=t.y>0==o.y>0;return tr(t)&&tr(o)&&g}}const Jn={panStep:100,bearingStep:15,pitchStep:10};class hr{constructor(){const t=Jn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,u=0,p=0,f=0,g=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?u=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?u=1:(t.preventDefault(),f=1);break;case 38:t.shiftKey?p=1:(t.preventDefault(),g=-1);break;case 40:t.shiftKey?p=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(u=0,p=0),{cameraAnimation:y=>{const v=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:Ys,zoom:o?Math.round(v)+o*(t.shiftKey?2:1):v,bearing:y.getBearing()+u*this._bearingStep,pitch:y.getPitch()+p*this._pitchStep,offset:[-f*this._panStep,-g*this._panStep],center:y.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ys(l){return l*(2-l)}const Re=4.000244140625;class vc{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._handler=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=t.deltaMode===a.window.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const u=a.exported.now(),p=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,o!==0&&o%Re==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(p*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const o=Qe(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform,o=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const v=this._type==="wheel"&&Math.abs(this._delta)>Re?this._wheelZoomRate:this._defaultZoomRate;let T=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&T!==0&&(T=1/T);const S=o(),A=Math.pow(2,S),k=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):A;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(k*T))),this._type==="wheel"&&(this._startZoom=o(),this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:o(),p=this._startZoom,f=this._easing;let g,y=!1;if(this._type==="wheel"&&p&&f){const v=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),T=f(v);g=a.number(p,u,T),v<1?this._frameId||(this._frameId=!0):y=!0}else g=u,y=!0;return this._active=!0,y&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!y,zoomDelta:g-o(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=a.ease;if(this._prevEase){const u=this._prevEase,p=(a.exported.now()-u.start)/u.duration,f=u.easing(p+.01)-u.easing(p),g=.27/Math.sqrt(f*f+1e-4)*.01,y=Math.sqrt(.0729-g*g);o=a.bezier(g,y,.25,1)}return this._prevEase={start:a.exported.now(),duration:t,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Xe("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(a.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_isFullscreen(){return!!a.window.document.fullscreenElement||!!a.window.document.webkitFullscreenElement}_showBlockerAlert(){this._alertContainer.style.visibility==="hidden"&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show")},200)}}class bc{constructor(t,o){this._clickZoom=t,this._tapZoom=o}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 $o{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,o){return t.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:u.getZoom()+(t.shiftKey?-1:1),around:u.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(){this._tap=new Xs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,o,u){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?u.length>0&&(this._swipePoint=o[0],this._swipeTouch=u[0].identifier):this._tap.touchstart(t,o,u))}touchmove(t,o,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const p=o[0],f=p.y-this._swipePoint.y;return this._swipePoint=p,t.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(t,o,u)}touchend(t,o,u){this._tapTime?this._swipePoint&&u.length===0&&this.reset():this._tap.touchend(t,o,u)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wc{constructor(t,o,u){this._el=t,this._mousePan=o,this._touchPan=u}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Tc{constructor(t,o,u){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=u}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 Ec{constructor(t,o,u,p){this._el=t,this._touchZoom=o,this._touchRotate=u,this._tapDragZoom=p,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("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-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 Xo=l=>l.zoom||l.drag||l.pitch||l.rotate;class Sc extends a.Event{}class Mc{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,o){const u=a.sub([],o,t);this.radius=a.length(u[2]<0?a.div([],u,this.constants):[u[0],u[1],0])}projectRay(t){a.div(t,t,this.constants),a.normalize(t,t),a.mul$1(t,t,this.constants);const o=a.scale$2([],t,this.radius);if(o[2]>0){const u=a.scale$2([],[0,0,1],a.dot(o,[0,0,1])),p=a.scale$2([],a.normalize([],[o[0],o[1],0]),this.radius),f=a.add([],o,a.scale$2([],a.sub([],a.add([],p,u),o),2));o[0]=f[0],o[1]=f[1]}return o}}function Wo(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Ks{constructor(t,o){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Fu(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Mc,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(o),a.bindAll(["handleEvent","handleWindowEvent"],this);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[a.window.document,"mousemove",{capture:!0}],[a.window.document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[a.window,"blur",void 0]];for(const[p,f,g]of this._listeners)p.addEventListener(f,p===a.window.document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,o,u]of this._listeners)t.removeEventListener(o,t===a.window.document?this.handleWindowEvent:this.handleEvent,u)}_addDefaultHandlers(t){const o=this._map,u=o.getCanvasContainer();this._add("mapEvent",new $s(o,t));const p=o.boxZoom=new hc(o,t);this._add("boxZoom",p);const f=new dc,g=new $o;o.doubleClickZoom=new bc(g,f),this._add("tapZoom",f),this._add("clickZoom",g);const y=new qo;this._add("tapDragZoom",y);const v=o.touchPitch=new xc(o);this._add("touchPitch",v);const T=new Ja(t),S=new Qa(t);o.dragRotate=new Tc(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const A=new fc(t),k=new mc(o,t);o.dragPan=new wc(u,A,k),this._add("mousePan",A),this._add("touchPan",k,["touchZoom","touchRotate"]);const L=new Ou,B=new gc;o.touchZoomRotate=new Ec(u,B,L,y),this._add("touchRotate",L,["touchPan","touchZoom"]),this._add("touchZoom",B,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Ka(o));const P=o.scrollZoom=new vc(o,this);this._add("scrollZoom",P,["mousePan"]);const G=o.keyboard=new hr;this._add("keyboard",G);for(const D of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[D]&&o[D].enable(t[D])}_add(t,o,u){this._handlers.push({handlerName:t,handler:o,allowed:u}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.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!!Xo(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,o,u){for(const p in t)if(p!==u&&(!o||o.indexOf(p)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const o=[];for(const u of t)this._el.contains(u.target)&&o.push(u);return o}handleEvent(t,o){this._updatingCamera=!0;const u=t.type==="renderFrame",p=u?void 0:t,f={needsRenderFrame:!1},g={},y={},v=t.touches?this._getMapTouches(t.touches):void 0,T=v?sr(this._el,v):u?void 0:Qe(this._el,t);for(const{handlerName:k,handler:L,allowed:B}of this._handlers){if(!L.isEnabled())continue;let P;this._blockedByActive(y,B,k)?L.reset():L[o||t.type]&&(P=L[o||t.type](t,T,v),this.mergeHandlerResult(f,g,P,k,p),P&&P.needsRenderFrame&&this._triggerRenderFrame()),(P||L.isActive())&&(y[k]=L)}const S={};for(const k in this._previousActiveHandlers)y[k]||(S[k]=p);this._previousActiveHandlers=y,(Object.keys(S).length||Wo(f))&&(this._changes.push([f,g,S]),this._triggerRenderFrame()),(Object.keys(y).length||Wo(f))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=f;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))}mergeHandlerResult(t,o,u,p,f){if(!u)return;a.extend(t,u);const g={handlerName:p,originalEvent:u.originalEvent||f};u.zoomDelta!==void 0&&(o.zoom=g),u.panDelta!==void 0&&(o.drag=g),u.pitchDelta!==void 0&&(o.pitch=g),u.bearingDelta!==void 0&&(o.rotate=g)}_applyChanges(){const t={},o={},u={};for(const[p,f,g]of this._changes)p.panDelta&&(t.panDelta=(t.panDelta||new a.pointGeometry(0,0))._add(p.panDelta)),p.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(t.around=p.around),p.aroundCoord!==void 0&&(t.aroundCoord=p.aroundCoord),p.pinchAround!==void 0&&(t.pinchAround=p.pinchAround),p.noInertia&&(t.noInertia=p.noInertia),a.extend(o,f),a.extend(u,g);this._updateMapTransform(t,o,u),this._changes=[]}_updateMapTransform(t,o,u){const p=this._map,f=p.transform,g=F=>[F.x,F.y,F.z];if((F=>{const O=this._eventsInProgress.drag;return O&&!this._handlersById[O.handlerName].isActive()})()&&!Wo(t)){const F=f.zoom;f.cameraElevationReference="sea",f.recenterOnTerrain(),f.cameraElevationReference="ground",F!==f.zoom&&this._map._update(!0)}if(!Wo(t))return void this._fireEvents(o,u,!0);let{panDelta:y,zoomDelta:v,bearingDelta:T,pitchDelta:S,around:A,aroundCoord:k,pinchAround:L}=t;L!==void 0&&(A=L),(F=>o.drag&&!this._eventsInProgress.drag)()&&A&&(this._dragOrigin=g(f.pointCoordinate3D(A)),this._trackingEllipsoid.setup(f._camera.position,this._dragOrigin)),f.cameraElevationReference="sea",p._stop(!0),A=A||p.transform.centerPoint,T&&(f.bearing+=T),S&&(f.pitch+=S),f._updateCameraState();const B=[0,0,0];if(y){const F=f.pointCoordinate(A);if(f.projection.name==="globe"){const O=a.latFromMercatorY(F.y),X=f.center.lat,N=Math.min(a.mercatorZfromAltitude(1,O)/a.mercatorZfromAltitude(1,X),2);y=y.rotate(-f.angle),B[0]=-y.x/f.worldSize*N,B[1]=-y.y/f.worldSize*N}else{const O=f.pointCoordinate(A.sub(y));F&&O&&(B[0]=O.x-F.x,B[1]=O.y-F.y)}}const P=f.zoom,G=[0,0,0];if(v){const F=g(k||f.pointCoordinate3D(A)),O={dir:a.normalize([],a.sub([],F,f._camera.position))};if(O.dir[2]<0){const X=f.zoomDeltaToMovement(F,v);a.scale$2(G,O.dir,X)}}const D=a.add(B,B,G);f._translateCameraConstrained(D),v&&Math.abs(f.zoom-P)>1e-4&&f.recenterOnTerrain(),f.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,u,!0)}_fireEvents(t,o,u){const p=Xo(this._eventsInProgress),f=Xo(t),g={};for(const S in t){const{originalEvent:A}=t[S];this._eventsInProgress[S]||(g[`${S}start`]=A),this._eventsInProgress[S]=t[S]}!p&&f&&this._fireEvent("movestart",f.originalEvent);for(const S in g)this._fireEvent(S,g[S]);f&&this._fireEvent("move",f.originalEvent);for(const S in t){const{originalEvent:A}=t[S];this._fireEvent(S,A)}const y={};let v;for(const S in this._eventsInProgress){const{handlerName:A,originalEvent:k}=this._eventsInProgress[S];this._handlersById[A].isActive()||(delete this._eventsInProgress[S],v=o[A]||k,y[`${S}end`]=v)}for(const S in y)this._fireEvent(S,y[S]);const T=Xo(this._eventsInProgress);if(u&&(p||f)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=k=>k!==0&&-this._bearingSnap<k&&k<this._bearingSnap;S?(A(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:v})):(this._map.fire(new a.Event("moveend",{originalEvent:v})),A(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new a.Event(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new Sc("renderFrame",{timeStamp:t})),this._applyChanges()})}
1081_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Js="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Qs extends a.Evented{constructor(t,o){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,u){return t=a.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,a.extend({offset:t},o),u)}panTo(t,o,u){return this.easeTo(a.extend({center:t},o),u)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,u){return this.easeTo(a.extend({zoom:t},o),u)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,u){return this.easeTo(a.extend({bearing:t},o),u)}resetNorth(t,o){return this.rotateTo(0,a.extend({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}cameraForBounds(t,o){this.transform.projection.name==="globe"&&a.warnOnce('Globe projection does not support cameraForBounds API, this API may behave unexpectedly."'),t=a.LngLatBounds.convert(t);const u=o&&o.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),u,o)}_extendCameraOptions(t){const o={top:0,bottom:0,right:0,left:0};if(typeof(t=a.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=="number"){const u=t.padding;t.padding={top:u,bottom:u,right:u,left:u}}return t.padding=a.extend(o,t.padding),t}_cameraForBoxAndBearing(t,o,u,p){const f=this._extendCameraOptions(p),g=this.transform,y=g.padding,v=g.project(a.LngLat.convert(t)),T=g.project(a.LngLat.convert(o)),S=new a.pointGeometry(v.x,T.y),A=new a.pointGeometry(T.x,v.y),k=-a.degToRad(u),L=v.rotate(k),B=T.rotate(k),P=S.rotate(k),G=A.rotate(k),D=new a.pointGeometry(Math.max(L.x,B.x,P.x,G.x),Math.max(L.y,B.y,P.y,G.y)),F=new a.pointGeometry(Math.min(L.x,B.x,P.x,G.x),Math.min(L.y,B.y,P.y,G.y)),O=D.sub(F),X=(g.width-((y.left||0)+(y.right||0)+f.padding.left+f.padding.right))/O.x,N=(g.height-((y.top||0)+(y.bottom||0)+f.padding.top+f.padding.bottom))/O.y;if(N<0||X<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Z=Math.min(g.scaleZoom(g.scale*Math.min(X,N)),f.maxZoom),K=typeof f.offset.x=="number"&&typeof f.offset.y=="number"?new a.pointGeometry(f.offset.x,f.offset.y):a.pointGeometry.convert(f.offset),le=new a.pointGeometry((f.padding.left-f.padding.right)/2,(f.padding.top-f.padding.bottom)/2).rotate(u*Math.PI/180),he=K.add(le).mult(g.scale/g.zoomScale(Z));return{center:g.unproject(v.add(T).div(2).sub(he)),zoom:Z,bearing:u}}_cameraForBox(t,o,u,p,f){const g=this._extendCameraOptions(f);u=u||0,p=p||0,t=a.LngLat.convert(t),o=a.LngLat.convert(o);const y=this.transform.clone();y.padding=g.padding;const v=this.getFreeCameraOptions(),T=new a.LngLat(.5*(t.lng+o.lng),.5*(t.lat+o.lat)),S=.5*(u+p);if(y._camera.position[2]<a.mercatorZfromAltitude(S,T.lat))return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v.lookAtPoint(T),y.setFreeCameraOptions(v);const A=a.MercatorCoordinate.fromLngLat(t),k=a.MercatorCoordinate.fromLngLat(o),L=y.pointRayIntersection(y.centerPoint,S),B=[(P=y.rayIntersectionCoordinate(L)).x,P.y,P.z];var P;const G=y.screenPointToMercatorRay(y.centerPoint),D=y.projection.name!=="globe";let F,O=0;do{const X=Math.floor(y.zoom),N=1<<X,Z=Math.min(N*A.x,N*k.x),K=Math.min(N*A.y,N*k.y),le=Math.max(N*A.x,N*k.x),he=Math.max(N*A.y,N*k.y),ce=new a.Aabb([Z,K,u],[le,he,p]),ae=a.Frustum.fromInvProjectionMatrix(y.invProjMatrix,y.worldSize,X,D);if(ce.intersects(ae)!==2){F&&(y._camera.position=a.scaleAndAdd([],y._camera.position,G.dir,-F),y._updateStateFromCamera());break}const q=a.sub([],y._camera.position,B);F=.5*a.length(q),y._camera.position=a.scaleAndAdd([],y._camera.position,G.dir,F);try{y._updateStateFromCamera()}catch{return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}}
1081while(++O<10);return{center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}}fitBounds(t,o,u){return this.transform.projection.name==="globe"&&a.warnOnce("Globe projection does not support fitBounds API, this API may behave unexpectedly."),this._fitInternal(this.cameraForBounds(t,o),o,u)}_raycastElevationBox(t,o){const u=this.transform.elevation;if(!u)return;const p=new a.pointGeometry(t.x,o.y),f=new a.pointGeometry(o.x,t.y),g=u.pointCoordinate(t);if(!g)return;const y=u.pointCoordinate(o);if(!y)return;const v=u.pointCoordinate(p);if(!v)return;const T=u.pointCoordinate(f);if(!T)return;const S=new a.MercatorCoordinate(g[0],g[1]).toLngLat(),A=new a.MercatorCoordinate(y[0],y[1]).toLngLat(),k=new a.MercatorCoordinate(v[0],v[1]).toLngLat(),L=new a.MercatorCoordinate(T[0],T[1]).toLngLat(),B=Math.min(S.lng,Math.min(A.lng,Math.min(k.lng,L.lng))),P=Math.min(S.lat,Math.min(A.lat,Math.min(k.lat,L.lat))),G=Math.max(S.lng,Math.max(A.lng,Math.max(k.lng,L.lng))),D=Math.max(S.lat,Math.max(A.lat,Math.max(k.lat,L.lat))),F=Math.min(g[3],Math.min(y[3],Math.min(v[3],T[3]))),O=Math.max(g[3],Math.max(y[3],Math.max(v[3],T[3])));return{minLngLat:new a.LngLat(B,P),maxLngLat:new a.LngLat(G,D),minAltitude:F,maxAltitude:O}}fitScreenCoordinates(t,o,u,p,f){let g,y,v,T;this.transform.projection.name==="globe"&&a.warnOnce("Globe projection does not support fitScreenCoordinates API, this API may behave unexpectedly.");const S=a.pointGeometry.convert(t),A=a.pointGeometry.convert(o),k=this._raycastElevationBox(S,A);if(k)g=k.minLngLat,y=k.maxLngLat,v=k.minAltitude,T=k.maxAltitude;else{if(this.transform.anyCornerOffEdge(S,A))return this;g=this.transform.pointLocation(S),y=this.transform.pointLocation(A)}return this._fitInternal(this.transform.pitch===0?this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(o)),u,p):this._cameraForBox(g,y,v,T,p),p,f)}_fitInternal(t,o,u){return t?(delete(o=a.extend(t,o)).padding,o.linear?this.easeTo(o,u):this.flyTo(o,u)):this}jumpTo(t,o){this.stop();const u=t.preloadOnly?this.transform.clone():this.transform;let p=!1,f=!1,g=!1;return"zoom"in t&&u.zoom!==+t.zoom&&(p=!0,u.zoom=+t.zoom),t.center!==void 0&&(u.center=a.LngLat.convert(t.center)),"bearing"in t&&u.bearing!==+t.bearing&&(f=!0,u.bearing=+t.bearing),"pitch"in t&&u.pitch!==+t.pitch&&(g=!0,u.pitch=+t.pitch),t.padding==null||u.isPaddingEqual(t.padding)||(u.padding=t.padding),t.preloadOnly?(this._preloadTiles(u),this):(this.fire(new a.Event("movestart",o)).fire(new a.Event("move",o)),p&&this.fire(new a.Event("zoomstart",o)).fire(new a.Event("zoom",o)).fire(new a.Event("zoomend",o)),f&&this.fire(new a.Event("rotatestart",o)).fire(new a.Event("rotate",o)).fire(new a.Event("rotateend",o)),g&&this.fire(new a.Event("pitchstart",o)).fire(new a.Event("pitch",o)).fire(new a.Event("pitchend",o)),this.fire(new a.Event("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.warnOnce(Js),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,o){const u=this.transform;if(!u.projection.supportsFreeCamera)return a.warnOnce(Js),this;this.stop();const p=u.zoom,f=u.pitch,g=u.bearing;u.setFreeCameraOptions(t);const y=p!==u.zoom,v=f!==u.pitch,T=g!==u.bearing;return this.fire(new a.Event("movestart",o)).fire(new a.Event("move",o)),y&&this.fire(new a.Event("zoomstart",o)).fire(new a.Event("zoom",o)).fire(new a.Event("zoomend",o)),T&&this.fire(new a.Event("rotatestart",o)).fire(new a.Event("rotate",o)).fire(new a.Event("rotateend",o)),v&&this.fire(new a.Event("pitchstart",o)).fire(new a.Event("pitch",o)).fire(new a.Event("pitchend",o)),this.fire(new a.Event("moveend",o)),this}easeTo(t,o){this._stop(!1,t.easeId),((t=a.extend({offset:[0,0],duration:500,easing:a.ease},t)).animate===!1||!t.essential&&a.exported.prefersReducedMotion)&&(t.duration=0);const u=this.transform,p=this.getZoom(),f=this.getBearing(),g=this.getPitch(),y=this.getPadding(),v="zoom"in t?+t.zoom:p,T="bearing"in t?this._normalizeBearing(t.bearing,f):f,S="pitch"in t?+t.pitch:g,A="padding"in t?t.padding:u.padding,k=a.pointGeometry.convert(t.offset);let L,B,P;if(u.projection.name==="globe"){const he=a.MercatorCoordinate.fromLngLat(u.center),ce=k.rotate(-u.angle);he.x+=ce.x/u.worldSize,he.y+=ce.y/u.worldSize;const ae=he.toLngLat(),q=a.LngLat.convert(t.center||ae);this._normalizeCenter(q),L=u.centerPoint.add(ce),B=new a.pointGeometry(he.x,he.y).mult(u.worldSize),P=new a.pointGeometry(a.mercatorXfromLng(q.lng),a.mercatorYfromLat(q.lat)).mult(u.worldSize).sub(B)}else{L=u.centerPoint.add(k);
vendor: 5,633 bytes, line 1081
1081const he=u.pointLocation(L),ce=a.LngLat.convert(t.center||he);this._normalizeCenter(ce),B=u.project(he),P=u.project(ce).sub(B)}const G=u.zoomScale(v-p);let D,F;t.around&&(D=a.LngLat.convert(t.around),F=u.locationPoint(D));const O=this._zooming||v!==p,X=this._rotating||f!==T,N=this._pitching||S!==g,Z=!u.isPaddingEqual(A),K=he=>ce=>{if(O&&(he.zoom=a.number(p,v,ce)),X&&(he.bearing=a.number(f,T,ce)),N&&(he.pitch=a.number(g,S,ce)),Z&&(he.interpolatePadding(y,A,ce),L=he.centerPoint.add(k)),D)he.setLocationAtPoint(D,F);else{const ae=he.zoomScale(he.zoom-p),q=v>p?Math.min(2,G):Math.max(.5,G),ge=Math.pow(q,1-ce),_e=he.unproject(B.add(P.mult(ce*ge)).mult(ae));he.setLocationAtPoint(he.renderWorldCopies?_e.wrap():_e,L)}return t.preloadOnly||this._fireMoveEvents(o),he};if(t.preloadOnly){const he=this._emulate(K,t.duration,u);return this._preloadTiles(he),this}const le={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=O,this._rotating=X,this._pitching=N,this._padding=Z,this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,le),this._ease(K(u),he=>{u.recenterOnTerrain(),this._afterEase(o,he)},t),this}_prepareEase(t,o,u={}){this._moving=!0,this.transform.cameraElevationReference="sea",o||u.moving||this.fire(new a.Event("movestart",t)),this._zooming&&!u.zooming&&this.fire(new a.Event("zoomstart",t)),this._rotating&&!u.rotating&&this.fire(new a.Event("rotatestart",t)),this._pitching&&!u.pitching&&this.fire(new a.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.Event("move",t)),this._zooming&&this.fire(new a.Event("zoom",t)),this._rotating&&this.fire(new a.Event("rotate",t)),this._pitching&&this.fire(new a.Event("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const u=this._zooming,p=this._rotating,f=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new a.Event("zoomend",t)),p&&this.fire(new a.Event("rotateend",t)),f&&this.fire(new a.Event("pitchend",t)),this.fire(new a.Event("moveend",t))}flyTo(t,o){if(!t.essential&&a.exported.prefersReducedMotion){const Ae=a.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ae,o)}this.stop(),t=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},t);const u=this.transform,p=this.getZoom(),f=this.getBearing(),g=this.getPitch(),y=this.getPadding(),v="zoom"in t?a.clamp(+t.zoom,u.minZoom,u.maxZoom):p,T="bearing"in t?this._normalizeBearing(t.bearing,f):f,S="pitch"in t?+t.pitch:g,A="padding"in t?t.padding:u.padding,k=u.zoomScale(v-p),L=a.pointGeometry.convert(t.offset);let B=u.centerPoint.add(L);const P=u.pointLocation(B),G=a.LngLat.convert(t.center||P);this._normalizeCenter(G);const D=u.project(P),F=u.project(G).sub(D);let O=t.curve;const X=Math.max(u.width,u.height),N=X/k,Z=F.mag();if("minZoom"in t){const Ae=a.clamp(Math.min(t.minZoom,p,v),u.minZoom,u.maxZoom),Ee=X/u.zoomScale(Ae-p);O=Math.sqrt(Ee/Z*2)}const K=O*O;function le(Ae){const Ee=(N*N-X*X+(Ae?-1:1)*K*K*Z*Z)/(2*(Ae?N:X)*K*Z);return Math.log(Math.sqrt(Ee*Ee+1)-Ee)}function he(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function ce(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}const ae=le(0);let q=function(Ae){return ce(ae)/ce(ae+O*Ae)},ge=function(Ae){return X*((ce(ae)*(he(Ee=ae+O*Ae)/ce(Ee))-he(ae))/K)/Z;var Ee},_e=(le(1)-ae)/O;if(Math.abs(Z)<1e-6||!isFinite(_e)){if(Math.abs(X-N)<1e-6)return this.easeTo(t,o);const Ae=N<X?-1:1;_e=Math.abs(Math.log(N/X))/O,ge=function(){return 0},q=function(Ee){return Math.exp(Ae*O*Ee)}}t.duration="duration"in t?+t.duration:1e3*_e/("screenSpeed"in t?+t.screenSpeed/O:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const ze=f!==T,de=S!==g,Ve=!u.isPaddingEqual(A),Ce=Ae=>Ee=>{const Ie=Ee*_e,He=1/q(Ie);Ae.zoom=Ee===1?v:p+Ae.scaleZoom(He),ze&&(Ae.bearing=a.number(f,T,Ee)),de&&(Ae.pitch=a.number(g,S,Ee)),Ve&&(Ae.interpolatePadding(y,A,Ee),B=Ae.centerPoint.add(L));const Ne=Ee===1?G:Ae.unproject(D.add(F.mult(ge(Ie))).mult(He));return Ae.setLocationAtPoint(Ae.renderWorldCopies?Ne.wrap():Ne,B),Ae._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(o),Ae};if(t.preloadOnly){const Ae=this._emulate(Ce,t.duration,u);return this._preloadTiles(Ae),this}return this._zooming=!0,this._rotating=ze,this._pitching=de,this._padding=Ve,this._prepareEase(o,!1),this._ease(Ce(u),()=>this._afterEase(o),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const u=this._onEaseEnd;this._onEaseEnd=void 0,u.call(this,o)}if(!t){const u=this.handlers;u&&u.stop(!1)}return this}_ease(t,o,u){u.animate===!1||u.duration===0?(t(1),o()):(this._easeStart=a.exported.now(),this._easeOptions=u,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,o){t=a.wrap(t,-180,180);const u=Math.abs(t-o);return Math.abs(t-360-o)<u&&(t-=360),Math.abs(t+360-o)<u&&(t+=360),t}_normalizeCenter(t){const o=this.transform;if(!o.renderWorldCopies||o.maxBounds)return;const u=t.lng-o.center.lng;t.lng+=u>180?-360:u<-180?360:0}_emulate(t,o,u){const p=Math.ceil(15*o/1e3),f=[],g=t(u.clone());for(let y=0;y<=p;y++){const v=g(y/p);f.push(v.clone())}return f}}
vendor: 5,181 bytes, line 1081
1081class el{constructor(t={}){this.options=t,a.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const o=this.options&&this.options.compact;return this._map=t,this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Xe("button","mapboxgl-ctrl-attrib-button",this._container),Xe("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Xe("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),o&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),o===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(t,o){const u=this._map._getUIString(`AttributionControl.${o}`);t.setAttribute("aria-label",u),t.removeAttribute("title"),t.firstElementChild&&t.firstElementChild.setAttribute("title",u)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.config.ACCESS_TOKEN}];if(t){const u=o.reduce((p,f,g)=>(f.value&&(p+=`${f.key}=${f.value}${g<o.length-1?"&":""}`),p),"?");t.href=`${a.config.FEEDBACK_URL}/${u}${this._map._hash?this._map._hash.getHashString(!0):""}`,t.rel="noopener nofollow",this._setElementTitle(t,"MapFeedback")}}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}const o=this._map.style._sourceCaches;for(const p in o){const f=o[p];if(f.used){const g=f.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t.sort((p,f)=>p.length-f.length),t=t.filter((p,f)=>{for(let g=f+1;g<t.length;g++)if(t[g].indexOf(p)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const u=t.join(" | ");u!==this._attribHTML&&(this._attribHTML=u,t.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class tl{constructor(){a.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Xe("div","mapboxgl-ctrl");const o=Xe("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const o in t){const u=t[o].getSource();if(u.hasOwnProperty("mapbox_logo")&&!u.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const o=t[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class il{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,u=o?this._queue.concat(o):this._queue;
vendor: 4,862 bytes, line 1081
1081for(const p of u)if(p.id===t)return void(p.cancelled=!0)}run(t=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const u of o)if(!u.cancelled&&(u.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function rl(l,t,o){if(l=new a.LngLat(l.lng,l.lat),t){const u=new a.LngLat(l.lng-360,l.lat),p=new a.LngLat(l.lng+360,l.lat),f=360*Math.ceil(Math.abs(l.lng-o.center.lng)/360),g=o.locationPoint(l).distSqr(t),y=t.x<0||t.y<0||t.x>o.width||t.y>o.height;o.locationPoint(u).distSqr(t)<g&&(y||Math.abs(u.lng-o.center.lng)<f)?l=u:o.locationPoint(p).distSqr(t)<g&&(y||Math.abs(p.lng-o.center.lng)<f)&&(l=p)}for(;Math.abs(l.lng-o.center.lng)>180;){const u=o.locationPoint(l);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;l.lng>o.center.lng?l.lng-=360:l.lng+=360}return l}const ea={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%)"};class ta extends a.Evented{constructor(t,o){if(super(),(t instanceof a.window.HTMLElement||o)&&(t=a.extend({element:t},o)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),t&&t.element)this._element=t.element,this._offset=a.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=Xe("div");const p=41,f=27,g=kt("svg",{display:"block",height:p*this._scale+"px",width:f*this._scale+"px",viewBox:`0 0 ${f} ${p}`},this._element),y=kt("radialGradient",{id:"shadowGradient"},kt("defs",{},g));kt("stop",{offset:"10%","stop-opacity":.4},y),kt("stop",{offset:"100%","stop-opacity":.05},y),kt("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},g),kt("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},g),kt("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},g),kt("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},g),this._offset=a.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",p=>{p.preventDefault()}),this._element.addEventListener("mousedown",p=>{p.preventDefault()});const u=this._element.classList;for(const p in ea)u.remove(`mapboxgl-marker-anchor-${p}`);u.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const p=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
10810,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const o=t.code,u=t.charCode||t.keyCode;o!=="Space"&&o!=="Enter"&&u!==32&&u!==13||this.togglePopup()}_onMapClick(t){const o=t.originalEvent.target,u=this._element;this._popup&&(o===u||u.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map;if(!t)return!1;const o=t.unproject(this._pos),u=t.getFreeCameraOptions();if(!u.position)return!1;const p=u.position.toLngLat();return p.distanceTo(o)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const o=this._pos;if(!o||o.x<0||o.x>t.transform.width||o.y<0||o.y>t.transform.height)return void this._clearFadeTimer();const u=t.unproject(o);let p;t._usingGlobe()&&a.isLngLatBehindGlobe(t.transform,this._lngLat)?p=0:(p=1-t._queryFogOpacity(u),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(p*=.2)),this._element.style.opacity=`${p}`,this._element.style.pointerEvents=p>0?"auto":"none",this._popup&&this._popup._setOpacity(p),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const o=this._calculateXYTransform()+this._calculateZTransform(),u=this._offset.mult(this._scale);this._element.style.transform=` 1082 translate(${t.x}px,${t.y}px) ${ea[this._anchor]} 1083 ${o} 1084 translate(${u.x}px,${u.y}px) 1085 `}_calculateXYTransform(){const t=this._pos,o=this._map;if(this.getPitchAlignment()!=="map"||!o||!t)return"";if(!o._usingGlobe()){const v=o.getPitch();return v?`rotateX(${v}deg)`:""}const u=a.radToDeg(a.globeTiltAtLngLat(o.transform,this._lngLat)),p=t.sub(a.globeCenterToScreenPoint(o.transform)),f=u/(Math.abs(p.x)+Math.abs(p.y)),g=p.x*f,y=-p.y*f;return y||g?`rotateX(${y}deg) rotateY(${g}deg)`:""}_calculateZTransform(){const t=this._calculateRotation();return t?`rotateZ(${t}deg)`:""}_calculateRotation(){if(this._rotationAlignment==="viewport"||this._rotationAlignment==="auto")return this._rotation;if(this._map&&this._rotationAlignment==="map"){const t=this._map;if(this._pos&&t&&t._usingGlobe()){const o=t.project(new a.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),u=t.project(new a.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(o);return this._rotation+a.radToDeg(Math.atan2(u.y,u.x))-90}return this._rotation-this._map.getBearing()}return 0}_update(t){a.window.cancelAnimationFrame(this._updateFrameId);const o=this._map;
1085o&&(o.transform.renderWorldCopies&&(this._lngLat=rl(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat),t===!0?this._updateFrameId=a.window.requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._usingGlobe()||o.getTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=a.pointGeometry.convert(t),this._update(),this}_onMove(t){const o=this._map;if(o){if(!this._isDragging){const u=this._clickTolerance||o._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=u}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=o.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.Event("dragstart"))),this.fire(new a.Event("drag")))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new a.Event("dragend")),this._state="inactive"}_addDragHandler(t){const o=this._map;o&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos),this._pointerdownPos=t.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const o=this._map;return o&&(t?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.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==="auto"?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||"auto",this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}}class Ic{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const o=a.easeCubicInOut((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,o,u){this._start=this.getValue(o),this._end=t,this._startTime=o,this._endTime=o+u}}const nl={"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","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},Ac={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileC
1085acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function ia(l){l.parentNode&&l.parentNode.removeChild(l)}const Cc={showCompass:!0,showZoom:!0,visualizePitch:!1};class zc{constructor(t,o,u=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new Ja({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,u&&(this.mousePitch=new Qa({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(t,o){this.mouseRotate.mousedown(t,o),this.mousePitch&&this.mousePitch.mousedown(t,o),en()}move(t,o){const u=this.map,p=this.mouseRotate.mousemoveWindow(t,o),f=p&&p.bearingDelta;if(f&&u.setBearing(u.getBearing()+f),this.mousePitch){const g=this.mousePitch.mousemoveWindow(t,o),y=g&&g.pitchDelta;y&&u.setPitch(u.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart,{passive:!1}),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){mo(),a.window.removeEventListener("mousemove",this.mousemove),a.window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(a.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),Qe(this.element,t)),a.window.addEventListener("mousemove",this.mousemove),a.window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,Qe(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=sr(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=sr(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}const ol={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},kc={maxWidth:100,unit:"metric"};function sl(l,t,o){const u=al(t),p=u/t,f={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[o];this._map._requestDomTask(()=>{this._container.style.width=l*p+"px",this._container.innerHTML=`${u} ${f}`})}function al(l){const t=Math.pow(10,`${Math.floor(l)}`.length-1);let o=l/t;return o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:function(u){const p=Math.pow(10,Math.ceil(-Math.log(u)/Math.LN10));return Math.round(u*p)/p}(o),t*o}const ll={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},cl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ra(l=new a.pointGeometry(0,0),t="bottom"){if(typeof l=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new a.pointGeometry(0,l);case"top-left":return new a.pointGeometry(o,o);case"top-right":return new a.pointGeometry(-o,o);case"bottom":return new a.pointGeometry(0,-l);case"bottom-left":return new a.pointGeometry(o,-o);case"bottom-right":return new a.pointGeometry(-o,-o);case"left":return new a.pointGeometry(l,0);case"right":return new a.pointGeometry(-l,0)}return new a.pointGeometry(0,0)}return l instanceof a.pointGeometry||Array.isArray(l)?a.pointGeometry.convert(l):a.pointGeometry.convert(l[t]||[0,0])}const na={version:a.version,supported:or,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Qs{constructor(l){if((l=a.extend({}
1085,Ac,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&a.isSafariWithAntialiasingBug(a.window)&&(l.antialias=!1,a.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Zs(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies),l),this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=l.collectResourceTiming,this._optimizeForTerrain=l.optimizeForTerrain,this._language=l.language==="auto"?a.window.navigator.language:l.language,this._worldview=l.worldview,this._renderTaskQueue=new il,this._domRenderTaskQueue=new il,this._controls=[],this._markers=[],this._mapId=a.uniqueId(),this._locale=a.extend({},nl,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Ic(0),this._explicitProjection=null,this._requestManager=new a.RequestManager(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,typeof l.container=="string"){if(this._container=a.window.document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof a.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&a.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),a.window!==void 0&&(a.window.addEventListener("online",this._onWindowOnline,!1),a.window.addEventListener("resize",this._onWindowResize,!1),a.window.addEventListener("orientationchange",this._onWindowResize,!1),a.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new Ks(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,l.style&&this.setStyle(l.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),this._hash=l.hash&&new Ya(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,a.extend({},l.fitBoundsOptions,{duration:0})))),this.resize(),l.attributionControl&&this.addControl(new el({customAttribution:l.customAttribution})),this._logoControl=new tl,this.addControl(this._logoControl,l.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 a.Event(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new a.Event(`${t.dataType}dataloading`,t))})}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=l.onAdd(this);this._controls.push(l);const u=this._controlPositions[t];return t.indexOf("bottom")!==-1?u.insertBefore(o,u.firstChild):u.appendChild(o),this}
1085removeControl(l){if(!l||!l.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new a.Event("movestart",l)).fire(new a.Event("move",l)),this.fire(new a.Event("resize",l)),t&&this.fire(new a.Event("moveend",l)),this}getBounds(){return this.transform.projection.name==="globe"&&a.warnOnce('Globe projection does not support getBounds API, this API may behave unexpectedly."'),this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(a.LngLatBounds.convert(l)),this._update()}setMinZoom(l){if((l=l==null?-2:l)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new a.Event("zoomstart")).fire(new a.Event("zoom")).fire(new a.Event("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l==null?22:l)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new a.Event("zoomstart")).fire(new a.Event("zoom")).fire(new a.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l==null?0:l)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new a.Event("pitchstart")).fire(new a.Event("pitch")).fire(new a.Event("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l==null?85:l)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new a.Event("pitchstart")).fire(new a.Event("pitch")).fire(new a.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this._update()}getLanguage(){return this._language}setLanguage(l){if(this._language=l==="auto"?a.window.navigator.language:l,this.style)for(const t in this.style._sourceCaches){const o=this.style._sourceCaches[t]._source;o._setLanguage&&o._setLanguage(this._language)}for(const t of this._controls)t._setLanguage&&t._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){if(this._worldview=l,this.style)for(const t in this.style._sourceCaches){const o=this.style._sourceCaches[t]._source;o._setWorldview&&o._setWorldview(l)}return this}getProjection(){return this._explicitProjection?this._explicitProjection:this.style&&this.style.stylesheet&&this.style.stylesheet.projection?this.style.stylesheet.projection:{name:"mercator",center:[0,0]}}_usingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._updateProjection(l)}_updateProjection(l){const t=this.getProjection();l===null&&(this._explicitProjection=null);const o=l||this.getProjection();let u;if(o&&o.name==="globe"&&this.transform.zoom>=a.GLOBE_ZOOM_THRESHOLD_MAX?(u=this.transform.setProjection({name:"mercator"}),this.transform.mercatorFromTransition=!0):(u=this.transform.setProjection(o),this.transform.mercatorFromTransition=!1),l&&(this._explicitProjection=l.name==="globe"?{name:"globe",center:[0,0]}:this.transform.getProjection()),this.style.applyProjectionUpdate(),u){if(t.name==="globe"&&this.getProjection().name==="globe")this.style._forceSymbolLayer
1085Update();else{this.painter.clearBackgroundTiles();for(const p in this.style._sourceCaches)this.style._sourceCaches[p].clearTiles()}this._update(!0)}return this}project(l){return this.transform.locationPoint3D(a.LngLat.convert(l))}unproject(l){return this.transform.pointLocation3D(a.pointGeometry.convert(l))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_createDelegatedListener(l,t,o){if(l==="mouseenter"||l==="mouseover"){let u=!1;const p=g=>{const y=t.filter(T=>this.getLayer(T)),v=y.length?this.queryRenderedFeatures(g.point,{layers:y}):[];v.length?u||(u=!0,o.call(this,new vi(l,this,g.originalEvent,{features:v}))):u=!1},f=()=>{u=!1};return{layers:new Set(t),listener:o,delegates:{mousemove:p,mouseout:f}}}if(l==="mouseleave"||l==="mouseout"){let u=!1;const p=g=>{const y=t.filter(v=>this.getLayer(v));(y.length?this.queryRenderedFeatures(g.point,{layers:y}):[]).length?u=!0:u&&(u=!1,o.call(this,new vi(l,this,g.originalEvent)))},f=g=>{u&&(u=!1,o.call(this,new vi(l,this,g.originalEvent)))};return{layers:new Set(t),listener:o,delegates:{mousemove:p,mouseout:f}}}{const u=p=>{const f=t.filter(y=>this.getLayer(y)),g=f.length?this.queryRenderedFeatures(p.point,{layers:f}):[];g.length&&(p.features=g,o.call(this,p),delete p.features)};return{layers:new Set(t),listener:o,delegates:{[l]:u}}}}on(l,t,o){if(o===void 0)return super.on(l,t);Array.isArray(t)||(t=[t]);const u=this._createDelegatedListener(l,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(u);for(const p in u.delegates)this.on(p,u.delegates[p]);return this}once(l,t,o){if(o===void 0)return super.once(l,t);Array.isArray(t)||(t=[t]);const u=this._createDelegatedListener(l,t,o);for(const p in u.delegates)this.once(p,u.delegates[p]);return this}off(l,t,o){if(o===void 0)return super.off(l,t);t=new Set(Array.isArray(t)?t:[t]);const u=(f,g)=>{if(f.size!==g.size)return!1;for(const y of f)if(!g.has(y))return!1;return!0},p=this._delegatedListeners?this._delegatedListeners[l]:void 0;return p&&(f=>{for(let g=0;g<f.length;g++){const y=f[g];if(y.listener===o&&u(y.layers,t)){for(const v in y.delegates)this.off(v,y.delegates[v]);return f.splice(g,1),this}}})(p),this}queryRenderedFeatures(l,t){return this.style?(t!==void 0||l===void 0||l instanceof a.pointGeometry||Array.isArray(l)||(t=l,l=void 0),this.style.queryRenderedFeatures(l=l||[[0,0],[this.transform.width,this.transform.height]],t=t||{},this.transform)):[]}querySourceFeatures(l,t){return this.style.querySourceFeatures(l,t)}queryTerrainElevation(l,t){const o=this.transform.elevation;return o?(t=a.extend({},{exaggerated:!0},t),o.getAtPoint(a.MercatorCoordinate.fromLngLat(l),null,t.exaggerated)):null}setStyle(l,t){return(t=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&t.localFontFamily===this._localFontFamily&&this.style&&l?(this._diffStyle(l,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l&&(this.style=new er(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof l=="string"?this.style.loadURL(l):this.style.loadJSON(l)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new er(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(l,t){if(typeof l=="string"){const o=this._requestManager.normalizeStyleURL(l),u=this._requestManager.transformRequest(o,a.ResourceType.Style);a.getJSON(u,(p,f)=>{p?this.fire(new a.ErrorEvent(p)):f&&this._updateDiff(f,t)})}else typeof l=="object"&&this._updateDiff(l,t)}_updateDiff(l,t){try{this.style.setState(l)&&this._update(!0)}catch(o){a.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(a.warnOnce("There is no style added to the map."),!1)}addSource(l,t){return this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)}isSourceLoaded(l){return!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){const l=this.style&&this.style._sourceCaches;for(const t in l){const o=l[t]._tiles;for(const u in o){const p=o[u];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}addSourceType(l,t,o){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,o)}removeSource(l){return this.style.removeSource(l),this._updateTerrain(),this._update(!0)}getSource(l){return this.style.getSource(l)}addImage(l,t,{pixelRatio:o=1,sdf:u=!1,stretchX:p,stretchY:f,content:g}={}){if(this._lazyInitEmptyStyle(),t instanceof a.window.HTMLImageElement||a.window.ImageBitmap&&t instanceof a.window.ImageBitmap){const{width:y,height:v,data:T}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.RGBAImage({width:y,height:v},T),pixelRatio:o,stretchX:p,stretchY:f,content:g,sdf:u,version:0})}else if(t.width===void 0||t.height===void 0)this.fire(new a.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`")));else{const{width:y,height:v}=t,T=t;this.style.addImage(l,{data:new a.RGBAImage({width:y,height:v},new Uint8Array(T.data)),pixelRatio:o,stretchX:p,stretchY:f,content:g,sdf:u,version:0,userImage:T}),T.onAdd&&T.onAdd(this,l)}}updateImage(l,t){const o=this.style.getImage(l);if(!o)return void this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const u=t instanceof a.window.HTMLImageElement||a.window.ImageBitmap&&t instanceof a.window.ImageBitmap?a.exported.getImageData(t):t,{width:p,height:f}=u;p!==void 0&&f!==void 0?p===o.data.width&&f===o.data.height?(o.data.replace(u.data,!(t instanceof a.window.HTMLImageElement||a.window.ImageBitmap&&t instanceof a.window.ImageBitmap)),this.style.updateImage(l,o)):this.fire(new a.ErrorEvent(new Error(`The width and height of the updated image (${p}, ${f}) 1086 must be that same as the previous version of the image 1087 (${o.data.width}, ${o.data.height})`))):this.fire(new a.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`")))}hasImage(l){return l?!!this.style.getImage(l):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(l)}loadImage(l,t){a.getImage(this._requestManager.transformRequest(l,a.ResourceType.Image),(o,u)=>{t(o,u instanceof a.window.HTMLImageElement?a.exported.getImageData(u):u)})}listImages(){return this.style.listImages()}addLayer(l,t){return this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)}moveLayer(l,t){return this.style.moveLayer(l,t),this._update(!0)}removeLayer(l){return this.style.removeLayer(l),this._update(!0)}getLayer(l){return this.style.getLayer(l)}setLayerZoomRange(l,t,o){return this.style.setLayerZoomRange(l,t,o),this._update(!0)}setFilter(l,t,o={}){return this.style.setFilter(l,t,o),this._update(!0)}getFilter(l){return this.style.getFilter(l)}setPaintProperty(l,t,o,u={}){return this.style.setPaintProperty(l,t,o,u),this._update(!0)}getPaintProperty(l,t){return this.style.getPaintProperty(l,t)}setLayoutProperty(l,t,o,u={}){return this.style.setLayoutProperty(l,t,o,u),this._update(!0)}getLayoutProperty(l,t){return this.style.getLayoutProperty(l,t)}setLight(l,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(l,t),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.LngLat.convert(l),this.transform):0}setFeatureState(l,t){return this.style.setFeatureState(l,t),this._update()}removeFeatureState(l,t){return this.style.removeFeatureState(l,t),this._update()}getFeatureState(l){return this.style.getFeatureState(l)}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let o,u,p,f=this._container;for(;f&&(!u||!p);){const g=a.window.getComputedStyle(f).transform;g&&g!=="none"&&(o=g.match(/matrix.*\((.+)\)/)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(u=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(p=o[3])),f=f.parentElement}this._containerWidth=u?Math.abs(l/u):l,this._containerHeight=p?Math.abs(t/p):t}_detectMissingCSS(){a.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described
1087in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=Xe("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Xe("div","mapboxgl-canvas-container",l);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=Xe("canvas","mapboxgl-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",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const o=this._controlContainer=Xe("div","mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{u[p]=Xe("div",`mapboxgl-ctrl-${p}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const o=a.exported.devicePixelRatio||1;this._canvas.width=o*Math.ceil(l),this._canvas.height=o*Math.ceil(t),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const t=this._markers.indexOf(l);t!==-1&&this._markers.splice(t,1)}_setupPainter(){const l=a.extend({},or.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",l)||this._canvas.getContext("experimental-webgl",l);t?(a.storeAuthState(t,!0),this.painter=new js(t,this.transform),this.on("data",o=>{o.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),a.exported$1.testSupport(t)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;const o=this.painter.context.extTimerQuery,u=a.exported.now();if(this.listens("gpu-timing-frame")&&(t=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this.getProjection().name==="globe"&&(this.transform.zoom>=a.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.projection.name==="globe"&&this._updateProjection():this.transform.projection.name==="mercator"&&this._updateProjection());let p=!1;const f=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const v=this.transform.zoom,T=this.transform.pitch,S=a.exported.now();this.style.zoomHistory.update(v,S);const A=new a.EvaluationParameters(v,{now:S,fadeDuration:f,pitch:T,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),k=A.crossFadingFactor();k===1&&k===this._crossFadingFactor||(p=!0,this._crossFadingFactor=k),this.style.update(A)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let g=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),g=this._updateAverageElevation(u),this.style._updateSources(this.transform),this._forceMar
1087kerUpdate()):g=this._updateAverageElevation(u),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,f,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||p)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const v=a.exported.now()-u;o.endQueryEXT(o.TIME_ELAPSED_EXT,t),setTimeout(()=>{const T=o.getQueryObjectEXT(t,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(t),this.fire(new a.Event("gpu-timing-frame",{cpuTime:v,gpuTime:T})),a.window.performance.mark("frame-gpu",{startTime:u,detail:{gpuTime:T}})},50)}if(this.listens("gpu-timing-layer")){const v=this.painter.collectGpuTimers();setTimeout(()=>{const T=this.painter.queryGpuTimers(v);this.fire(new a.Event("gpu-timing-layer",{layerTimes:T}))},50)}if(this.listens("gpu-timing-deferred-render")){const v=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const T=this.painter.queryGpuTimeDeferredRender(v);this.fire(new a.Event("gpu-timing-deferred-render",{gpuTime:T}))},50)}const y=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(y||this._repaint)this.triggerRepaint();else{const v=!this.isMoving()&&this.loaded();if(v&&(g=this._updateAverageElevation(u,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),v&&(this.fire(new a.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const T=this._calculateSpeedIndex();this.fire(new a.Event("speedindexcompleted",{speedIndex:T})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,this._authenticate())}_forceMarkerUpdate(){for(const l of this._markers)l._update()}_updateAverageElevation(l,t=!1){const o=u=>(this.transform.averageElevation=u,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);if((t||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const u=this.transform.averageElevation;let p=this.transform.sampleAverageElevation(),f=!1;this.transform.elevation&&(f=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=l;const g=Math.abs(u-p);if(g>1){if(this._isInitialLoad||f)return this._averageElevation.jumpTo(p),o(p);this._averageElevation.easeTo(p,l,300)}else if(g>1e-4)return this._averageElevation.jumpTo(p),o(p)}return!!this._averageElevation.isEasing(l)&&o(this._averageElevation.getValue(l))}_authenticate(){a.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===a.AUTH_ERR_MSG||l.status===401)){const t=this.painter.context.gl;a.storeAuthState(t,!1),this._logoControl instanceof tl&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),a.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const o=this.painter.context.gl,u=o.createFramebuffer();function p(f){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,f,0);const g=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,g),g}return o.bindFramebuffer(o.FRAMEBUFFER,u),this._canvasPixelComparison(p(l),t.canvasCopies.map(p),t.timeStamps)}_canvasPixelComparison(l,t,o){let u=o[1]-o[0];const p=l.length/4;for(let f=0;f<t.length;f++){const g=t[f];let y=0;for(let v=0;v<g.length;v+=4)g[v]===l[v]&&g[v+1]===l[v+1]&&g[v+2]===l[v+2]&&g[v+3]===l[v+3]&&(y+=1);u+=(o[f+2]-o[f+1])*(1-y/p)}return u}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),a.window!==void 0&&(a.window.removeEventListener("resize",this._onWindowResize,!1),a.window.removeEventListener("orientationchange",this._onWindowResize,!1),a.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),a.window.removeEventListener("online",this._onWindowOnline,!1));const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),ia(this._canvasContainer),ia(this._controlContainer),ia(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),a.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=a.exported.frame(t=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(t)}))}_preloadTiles(l){const t=this.style?Object.values(this.style._sourceCaches):[];return a.asyncAll(t,(o,u)=>o._preloadTiles(l,u),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}_setCacheLimits(l,t){a.setCacheLimits(l,t)}get version(){return a.version}},NavigationControl:class{constructor(l){this.options=a.extend({},Cc,l),this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),Xe("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),Xe("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:t}):o.resetNorth({},{originalEvent:t}))}),this._compassIcon=Xe("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;
1087const t=l.getZoom(),o=t===l.getMaxZoom(),u=t===l.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new zc(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,t){const o=Xe("button",l,this._container);return o.type="button",o.addEventListener("click",t),o}_setButtonTitle(l,t){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",o),l.firstElementChild&&l.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends a.Evented{constructor(l){super(),this.options=a.extend({geolocation:a.window.navigator.geolocation},ol,l),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=No(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(l){this._supportsGeolocation!==void 0?l(this._supportsGeolocation):a.window.navigator.permissions!==void 0?a.window.navigator.permissions.query({name:"geolocation"}).then(t=>{this._supportsGeolocation=t.state!=="denied",l(this._supportsGeolocation)}):(this._supportsGeolocation=!!this.options.geolocation,l(this._supportsGeolocation))}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),o=l.coords;return!!t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
1087RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",l)),this._finish()}}_updateCamera(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude),o=l.coords.accuracy,u=this._map.getBearing(),p=a.extend({bearing:u},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(o),p,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=a.mercatorZfromAltitude(1,l._center.lat)*l.worldSize,o=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Xe("button","mapboxgl-ctrl-geolocate",this._container),Xe("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
1087se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Xe("div","mapboxgl-user-location"),this._dotElement.appendChild(Xe("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Xe("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ta({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Xe("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ta({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const l=()=>{a.window.addEventListener("ondeviceorientationabsolute"in a.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};a.window.DeviceMotionEvent!==void 0&&typeof a.window.DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),a.window.removeEventListener("deviceorientation",this._onDeviceOrientation),a.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
1087se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:el,ScaleControl:class{constructor(l){this.options=a.extend({},kc,l),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch{return!1}}()||(this._setScale=sl.bind(this)),a.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,o=t._containerHeight/2,u=t._containerWidth/2-l/2,p=t.unproject([u,o]),f=t.unproject([u+l,o]),g=p.distanceTo(f);if(this.options.unit==="imperial"){const y=3.2808*g;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,g/1852,"nautical-mile"):g>=1e3?this._setScale(l,g/1e3,"kilometer"):this._setScale(l,g,"meter")}_setScale(l,t,o){const u=al(t),p=u/t;this._map._requestDomTask(()=>{this._container.style.width=l*p+"px",this._container.innerHTML=o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"narrow",unit:o}).format(u):`${u} nm`})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof a.window.HTMLElement?this._container=l.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in a.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in a.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,a.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!a.window.document.fullscreenEnabled&&!a.window.document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=Xe("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Xe("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),a.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(a.window.document.fullscreenElement||a.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?a.window.document.exitFullscreen?a.window.document.exitFullscreen():a.window.document.webkitCancelFullScreen&&a.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.Evented{constructor(l){super(),this.options=a.extend(Object.create(ll),l),a.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),this._map=void 0),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=a.LngLat.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(a.window.document.createTextNode(l))}setHTML(l){const t=a.window.document.createDocumentFragment(),o=a.window.document.createElement("body");let u;for(o.innerHTML=l;u=o.firstChild,u;)t.appendChild(u);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=Xe("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const o=this._closeButton=Xe("button","mapboxgl-popup-close-button",t);o.type="button",o.setAttribute("aria-label","Close popup"),o.setAttribute("aria-hidden","true"),o.innerHTML="×",o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let t;return this._classList.delete(l)?t=!1:(this._classList.add(l),t=!0),this._updateClassList(),t}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const t=this._map,o=this._container,u=this._pos;if(!t||!o||!u)return"bottom";const p=o.offsetWidth,f=o.offsetHeight,g=u.x<p/2,y=u.x>t.transform.width-p/2;if(u.y+l<f)return g?"top-left":y?"top-right":"top";if(u.y>t.transform.height-f){if(g)return"bottom-left";if(y)return"bottom-right"}
1087return g?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,o=this._content;if(!t||!this._lngLat&&!this._trackPointer||!o)return;let u=this._container;if(u||(u=this._container=Xe("div","mapboxgl-popup",t.getContainer()),this._tip=Xe("div","mapboxgl-popup-tip",u),u.appendChild(o)),this.options.maxWidth&&u.style.maxWidth!==this.options.maxWidth&&(u.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rl(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const p=this._pos=this._trackPointer&&l?l:t.project(this._lngLat),f=ra(this.options.offset),g=this._anchor=this._getAnchor(f.y),y=ra(this.options.offset,g),v=p.add(y).round();t._requestDomTask(()=>{this._container&&g&&(this._container.style.transform=`${ea[g]} translate(${v.x}px,${v.y}px)`)})}if(!this._marker&&t._usingGlobe()){const p=a.isLngLatBehindGlobe(t.transform,this._lngLat)?0:1;this._setOpacity(p)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(cl);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:ta,Style:er,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,FreeCameraOptions:Vo,Evented:a.Evented,config:a.config,prewarm:function(){_t().acquire(Ze)},clearPrewarmedResources:function(){const l=rt;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(Ze),rt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return a.config.ACCESS_TOKEN},set accessToken(l){a.config.ACCESS_TOKEN=l},get baseApiUrl(){return a.config.API_URL},set baseApiUrl(l){a.config.API_URL=l},get workerCount(){return We.workerCount},set workerCount(l){We.workerCount=l},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.clearTileCache(l)},workerUrl:"",workerClass:null,setNow:a.exported.setNow,restoreNow:a.exported.restoreNow};return na});var ba=Qt;return ba})})(yf);const cs=yf.exports;
1087class ng{constructor(){this.node=document.createElement("div"),this.node.classList.add("mapboxgl-ctrl"),this.node.classList.add("mapboxgl-ctrl-group"),this.node.classList.add("mapbox-control")}addButton(wt){this.node.appendChild(wt.node)}addClassName(wt){this.node.classList.add(wt)}removeClassName(wt){this.node.classList.remove(wt)}onAddControl(){}onRemoveControl(){}onAdd(wt){return this.map=wt,this.onAddControl(),this.node}onRemove(){this.onRemoveControl(),this.node.parentNode.removeChild(this.node),this.map=void 0}}class _f{constructor(){this.node=document.createElement("button"),this.node.type="button",this.icon=null}setIcon(wt){this.icon=wt,this.node.appendChild(wt)}setText(wt){this.node.textContent=wt}onClick(wt){this.node.addEventListener("click",wt)}addClassName(wt){this.node.classList.add(wt)}removeClassName(wt){this.node.classList.remove(wt)}}const og=` 1088<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" viewBox="0 0 24 24" fill="#505050" width="20" height="20"> 1089 <rect fill="none" height="24" width="24"/> 1090 <path d="M18,13h-5v5c0,0.55-0.45,1-1,1l0,0c-0.55,0-1-0.45-1-1v-5H6c-0.55,0-1-0.45-1-1l0,0c0-0.55,0.45-1,1-1h5V6 c0-0.55,0.45-1,1-1l0,0c0.55,0,1,0.45,1,1v5h5c0.55,0,1,0.45,1,1l0,0C19,12.55,18.55,13,18,13z"/> 1091</svg> 1092`;function sg(){return new DOMParser().parseFromString(og,"image/svg+xml").firstChild}const ag=` 1093<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" viewBox="0 0 24 24" fill="#505050" width="20" height="20"> 1094 <rect fill="none" height="24" width="24"/> 1095 <path d="M18,13H6c-0.55,0-1-0.45-1-1l0,0c0-0.55,0.45-1,1-1h12c0.55,0,1,0.45,1,1l0,0C19,12.55,18.55,13,18,13z"/> 1096</svg> 1097`;function lg(){return new DOMParser().parseFromString(ag,"image/svg+xml").firstChild}class cg extends ng{constructor(){super(),this.zoomIn=new _f,this.zoomOut=new _f}insert(){this.addClassName("mapbox-zoom"),this.zoomIn.setIcon(sg()),this.zoomIn.onClick(()=>this.map.zoomIn()),this.zoomOut.setIcon(lg()),this.zoomOut.onClick(()=>this.map.zoomOut()),this.addButton(this.zoomIn),this.addButton(this.zoomOut)}onAddControl(){this.insert()}}const{document:gf}=eg;function ug(yr){let wt,ri,xi;return{c(){wt=df("link"),ri=X_(),xi=df("div"),this.h()},l(Qt){const zi=W_('[data-svelte="svelte-5s2j65"]',gf.head);wt=ff(zi,"LINK",{href:!0,rel:!0}),zi.forEach(Ol),ri=H_(Qt),xi=ff(Qt,"DIV",{id:!0,class:!0}),Y_(xi).forEach(Ol),this.h()},h(){yu(wt,"href","https://api.mapbox.com/mapbox-gl-js/v2.8.1/mapbox-gl.css"),yu(wt,"rel","stylesheet"),yu(xi,"id","map"),yu(xi,"class","w-full h-full")},m(Qt,zi){K_(gf.head,wt),mf(Qt,ri,zi),mf(Qt,xi,zi)},p:Nh,i:Nh,o:Nh,d(Qt){Ol(wt),Qt&&Ol(ri),Qt&&Ol(xi)}}}function hg(yr,wt,ri){let xi;J_(yr,rg,kt=>ri(8,xi=kt));let Qt,{flyTo:zi}=wt,{disableZoom:ba=!1}=wt,{initialZoom:a=12}=wt,{preventInitialZoomAroundMarkers:Se=!1}=wt;const or={lat:41.28346,lng:-70.09946};let di=[],{singlePropertyMarkers:Me}=wt,Xe=[];return Q_(()=>{ri(5,cs.accessToken="pk.eyJ1IjoiYWxseWdwcCIsImEiOiJjbXM3dWM5N20wN3RhMndxMmZpM3RuM2JrIn0.KSTzXLXRk0Fw1lDT1UnOCw",cs),ri(6,Qt=new cs.Map({container:"map",style:"mapbox://styles/allygpp/cms7u80f7009k01qo9jbv13q6",center:[or.lng,or.lat],zoom:a})),ba&&Qt.scrollZoom.disable(),Qt.addControl(new cg,"top-right")}),yr.$$set=kt=>{"flyTo"in kt&&ri(0,zi=kt.flyTo),"disableZoom"in kt&&ri(1,ba=kt.disableZoom),"initialZoom"in kt&&ri(2,a=kt.initialZoom),"preventInitialZoomAroundMarkers"in kt&&ri(3,Se=kt.preventInitialZoomAroundMarkers),"singlePropertyMarkers"in kt&&ri(4,Me=kt.singlePropertyMarkers)},yr.$$.update=()=>{if(yr.$$.dirty&505&&typeof Qt<"u"){di.forEach(Lt=>{Lt.remove()}),Me?ri(7,Xe=Me):ri(7,Xe=xi),Xe.forEach(Lt=>{let Ye="";typeof Lt.address<"u"&&(Ye+=`<h3><a href="${Lt.href}" target="_blank">${Lt.address}</a></h3>`,typeof Lt<"u"&&(Ye+=`<a href="${Lt.href}" target="_blank"><img src="${ig(220,147)}${encodeURIComponent(Lt.src)}" class="w-64"/></a>`));const ni=document.createElement("div");if(ni.className="marker",!isNaN(Lt.lng)&&!isNaN(Lt.lat)){const en=new cs.Marker(ni).setLngLat([+Lt.lng,+Lt.lat]).addTo(Qt);Ye!==""&&en.setPopup(new cs.Popup({offset:25}).setHTML(Ye)),di.push(en)}}),zi?Qt.flyTo({center:[zi.lng,zi.lat]}):typeof Xe[0]<"u"&&!Se&&Qt.flyTo({center:[Xe[0].lng,Xe[0].lat]});const kt=600;if(Xe.length>0&&!Se){console.log([Xe[0].lng,Xe[0].lat]);const Lt=new cs.LngLatBounds([Xe[0].lng,Xe[0].lat],[Xe[0].lng,Xe[0].lat]);Xe.forEach(Ye=>{!isNaN(Ye.lng)&&!isNaN(Ye.lat)&&Lt.extend([Ye.lng,Ye.lat])}),Qt.fitBounds(Lt,{padding:parseInt(kt/Xe.length)})}}},[zi,ba,a,Se,Me,cs,Qt,Xe,xi]}class mg extends Z_{constructor(wt){super(),$_(this,wt,hg,ug,q_,{flyTo:0,disableZoom:1,initialZoom:2,preventInitialZoomAroundMarkers:3,singlePropertyMarkers:4})}}export{mg as M};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.