PageSourceSearch

https://assets.oneroof.co.nz/rebuild/aws/20260921155645/_next/static/chunks/c36f3faa-5123e5a433efa068.js

js oneroof.co.nz collected 2026-09-24 19:33:03 UTC 962,953 bytes, 67 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3415],{42520:function(i,r,n){var a,o=n(40257);a=function(){"use strict";var i,r,n;function a(a,o){if(i){if(r){var s="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 = {}; ("+i+")(sharedChunk); ("+r+")(sharedChunk); self.onerror = null;",l={};i(l),n=o(l),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(n.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}else r=o}else i=o}return a(["exports"],function(i){let r,n,a,s,l,h,u;var c,d="undefined"!=typeof self?self:{},p="2.13.0";let f={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==r){let i=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{r=null!=o.env.API_URL_REGEX?new RegExp(o.env.API_URL_REGEX):i}catch(n){r=i}}return r},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"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},m={supported:!1,testSupport:function(i){!y&&g&&(x?v(i):_=i)}},_,g,y=!1,x=!1;function v(i){let r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,g),i.isContextLost())return;m.supported=!0}
1catch(i){}i.deleteTexture(r),y=!0}function b(i,r,n,a){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(a-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=r,this.p2x=n,this.p2y=a}d.document&&((g=d.document.createElement("img")).onload=function(){_&&v(_),_=null,x=!0},g.onerror=function(){y=!0,_=null},g.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),b.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,r){if(void 0===r&&(r=1e-6),i<0)return 0;if(i>1)return 1;for(var n=i,a=0;a<8;a++){var o=this.sampleCurveX(n)-i;if(Math.abs(o)<r)return n;var s=this.sampleCurveDerivativeX(n);if(1e-6>Math.abs(s))break;n-=o/s}var l=0,h=1;for(n=i,a=0;a<20&&!(Math.abs((o=this.sampleCurveX(n))-i)<r);a++)i>o?l=n:h=n,n=.5*(h-l)+l;return n},solve:function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))}};var w=T;function T(i,r){this.x=i,this.y=r}T.prototype={clone:function(){return new T(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,r){return this.clone()._rotateAround(i,r)},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 r=i.x-this.x,n=i.y-this.y;return r*r+n*n},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,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult:function(i){var r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,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 r=Math.cos(i),n=Math.sin(i),a=n*this.x+r*this.y;return this.x=r*this.x-n*this.y,this.y=a,this},_rotateAround:function(i,r){var n=Math.cos(i),a=Math.sin(i),o=r.y+a*(this.x-r.x)+n*(this.y-r.y);return this.x=r.x+n*(this.x-r.x)-a*(this.y-r.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},T.convert=function(i){return i instanceof T?i:Array.isArray(i)?new T(i[0],i[1]):i};let E=Math.PI/180,S=180/Math.PI,M=[[0,0],[1,0],[1,1],[0,1]];function A(i){if(i<=0)return 0;if(i>=1)return 1;let r=i*i,n=r*i;return 4*(i<.5?n:3*(i-r)+n-.75)}function I(i,r,n,a){let o=new b(i,r,n,a);return function(i){return o.solve(i)}}let C=I(.25,.1,.25,1);function z(i,r,n){return Math.min(n,Math.max(r,i))}function k(i,r,n){return(n=z((n-i)/(r-i),0,1))*n*(3-2*n)}function D(i,r,n){let a=n-r,o=((i-r)%a+a)%a+r;return o===r?n:o}function P(i,r,n){if(!i.length)return n(null,[]);let a=i.length,o=Array(i.length),s=null;i.forEach((i,l)=>{r(i,(i,r)=>{i&&(s=i),o[l]=r,0==--a&&n(s,o)})})}function L(i){let r=[];for(let n in i)r.push(i[n]);return r}function R(i,...r){for(let n of r)for(let r in n)i[r]=n[r];return i}let B=1;function O(){return B++}function F(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function U(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function V(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)}
1function N(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function j(i,r){return -1!==i.indexOf(r,i.length-r.length)}function G(i,r,n){let a={};for(let o in i)a[o]=r.call(n||this,i[o],o,i);return a}function Z(i,r,n){let a={};for(let o in i)r.call(n||this,i[o],o,i)&&(a[o]=i[o]);return a}function $(i){return Array.isArray(i)?i.map($):"object"==typeof i&&i?G(i,$):i}let q={};function W(i){q[i]||("undefined"!=typeof console&&console.warn(i),q[i]=!0)}function X(i,r,n){return(n.y-i.y)*(r.x-i.x)>(r.y-i.y)*(n.x-i.x)}function H(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function Y(i){let r={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,a,o)=>{let s=a||o;return r[n]=!s||s.toLowerCase(),""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}let K=null;function J(i){if(null==K){let r=i.navigator?i.navigator.userAgent:null;K=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return K}function Q(i){try{let r=d[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(i){return!1}}function ee(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}let et="mapbox-tiles",ei,er,en=500,ea=50;function eo(){try{return d.caches}catch(i){}}function es(){eo()&&!ei&&(ei=d.caches.open(et))}function el(i){let r=i.indexOf("?");if(r<0)return i;let n=(function(i){let r=i.indexOf("?");return r>0?i.slice(r+1).split("&"):[]})(i).filter(i=>{let r=i.split("=");return"language"===r[0]||"worldview"===r[0]});return n.length?`${i.slice(0,r)}?${n.join("&")}`:i.slice(0,r)}let eh=1/0,eu={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(eu);class ec extends Error{constructor(i,r,n){401===r&&ex(n)&&(i+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(i),this.status=r,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let ed=H()?()=>self.worker&&self.worker.referrer:()=>("blob:"===d.location.protocol?d.parent:d).location.href,ep=function(i,r){var n;if(!(/^file:/.test(n=i.url)||/^file:/.test(ed())&&!/^\w+:/.test(n))){if(d.fetch&&d.Request&&d.AbortController&&d.Request.prototype.hasOwnProperty("signal"))return function(i,r){var n;let a=new d.AbortController,o=new d.Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:ed(),signal:a.signal}),s=!1,l=!1,h=(n=o.url).indexOf("sku=")>0&&ex(n);"json"===i.type&&o.headers.set("Accept","application/json");let u=(n,a,s)=>{if(l)return;if(n&&"SecurityError"!==n.message&&W(n),a&&s)return c(a);let u=Date.now();d.fetch(o).then(n=>{if(n.ok){let i=h?n.clone():null;return c(n,i,u)}return r(new ec(n.statusText,n.status,i.url))}).catch(n=>{"AbortError"!==n.name&&r(Error(`${n.message} ${i.url}`))})},c=(n,a,h)=>{("arrayBuffer"===i.type?n.arrayBuffer():"json"===i.type?n.json():n.text()).then(i=>{l||(a&&h&&function(i,r,n){if(es(),!ei)return;let a={status:r.status,statusText:r.statusText,headers:new d.Headers};r.headers.forEach((i,r)=>a.headers.set(r,i));let o=Y(r.headers.get("Cache-Control")||"");if(o["no-store"])return;o["max-age"]&&a.headers.set("Expires",new Date(n+1e3*o["max-age"]).toUTCString());let s=a.headers.get("Expires");s&&(new Date(s).getTime()-n<42e4||function(i,r){if(void 0===er)try{new Response(new ReadableStream),er=!0}catch(i){er=!1}er?r(i.body):i.blob().then(r)}(r,r=>{let n=new d.Response(r,a);es(),ei&&ei.then(r=>r.put(el(i.url),n)).catch(i=>W(i.message))}))}(o,a,h),s=!0,r(null,i,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(i=>{l||r(Error(i.message))})};return h?function(i,r){if(es(),!ei)return r(null);let n=el(i.url);ei.then(i=>{i.match(n).then(a=>{let o=function(i){if(!i)return!1;let r=new Date(i.headers.get("Expires")||0),n=Y(i.headers.get("Cache-Control")||"");return r>
1Date.now()&&!n["no-cache"]}(a);i.delete(n),o&&i.put(n,a.clone()),r(null,a,o)}).catch(r)}).catch(r)}(o,u):u(null,null),{cancel:()=>{l=!0,s||a.abort()}}}(i,r);if(H()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,r,void 0,!0)}return function(i,r){let n=new d.XMLHttpRequest;for(let r in n.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(n.responseType="arraybuffer"),i.headers)n.setRequestHeader(r,i.headers[r]);return"json"===i.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===i.credentials,n.onerror=()=>{r(Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let a=n.response;if("json"===i.type)try{a=JSON.parse(n.response)}catch(i){return r(i)}r(null,a,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else r(new ec(n.statusText,n.status,i.url))},n.send(i.body),{cancel:()=>n.abort()}}(i,r)},ef=function(i,r){return ep(R(i,{type:"arrayBuffer"}),r)},em="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";n=[],a=0;let e_=function(i,r){if(m.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),a>=f.MAX_PARALLEL_IMAGE_REQUESTS){let a={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return n.push(a),a}a++;let o=!1,s=()=>{if(!o)for(o=!0,a--;n.length&&a<f.MAX_PARALLEL_IMAGE_REQUESTS;){let i=n.shift(),{requestParameters:r,callback:a,cancelled:o}=i;o||(i.cancel=e_(r,a).cancel)}},l=ef(i,(i,n,a,o)=>{s(),i?r(i):n&&(d.createImageBitmap?function(i,r){let n=new d.Blob([new Uint8Array(i)],{type:"image/png"});d.createImageBitmap(n).then(i=>{r(null,i)}).catch(i=>{r(Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(n,(i,n)=>r(i,n,a,o)):function(i,r){let n=new d.Image,a=d.URL;n.onload=()=>{r(null,n),a.revokeObjectURL(n.src),n.onload=null,d.requestAnimationFrame(()=>{n.src=em})},n.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let o=new d.Blob([new Uint8Array(i)],{type:"image/png"});n.src=i.byteLength?a.createObjectURL(o):em}(n,(i,n)=>r(i,n,a,o)))});return{cancel:()=>{l.cancel(),s()}}},eg="NO_ACCESS_TOKEN";function ey(i){return 0===i.indexOf("mapbox:")}function ex(i){return f.API_URL_REGEX.test(i)}function ev(i){return f.API_CDN_URL_REGEX.test(i)}function eb(i){return f.API_STYLE_REGEX.test(i)&&!ew(i)}function ew(i){return f.API_SPRITE_REGEX.test(i)}let eT=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function eE(i){let r=i.match(eT);if(!r)throw Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function eS(i){let r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}function eM(i){if(!i)return null;let r=i.split(".");if(!r||3!==r.length)return null;try{return JSON.parse(decodeURIComponent(d.atob(r[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(i){return null}}class eA{constructor(i){this.type=i,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){let r=eM(f.ACCESS_TOKEN),n="";return n=r&&r.u?d.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r)))):f.ACCESS_TOKEN||"",i?`mapbox.eventData.${i}:${n}`:`mapbox.eventData:${n}`}fetchEventData(){let i=Q("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{let i=d.localStorage.getItem(r);i&&(this.eventData=JSON.parse(i));let a=d.localStorage.getItem(n);a&&(this.anonId=a)}catch(i){W("Unable to read from LocalStorage")}}saveEventData(){let i=Q("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{d.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&d.localStorage.setItem(r,JSON.stringify(this.eventData))}catch(i){W("Unable to write to LocalStorage")}}processRequests(i){}postEvent(i,r,n,a){var o;if(!f.EVENTS_URL)return;let s=eE(f.EVENTS_URL);s.params.push(`access_token=${a||f.ACCESS_TOKEN||""}`);let l={event:this.type,created:new Date(i).toISOString()},h=r?R(l,r):l,u={url:eS(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([h])};this.pendingRequest=(o=i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(a)},ep(R(u,{method:"POST"}),o))}queueRequest(i,r){this.queue.push(i),this.processRequests(r)}}let eI=new class extends eA{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,r){f.EVENTS_URL&&f.ACCESS_TOKEN&&Array.isArray(i)&&i.some(i=>ey(i)||ex(i))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let r=eM(f.ACCESS_TOKEN),n=r?r.u:f.ACCESS_TOKEN,a=n!==this.eventData.tokenU;V(this.anonId)||(this.anonId=F(),a=!0);let o=this.queue.shift();if(this.eventData.lastSuccess){let i=new Date(this.eventData.lastSuccess),r=new Date(o),n=(o-this.eventData.lastSuccess)/864e5;a=a||n>=1||n<-1||i.getDate()!==r.getDate()}else a=!0;a?this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:p,skuId:"01","enabled.telemetry":!1,userId:this.anonId},i=>{i||(this.eventData.lastSuccess=o,this.eventData.tokenU=n)},i):this.processRequests()}},eC=eI.postTurnstileEvent.bind(eI),ez=new class extends eA{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,n,a){this.skuToken=r,this.errorCb=a,f.EVENTS_URL&&(n||f.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(eg)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),V(this.anonId)||(this.anonId=F()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:p,skuId:"01",skuToken:this.skuToken,userId:this.anonId},i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i))}},ek=ez.postMapLoadEvent.bind(ez),eD=new class extends eA{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){f.EVENTS_URL&&(i||f.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,performanceData:n}=this.queue.shift(),a=function(i){let r=d.performance.getEntriesByType("resource"),n=d.performance.getEntriesByType("mark"),a=function(i){let r={};if(i){for(let n in i)if("other"!==n)for(let a of i[n]){let i=`${n}ResolveRangeMin`,o=`${n}ResolveRangeMax`,s=`${n}RequestCount`,l=`${n}RequestCachedCount`;r[i]=Math.min(r[i]||1/0,a.startTime),r[o]=Math.max(r[o]||-1/0,a.responseEnd);let h=i=>{void 0===r[i]&&(r[i]=0),++r[i]};void 0!==a.transferSize&&0===a.transferSize&&h(l),h(s)}}return r}(function(i,r){let n={};if(i)for(let a of i){let i=r(a);void 0===n[i]&&(n[i]=[]),n[i].push(a)}return n}(r,eF)),o=d.devicePixelRatio,s=d.navigator.connection||d.navigator.mozConnection||d.navigator.webkitConnection,l={counters:[],metadata:[],attributes:[]},h=(i,r,n)=>{null!=n&&i.push({name:r,value:n.toString()})};for(let i in a)h(l.counters,i,a[i]);if(i.interactionRange[0]!==1/0&&i.interactionRange[1]!==-1/0&&(h(l.counters,"interactionRangeMin",i.interactionRange[0]),h(l.counters,"interactionRangeMax",i.interactionRange[1])),n)for(let i of Object.keys(eO)){let r=eO[i],a=n.find(i=>i.name===r);a&&h(l.counters,r,a.startTime)}return h(l.counters,"visibilityHidden",i.visibilityHidden),h(l.attributes,"style",function(i){if(i)for(let r of i){let i=r.name.split("?")[0];if(eb(i)){let r=i.split("/").slice(-2);if(2===r.length)return`mapbox://styles/${r[0]}/${r[1]}`}}}(r)),h(l.attributes,"terrainEnabled",i.terrainEnabled?"true":"false"),h(l.attributes,"fogEnabled",i.fogEnabled?"true":"false"),h(l.attributes,"projection",i.projection),h(l.attributes,"zoom",i.zoom),h(l.metadata,"devicePixelRatio",o),h(l.metadata,"connectionEffectiveType",s?s.effectiveType:void 0),h(l.metadata,"navigatorUserAgent",d.navigator.userAgent),h(l.metadata,"screenWidth",d.screen.width),h(l.metadata,"screenHeight",d.screen.height),h(l.metadata,"windowWidth",d.innerWidth),h(l.metadata,"windowHeight",d.innerHeight),h(l.metadata,"mapWidth",i.width/o),h(l.metadata,"mapHeight",i.height/o),h(l.metadata,"webglRenderer",i.renderer),h(l.metadata,"webglVendor",i.vendor),h(l.metadata,"sdkVersion",p),h(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(n);for(let i of a.metadata);for(let i of a.counters);for(let i of a.attributes);this.postEvent(r,a,()=>{},i)}},eP=eD.postPerformanceEvent.bind(eD),eL=new class extends eA{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,n,a){var o;if(!f.API_URL||!f.SESSION_PATH)return;let s=eE(f.API_URL+f.SESSION_PATH);s.params.push(`sku=${r||""}`),s.params.push(`access_token=${a||f.ACCESS_TOKEN||""}`);let l={url:eS(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=(o=i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(a)},ep(R(l,{method:"GET"}),o))}getSessionAPI(i,r,n,a){this.skuToken=r,this.errorCb=a,f.SESSION_PATH&&f.API_URL&&(n||f.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(eg)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:n}=this.queue.shift();
1r&&this.success[r]||this.getSession(n,this.skuToken,i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i)}},eR=eL.getSessionAPI.bind(eL),eB=new Set,eO={create:"create",load:"load",fullLoad:"fullLoad"};function eF(i){let r=i.name.split("?")[0];return ev(r)&&r.includes("mapbox-gl.js")?"javascript":ev(r)&&r.includes("mapbox-gl.css")?"css":f.API_FONTS_REGEX.test(r)?"fontRange":ew(r)?"sprite":eb(r)?"style":f.API_TILEJSON_REGEX.test(r)?"tilejson":"other"}let eU=d.performance;function eV(i){let r=i?i.url.toString():void 0;return eU.getEntriesByName(r)}let eN={now:()=>void 0!==h?h:d.performance.now(),setNow(i){h=i},restoreNow(){h=void 0},frame(i){let r=d.requestAnimationFrame(i);return{cancel:()=>d.cancelAnimationFrame(r)}},getImageData(i,r=0){let{width:n,height:a}=i;u||(u=d.document.createElement("canvas"));let o=u.getContext("2d",{willReadFrequently:!0});if(!o)throw Error("failed to create canvas 2d context");return(n>u.width||a>u.height)&&(u.width=n,u.height=a),o.clearRect(-r,-r,n+2*r,a+2*r),o.drawImage(i,0,0,n,a),o.getImageData(-r,-r,n+2*r,a+2*r)},resolveURL:i=>(s||(s=d.document.createElement("a")),s.href=i,s.href),get devicePixelRatio(){return d.devicePixelRatio},get prefersReducedMotion(){return!!d.matchMedia&&(null==l&&(l=d.matchMedia("(prefers-reduced-motion: reduce)")),l.matches)}};function ej(i,r,n){n[i]&&-1!==n[i].indexOf(r)||(n[i]=n[i]||[],n[i].push(r))}function eG(i,r,n){if(n&&n[i]){let a=n[i].indexOf(r);-1!==a&&n[i].splice(a,1)}}class eZ{constructor(i,r={}){R(this,r),this.type=i}}class e$ extends eZ{constructor(i,r={}){super("error",R({error:i},r))}}class eq{on(i,r){return this._listeners=this._listeners||{},ej(i,r,this._listeners),this}off(i,r){return eG(i,r,this._listeners),eG(i,r,this._oneTimeListeners),this}once(i,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},ej(i,r,this._oneTimeListeners),this):new Promise(r=>this.once(i,r))}fire(i,r){"string"==typeof i&&(i=new eZ(i,r||{}));let n=i.type;if(this.listens(n)){for(let r of(i.target=this,this._listeners&&this._listeners[n]?this._listeners[n].slice():[]))r.call(this,i);for(let r of this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[])eG(n,r,this._oneTimeListeners),r.call(this,i);let r=this._eventedParent;r&&(R(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(i))}else i instanceof e$&&console.error(i.error);return this}listens(i){return!!(this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i))}setEventedParent(i,r){return this._eventedParent=i,this._eventedParentData=r,this}}var eW=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}
1,"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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1
vendor: 16,128 bytes, line 1
1,"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":
vendor: 3,713 bytes, line 1
1false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"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":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"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"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]}},"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"}
1,"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":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"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":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"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"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function eX(i,...r){for(let n of r)for(let r in n)i[r]=n[r];return i}function eH(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function eY(i){if(Array.isArray(i))return i.map(eY);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let r={};for(let n in i)r[n]=eY(i[n]);return r}return eH(i)}
1class eK extends Error{constructor(i,r){super(r),this.message=r,this.key=i}}class eJ{constructor(i,r=[]){for(let[n,a]of(this.parent=i,this.bindings={},r))this.bindings[n]=a}concat(i){return new eJ(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}let eQ={kind:"null"},e0={kind:"number"},e1={kind:"string"},e2={kind:"boolean"},e3={kind:"color"},e5={kind:"object"},e4={kind:"value"},e6={kind:"collator"},e8={kind:"formatted"},e9={kind:"resolvedImage"};function e7(i,r){return{kind:"array",itemType:i,N:r}}function te(i){if("array"===i.kind){let r=te(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}let tt=[eQ,e0,e1,e2,e3,e8,e5,e7(e4),e9];function ti(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!ti(i.itemType,r.itemType))&&("number"!=typeof i.N||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if("value"===i.kind){for(let i of tt)if(!ti(i,r))return null}}return`Expected ${te(i)} but found ${te(r)} instead.`}function tr(i,r){return r.some(r=>r.kind===i.kind)}function tn(i,r){return r.some(r=>"null"===r?null===i:"array"===r?Array.isArray(i):"object"===r?i&&!Array.isArray(i)&&"object"==typeof i:r===typeof i)}var ta,to={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 ts(i){return(i=Math.round(i))<0?0:i>255?255:i}function tl(i){return ts("%"===i[i.length-1]?parseFloat(i)/100*255:parseInt(i))}function th(i){var r;return(r="%"===i[i.length-1]?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r}function tu(i,r,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?i+(r-i)*n*6:2*n<1?r:3*n<2?i+(r-i)*(2/3-n)*6:i}try{ta=({}).parseCSSColor=function(i){var r,n=i.replace(/ /g,"").toLowerCase();if(n in to)return to[n].slice();if("#"===n[0])return 4===n.length?(r=parseInt(n.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null:7===n.length&&(r=parseInt(n.substr(1),16))>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null;var a=n.indexOf("("),o=n.indexOf(")");if(-1!==a&&o+1===n.length){var s=n.substr(0,a),l=n.substr(a+1,o-(a+1)).split(","),h=1;switch(s){case"rgba":if(4!==l.length)break;h=th(l.pop());case"rgb":return 3!==l.length?null:[tl(l[0]),tl(l[1]),tl(l[2]),h];case"hsla":if(4!==l.length)break;h=th(l.pop());case"hsl":if(3!==l.length)break;var u=(parseFloat(l[0])%360+360)%360/360,c=th(l[1]),d=th(l[2]),p=d<=.5?d*(c+1):d+c-d*c,f=2*d-p;
1return[ts(255*tu(f,p,u+1/3)),ts(255*tu(f,p,u)),ts(255*tu(f,p,u-1/3)),h]}}return null}}catch(i){}class tc{constructor(i,r,n,a=1){this.r=i,this.g=r,this.b=n,this.a=a}static parse(i){if(!i)return;if(i instanceof tc)return i;if("string"!=typeof i)return;let r=ta(i);return r?new tc(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){let[i,r,n,a]=this.toArray();return`rgba(${Math.round(i)},${Math.round(r)},${Math.round(n)},${a})`}toArray(){let{r:i,g:r,b:n,a:a}=this;return 0===a?[0,0,0,0]:[255*i/a,255*r/a,255*n/a,a]}toArray01(){let{r:i,g:r,b:n,a:a}=this;return 0===a?[0,0,0,0]:[i/a,r/a,n/a,a]}toArray01PremultipliedAlpha(){let{r:i,g:r,b:n,a:a}=this;return[i,r,n,a]}}tc.black=new tc(0,0,0,1),tc.white=new tc(1,1,1,1),tc.transparent=new tc(0,0,0,0),tc.red=new tc(1,0,0,1),tc.blue=new tc(0,0,1,1);class td{constructor(i,r,n){this.sensitivity=i?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,r){return this.collator.compare(i,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class tp{constructor(i,r,n,a,o){this.text=i.normalize?i.normalize():i,this.image=r,this.scale=n,this.fontStack=a,this.textColor=o}}class tf{constructor(i){this.sections=i}static fromString(i){return new tf([new tp(i,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(i=>0!==i.text.length||i.image&&0!==i.image.name.length)}static factory(i){return i instanceof tf?i:tf.fromString(i)}toString(){return 0===this.sections.length?"":this.sections.map(i=>i.text).join("")}serialize(){let i=["format"];for(let r of this.sections){if(r.image){i.push(["image",r.image.name]);continue}i.push(r.text);let 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())),i.push(n)}return i}}class tm{constructor(i){this.name=i.name,this.available=i.available}toString(){return this.name}static fromString(i){return i?new tm({name:i,available:!1}):null}serialize(){return["image",this.name]}}function t_(i,r,n,a){return"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[i,r,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[i,r,n,a]:[i,r,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tg(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof tc||i instanceof td||i instanceof tf||i instanceof tm)return!0;if(Array.isArray(i)){for(let r of i)if(!tg(r))return!1;return!0}if("object"==typeof i){for(let r in i)if(!tg(i[r]))return!1;return!0}return!1}function ty(i){if(null===i)return eQ;if("string"==typeof i)return e1;if("boolean"==typeof i)return e2;if("number"==typeof i)return e0;if(i instanceof tc)return e3;if(i instanceof td)return e6;if(i instanceof tf)return e8;if(i instanceof tm)return e9;if(Array.isArray(i)){let r;let n=i.length;for(let n of i){let i=ty(n);if(r){if(r===i)continue;r=e4;break}r=i}return e7(r||e4,n)}return e5}function tx(i){let r=typeof i;return null===i?"":"string"===r||"number"===r||"boolean"===r?String(i):i instanceof tc||i instanceof tf||i instanceof tm?i.toString():JSON.stringify(i)}class tv{constructor(i,r){this.type=i,this.value=r}static parse(i,r){if(2!==i.length)return r.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!tg(i[1]))return r.error("invalid value");let n=i[1],a=ty(n),o=r.expectedType;return"array"===a.kind&&0===a.N&&o&&"array"===o.kind&&("number"!=typeof o.N||0===o.N)&&(a=o),new tv(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof tc?["rgba"].concat(this.value.toArray()):this.value instanceof tf?this.value.serialize():this.value}}var tb=class{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}};let tw={string:e1,number:e0,boolean:e2,object:e5}
1;class tT{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n,a=1,o=i[0];if("array"===o){let o,s;if(i.length>2){let n=i[1];if("string"!=typeof n||!(n in tw)||"object"===n)return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=tw[n],a++}else o=e4;if(i.length>3){if(null!==i[2]&&("number"!=typeof i[2]||i[2]<0||i[2]!==Math.floor(i[2])))return r.error('The length argument to "array" must be a positive integer literal',2);s=i[2],a++}n=e7(o,s)}else n=tw[o];let s=[];for(;a<i.length;a++){let n=r.parse(i[a],a,e4);if(!n)return null;s.push(n)}return new tT(n,s)}evaluate(i){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(i);if(!ti(this.type,ty(n)))return n;if(r===this.args.length-1)throw new tb(`Expected value to be of type ${te(this.type)}, but found ${te(ty(n))} instead.`)}return null}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=this.type,r=[i.kind];if("array"===i.kind){let n=i.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){r.push(n.kind);let a=i.N;("number"==typeof a||this.args.length>1)&&r.push(a)}}return r.concat(this.args.map(i=>i.serialize()))}}class tE{constructor(i){this.type=e8,this.sections=i}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n=i[1];if(!Array.isArray(n)&&"object"==typeof n)return r.error("First argument must be an image or text section.");let a=[],o=!1;for(let n=1;n<=i.length-1;++n){let s=i[n];if(o&&"object"==typeof s&&!Array.isArray(s)){o=!1;let i=null;if(s["font-scale"]&&!(i=r.parse(s["font-scale"],1,e0)))return null;let n=null;if(s["text-font"]&&!(n=r.parse(s["text-font"],1,e7(e1))))return null;let l=null;if(s["text-color"]&&!(l=r.parse(s["text-color"],1,e3)))return null;let h=a[a.length-1];h.scale=i,h.font=n,h.textColor=l}else{let s=r.parse(i[n],1,e4);if(!s)return null;let l=s.type.kind;if("string"!==l&&"value"!==l&&"null"!==l&&"resolvedImage"!==l)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,a.push({content:s,scale:null,font:null,textColor:null})}}return new tE(a)}evaluate(i){return new tf(this.sections.map(r=>{let n=r.content.evaluate(i);return ty(n)===e9?new tp("",n,null,null,null):new tp(tx(n),null,r.scale?r.scale.evaluate(i):null,r.font?r.font.evaluate(i).join(","):null,r.textColor?r.textColor.evaluate(i):null)}))}eachChild(i){for(let r of this.sections)i(r.content),r.scale&&i(r.scale),r.font&&i(r.font),r.textColor&&i(r.textColor)}outputDefined(){return!1}serialize(){let i=["format"];for(let r of this.sections){i.push(r.content.serialize());let 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()),i.push(n)}return i}}class tS{constructor(i){this.type=e9,this.input=i}static parse(i,r){if(2!==i.length)return r.error("Expected two arguments.");let n=r.parse(i[1],1,e1);return n?new tS(n):r.error("No image name provided.")}evaluate(i){let r=this.input.evaluate(i),n=tm.fromString(r);return n&&i.availableImages&&(n.available=i.availableImages.indexOf(r)>-1),n}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}let tM={"to-boolean":e2,"to-color":e3,"to-number":e0,"to-string":e1};class tA{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n=i[0];if(("to-boolean"===n||"to-string"===n)&&2!==i.length)return r.error("Expected one argument.");let a=tM[n],o=[];for(let n=1;n<i.length;n++){let a=r.parse(i[n],n,e4);if(!a)return null;o.push(a)}return new tA(a,o)}evaluate(i){if("boolean"===this.type.kind)return!!this.args[0].evaluate(i);if("color"===this.type.kind){let r,n;for(let a of this.args){if(r=a.evaluate(i),n=null,r instanceof tc)return r;if("string"==typeof r){let n=i.parseColor(r);if(n)return n}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.`:t_(r[0],r[1],r[2],r[3])))return new tc(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new tb(n||`Could not parse color from value '${"string"==typeof r?r:String(JSON.stringify(r))}'`)}if("number"===this.type.kind){let r=null;for(let n of this.args){if(null===(r=n.evaluate(i)))return 0;let a=Number(r);
1if(!isNaN(a))return a}throw new tb(`Could not convert ${JSON.stringify(r)} to number.`)}return"formatted"===this.type.kind?tf.fromString(tx(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?tm.fromString(tx(this.args[0].evaluate(i))):tx(this.args[0].evaluate(i))}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){if("formatted"===this.type.kind)return new tE([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new tS(this.args[0]).serialize();let i=[`to-${this.type.kind}`];return this.eachChild(r=>{i.push(r.serialize())}),i}}let tI=["Unknown","Point","LineString","Polygon"];var tC=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&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?tI[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){let i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:n,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*r-i[0])+this.featureDistanceData.bearing[1]*(a*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=tc.parse(i)),r}};class tz{constructor(i,r,n,a){this.name=i,this.type=r,this._evaluate=n,this.args=a}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(i=>i.serialize()))}static parse(i,r){let n=i[0],a=tz.definitions[n];if(!a)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,l=s.filter(([r])=>!Array.isArray(r)||r.length===i.length-1),h=null;for(let[a,s]of l){h=new tX(r.registry,r.path,null,r.scope);let l=[],u=!1;for(let r=1;r<i.length;r++){let n=i[r],o=Array.isArray(a)?a[r-1]:a.type,s=h.parse(n,1+l.length,o);if(!s){u=!0;break}l.push(s)}if(!u){if(Array.isArray(a)&&a.length!==l.length)h.error(`Expected ${a.length} arguments, but found ${l.length} instead.`);else{for(let i=0;i<l.length;i++){let r=Array.isArray(a)?a[i]:a.type,n=l[i];h.concat(i+1).checkSubtype(r,n.type)}if(0===h.errors.length)return new tz(n,o,s,l)}}}if(1===l.length)r.errors.push(...h.errors);else{let n=(l.length?l:s).map(([i])=>Array.isArray(i)?`(${i.map(te).join(", ")})`:`(${te(i.type)}...)`).join(" | "),a=[];for(let n=1;n<i.length;n++){let o=r.parse(i[n],1+a.length);if(!o)return null;a.push(te(o.type))}r.error(`Expected arguments of type ${n}, but found (${a.join(", ")}) instead.`)}return null}static register(i,r){for(let n in tz.definitions=r,r)i[n]=tz}}class tk{constructor(i,r,n){this.type=e6,this.locale=n,this.caseSensitive=i,this.diacriticSensitive=r}static parse(i,r){if(2!==i.length)return r.error("Expected one argument.");let n=i[1];if("object"!=typeof n||Array.isArray(n))return r.error("Collator options argument must be an object.");let a=r.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,e2);if(!a)return null;let o=r.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,e2);if(!o)return null;let s=null;return!n.locale||(s=r.parse(n.locale,1,e1))?new tk(a,o,s):null}evaluate(i){return new td(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}serialize(){let i={};return i["case-sensitive"]=this.caseSensitive.serialize(),i["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(i.locale=this.locale.serialize()),["collator",i]}}function tD(i,r){i[0]=Math.min(i[0],r[0]),i[1]=Math.min(i[1],r[1]),i[2]=Math.max(i[2],r[0]),i[3]=Math.max(i[3],r[1])}function tP(i,r){return!(i[0]<=r[0]||i[2]>=r[2]||i[1]<=r[1]||i[3]>=r[3])}function tL(i,r){var n,a;let o=!1;for(let s=0,l=r.length;s<l;s++){let l=r[s];for(let r=0,s=l.length;r<s-1;r++){if(function(i,r,n){let a=i[0]-r[0],o=i[1]-r[1],s=i[0]-n[0],l=i[1]-n[1];return a*l-s*o==0&&a*s<=0&&o*l<=0}(i,l[r],l[r+1]))return!1;(n=l[r])[1]>i[1]!=(a=l[r+1])[1]>i[1]&&i[0]<(a[0]-n[0])*(i[1]-n[1])/(a[1]-n[1])+n[0]&&(o=!o)}}return o}function tR(i,r,n,a){let o=a[0]-n[0],s=a[1]-n[1],l=(i[0]-n[0])*s-o*(i[1]-n[1]),h=(r[0]-n[0])*s-o*(r[1]-n[1]);return l>0&&h<0||l<0&&h>0}function tB(i,r){for(let n=0;n<i.length;++n)if(!tL(i[n],r))return!1;for(let n=0;n<i.length-1;++n)if(function(i,r,n){var a,o,s,l;for(let h of n)for(let n=0;n<h.length-1;++n)if(0!=(s=[(o=h[n+1])[0]-(a=h[n])[0],o[1]-a[1]])[0]*(l=[r[0]-i[0],r[1]-i[1]])[1]-s[1]*l[0]&&tR(i,r,a,o)&&tR(a,o,i,r))return!0;return!1}(i[n],i[n+1],r))return!1;return!0}function tO(i,r,n){let a=[];for(let o=0;o<i.length;o++){let s=[];for(let a=0;a<i[o].length;a++){let l=function(i,r){let n=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,r.z);return[Math.round(n*o*8192),Math.round(a*o*8192)]}(i[o][a],n);tD(r,l),s.push(l)}a.push(s)}return a}function tF(i,r,n){let a=[];for(let o=0;o<i.length;o++){let s=tO(i[o],r,n);a.push(s)}return a}function tU(i,r,n,a){if(i[0]<n[0]||i[0]>n[2]){let r=.5*a,o=i[0]-n[0]>r?-a:n[0]-i[0]>r?a:0;0===o&&(o=i[0]-n[2]>r?-a:n[2]-i[0]>r?a:0),i[0]+=o}tD(r,i)}function tV(i,r,n,a){let o=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],l=[];
1if(!i)return l;for(let a of i)for(let i of a){let a=[i.x+s[0],i.y+s[1]];tU(a,r,n,o),l.push(a)}return l}function tN(i,r,n,a){let o=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],l=[];if(!i)return l;for(let n of i){let i=[];for(let a of n){let n=[a.x+s[0],a.y+s[1]];tD(r,n),i.push(n)}l.push(i)}if(r[2]-r[0]<=o/2)for(let i of(r[0]=r[1]=1/0,r[2]=r[3]=-1/0,l))for(let a of i)tU(a,r,n,o);return l}class tj{constructor(i,r){this.type=e2,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(tg(i[1])){let r=i[1];if("FeatureCollection"===r.type)for(let i=0;i<r.features.length;++i){let n=r.features[i].geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new tj(r,r.features[i].geometry)}else if("Feature"===r.type){let i=r.geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new tj(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new tj(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(null!=i.geometry()&&null!=i.canonicalID()){if("Point"===i.geometryType())return function(i,r){let n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=tO(r.coordinates,a,o),l=tV(i.geometry(),n,a,o);if(!tP(n,a))return!1;for(let i of l)if(!tL(i,s))return!1}if("MultiPolygon"===r.type){let s=tF(r.coordinates,a,o),l=tV(i.geometry(),n,a,o);if(!tP(n,a))return!1;for(let i of l)if(!function(i,r){for(let n=0;n<r.length;n++)if(tL(i,r[n]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries);if("LineString"===i.geometryType())return function(i,r){let n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=tO(r.coordinates,a,o),l=tN(i.geometry(),n,a,o);if(!tP(n,a))return!1;for(let i of l)if(!tB(i,s))return!1}if("MultiPolygon"===r.type){let s=tF(r.coordinates,a,o),l=tN(i.geometry(),n,a,o);if(!tP(n,a))return!1;for(let i of l)if(!function(i,r){for(let n=0;n<r.length;n++)if(tB(i,r[n]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function tG(i){if(i instanceof tz&&("get"===i.name&&1===i.args.length||"feature-state"===i.name||"has"===i.name&&1===i.args.length||"properties"===i.name||"geometry-type"===i.name||"id"===i.name||/^filter-/.test(i.name))||i instanceof tj)return!1;let r=!0;return i.eachChild(i=>{r&&!tG(i)&&(r=!1)}),r}function tZ(i){if(i instanceof tz&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!tZ(i)&&(r=!1)}),r}function t$(i,r){if(i instanceof tz&&r.indexOf(i.name)>=0)return!1;let n=!0;return i.eachChild(i=>{n&&!t$(i,r)&&(n=!1)}),n}class tq{constructor(i,r){this.type=r.type,this.name=i,this.boundExpression=r}static parse(i,r){if(2!==i.length||"string"!=typeof i[1])return r.error("'var' expression requires exactly one string literal argument.");let n=i[1];return r.scope.has(n)?new tq(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(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class tW{constructor(i,r=[],n,a=new eJ,o=[]){this.registry=i,this.path=r,this.key=r.map(i=>`[${i}]`).join(""),this.scope=a,this.errors=o,this.expectedType=n}parse(i,r,n,a,o={}){return r?this.concat(r,n,a)._parse(i,o):this._parse(i,o)}_parse(i,r){function n(i,r,n){return"assert"===n?new tT(r,[i]):"coerce"===n?new tA(r,[i]):i}if(null!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i||(i=["literal",i]),Array.isArray(i)){if(0===i.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a=i[0];if("string"!=typeof a)return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[a];if(o){let a=o.parse(i,this);if(!a)return null;if(this.expectedType){let i=this.expectedType,o=a.type;if("string"!==i.kind&&"number"!==i.kind&&"boolean"!==i.kind&&"object"!==i.kind&&"array"!==i.kind||"value"!==o.kind){if("color"!==i.kind&&"formatted"!==i.kind&&"resolvedImage"!==i.kind||"value"!==o.kind&&"string"!==o.kind){if(this.checkSubtype(i,o))return null}else a=n(a,i,r.typeAnnotation||"coerce")}else a=n(a,i,r.typeAnnotation||"assert")}if(!(a instanceof tv)&&"resolvedImage"!==a.type.kind&&function i(r){if(r instanceof tq)return i(r.boundExpression);if(r instanceof tz&&"error"===r.name||r instanceof tk||r instanceof tj)return!1;let n=r instanceof tA||r instanceof tT,a=!0;return r.eachChild(r=>{a=n?a&&i(r):a&&r instanceof tv}),!!a&&tG(r)&&t$(r,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}(a)){let i=new tC;try{a=new tv(a.type,a.evaluate(i))}catch(i){return this.error(i.message),null}}return a}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===i?"'undefined' value invalid. Use null instead.":"object"==typeof i?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,r,n){let a="number"==typeof i?this.path.concat(i):this.path,o=n?this.scope.concat(n):this.scope;return new tW(this.registry,a,r||null,o,this.errors)}error(i,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new eK(n,i))}checkSubtype(i,r){let n=ti(i,r);return n&&this.error(n),n}}var tX=tW;function tH(i,r){let n=i.length-1,a,o,s=0,l=n,h=0;for(;s<=l;)if(a=i[h=Math.floor((s+l)/2)],o=i[h+1],a<=r){if(h===n||r<o)return h;s=h+1}else{if(!(a>r))throw new tb("Input is not a number.");l=h-1}return 0}
1class tY{constructor(i,r,n){for(let[a,o]of(this.type=i,this.input=r,this.labels=[],this.outputs=[],n))this.labels.push(a),this.outputs.push(o)}static parse(i,r){if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");let n=r.parse(i[1],1,e0);if(!n)return null;let a=[],o=null;r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);for(let n=1;n<i.length;n+=2){let s=1===n?-1/0:i[n],l=i[n+1],h=n,u=n+1;if("number"!=typeof s)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(a.length&&a[a.length-1][0]>=s)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);let c=r.parse(l,u,o);if(!c)return null;o=o||c.type,a.push([s,c])}return new tY(o,n,a)}evaluate(i){let r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);let a=this.input.evaluate(i);if(a<=r[0])return n[0].evaluate(i);let o=r.length;return a>=r[o-1]?n[o-1].evaluate(i):n[tH(r,a)].evaluate(i)}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&i.push(this.labels[r]),i.push(this.outputs[r].serialize());return i}}function tK(i,r,n){return i*(1-n)+r*n}var tJ=Object.freeze({__proto__:null,number:tK,color:function(i,r,n){return new tc(tK(i.r,r.r,n),tK(i.g,r.g,n),tK(i.b,r.b,n),t
1K(i.a,r.a,n))},array:function(i,r,n){return i.map((i,a)=>tK(i,r[a],n))}});let tQ=4/29,t0=6/29,t1=6/29*3*(6/29),t2=Math.PI/180,t3=180/Math.PI;function t5(i){return i>.008856451679035631?Math.pow(i,1/3):i/t1+tQ}function t4(i){return i>t0?i*i*i:t1*(i-tQ)}function t6(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function t8(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function t9(i){let r=t8(i.r),n=t8(i.g),a=t8(i.b),o=t5((.4124564*r+.3575761*n+.1804375*a)/.95047),s=t5((.2126729*r+.7151522*n+.072175*a)/1);return{l:116*s-16,a:500*(o-s),b:200*(s-t5((.0193339*r+.119192*n+.9503041*a)/1.08883)),alpha:i.a}}function t7(i){let r=(i.l+16)/116,n=isNaN(i.a)?r:r+i.a/500,a=isNaN(i.b)?r:r-i.b/200;return r=1*t4(r),new tc(t6(3.2404542*(n=.95047*t4(n))-1.5371385*r-.4985314*(a=1.08883*t4(a))),t6(-.969266*n+1.8760108*r+.041556*a),t6(.0556434*n-.2040259*r+1.0572252*a),i.alpha)}let ie={forward:t9,reverse:t7,interpolate:function(i,r,n){return{l:tK(i.l,r.l,n),a:tK(i.a,r.a,n),b:tK(i.b,r.b,n),alpha:tK(i.alpha,r.alpha,n)}}},it={forward:function(i){let{l:r,a:n,b:a}=t9(i),o=Math.atan2(a,n)*t3;return{h:o<0?o+360:o,c:Math.sqrt(n*n+a*a),l:r,alpha:i.a}},reverse:function(i){let r=i.h*t2,n=i.c;return t7({l:i.l,a:Math.cos(r)*n,b:Math.sin(r)*n,alpha:i.alpha})},interpolate:function(i,r,n){return{h:function(i,r,n){let a=r-i;return i+n*(a>180||a<-180?a-360*Math.round(a/360):a)}(i.h,r.h,n),c:tK(i.c,r.c,n),l:tK(i.l,r.l,n),alpha:tK(i.alpha,r.alpha,n)}}};var ii=Object.freeze({__proto__:null,lab:ie,hcl:it});class ir{constructor(i,r,n,a,o){for(let[s,l]of(this.type=i,this.operator=r,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[],o))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(i,r,n,a){let o=0;if("exponential"===i.name)o=ia(r,i.base,n,a);else if("linear"===i.name)o=ia(r,1,n,a);else if("cubic-bezier"===i.name){let s=i.controlPoints;o=new b(s[0],s[1],s[2],s[3]).solve(ia(r,1,n,a))}return o}static parse(i,r){let[n,a,o,...s]=i;if(!Array.isArray(a)||0===a.length)return r.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let i=a[1];if("number"!=typeof i)return r.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:i}}else{if("cubic-bezier"!==a[0])return r.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let i=a.slice(1);if(4!==i.length||i.some(i=>"number"!=typeof i||i<0||i>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:i}}}if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(!(o=r.parse(o,2,e0)))return null;let l=[],h=null;"interpolate-hcl"===n||"interpolate-lab"===n?h=e3:r.expectedType&&"value"!==r.expectedType.kind&&(h=r.expectedType);for(let i=0;i<s.length;i+=2){let n=s[i],a=s[i+1],o=i+3,u=i+4;if("number"!=typeof n)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(l.length&&l[l.length-1][0]>=n)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);let c=r.parse(a,u,h);if(!c)return null;h=h||c.type,l.push([n,c])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new ir(h,n,a,o,l):r.error(`Type ${te(h)} is not interpolatable.`)}evaluate(i){let r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);let a=this.input.evaluate(i);if(a<=r[0])return n[0].evaluate(i);let o=r.length;if(a>=r[o-1])return n[o-1].evaluate(i);let s=tH(r,a),l=ir.interpolationFactor(this.interpolation,a,r[s],r[s+1]),h=n[s].evaluate(i),u=n[s+1].evaluate(i);return"interpolate"===this.operator?tJ[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?it.reverse(it.interpolate(it.forward(h),it.forward(u),l)):ie.reverse(ie.interpolate(ie.forward(h
1),ie.forward(u),l))}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i;i="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);let r=[this.operator,i,this.input.serialize()];for(let i=0;i<this.labels.length;i++)r.push(this.labels[i],this.outputs[i].serialize());return r}}function ia(i,r,n,a){let o=a-n,s=i-n;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}class io{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expectected at least one argument.");let n=null,a=r.expectedType;a&&"value"!==a.kind&&(n=a);let o=[];for(let a of i.slice(1)){let i=r.parse(a,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!i)return null;n=n||i.type,o.push(i)}return new io(a&&o.some(i=>ti(a,i.type))?e4:n,o)}evaluate(i){let r,n=null,a=0;for(let o of this.args){if(a++,(n=o.evaluate(i))&&n instanceof tm&&!n.available&&(r||(r=n),n=null,a===this.args.length))return r;if(null!==n)break}return n}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=["coalesce"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class is{constructor(i,r){this.type=r.type,this.bindings=[].concat(i),this.result=r}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(let r of this.bindings)i(r[1]);i(this.result)}static parse(i,r){if(i.length<4)return r.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);let n=[];for(let a=1;a<i.length-1;a+=2){let o=i[a];if("string"!=typeof o)return r.error(`Expected string, but found ${typeof o} instead.`,a);if(/[^a-zA-Z0-9_]/.test(o))return r.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=r.parse(i[a+1],a+1);if(!s)return null;n.push([o,s])}let a=r.parse(i[i.length-1],i.length-1,r.expectedType,n);return a?new is(n,a):null}outputDefined(){return this.result.outputDefined()}serialize(){let i=["let"];for(let[r,n]of this.bindings)i.push(r,n.serialize());return i.push(this.result.serialize()),i}}class il{constructor(i,r,n){this.type=i,this.index=r,this.input=n}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,e0),a=r.parse(i[2],2,e7(r.expectedType||e4));return n&&a?new il(a.type.itemType,n,a):null}evaluate(i){let r=this.index.evaluate(i),n=this.input.evaluate(i);if(r<0)throw new tb(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new tb(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new tb(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class ih{constructor(i,r){this.type=e2,this.needle=i,this.haystack=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,e4),a=r.parse(i[2],2,e4);return n&&a?tr(n.type,[e2,e1,e0,eQ,e4])?new ih(n,a):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(n.type)} instead`):null}evaluate(i){let r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(null==n)return!1;if(!tn(r,["boolean","string","number","null"]))throw new tb(`Expected first argument to be of type boolean, string, number or null, but found ${te(ty(r))} instead.`);if(!tn(n,["string","array"]))throw new tb(`Expected second argument to be of type array or string, but found ${te(ty(n))} instead.`);return n.indexOf(r)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class iu{constructor(i,r,n){this.type=e0,this.needle=i,this.haystack=r,this.fromIndex=n}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,e4),a=r.parse(i[2],2,e4);if(!n||!a)return null;if(!tr(n.type,[e2,e1,e0,eQ,e4]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(n.type)} instead`);if(4===i.length){let o=r.parse(i[3],3,e0);return o?new iu(n,a,o):null}return new iu(n,a)}evaluate(i){let r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(!tn(r,["boolean","string","number","null"]))throw new tb(`Expected first argument to be of type boolean, string, number or null, but found ${te(ty(r))} instead.`);if(!tn(n,["string","array"]))throw new tb(`Expected second argument to be of type array or string, but found ${te(ty(n))} instead.`);if(this.fromIndex){let a=this.fromIndex.evaluate(i);return n.indexOf(r,a)}return n.indexOf(r)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let i=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),i]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ic{constructor(i,r,n,a,o,s){this.inputType=i,this.type=r,this.input=n,this.cases=a,this.outputs=o,this.otherwise=s}static parse(i,r){let n,a;if(i.length<5)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return r.error("Expected an even number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(a=r.expectedType);let o={},s=[];for(let l=2;l<i.length-1;l+=2){let h=i[l],u=i[l+1];Array.isArray(h)||(h=[h]);let c=r.concat(l);
1if(0===h.length)return c.error("Expected at least one branch label.");for(let i of h){if("number"!=typeof i&&"string"!=typeof i)return c.error("Branch labels must be numbers or strings.");if("number"==typeof i&&Math.abs(i)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof i&&Math.floor(i)!==i)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,ty(i)))return null}else n=ty(i);if(void 0!==o[String(i)])return c.error("Branch labels must be unique.");o[String(i)]=s.length}let d=r.parse(u,l,a);if(!d)return null;a=a||d.type,s.push(d)}let l=r.parse(i[1],1,e4);if(!l)return null;let h=r.parse(i[i.length-1],i.length-1,a);return h?"value"!==l.type.kind&&r.concat(1).checkSubtype(n,l.type)?null:new ic(n,a,l,o,s,h):null}evaluate(i){let r=this.input.evaluate(i);return(ty(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),n=[],a={};for(let i of r){let r=a[this.cases[i]];void 0===r?(a[this.cases[i]]=n.length,n.push([this.cases[i],[i]])):n[r][1].push(i)}let o=i=>"number"===this.inputType.kind?Number(i):i;for(let[r,a]of n)i.push(1===a.length?o(a[0]):a.map(o)),i.push(this.outputs[r].serialize());return i.push(this.otherwise.serialize()),i}}class id{constructor(i,r,n){this.type=i,this.branches=r,this.otherwise=n}static parse(i,r){let n;if(i.length<4)return r.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return r.error("Expected an odd number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);let a=[];for(let o=1;o<i.length-1;o+=2){let s=r.parse(i[o],o,e2);if(!s)return null;let l=r.parse(i[o+1],o+1,n);if(!l)return null;a.push([s,l]),n=n||l.type}let o=r.parse(i[i.length-1],i.length-1,n);return o?new id(n,a,o):null}evaluate(i){for(let[r,n]of this.branches)if(r.evaluate(i))return n.evaluate(i);return this.otherwise.evaluate(i)}eachChild(i){for(let[r,n]of this.branches)i(r),i(n);i(this.otherwise)}outputDefined(){return this.branches.every(([i,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["case"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class ip{constructor(i,r,n,a){this.type=i,this.input=r,this.beginIndex=n,this.endIndex=a}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,e4),a=r.parse(i[2],2,e0);if(!n||!a)return null;if(!tr(n.type,[e7(e4),e1,e4]))return r.error(`Expected first argument to be of type array or string, but found ${te(n.type)} instead`);if(4===i.length){let o=r.parse(i[3],3,e0);return o?new ip(n.type,n,a,o):null}return new ip(n.type,n,a)}evaluate(i){let r=this.input.evaluate(i),n=this.beginIndex.evaluate(i);if(!tn(r,["string","array"]))throw new tb(`Expected first argument to be of type array or string, but found ${te(ty(r))} instead.`);if(this.endIndex){let a=this.endIndex.evaluate(i);return r.slice(n,a)}return r.slice(n)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let i=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),i]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function im(i,r){return"=="===i||"!="===i?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function i_(i,r,n,a){return 0===a.compare(r,n)}function ig(i,r,n){let a="=="!==i&&"!="!==i;return class o{constructor(i,r,n){this.type=e2,this.lhs=i,this.rhs=r,this.collator=n,this.hasUntypedArgument="value"===i.type.kind||"value"===r.type.kind}static parse(i,r){if(3!==i.length&&4!==i.length)return r.error("Expected two or three arguments.");let n=i[0],s=r.parse(i[1],1,e4);if(!s)return null;if(!im(n,s.type))return r.concat(1).error(`"${n}" comparisons are not supported for type '${te(s.type)}'.`);let l=r.parse(i[2],2,e4);if(!l)return null;if(!im(n,l.type))return r.concat(2).error(`"${n}" comparisons are not supported for type '${te(l.type)}'.`);if(s.type.kind!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${te(s.type)}' and '${te(l.type)}'.`);a&&("value"===s.type.kind&&"value"!==l.type.kind?s=new tT(l.type,[s]):"value"!==s.type.kind&&"value"===l.type.kind&&(l=new tT(s.type,[l])));let h=null;if(4===i.length){if("string"!==s.type.kind&&"string"!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(h=r.parse(i[3],3,e6)))return null}return new o(s,l,h)}evaluate(o){let s=this.lhs.evaluate(o),l=this.rhs.evaluate(o);if(a&&this.hasUntypedArgument){let r=ty(s),n=ty(l);if(r.kind!==n.kind||"string"!==r.kind&&"number"!==r.kind)throw new tb(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${r.kind}, ${n.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let i=ty(s),n=ty(l);if("string"!==i.kind||"string"!==n.kind)return r(o,s,l)}return this.collator?n(o,s,l,this.collator.evaluate(o)):r(o,s,l)}eachChild(i){i(this.lhs),i(this.rhs),this.collator&&i(this.collator)}outputDefined(){return!0}serialize(){let r=[i];return this.eachChild(i=>{r.push(i.serialize())}),r}}}let iy=ig("==",function(i,r,n){return r===n},i_),ix=ig("!=",function(i,r,n){return r!==n},function(i,r,n,a){return!i_(0,r,n,a)}),iv=ig("<",function(i,r,n){return r<n},function(i,r,n,a){return 0>a.compare(r,n)}),ib=ig(">",function(i,r,n){return r>n},function(i,r,n,a){return a.compare(r,n)>0}
1),iw=ig("<=",function(i,r,n){return r<=n},function(i,r,n,a){return 0>=a.compare(r,n)}),iT=ig(">=",function(i,r,n){return r>=n},function(i,r,n,a){return a.compare(r,n)>=0});class iE{constructor(i,r,n,a,o,s){this.type=e1,this.number=i,this.locale=r,this.currency=n,this.unit=a,this.minFractionDigits=o,this.maxFractionDigits=s}static parse(i,r){if(3!==i.length)return r.error("Expected two arguments.");let n=r.parse(i[1],1,e0);if(!n)return null;let a=i[2];if("object"!=typeof a||Array.isArray(a))return r.error("NumberFormat options argument must be an object.");let o=null;if(a.locale&&!(o=r.parse(a.locale,1,e1)))return null;let s=null;if(a.currency&&!(s=r.parse(a.currency,1,e1)))return null;let l=null;if(a.unit&&!(l=r.parse(a.unit,1,e1)))return null;let h=null;if(a["min-fraction-digits"]&&!(h=r.parse(a["min-fraction-digits"],1,e0)))return null;let u=null;return!a["max-fraction-digits"]||(u=r.parse(a["max-fraction-digits"],1,e0))?new iE(n,o,s,l,h,u):null}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(i):void 0,unit:this.unit?this.unit.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.unit&&i(this.unit),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let i={};return this.locale&&(i.locale=this.locale.serialize()),this.currency&&(i.currency=this.currency.serialize()),this.unit&&(i.unit=this.unit.serialize()),this.minFractionDigits&&(i["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(i["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),i]}}class iS{constructor(i){this.type=e0,this.input=i}static parse(i,r){if(2!==i.length)return r.error(`Expected 1 argument, but found ${i.length-1} instead.`);let n=r.parse(i[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?r.error(`Expected argument of type string or array, but found ${te(n.type)} instead.`):new iS(n):null}evaluate(i){let r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new tb(`Expected value to be of type string or array, but found ${te(ty(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){let i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}}let iM={"==":iy,"!=":ix,">":ib,"<":iv,">=":iT,"<=":iw,array:tT,at:il,boolean:tT,case:id,coalesce:io,collator:tk,format:tE,image:tS,in:ih,"index-of":iu,interpolate:ir,"interpolate-hcl":ir,"interpolate-lab":ir,length:iS,let:is,literal:tv,match:ic,number:tT,"number-format":iE,object:tT,slice:ip,step:tY,string:tT,"to-boolean":tA,"to-color":tA,"to-number":tA,"to-string":tA,var:tq,within:tj};function iA(i,[r,n,a,o]){r=r.evaluate(i),n=n.evaluate(i),a=a.evaluate(i);let s=o?o.evaluate(i):1,l=t_(r,n,a,s);if(l)throw new tb(l);return new tc(r/255*s,n/255*s,a/255*s,s)}function iI(i,r){let n=r[i];return void 0===n?null:n}function iC(i){return{type:i}}function iz(i){return{result:"success",value:i}}function ik(i){return{result:"error",value:i}}function iD(i){return"data-driven"===i["property-type"]}function iP(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function iL(i){return!!i.expression&&i.expression.interpolated}function iR(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":null===i?"null":typeof i}function iB(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function iO(i){return i}function iF(i,r,n){return void 0!==i?i:void 0!==r?r:void 0!==n?n:void 0}function iU(i,r,n,a,o){return iF(typeof n===o?a[n]:void 0,i.default,r.default)}function iV(i,r,n){if("number"!==iR(n))return iF(i.default,r.default);let a=i.stops.length;if(1===a||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[a-1][0])return i.stops[a-1][1];let o=tH(i.stops.map(i=>i[0]),n);return i.stops[o][1]}function iN(i,r,n){let a=void 0!==i.base?i.base:1;if("number"!==iR(n))return iF(i.default,r.default);let o=i.stops.length;if(1===o||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[o-1][0])return i.stops[o-1][1];let s=tH(i.stops.map(i=>i[0]),n),l=function(i,r,n,a){let o=a-n,s=i-n;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}(n,a,i.stops[s][0],i.stops[s+1][0]),h=i.stops[s][1],u=i.stops[s+1][1],c=tJ[r.type]||iO;if(i.colorSpace&&"rgb"!==i.colorSpace){let r=ii[i.colorSpace];c=(i,n)=>r.reverse(r.interpolate(r.forward(i),r.forward(n),l))}return"function"==typeof h.evaluate?{evaluate(...i){let r=h.evaluate.apply(void 0,i),n=u.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==n)return c(r,n,l)}}:c(h,u,l)}function ij(i,r,n){return"color"===r.type?n=tc.parse(n):"formatted"===r.type?n=tf.fromString(n.toString()):"resolvedImage"===r.type?n=tm.fromString(n.toString()):iR(n)===r.type||"enum"===r.type&&r.values[n]||(n=void 0),iF(n,i.default,r.default)}tz.register(iM,{error:[{kind:"error"},[e1],(i,[r])=>{throw new tb(r.evaluate(i))}],typeof:[e1,[e4],(i,[r])=>te(ty(r.evaluate(i)))],"to-rgba":[e7(e0,4),[e3],(i,[r])=>r.evaluate(i).toArray()],rgb:[e3,[e0,e0,e0],iA],rgba:[e3,[e0,e0,e0,e0],iA],has:{type:e2,overloads:[[[e1],(i,[r])=>r.evaluate(i) in i.properties()],[[e1,e5],(i,[r,n])=>r.evaluate(i) in n.evaluate(i)]]},get:{type:e4,overloads:[[[e1],(i,[r])=>iI(r.evaluate(i),i.properties())],[[e1,e5],(i,[r,n])=>iI(r.evaluate(i),n.evaluate(i))]]},"feature-state":[e4,[e1],(i,[r])=>iI(r.evaluate(i),i.featureState||{})],properties:[e5,[],i=>i.properties()],"geometry-type":[e1,[],i=>i.geometryType()],id:[e4,[],i=>i.id()],zoom:[e0,[],i=>i.globals.zoom],pitch:[e0,[],i=>i.globals.pitch||0],"distance-from-center":[e0,[],i=>i.distanceFromCenter()],"heatmap-density":[e0,[],i=>i.globals.heatmapDensity||0],"line-progress":[e0,[],i=>i.globals.lineProgress||0],"sky-radial-progress":[e0,[],i=>i.globals.skyRadialProgress||0],accumulated:[e4,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[e0,iC(e0),(i,r)=>{let n=0;for(let a of r)n+=a.evaluate(i);return n}],"*":[e0,iC(e0),(i,r)=>{let n=1;for(let a of r)n*=a.evaluate(i);return n}],"-":{type:e0,overloads:[[[e0,e0],(i,[r,n])=>r.evaluate(i)-n.evaluate(i)],[[e0],(i,[r])=>-r.evaluate(i)]]},"/":[e0,[e0,e0],(i,[r,n])=>r.evaluate(i)/n.evaluate(i)],"%":[e0,[e0,e0],(i,[r,n])=>r.evaluate(i)%n.evaluate(i)],ln2:[e0,[],()=>Math.LN2],pi:[e0,[],()=>Math.PI],e:[e0,[],()=>Math.E],"^":[e0,[e0,e0],(i,[r,n])=>Math.pow(r.evaluate(i),n.evaluate(i))],sqrt:[e0,[e0],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[e0,[e0],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[e0,[e0],(i,[r])=>Math.log(r.evaluate(i))],log2:[e0,[e0],(i,[r])=>Math.log(r.evaluate(i))/Math.LN2],sin:[e0,[e0],(i,[r])=>Math.sin(r.evaluate(i))],cos:[e0,[e0],(i,[r])=>Math.cos(r.evaluate(i))],tan:[e0,[e0],(i,[r])=>Math.tan(r.evaluate(i))],asin:[e0,[e0],(i,[r])=>Math.asin(r.evaluate(i))],acos:[e0,[e0],(i,[r])=>Math.acos(r.evaluate(i))],atan:[e0,[e0],(i,[r])=>Math.atan(r.evaluate(i))],min:[e0,iC(e0),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[e0,iC(e0),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[e0,[e0],(i,[r])=>Math.abs(r.evaluate(i))],round:[e0,[e0],(i,[r])=>{let n=r.evaluate(i);return n<0?-Math.round(-n):Math.round(n)}],floor:[e0,[e0],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[e0,[e0],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[e2,[e1,e4],(i,[r,n])=>i.properties()[r.value]===n.value],"filter-id-==":[e2,[e4],(i,[r])=>i.id()===r.value],"filter-type-==":[e2,[e1],(i,[r])=>i.geometryType()===r.value],"filter-<":[e2,[e1,e4],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a<o}],"filter-id-<":[e2,[e4],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n<a}],"filter->":[e2,[e1,e4],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a>o}],"filter-id->":[e2,[e4],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n>a}],"filter-<=":[e2,[e1,e4],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[e2,[e4],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n<=a}],"filter->=":[e2,[e1,e4],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[e2,[e4],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n>=a}],"filter-has":[e2,[e4],(i,[r])=>r.value in i.properties()],"filter-has-id":[e2,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[e2,[e7(e1)],(i,[r])=>r.value.indexOf(i.geometryType())>=0],"filter-id-in":[e2,[e7(e4)],(i,[r])=>r.value.indexOf(i.id())>=0],"filter-in-small":[e2,[e1,e7(e4)],(i,[r,n])=>n.value.indexOf(i.properties()[r.value])>=0],"filter-in-large":[e2,[e1,e7(e4)],(i,[r,n])=>(function(i,r,n,a){for(;n<=a;){let o=n+a>>1;if(r[o]===i)return!0;r[o]>i?a=o-1:n=o+1}return!1})(i.properties()[r.value],n.value,0,n.value.length-1)],all:{type:e2,overloads:[[[e2,e2],(i,[r,n])=>r.evaluate(i)&&n.evaluate(i)],[iC(e2),(i,r)=>{for(let n of r)if(!n.evaluate(i))return!1;return!0}]]},any:{type:e2,overloads:[[[e2,e2],(i,[r,n])=>r.evaluate(i)||n.evaluate(i)],[iC(e2),(i,r)=>{for(let n of r)if(n.evaluate(i))return!0;return!1}]]},"!":[e2,[e2],(i,[r])=>!r.evaluate(i)],"is-supported-script":[e2,[e1],(i,[r])=>{let n=i.globals&&i.globals.isSupportedScript;return!n||n(r.evaluate(i))}],upcase:[e1,[e1],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[e1,[e1],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[e1,iC(e4),(i,r)=>r.map(r=>tx(r.evaluate(i))).join("")],"resolved-locale":[e1,[e6],(i,[r])=>r.evaluate(i).resolvedLocale()]});class iG{constructor(i,r){this.expression=i,this._warningHistory={},this._evaluator=new tC,this._defaultValue=r?"color"===r.type&&(iB(r.default)||Array.isArray(r.default))?new tc(0,0,0,0):"color"===r.type?tc.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=r&&"enum"===r.type?r.values:null}evaluateWithoutErrorHandling(i,r,n,a,o,s,l,h){return this._evaluator.globals=i,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=a||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(i,r,n,a,o,s,l,h){this._evaluator.globals=i,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null;try{let i=this.expression.evaluate(this._evaluator);if(null==i||"number"==typeof i&&i!=i)return this._defaultValue;if(this._enumValues&&!(i in this._enumValues))throw new tb(`Expected value to be one of ${Object.keys(this._enumValues).map(i=>JSON.stringify(i)).join(", ")}, but found ${JSON.stringify(i)} instead.`);return i}catch(i){return this._warningHistory[i.message]||(this._warningHistory[i.message]=!0,"undefined"!=typeof console&&console.warn(i.message)),this._defaultValue}}}function iZ(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&i[0]in iM}function i$(i,r){let n=new tX(iM,[],r?function(i){let r={color:e3,string:e1,number:e0,enum:e1,boolean:e2,formatted:e8,resolvedImage:e9};
1return"array"===i.type?e7(r[i.value]||e4,i.length):r[i.type]}(r):void 0),a=n.parse(i,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return a?iz(new iG(a,r)):ik(n.errors)}class iq{constructor(i,r){this.kind=i,this._styleExpression=r,this.isStateDependent="constant"!==i&&!tZ(r.expression)}evaluateWithoutErrorHandling(i,r,n,a,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,a,o,s)}evaluate(i,r,n,a,o,s){return this._styleExpression.evaluate(i,r,n,a,o,s)}}class iW{constructor(i,r,n,a){this.kind=i,this.zoomStops=n,this._styleExpression=r,this.isStateDependent="camera"!==i&&!tZ(r.expression),this.interpolationType=a}evaluateWithoutErrorHandling(i,r,n,a,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,a,o,s)}evaluate(i,r,n,a,o,s){return this._styleExpression.evaluate(i,r,n,a,o,s)}interpolationFactor(i,r,n){return this.interpolationType?ir.interpolationFactor(this.interpolationType,i,r,n):0}}function iX(i,r){if("error"===(i=i$(i,r)).result)return i;let n=i.value.expression,a=tG(n);if(!a&&!iD(r))return ik([new eK("","data expressions not supported")]);let o=t$(n,["zoom","pitch","distance-from-center"]);if(!o&&!iP(r))return ik([new eK("","zoom expressions not supported")]);let s=function i(r){let n=null;if(r instanceof is)n=i(r.result);else if(r instanceof io){for(let a of r.args)if(n=i(a))break}else(r instanceof tY||r instanceof ir)&&r.input instanceof tz&&"zoom"===r.input.name&&(n=r);return n instanceof eK||r.eachChild(r=>{let a=i(r);a instanceof eK?n=a:!n&&a?n=new eK("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&a&&n!==a&&(n=new eK("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(n);return s||o?s instanceof eK?ik([s]):s instanceof ir&&!iL(r)?ik([new eK("",'"interpolate" expressions cannot be used with this property')]):iz(s?new iW(a?"camera":"composite",i.value,s.labels,s instanceof ir?s.interpolation:void 0):new iq(a?"constant":"source",i.value)):ik([new eK("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class iH{constructor(i,r){this._parameters=i,this._specification=r,eX(this,function i(r,n){let a,o,s;let l="color"===n.type,h=r.stops&&"object"==typeof r.stops[0][0],u=h||!(h||void 0!==r.property),c=r.type||(iL(n)?"exponential":"interval");if(l&&((r=eX({},r)).stops&&(r.stops=r.stops.map(i=>[i[0],tc.parse(i[1])])),r.default=tc.parse(r.default?r.default:n.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!ii[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===c)a=iN;else if("interval"===c)a=iV;else if("categorical"===c){for(let i of(a=iU,o=Object.create(null),r.stops))o[i[0]]=i[1];s=typeof r.stops[0][0]}else{if("identity"!==c)throw Error(`Unknown function type "${c}"`);a=ij}if(h){let a={},o=[];for(let i=0;i<r.stops.length;i++){let n=r.stops[i],s=n[0].zoom;void 0===a[s]&&(a[s]={zoom:s,type:r.type,property:r.property,default:r.default,stops:[]},o.push(s)),a[s].stops.push([n[0].value,n[1]])}let s=[];for(let r of o)s.push([a[r].zoom,i(a[r],n)]);let l={name:"linear"};return{kind:"composite",interpolationType:l,interpolationFactor:ir.interpolationFactor.bind(void 0,l),zoomStops:s.map(i=>i[0]),evaluate:({zoom:i},a)=>iN({stops:s,base:r.base},n,i).evaluate(i,a)}}if(u){let i="exponential"===c?{name:"exponential",base:void 0!==r.base?r.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ir.interpolationFactor.bind(void 0,i),zoomStops:r.stops.map(i=>i[0]),evaluate:({zoom:i})=>a(r,n,i,o,s)}}return{kind:"source",evaluate(i,l){let h=l&&l.properties?l.properties[r.property]:void 0;return void 0===h?iF(r.default,n.default):a(r,n,h,o,s)}}}(this._parameters,this._specification))}static deserialize(i){return new iH(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}class iY{constructor(i,r,n,a){this.message=(i?`${i}: `:"")+n,a&&(this.identifier=a),null!=r&&r.__line__&&(this.line=r.__line__)}}function iK(i){let r=i.key,n=i.value,a=i.valueSpec||{},o=i.objectElementValidators||{},s=i.style,l=i.styleSpec,h=[],u=iR(n);if("object"!==u)return[new iY(r,n,`object expected, ${u}
1 found`)];for(let i in n){let u;let c=i.split(".")[0],d=a[c]||a["*"];o[c]?u=o[c]:a[c]?u=rf:o["*"]?u=o["*"]:a["*"]&&(u=rf),u?h=h.concat(u({key:(r?`${r}.`:r)+i,value:n[i],valueSpec:d,style:s,styleSpec:l,object:n,objectKey:i},n)):h.push(new iY(r,n[i],`unknown property "${i}"`))}for(let i in a)o[i]||a[i].required&&void 0===a[i].default&&void 0===n[i]&&h.push(new iY(r,n,`missing required property "${i}"`));return h}function iJ(i){let r=i.value,n=i.valueSpec,a=i.style,o=i.styleSpec,s=i.key,l=i.arrayElementValidator||rf;if("array"!==iR(r))return[new iY(s,r,`array expected, ${iR(r)} found`)];if(n.length&&r.length!==n.length)return[new iY(s,r,`array length ${n.length} expected, length ${r.length} found`)];if(n["min-length"]&&r.length<n["min-length"])return[new iY(s,r,`array length at least ${n["min-length"]} expected, length ${r.length} found`)];let h={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};o.$version<7&&(h.function=n.function),"object"===iR(n.value)&&(h=n.value);let u=[];for(let i=0;i<r.length;i++)u=u.concat(l({array:r,arrayIndex:i,value:r[i],valueSpec:h,style:a,styleSpec:o,key:`${s}[${i}]`}));return u}function iQ(i){let r=i.key,n=i.value,a=i.valueSpec,o=iR(n);if("number"===o&&n!=n&&(o="NaN"),"number"!==o)return[new iY(r,n,`number expected, ${o} found`)];if("minimum"in a){let o=a.minimum;if("array"===iR(a.minimum)&&(o=a.minimum[i.arrayIndex]),n<o)return[new iY(r,n,`${n} is less than the minimum value ${o}`)]}if("maximum"in a){let o=a.maximum;if("array"===iR(a.maximum)&&(o=a.maximum[i.arrayIndex]),n>o)return[new iY(r,n,`${n} is greater than the maximum value ${o}`)]}return[]}function i0(i){let r=i.valueSpec,n=eH(i.value.type),a,o,s,l={},h="categorical"!==n&&void 0===i.value.property,u="array"===iR(i.value.stops)&&"array"===iR(i.value.stops[0])&&"object"===iR(i.value.stops[0][0]),c=iK({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===n)return[new iY(i.key,i.value,'identity function may not have a "stops" property')];let r=[],a=i.value;return r=r.concat(iJ({key:i.key,value:a,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:d})),"array"===iR(a)&&0===a.length&&r.push(new iY(i.key,a,"array must have at least one stop")),r},default:function(i){return rf({key:i.key,value:i.value,valueSpec:r,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===n&&h&&c.push(new iY(i.key,i.value,'missing required property "property"')),"identity"===n||i.value.stops||c.push(new iY(i.key,i.value,'missing required property "stops"')),"exponential"===n&&i.valueSpec.expression&&!iL(i.valueSpec)&&c.push(new iY(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(h||iD(i.valueSpec)?h&&!iP(i.valueSpec)&&c.push(new iY(i.key,i.value,"zoom functions not supported")):c.push(new iY(i.key,i.value,"property functions not supported"))),("categorical"===n||u)&&void 0===i.value.property&&c.push(new iY(i.key,i.value,'"property" property is required')),c;function d(i){let n=[],a=i.value,h=i.key;if("array"!==iR(a))return[new iY(h,a,`array expected, ${iR(a)} found`)];if(2!==a.length)return[new iY(h,a,`array length 2 expected, length ${a.length} found`)];if(u){if("object"!==iR(a[0]))return[new iY(h,a,`object expected, ${iR(a[0])} found`)];if(void 0===a[0].zoom)return[new iY(h,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new iY(h,a,"object stop key must have value")];let r=eH(a[0].zoom);if("number"!=typeof r)return[new iY(h,a[0].zoom,"stop zoom values must be numbers")];if(s&&s>r)return[new iY(h,a[0].zoom,"stop zoom values must appear in ascending order")];r!==s&&(s=r,o=void 0,l={}),n=n.concat(iK({key:`${h}[0]`,value:a[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:iQ,value:p}}))}else n=n.concat(p({key:`${h}[0]`,value:a[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},a));return iZ(eY(a[1]))?n.concat([new iY(`${h}[1]`,a[1],"expressions are not allowed in function stops.")]):n.concat(rf({key:`${h}[1]`,value:a[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}
1function p(i,s){let h=iR(i.value),u=eH(i.value),c=null!==i.value?i.value:s;if(a){if(h!==a)return[new iY(i.key,c,`${h} stop domain type must match previous stop domain type ${a}`)]}else a=h;if("number"!==h&&"string"!==h&&"boolean"!==h&&"number"!=typeof u&&"string"!=typeof u&&"boolean"!=typeof u)return[new iY(i.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==h&&"categorical"!==n){let a=`number expected, ${h} found`;return iD(r)&&void 0===n&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new iY(i.key,c,a)]}return"categorical"!==n||"number"!==h||"number"==typeof u&&isFinite(u)&&Math.floor(u)===u?"categorical"!==n&&"number"===h&&"number"==typeof u&&"number"==typeof o&&void 0!==o&&u<o?[new iY(i.key,c,"stop domain values must appear in ascending order")]:(o=u,"categorical"===n&&u in l?[new iY(i.key,c,"stop domain values must be unique")]:(l[u]=!0,[])):[new iY(i.key,c,`integer expected, found ${String(u)}`)]}}function i1(i){let r=("property"===i.expressionContext?iX:i$)(eY(i.value),i.valueSpec);if("error"===r.result)return r.value.map(r=>new iY(`${i.key}${r.key}`,i.value,r.message));let n=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!n.outputDefined())return[new iY(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!tZ(n))return[new iY(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,n){let a=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)a.delete(i);if(0===a.size)return[];let o=[];return r instanceof tz&&a.has(r.name)?[new iY(n.key,n.value,`["${r.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(r.eachChild(r=>{o.push(...i(r,n))}),o)}(n,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!t$(n,["zoom","feature-state"]))return[new iY(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!tG(n))return[new iY(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function i2(i){let r=i.key,n=i.value,a=i.valueSpec,o=[];return Array.isArray(a.values)?-1===a.values.indexOf(eH(n))&&o.push(new iY(r,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(a.values).indexOf(eH(n))&&o.push(new iY(r,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),o}function i3(i){if(!0===i||!1===i)return!0;if(!Array.isArray(i)||0===i.length)return!1;switch(i[0]){case"has":return i.length>=2&&"$id"!==i[1]&&"$type"!==i[1];case"in":return i.length>=3&&("string"!=typeof i[1]||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==i.length||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let r of i.slice(1))if(!i3(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function i5(i,r="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};i3(i)||(i=function i(r){if(!r)return!0;let n=r[0];return r.length<=1?"any"!==n:"=="===n?i9(r[1],r[2],"=="):"!="===n?rt(i9(r[1],r[2],"==")):"<"===n||">"===n||"<="===n||">="===n?i9(r[1],r[2],n):"any"===n?["any"].concat(r.slice(1).map(i)):"all"===n?["all"].concat(r.slice(1).map(i)):"none"===n?["all"].concat(r.slice(1).map(i).map(rt)):"in"===n?i7(r[1],r.slice(2)):"!in"===n?rt(i7(r[1],r.slice(2))):"has"===n?re(r[1]):"!has"===n?rt(re(r[1])):"within"!==n||r}(i));let n=i,a=!0;try{a=function(i){if(!i4(i))return i;let r=eY(i);return function i(r){let n=!1,a=[];if("case"===r[0]){for(let i=1;i<r.length-1;i+=2)n=n||i4(r[i]),a.push(r[i+1]);a.push(r[r.length-1])}else if("match"===r[0]){n=n||i4(r[1]);for(let i=2;i<r.length-1;i+=2)a.push(r[i+1]);a.push(r[r.length-1])}else if("step"===r[0]){n=n||i4(r[1]);for(let i=1;i<r.length-1;i+=2)a.push(r[i+1])}n&&(r.length=0,r.push("any",...a));for(let n=1;n<r.length;n++)i(r[n])}(r),r=function i(r){if(!Array.isArray(r))return r;let n=function(i){if(i6.has(i[0])){for(let r=1;r<i.length;r++)if(i4(i[r]))return!0}return i}(r);return!0===n?n:n.map(r=>i(r))}(r)}(n)}catch(i){console.warn(`Failed to extract static filter. Filter will c
1ontinue 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(n,null,2)}
7        `)}let o=eW[`filter_${r}`],s=i$(a,o),l=null;if("error"===s.result)throw Error(s.value.map(i=>`${i.key}: ${i.message}`).join(", "));l=(i,r,n)=>s.value.evaluate(i,r,{},n);let h=null,u=null;if(a!==n){let i=i$(n,o);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));h=(r,n,a,o,s)=>i.value.evaluate(r,n,{},a,void 0,void 0,o,s),u=!tG(i.value.expression)}return{filter:l,dynamicFilter:h||void 0,needGeometry:function i(r){if(!Array.isArray(r))return!1;if("within"===r[0])return!0;for(let n=1;n<r.length;n++)if(i(r[n]))return!0;return!1}(a),needFeature:!!u}}function i4(i){var r;if(!Array.isArray(i))return!1;if("pitch"===(r=i[0])||"distance-from-center"===r)return!0;for(let r=1;r<i.length;r++)if(i4(i[r]))return!0;return!1}let i6=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function i8(i,r){return i<r?-1:i>r?1:0}function i9(i,r,n){switch(i){case"$type":return[`filter-type-${n}`,r];case"$id":return[`filter-id-${n}`,r];default:return[`filter-${n}`,i,r]}}function i7(i,r){if(0===r.length)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",i,["literal",r.sort(i8)]]:["filter-in-small",i,["literal",r]]}}function re(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function rt(i){return["!",i]}function ri(i){return i3(eY(i.value))?i1(eX({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):function i(r){let n=r.value,a=r.key;if("array"!==iR(n))return[new iY(a,n,`array expected, ${iR(n)} found`)];let o=r.styleSpec,s,l=[];if(n.length<1)return[new iY(a,n,"filter array must have at least 1 element")];switch(l=l.concat(i2({key:`${a}[0]`,value:n[0],valueSpec:o.filter_operator,style:r.style,styleSpec:r.styleSpec})),eH(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===eH(n[1])&&l.push(new iY(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&l.push(new iY(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&"string"!==(s=iR(n[1]))&&l.push(new iY(`${a}[1]`,n[1],`string expected, ${s} found`));for(let i=2;i<n.length;i++)s=iR(n[i]),"$type"===eH(n[1])?l=l.concat(i2({key:`${a}[${i}]`,value:n[i],valueSpec:o.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&l.push(new iY(`${a}[${i}]`,n[i],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let o=1;o<n.length;o++)l=l.concat(i({key:`${a}[${o}]`,value:n[o],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":s=iR(n[1]),2!==n.length?l.push(new iY(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"string"!==s&&l.push(new iY(`${a}[1]`,n[1],`string expected, ${s} found`));break;case"within":s=iR(n[1]),2!==n.length?l.push(new iY(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"object"!==s&&l.push(new iY(`${a}[1]`,n[1],`object expected, ${s} found`))}return l}(i)}function rr(i,r){let n;let a=i.key,o=i.style,s=i.styleSpec,l=i.value,h=i.objectKey,u=s[`${r}_${i.layerType}`];if(!u)return[];let c=h.match(/^(.*)-transition$/);if("paint"===r&&c&&u[c[1]]&&u[c[1]].transition)return rf({key:a,value:l,valueSpec:s.transition,style:o,styleSpec:s});let d=i.valueSpec||u[h];if(!d)return[new iY(a,l,`unknown property "${h}"`)];if("string"===iR(l)&&iD(d)&&!d.tokens&&(n=/^{([^}]+)}$/.exec(l)))return[new iY(a,l,`"${h}" does not support interpolation syntax
8Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(n[1])} }\`.`)];let p=[];return"symbol"===i.layerType&&("text-field"===h&&o&&!o.glyphs&&p.push(new iY(a,l,'use of "text-field" requires a style "glyphs" property')),"text-font"===h&&iB(eY(l))&&"identity"===eH(l.type)&&p.push(new iY(a,l,'"text-font" does not support identity functions'))),p.concat(rf({key:i.key,value:l,valueSpec:d,style:o,styleSpec:s,expressionContext:"property",propertyType:r,propertyKey:h}))}function rn(i){return rr(i,"paint")}function ra(i){return rr(i,"layout")}function ro(i){let r=[],n=i.value,a=i.key,o=i.style,s=i.styleSpec;n.type||n.ref||r.push(new iY(a,n,'either "type" or "ref" is required'));let l=eH(n.type),h=eH(n.ref);
8if(n.id){let s=eH(n.id);for(let l=0;l<i.arrayIndex;l++){let i=o.layers[l];eH(i.id)===s&&r.push(new iY(a,n.id,`duplicate layer id "${n.id}", previously used at line ${i.id.__line__}`))}}if("ref"in n){let i;["type","source","source-layer","filter","layout"].forEach(i=>{i in n&&r.push(new iY(a,n[i],`"${i}" is prohibited for ref layers`))}),o.layers.forEach(r=>{eH(r.id)===h&&(i=r)}),i?i.ref?r.push(new iY(a,n.ref,"ref cannot reference another ref layer")):l=eH(i.type):"string"==typeof h&&r.push(new iY(a,n.ref,`ref layer "${h}" not found`))}else if("background"!==l&&"sky"!==l){if(n.source){let i=o.sources&&o.sources[n.source],s=i&&eH(i.type);i?"vector"===s&&"raster"===l?r.push(new iY(a,n.source,`layer "${n.id}" requires a raster source`)):"raster"===s&&"raster"!==l?r.push(new iY(a,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==s||n["source-layer"]?"raster-dem"===s&&"hillshade"!==l?r.push(new iY(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===l&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&("geojson"!==s||!i.lineMetrics)&&r.push(new iY(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new iY(a,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new iY(a,n.source,`source "${n.source}" not found`))}else r.push(new iY(a,n,'missing required property "source"'))}return r=r.concat(iK({key:a,value:n,valueSpec:s.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>rf({key:`${a}.type`,value:n.type,valueSpec:s.layer.type,style:i.style,styleSpec:i.styleSpec,object:n,objectKey:"type"}),filter:i=>ri(eX({layerType:l},i)),layout:i=>iK({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ra(eX({layerType:l},i))}}),paint:i=>iK({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rn(eX({layerType:l},i))}})}}))}function rs(i){let r=i.value,n=i.key,a=iR(r);return"string"!==a?[new iY(n,r,`string expected, ${a} found`)]:[]}let rl={promoteId:function({key:i,value:r}){if("string"===iR(r))return rs({key:i,value:r});{let n=[];for(let a in r)n.push(...rs({key:`${i}.${a}`,value:r[a]}));return n}}};function rh(i){let r;let n=i.value,a=i.key,o=i.styleSpec,s=i.style;if(!n.type)return[new iY(a,n,'"type" is required')];let l=eH(n.type);switch(l){case"vector":case"raster":case"raster-dem":return iK({key:a,value:n,valueSpec:o[`source_${l.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:rl});case"geojson":if(r=iK({key:a,value:n,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:rl}),n.cluster)for(let i in n.clusterProperties){let[o,s]=n.clusterProperties[i],l="string"==typeof o?[o,["accumulated"],["get",i]]:o;r.push(...i1({key:`${a}.${i}.map`,value:s,expressionContext:"cluster-map"})),r.push(...i1({key:`${a}.${i}.reduce`,value:l,expressionContext:"cluster-reduce"}))}return r;case"video":return iK({key:a,value:n,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return iK({key:a,value:n,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new iY(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return i2({key:`${a}.type`,value:n.type,valueSpec:{values:o.source.reduce((i,r)=>{let n=o[r];return"enum"===n.type.type&&(i=i.concat(Object.keys(n.type.values))),i},[])},style:s,styleSpec:o})}}function ru(i){let r=i.value,n=i.styleSpec,a=n.light,o=i.style,s=[],l=iR(r);if(void 0===r)return s;if("object"!==l)return s.concat([new iY("light",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&a[l[1]]&&a[l[1]].transition?rf({key:i,value:r[i],valueSpec:n.transition,style:o,styleSpec:n}):a[i]?rf({key:i,value:r[i],valueSpec:a[i],style:o,styleSpec:n}):[new iY(i,r[i],`unknown property "${i}"`)])}return s}function rc(i){let r=i.value,n=i.key,a=i.style,o=i.styleSpec,s=o.terrain,l=[],h=iR(r);if(void 0===r)return l;if("object"!==h)return l.concat([new iY("terrain",r,`object expected, ${h} found`)]);for(let i in r){let n=i.match(/^(.*)-transition$/);l=l.concat(n&&s[n[1]]&&s[n[1]].transition?rf({key:i,value:r[i],valueSpec:o.transition,style:a,styleSpec:o}):s[i]?rf({key:i,value:r[i],valueSpec:s[i],style:a,styleSpec:o}):[new iY(i,r[i],`unknown property "${i}"`)])}if(r.source){let i=a.sources&&a.sources[r.source],o=i&&eH(i.type);i?"raster-dem"!==o&&l.push(new iY(n,r.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):l.push(new iY(n,r.source,`source "${r.source}" not found`))}else l.push(new iY(n,r,'terrain is missing required property "source"'));return l}
vendor: 4,439 bytes, line 8
8function rd(i){let r=i.value,n=i.style,a=i.styleSpec,o=a.fog,s=[],l=iR(r);if(void 0===r)return s;if("object"!==l)return s.concat([new iY("fog",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&o[l[1]]&&o[l[1]].transition?rf({key:i,value:r[i],valueSpec:a.transition,style:n,styleSpec:a}):o[i]?rf({key:i,value:r[i],valueSpec:o[i],style:n,styleSpec:a}):[new iY(i,r[i],`unknown property "${i}"`)])}return s}let rp={"*":()=>[],array:iJ,boolean:function(i){let r=i.value,n=i.key,a=iR(r);return"boolean"!==a?[new iY(n,r,`boolean expected, ${a} found`)]:[]},number:iQ,color:function(i){let r=i.key,n=i.value,a=iR(n);return"string"!==a?[new iY(r,n,`color expected, ${a} found`)]:null===ta(n)?[new iY(r,n,`color expected, "${n}" found`)]:[]},enum:i2,filter:ri,function:i0,layer:ro,object:iK,source:rh,light:ru,terrain:rc,fog:rd,string:rs,formatted:function(i){return 0===rs(i).length?[]:i1(i)},resolvedImage:function(i){return 0===rs(i).length?[]:i1(i)},projection:function(i){let r=i.value,n=i.styleSpec,a=n.projection,o=i.style,s=[],l=iR(r);if("object"===l)for(let i in r)s=s.concat(rf({key:i,value:r[i],valueSpec:a[i],style:o,styleSpec:n}));else"string"!==l&&(s=s.concat([new iY("projection",r,`object or string expected, ${l} found`)]));return s}};function rf(i){let r=i.value,n=i.valueSpec,a=i.styleSpec;return n.expression&&iB(eH(r))?i0(i):n.expression&&iZ(eY(r))?i1(i):n.type&&rp[n.type]?rp[n.type](i):iK(eX({},i,{valueSpec:n.type?a[n.type]:n}))}function rm(i){let r=i.value,n=i.key,a=rs(i);return a.length||(-1===r.indexOf("{fontstack}")&&a.push(new iY(n,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&a.push(new iY(n,r,'"glyphs" url must include a "{range}" token'))),a}function r_(i,r=eW){return rx(rf({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:rm,"*":()=>[]}}))}let rg=i=>rx(rn(i)),ry=i=>rx(ra(i));function rx(i){return i.slice().sort((i,r)=>i.line&&r.line?i.line-r.line:0)}function rv(i,r){let n=!1;if(r&&r.length)for(let a of r)i.fire(new e$(Error(a.message))),n=!0;return n}function rb(i,r,n){var a=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var o=new Int32Array(this.arrayBuffer);i=o[0],this.d=(r=o[1])+2*(n=o[2]);for(var s=0;s<this.d*this.d;s++){var l=o[3+s],h=o[3+s+1];a.push(l===h?null:o.subarray(l,h))}var u=o[3+a.length+1];this.keys=o.subarray(o[3+a.length],u),this.bboxes=o.subarray(u),this.insert=this._insertReadonly}else{this.d=r+2*n;for(var c=0;c<this.d*this.d;c++)a.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=i,this.padding=n,this.scale=r/i,this.uid=0;var d=n/r*i;this.min=-d,this.max=i+d}rb.prototype.insert=function(i,r,n,a,o){this._forEachCell(r,n,a,o,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(o)},rb.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},rb.prototype._insertCell=function(i,r,n,a,o,s){this.cells[o].push(s)},rb.prototype.query=function(i,r,n,a,o){var s=this.min,l=this.max;if(i<=s&&r<=s&&l<=n&&l<=a&&!o)return Array.prototype.slice.call(this.keys);var h=[];return this._forEachCell(i,r,n,a,this._queryCell,h,{},o),h},rb.prototype._queryCell=function(i,r,n,a,o,s,l,h){var u=this.cells[o];if(null!==u)for(var c=this.keys,d=this.bboxes,p=0;p<u.length;p++){var f=u[p];if(void 0===l[f]){var m=4*f;(h?h(d[m+0],d[m+1],d[m+2],d[m+3]):i<=d[m+2]&&r<=d[m+3]&&n>=d[m+0]&&a>=d[m+1])?(l[f]=!0,s.push(c[f])):l[f]=!1}}},rb.prototype._forEachCell=function(i,r,n,a,o,s,l,h){for(var u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(n),p=this._convertToCellCoord(a),f=u;f<=d;f++)for(var m=c;m<=p;m++){var _=this.d*m+f;if((!h||h(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&o.call(this,i,r,n,a,_,s,l,h))return}},rb.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},rb.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},rb.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=3+this.cells.length+1+1,n=0,a=0;a<this.cells.length;a++)n+=this.cells[a].length;var o=new Int32Array(r+n+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;
8for(var s=r,l=0;l<i.length;l++){var h=i[l];o[3+l]=s,o.set(h,s),s+=h.length}return o[3+i.length]=s,o.set(this.keys,s),o[3+i.length+1]=s+=this.keys.length,o.set(this.bboxes,s),s+=this.bboxes.length,o.buffer};let rw={};function rT(i,r,n={}){Object.defineProperty(i,"_classRegistryKey",{value:r,writeable:!1}),rw[r]={klass:i,omit:n.omit||[]}}for(let i in rT(Object,"Object"),rb.serialize=function(i,r){let n=i.toArrayBuffer();return r&&r.push(n),{buffer:n}},rb.deserialize=function(i){return new rb(i.buffer)},Object.defineProperty(rb,"name",{value:"Grid"}),rT(rb,"Grid"),rT(tc,"Color"),rT(Error,"Error"),rT(ec,"AJAXError"),rT(tm,"ResolvedImage"),rT(iH,"StylePropertyFunction"),rT(iG,"StyleExpression",{omit:["_evaluator"]}),rT(iW,"ZoomDependentExpression"),rT(iq,"ZoomConstantExpression"),rT(tz,"CompoundExpression",{omit:["_evaluate"]}),iM)rw[iM[i]._classRegistryKey]||rT(iM[i],`Expression${i}`);function rE(i){return i&&"undefined"!=typeof ArrayBuffer&&(i instanceof ArrayBuffer||i.constructor&&"ArrayBuffer"===i.constructor.name)}function rS(i){return d.ImageBitmap&&i instanceof d.ImageBitmap}function rM(i,r){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp)return i;if(rE(i)||rS(i))return r&&r.push(i),i;if(ArrayBuffer.isView(i))return r&&r.push(i.buffer),i;if(i instanceof d.ImageData)return r&&r.push(i.data.buffer),i;if(Array.isArray(i)){let n=[];for(let a of i)n.push(rM(a,r));return n}if("object"==typeof i){let n=i.constructor,a=n._classRegistryKey;if(!a)throw Error(`can't serialize object of unregistered class ${a}`);let o=n.serialize?n.serialize(i,r):{};if(!n.serialize){for(let n in i)i.hasOwnProperty(n)&&(rw[a].omit.indexOf(n)>=0||(o[n]=rM(i[n],r)));i instanceof Error&&(o.message=i.message)}if(o.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(o.$name=a),o}throw Error("can't serialize object of type "+typeof i)}function rA(i){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||rE(i)||rS(i)||ArrayBuffer.isView(i)||i instanceof d.ImageData)return i;if(Array.isArray(i))return i.map(rA);
8if("object"==typeof i){let r=i.$name||"Object",{klass:n}=rw[r];if(!n)throw Error(`can't deserialize unregistered class ${r}`);if(n.deserialize)return n.deserialize(i);let a=Object.create(n.prototype);for(let r of Object.keys(i))"$name"!==r&&(a[r]=rA(i[r]));return a}throw Error("can't deserialize object of type "+typeof i)}let rI=i=>i>=1536&&i<=1791,rC=i=>i>=1872&&i<=1919,rz=i=>i>=2208&&i<=2303,rk=i=>i>=11904&&i<=12031,rD=i=>i>=12032&&i<=12255,rP=i=>i>=12272&&i<=12287,rL=i=>i>=12288&&i<=12351,rR=i=>i>=12352&&i<=12447,rB=i=>i>=12448&&i<=12543,rO=i=>i>=12544&&i<=12591,rF=i=>i>=12704&&i<=12735,rU=i=>i>=12736&&i<=12783,rV=i=>i>=12784&&i<=12799,rN=i=>i>=12800&&i<=13055,rj=i=>i>=13056&&i<=13311,rG=i=>i>=13312&&i<=19903,rZ=i=>i>=19968&&i<=40959,r$=i=>i>=40960&&i<=42127,rq=i=>i>=42128&&i<=42191,rW=i=>i>=44032&&i<=55215,rX=i=>i>=63744&&i<=64255,rH=i=>i>=64336&&i<=65023,rY=i=>i>=65040&&i<=65055,rK=i=>i>=65072&&i<=65103,rJ=i=>i>=65104&&i<=65135,rQ=i=>i>=65136&&i<=65279,r0=i=>i>=65280&&i<=65519;function r1(i){for(let r of i)if(r2(r.charCodeAt(0)))return!0;return!1}function r2(i){return!(746!==i&&747!==i&&(i<4352||!(rF(i)||rO(i)||rK(i)&&!(i>=65097&&i<=65103)||rX(i)||rj(i)||rk(i)||rU(i)||!(!rL(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||rG(i)||rZ(i)||rN(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||rW(i)||rR(i)||rP(i)||i>=12688&&i<=12703||rD(i)||rV(i)||rB(i)&&12540!==i||!(!r0(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!rJ(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||rY(i)||i>=19904&&i<=19967||r$(i)||rq(i))))}function r3(i){return!(r2(i)||i>=128&&i<=255&&(167===i||169===i||174===i||177===i||188===i||189===i||190===i||215===i||247===i)||i>=8192&&i<=8303&&(8214===i||8224===i||8225===i||8240===i||8241===i||8251===i||8252===i||8258===i||8263===i||8264===i||8265===i||8273===i)||i>=8448&&i<=8527||i>=8528&&i<=8591||i>=8960&&i<=9215&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||9003===i||i>=9085&&i<=9114||i>=9150&&i<=9165||9167===i||i>=9169&&i<=9179||i>=9186&&i<=9215)||i>=9216&&i<=9279&&9251!==i||i>=9280&&i<=9311||i>=9312&&i<=9471||i>=9632&&i<=9727||i>=9728&&i<=9983&&!(i>=9754&&i<=9759)||i>=11008&&i<=11263&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||rL(i)||rB(i)||i>=57344&&i<=63743||rK(i)||rJ(i)||r0(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function r5(i){return i>=1424&&i<=2303||rH(i)||rQ(i)}let r4="deferred",r6="loading",r8="loaded",r9=null,r7="unavailable",ne=null,nt=function(i){i&&"string"==typeof i&&i.indexOf("NetworkError")>-1&&(r7="error"),r9&&r9(i)};function ni(){nr.fire(new eZ("pluginStateChange",{pluginStatus:r7,pluginURL:ne}))}let nr=new eq,nn=function(){return r7},na=function(){if(r7!==r4||!ne)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");r7=r6,ni(),ne&&ef({url:ne},i=>{i?nt(i):(r7=r8,ni())})},no={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>r7===r8||null!=no.applyArabicShaping,isLoading:()=>r7===r6,setState(i){r7=i.pluginStatus,ne=i.pluginURL},isParsed:()=>null!=no.applyArabicShaping&&null!=no.processBidirectionalText&&null!=no.processStyledBidirectionalText,getPluginURL:()=>ne};class ns{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.transition=r.transition,this.pitch=r.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(i){return function(i,r){for(let a of i){var n;if(n=a.charCodeAt(0),!r&&r5(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||n>=6016&&n<=6143)return!1}return!0}(i,no.isLoaded())}}class nl{constructor(i,r){this.property=i,this.value=r,this.expression=function(i,r){if(iB(i))return new iH(i,r);if(iZ(i)){let n=iX(i,r);if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));return n.value}{let n=i;return"string"==typeof i&&"color"===r.type&&(n=tc.parse(i)),{kind:"constant",evaluate:()=>n}}}(void 0===r?i.specification.default:r,i.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,n){return this.property.possiblyEvaluate(this,i,r,n)}}class nh{constructor(i){this.property=i,this.value=new nl(i,void 0)}transitioned(i,r){return new nc(this.property,this.value,r,R({},i.transition,this.transition),i.now)}
8untransitioned(){return new nc(this.property,this.value,null,{},0)}}class nu{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return $(this._values[i].value.value)}setValue(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nh(this._values[i].property)),this._values[i].value=new nl(this._values[i].property,null===r?void 0:$(r))}getTransition(i){return $(this._values[i].transition)}setTransition(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nh(this._values[i].property)),this._values[i].transition=$(r)||void 0}serialize(){let i={};for(let r of Object.keys(this._values)){let n=this.getValue(r);void 0!==n&&(i[r]=n);let a=this.getTransition(r);void 0!==a&&(i[`${r}-transition`]=a)}return i}transitioned(i,r){let n=new nd(this._properties);for(let a of Object.keys(this._values))n._values[a]=this._values[a].transitioned(i,r._values[a]);return n}untransitioned(){let i=new nd(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}}class nc{constructor(i,r,n,a,o){let s=a.delay||0,l=a.duration||0;o=o||0,this.property=i,this.value=r,this.begin=o+s,this.end=this.begin+l,i.specification.transition&&(a.delay||a.duration)&&(this.prior=n)}possiblyEvaluate(i,r,n){let a=i.now||0,o=this.value.possiblyEvaluate(i,r,n),s=this.prior;if(s){if(a>this.end||this.value.isDataDriven())return this.prior=null,o;if(a<this.begin)return s.possiblyEvaluate(i,r,n);{let l=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(i,r,n),o,A(l))}}return o}}class nd{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,r,n){let a=new nm(this._properties);for(let o of Object.keys(this._values))a._values[o]=this._values[o].possiblyEvaluate(i,r,n);return a}hasTransition(){for(let i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class np{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}getValue(i){return $(this._values[i].value)}setValue(i,r){this._values[i]=new nl(this._values[i].property,null===r?void 0:$(r))}serialize(){let i={};for(let r of Object.keys(this._values)){let n=this.getValue(r);void 0!==n&&(i[r]=n)}return i}possiblyEvaluate(i,r,n){let a=new nm(this._properties);for(let o of Object.keys(this._values))a._values[o]=this._values[o].possiblyEvaluate(i,r,n);return a}}class nf{constructor(i,r,n){this.property=i,this.value=r,this.parameters=n}isConstant(){return"constant"===this.value.kind}constantOr(i){return"constant"===this.value.kind?this.value.value:i}evaluate(i,r,n,a){return this.property.evaluate(this.value,this.parameters,i,r,n,a)}}class nm{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class n_{constructor(i){this.specification=i}possiblyEvaluate(i,r){return i.expression.evaluate(r)}interpolate(i,r,n){let a=tJ[this.specification.type];return a?a(i,r,n):i}}class ng{constructor(i,r){this.specification=i,this.overrides=r}possiblyEvaluate(i,r,n,a){return new nf(this,"constant"===i.expression.kind||"camera"===i.expression.kind?{kind:"constant",value:i.expression.evaluate(r,null,{},n,a)}:i.expression,r)}interpolate(i,r,n){if("constant"!==i.value.kind||"constant"!==r.value.kind)return i;if(void 0===i.value.value||void 0===r.value.value)return new nf(this,{kind:"constant",value:void 0},i.parameters);let a=tJ[this.specification.type];return a?new nf(this,{kind:"constant",value:a(i.value.value,r.value.value,n)},i.parameters):i}evaluate(i,r,n,a,o,s){return"constant"===i.kind?i.value:i.evaluate(r,n,a,o,s)}}class ny{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,a){return!!i.expression.evaluate(r,null,{},n,a)}interpolate(){return!1}}class nx{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let r=new ns(0,{});for(let n in i){let a=i[n];a.specification.overridable&&this.overridableProperties.push(n);let o=this.defaultPropertyValues[n]=new nl(a,void 0),s=this.defaultTransitionablePropertyValues[n]=new nh(a);this.defaultTransitioningPropertyValues[n]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=o.possiblyEvaluate(r)}}}function nv(i,r){return 256*(i=z(Math.floor(i),0,255))+z(Math.floor(r),0,255)}rT(ng,"DataDrivenProperty"),rT(n_,"DataConstantProperty"),rT(ny,"ColorRampProperty");let nb={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
8class nw{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nT{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,r){return i._trim(),r&&(i.isTransferred=!0,r.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){let r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,r.capacity=i.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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw 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 nE(i,r=1){let n=0,a=0;return{members:i.map(i=>{let o=nb[i.type].BYTES_PER_ELEMENT,s=n=nS(n,Math.max(r,o)),l=i.components||1;return a=Math.max(a,o),n+=o*l,{name:i.name,type:i.type,components:l,offset:s}}),size:nS(n,Math.max(a,r)),alignment:r}}function nS(i,r){return Math.ceil(i/r)*r}class nM extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){let n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){let a=2*i;return this.int16[a+0]=r,this.int16[a+1]=n,i}}nM.prototype.bytesPerElement=4,rT(nM,"StructArrayLayout2i4");class nA extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,i,r,n)}emplace(i,r,n,a){let o=3*i;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=a,i}}nA.prototype.bytesPerElement=6,rT(nA,"StructArrayLayout3i6");class nI extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=n,this.int16[s+2]=a,this.int16[s+3]=o,i}}nI.prototype.bytesPerElement=8,rT(nI,"StructArrayLayout4i8");class nC extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,a,o,s,l)}emplace(i,r,n,a,o,s,l,h){let u=6*i,c=12*i;return this.int16[u+0]=r,this.int16[u+1]=n,this.uint8[c+4]=a,this.uint8[c+5]=o,this.uint8[c+6]=s,this.uint8[c+7]=l,this.float32[3*i+2]=h,i}}nC.prototype.bytesPerElement=12,rT(nC,"StructArrayLayout2i4ub1f12");class nz extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=4*i;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=a,this.float32[s+3]=o,i}}nz.prototype.bytesPerElement=16,rT(nz,"StructArrayLayout4f16");class nk extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,a,o)}emplace(i,r,n,a,o,s){let l=6*i;return this.uint16[l+0]=r,this.uint16[l+1]=n,this.uint16[l+2]=a,this.uint16[l+3]=o,this.float32[3*i+2]=s,i}}nk.prototype.bytesPerElement=12,rT(nk,"StructArrayLayout4ui1f12");class nD extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=4*i;return this.uint16[s+0]=r,this.uint16[s+1]=n,this.uint16[s+2]=a,this.uint16[s+3]=o,i}}nD.prototype.bytesPerElement=8,rT(nD,"StructArrayLayout4ui8");class nP extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,n,a,o,s)}emplace(i,r,n,a,o,s,l){let h=6*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=a,this.int16[h+3]=o,this.int16[h+4]=s,this.int16[h+5]=l,i}}nP.prototype.bytesPerElement=12,rT(nP,"StructArrayLayout6i12");class nL extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,i,r,n,a,o,s,l,h,u,c,d,p)}emplace(i,r,n,a,o,s,l,h,u,c,d,p,f){let m=12*i;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=a,this.int16[m+3]=o,this.uint16[m+4]=s,this.uint16[m+5]=l,this.uint16[m+6]=h,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=d,this.int16[m+10]=p,this.int16[m+11]=f,i}}nL.prototype.bytesPerElement=24,rT(nL,"StructArrayLayout4i4ui4i24");class nR extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,n,a,o,s)}emplace(i,r,n,a,o,s,l){let h=10*i,u=5*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=a,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}nR.prototype.bytesPerElement=20,rT(nR,"StructArrayLayout3i3f20");class nB extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[1*i+0]=r,i}}nB.prototype.bytesPerElement=4,rT(nB,"StructArrayLayout1ul4");class nO extends nT{_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(i,r,n,a,o,s,l,h,u,c,d,p,f){let m=this.length;return this.resize(m+1),this.emplace(m,i,r,n,a,o,s,l,h,u,c,d,p,f)}emplace(i,r,n,a,o,s,l,h,u,c,d,p,f,m){let _=20*i,g=10*i;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=a,this.int16[_+3]=o,this.int16[_+4]=s,this.float32[g+3]=l,this.float32[g+4]=h,this.float32[g+5]=u,this.float32[g+6]=c,this.int16[_+14]=d,this.uint32[g+8]=p,this.uint16[_+18]=f,this.uint16[_+19]=m,i}}nO.prototype.bytesPerElement=40,rT(nO,"StructArrayLayout5i4f1i1ul2ui40");class nF extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,a,o,s,l)}emplace(i,r,n,a,o,s,l,h){let u=8*i;return this.int16[u+0]=r,this.int16[u+1]=n,this.int16[u+2]=a,this.int16[u+4]=o,this.int16[u+5]=s,this.int16[u+6]=l,this.int16[u+7]=h,i}}nF.prototype.bytesPerElement=16,rT(nF,"StructArrayLayout3i2i2i16");class nU extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,a,o)}emplace(i,r,n,a,o,s){let l=4*i,h=8*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=a,this.int16[h+6]=o,this.int16[h+7]=s,i}}nU.prototype.bytesPerElement=16,rT(nU,"StructArrayLayout2f1f2i16");class nV extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=12*i,l=3*i;return this.uint8[s+0]=r,this.uint8[s+1]=n,this.float32[l+1]=a,this.float32[l+2]=o,i}}nV.prototype.bytesPerElement=12,rT(nV,"StructArrayLayout2ub2f12");class nN extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,i,r,n)}emplace(i,r,n,a){let o=3*i;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=a,i}}nN.prototype.bytesPerElement=12,rT(nN,"StructArrayLayout3f12");class nj extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,i,r,n)}emplace(i,r,n,a){let o=3*i;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=a,i}}nj.prototype.bytesPerElement=6,rT(nj,"StructArrayLayout3ui6");class nG extends nT{_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(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=this.length;return this.resize(T+1),this.emplace(T,i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)}emplace(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T){let E=30*i,S=15*i,M=60*i;return this.int16[E+0]=r,this.int16[E+1]=n,this.int16[E+2]=a,this.float32[S+2]=o,this.float32[S+3]=s,this.uint16[E+8]=l,this.uint16[E+9]=h,this.uint32[S+5]=u,this.uint32[S+6]=c,this.uint32[S+7]=d,this.uint16[E+16]=p,this.uint16[E+17]=f,this.uint16[E+18]=m,this.float32[S+10]=_,this.float32[S+11]=g,this.uint8[M+48]=y,this.uint8[M+49]=x,this.uint8[M+50]=v,this.uint32[S+13]=b,this.int16[E+28]=w,this.uint8[M+58]=T,i}}nG.prototype.bytesPerElement=60,rT(nG,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class nZ extends nT{_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(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,E,S,M,A,I,C,z,k){let D=this.length;return this.resize(D+1),this.emplace(D,i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,E,S,M,A,I,C,z,k)}emplace(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,E,S,M,A,I,C,z,k,D){let P=38*i,L=19*i;return this.int16[P+0]=r,this.int16[P+1]=n,this.int16[P+2]=a,this.float32[L+2]=o,this.float32[L+3]=s,this.int16[P+8]=l,this.int16[P+9]=h,this.int16[P+10]=u,this.int16[P+11]=c,this.int16[P+12]=d,this.int16[P+13]=p,this.uint16[P+14]=f,this.uint16[P+15]=m,this.uint16[P+16]=_,this.uint16[P+17]=g,this.uint16[P+18]=y,this.uint16[P+19]=x,this.uint16[P+20]=v,this.uint16[P+21]=b,this.uint16[P+22]=w,this.uint16[P+23]=T,this.uint16[P+24]=E,this.uint16[P+25]=S,this.uint16[P+26]=M,this.uint16[P+27]=A,this.uint16[P+28]=I,this.uint32[L+15]=C,this.float32[L+16]=z,this.float32[L+17]=k,this.float32[L+18]=D,i}}nZ.prototype.bytesPerElement=76,rT(nZ,"StructArrayLayout3i2f6i15ui1ul3f76");class n$ extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[1*i+0]=r,i}}n$.prototype.bytesPerElement=4,rT(n$,"StructArrayLayout1f4");class nq extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,a,o)}emplace(i,r,n,a,o,s){let l=5*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=a,this.float32[l+3]=o,this.float32[l+4]=s,i}}nq.prototype.bytesPerElement=20,rT(nq,"StructArrayLayout5f20");class nW extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=6*i;return this.uint32[3*i+0]=r,this.uint16[s+2]=n,this.uint16[s+3]=a,this.uint16[s+4]=o,i}}nW.prototype.bytesPerElement=12,rT(nW,"StructArrayLayout1ul3ui12");class nX extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){let n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){let a=2*i;return this.uint16[a+0]=r,this.uint16[a+1]=n,i}}nX.prototype.bytesPerElement=4,rT(nX,"StructArrayLayout2ui4");class nH extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[1*i+0]=r,i}}nH.prototype.bytesPerElement=2,rT(nH,"StructArrayLayout1ui2");class nY extends nT{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){let n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){let a=2*i;return this.float32[a+0]=r,this.float32[a+1]=n,i}}nY.prototype.bytesPerElement=8,rT(nY,"StructArrayLayout2f8");class nK extends nw{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]}}nK.prototype.size=40;
8class nJ extends nO{get(i){return new nK(this,i)}}rT(nJ,"CollisionBoxArray");class nQ extends nw{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(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}nQ.prototype.size=60;class n0 extends nG{get(i){return new nQ(this,i)}}rT(n0,"PlacedSymbolArray");class n1 extends nw{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(i){this._structArray.uint32[this._pos4+15]=i}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]}}n1.prototype.size=76;class n2 extends nZ{get(i){return new n1(this,i)}}rT(n2,"SymbolInstanceArray");class n3 extends n${getoffsetX(i){return this.float32[1*i+0]}}rT(n3,"GlyphOffsetArray");class n5 extends nM{getx(i){return this.int16[2*i+0]}gety(i){return this.int16[2*i+1]}}rT(n5,"SymbolLineVertexArray");class n4 extends nw{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]}}n4.prototype.size=12;class n6 extends nW{get(i){return new n4(this,i)}}rT(n6,"FeatureIndexArray");class n8 extends nX{geta_centroid_pos0(i){return this.uint16[2*i+0]}geta_centroid_pos1(i){return this.uint16[2*i+1]}}rT(n8,"FillExtrusionCentroidArray");let n9=nE([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),n7=nE([{name:"a_dash",components:4,type:"Uint16"}]);var ae={},at={};({get exports(){return at},set exports(t){at=t}}).exports=function(i,r){var n,a,o,s,l,h;for(a=i.length-(n=3&i.length),o=r,h=0;h<a;
8)l=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24,++h,o=27492+(65535&(s=5*(65535&(o=(o^=l=(65535&(l=(l=(65535&l)*3432918353+(((l>>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:o^=l=(65535&(l=(l=(65535&(l^=255&i.charCodeAt(h)))*3432918353+(((l>>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295}return o^=i.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0};var ai={};({get exports(){return ai},set exports(t){ai=t}}).exports=function(i,r){for(var n,a=i.length,o=r^a,s=0;a>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(s)|(255&i.charCodeAt(++s))<<8|(255&i.charCodeAt(++s))<<16|(255&i.charCodeAt(++s))<<24))+((1540483477*(n>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),a-=4,++s;switch(a){case 3:o^=(255&i.charCodeAt(s+2))<<16;case 2:o^=(255&i.charCodeAt(s+1))<<8;case 1:o=1540483477*(65535&(o^=255&i.charCodeAt(s)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};var ar=at,an=ai;({get exports(){return ae},set exports(t){ae=t}}).exports=ar,ae.murmur3=ar,ae.murmur2=an;class aa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,r,n,a){this.ids.push(ao(i)),this.positions.push(r,n,a)}getPositions(i){let r=ao(i),n=0,a=this.ids.length-1;for(;n<a;){let i=n+a>>1;this.ids[i]>=r?a=i:n=i+1}let o=[];for(;this.ids[n]===r;)o.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return o}static serialize(i,r){let n=new Float64Array(i.ids),a=new Uint32Array(i.positions);return function i(r,n,a,o){for(;a<o;){let s=r[a+o>>1],l=a-1,h=o+1;for(;;){do l++;while(r[l]<s);do h--;while(r[h]>s);if(l>=h)break;as(r,l,h),as(n,3*l,3*h),as(n,3*l+1,3*h+1),as(n,3*l+2,3*h+2)}h-a<o-h?(i(r,n,a,h),a=h+1):(i(r,n,h+1,o),o=h)}}(n,a,0,n.length-1),r&&r.push(n.buffer,a.buffer),{ids:n,positions:a}}static deserialize(i){let r=new aa;return r.ids=i.ids,r.positions=i.positions,r.indexed=!0,r}}function ao(i){let r=+i;return!isNaN(r)&&Number.MIN_SAFE_INTEGER<=r&&r<=Number.MAX_SAFE_INTEGER?r:ae(String(i))}function as(i,r,n){let a=i[r];i[r]=i[n],i[n]=a}rT(aa,"FeaturePositionMap");class al{constructor(i){this.gl=i.gl,this.initialized=!1}fetchUniformLocation(i,r){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(i,r),this.initialized=!0),!!this.location}}class ah extends al{constructor(i){super(i),this.current=0}set(i,r,n){this.fetchUniformLocation(i,r)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class au extends al{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,n){this.fetchUniformLocation(i,r)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class ac extends al{constructor(i){super(i),this.current=tc.transparent}set(i,r,n){this.fetchUniformLocation(i,r)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}let ad=new Float32Array(16),ap=new Float32Array(9),af=new Float32Array(4);function am(i){return[nv(255*i.r,255*i.g),nv(255*i.b,255*i.a)]}class a_{constructor(i,r,n){this.value=i,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(i,r,n,a,o){r.set(i,o,a.constantOr(this.value))}getBinding(i,r){return"color"===this.type?new ac(i):new ah(i)}}class ag{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(i){this.pixelRatio=i.pixelRatio||1,this.pattern=i.tl.concat(i.br)}setUniform(i,r,n,a,o){let s="u_pattern"===o||"u_dash"===o?this.pattern:"u_pixel_ratio"===o?this.pixelRatio:null;s&&r.set(i,o,s)}getBinding(i,r){return"u_pattern"===r||"u_dash"===r?new au(i):new ah(i)}}class ay{constructor(i,r,n,a){this.expression=i,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(i,r,n,a,o,s){let l=this.paintVertexArray.length,h=this.expression.evaluate(new ns(0),r,{},o,a,s);this.paintVertexArray.resize(i),this._setPaintValue(l,i,h)}updatePaintArray(i,r,n,a,o){let s=this.expression.evaluate({zoom:0},n,a,void 0,o);this._setPaintValue(i,r,s)}_setPaintValue(i,r,n){if("color"===this.type){let a=am(n);for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,a[0],a[1])}else{for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ax{constructor(i,r,n,a,o,s){this.expression=i,this.uniformNames=r.map(i=>`u_${i}_t`),this.type=n,this.useIntegerZoom=a,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(i,r,n,a,o,s){let l=this.expression.evaluate(new ns(this.zoom),r,{},o,a,s),h=this.expression.evaluate(new ns(this.zoom+1),r,{},o,a,s),u=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(u,i,l,h)}updatePaintArray(i,r,n,a,o){let s=this.expression.evaluate({zoom:this.zoom},n,a,void 0,o),l=this.expression.evaluate({zoom:this.zoom+1},n,a,void 0,o);this._setPaintValue(i,r,s,l)}_setPaintValue(i,r,n,a){if("color"===this.type){let o=am(n),s=am(a);for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,o[0],o[1],s[0],s[1])}else{for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,n,a);
8this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(a))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(i,r,n,a,o){let s=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,l=z(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);r.set(i,o,l)}getBinding(i,r){return new ah(i)}}class av{constructor(i,r,n,a,o){this.expression=i,this.layerId=o,this.paintVertexAttributes=("array"===n?n7:n9).members;for(let i=0;i<r.length;++i);this.paintVertexArray=new a}populatePaintArray(i,r,n){let a=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValues(a,i,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(i,r,n,a,o,s){this._setPaintValues(i,r,n.patterns&&n.patterns[this.layerId],s)}_setPaintValues(i,r,n,a){if(!a||!n)return;let o=a[n];if(!o)return;let{tl:s,br:l,pixelRatio:h}=o;for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,s[0],s[1],l[0],l[1],h)}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ab{constructor(i,r,n=()=>!0){this.binders={},this._buffers=[];let a=[];for(let s in i.paint._values){var o;if(!n(s))continue;let l=i.paint.get(s);if(!(l instanceof nf&&iD(l.property.specification)))continue;let h=(o=i.type,aT[s]||[s.replace(`${o}-`,"").replace(/-/g,"_")]),u=l.value,c=l.property.specification.type,d=l.property.useIntegerZoom,p="line-dasharray"===s||s.endsWith("pattern"),f="line-dasharray"===s&&"constant"!==i.layout.get("line-cap").value.kind;if("constant"!==u.kind||f){if("source"===u.kind||f||p){let r=aM(s,c,"source");this.binders[s]=p?new av(u,h,c,r,i.id):new ay(u,h,c,r),a.push(`/a_${s}`)}else{let i=aM(s,c,"composite");this.binders[s]=new ax(u,h,c,d,r,i),a.push(`/z_${s}`)}}else this.binders[s]=p?new ag(u.value,h):new a_(u.value,h,c),a.push(`/u_${s}`)}this.cacheKey=a.sort().join("")}getMaxValue(i){let r=this.binders[i];return r instanceof ay||r instanceof ax?r.maxValue:0}populatePaintArrays(i,r,n,a,o,s){for(let l in this.binders){let h=this.binders[l];(h instanceof ay||h instanceof ax||h instanceof av)&&h.populatePaintArray(i,r,n,a,o,s)}}setConstantPatternPositions(i){for(let r in this.binders){let n=this.binders[r];n instanceof ag&&n.setConstantPatternPositions(i)}}updatePaintArrays(i,r,n,a,o,s){let l=!1;for(let h in i)for(let u of r.getPositions(h)){let r=n.feature(u.index);for(let n in this.binders){let c=this.binders[n];if((c instanceof ay||c instanceof ax||c instanceof av)&&!0===c.expression.isStateDependent){let d=a.paint.get(n);c.expression=d.value,c.updatePaintArray(u.start,u.end,r,i[h],o,s),l=!0}}}return l}defines(){let i=[];for(let r in this.binders){let n=this.binders[r];(n instanceof a_||n instanceof ag)&&i.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getBinderAttributes(){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ay||n instanceof ax||n instanceof av)for(let r=0;r<n.paintVertexAttributes.length;r++)i.push(n.paintVertexAttributes[r].name)}return i}getBinderUniforms(){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof a_||n instanceof ag||n instanceof ax)for(let r of n.uniformNames)i.push(r)}return i}getPaintVertexBuffers(){return this._buffers}getUniforms(i){let r=[];for(let n in this.binders){let a=this.binders[n];if(a instanceof a_||a instanceof ag||a instanceof ax)for(let o of a.uniformNames)r.push({name:o,property:n,binding:a.getBinding(i,o)})}return r}setUniforms(i,r,n,a,o){for(let{name:r,property:s,binding:l}of n)this.binders[s].setUniform(i,l,o,a.get(s),r)}updatePaintBuffers(){for(let i in this._buffers=[],this.binders){let r=this.binders[i];(r instanceof ay||r instanceof ax||r instanceof av)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(i){for(let r in this.binders){let n=this.binders[r];(n instanceof ay||n instanceof ax||n instanceof av)&&n.upload(i)}this.updatePaintBuffers()}destroy(){for(let i in this.binders){let r=this.binders[i];(r instanceof ay||r instanceof ax||r instanceof av)&&r.destroy()}}}class aw{constructor(i,r,n=()=>!0){for(let a of(this.programConfigurations={},i))this.programConfigurations[a.id]=new ab(a,r,n);this.needsUpload=!1,this._featureMap=new aa,this._bufferOffset=0}populatePaintArrays(i,r,n,a,o,s,l){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(i,r,a,o,s,l);void 0!==r.id&&this._featureMap.add(r.id,n,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,n,a,o){for(let s of n)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(i,this._featureMap,r,s,a,o)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(let i in this.programConfigurations)this.programConfigurations[i].destroy()}}let aT={"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":["ga
8pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]},aE={"line-pattern":{source:nk,composite:nk},"fill-pattern":{source:nk,composite:nk},"fill-extrusion-pattern":{source:nk,composite:nk},"line-dasharray":{source:nD,composite:nD}},aS={color:{source:nY,composite:nz},number:{source:n$,composite:nY}};function aM(i,r,n){let a=aE[i];return a&&a[n]||aS[r][n]}rT(a_,"ConstantBinder"),rT(ag,"PatternConstantBinder"),rT(ay,"SourceExpressionBinder"),rT(av,"PatternCompositeBinder"),rT(ax,"CompositeExpressionBinder"),rT(ab,"ProgramConfiguration",{omit:["_buffers"]}),rT(aw,"ProgramConfigurationSet");let aA="-transition";class aI extends eq{constructor(i,r){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==i.type&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,"background"!==i.type&&"sky"!==i.type&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),r.layout&&(this._unevaluatedLayout=new np(r.layout)),r.paint)){for(let n in this._transitionablePaint=new nu(r.paint),i.paint)this.setPaintProperty(n,i.paint[n],{validate:!1});for(let r in i.layout)this.setLayoutProperty(r,i.layout[r],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nm(r.paint)}}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r,n={}){null!=r&&this._validate(ry,`layers.${this.id}.layout.${i}`,i,r,n)||("visibility"!==i?this._unevaluatedLayout.setValue(i,r):this.visibility=r)}getPaintProperty(i){return j(i,aA)?this._transitionablePaint.getTransition(i.slice(0,-aA.length)):this._transitionablePaint.getValue(i)}setPaintProperty(i,r,n={}){if(null!=r&&this._validate(rg,`layers.${this.id}.paint.${i}`,i,r,n))return!1;if(j(i,aA))return this._transitionablePaint.setTransition(i.slice(0,-aA.length),r||void 0),!1;{let n=this._transitionablePaint._values[i],a=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(i,r),this._handleSpecialPaintPropertyUpdate(i);let s=this._transitionablePaint._values[i].value,l=s.isDataDriven(),h=j(i,"pattern")||"line-dasharray"===i;return l||a||h||this._handleOverridablePaintPropertyUpdate(i,o,s)}}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getProgramConfiguration(i){return null}_handleOverridablePaintPropertyUpdate(i,r,n){return!1}isHidden(i){return!!(this.minzoom&&i<this.minzoom)||!!(this.maxzoom&&i>=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}
vendor: 7,121 bytes, line 8
8serialize(){let i={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&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),Z(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}_validate(i,r,n,a,o={}){return(!o||!1!==o.validate)&&rv(this,i.call(r_,{key:r,layerType:this.type,objectKey:n,value:a,styleSpec:eW,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let i in this.paint._values){let r=this.paint.get(i);if(r instanceof nf&&iD(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=i5(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}let aC=nE([{name:"a_pos",components:2,type:"Int16"}],4),az=nE([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class ak{constructor(i=[]){this.segments=i}prepareSegment(i,r,n,a){let o=this.segments[this.segments.length-1];return i>ak.MAX_VERTEX_ARRAY_LENGTH&&W(`Max vertices per segment is ${ak.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!o||o.vertexLength+i>ak.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==a)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==a&&(o.sortKey=a),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let i of this.segments)for(let r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,n,a){return new ak([{vertexOffset:i,primitiveOffset:r,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}}ak.MAX_VERTEX_ARRAY_LENGTH=65535,rT(ak,"SegmentVector");class aD{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):4===i.length?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof oN?new oN(i.lng,i.lat):oN.convert(i),this}setSouthWest(i){return this._sw=i instanceof oN?new oN(i.lng,i.lat):oN.convert(i),this}extend(i){let r,n;let a=this._sw,o=this._ne;if(i instanceof oN)r=i,n=i;else{if(!(i instanceof aD))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(aD.convert(i)):this.extend(oN.convert(i)):"object"==typeof i&&null!==i&&i.hasOwnProperty("lat")&&i.hasOwnProperty("lon")?this.extend(oN.convert(i)):this;if(r=i._sw,n=i._ne,!r||!n)return this}return a||o?(a.lng=Math.min(r.lng,a.lng),a.lat=Math.min(r.lat,a.lat),o.lng=Math.max(n.lng,o.lng),o.lat=Math.max(n.lat,o.lat)):(this._sw=new oN(r.lng,r.lat),this._ne=new oN(n.lng,n.lat)),this}getCenter(){return new oN((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 oN(this.getWest(),this.getNorth())}getSouthEast(){return new oN(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(i){let{lng:r,lat:n}=oN.convert(i),a=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&a}static convert(i){return!i||i instanceof aD?i:new aD(i)}}var aP="undefined"!=typeof Float32Array?Float32Array:Array;function aL(){var i=new aP(9);return aP!=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 aR(i,r,n){var a=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=n[0],m=n[1],_=n[2],g=n[3],y=n[4],x=n[5],v=n[6],b=n[7],w=n[8];return i[0]=f*a+m*l+_*c,i[1]=f*o+m*h+_*d,i[2]=f*s+m*u+_*p,i[3]=g*a+y*l+x*c,i[4]=g*o+y*h+x*d,i[5]=g*s+y*u+x*p,i[6]=v*a+b*l+w*c,i[7]=v*o+b*h+w*d,i[8]=v*s+b*u+w*p,i}function aB(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 aO(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],p=r[9],f=r[10],m=r[11],_=r[12],g=r[13],y=r[14],x=r[15],v=n*h-a*l,b=n*u-o*l,w=n*c-s*l,T=a*u-o*h,E=a*c-s*h,S=o*c-s*u,M=d*g-p*_,A=d*y-f*_,I=d*x-m*_,C=p*y-f*g,z=p*x-m*g,k=f*x-m*y,D=v*k-b*z+w*C+T*I-E*A+S*M;return D?(i[0]=(h*k-u*z+c*C)*(D=1/D),i[1]=(o*z-a*k-s*C)*D,i[2]=(g*S-y*E+x*T)*D,i[3]=(f*E-p*S-m*T)*D,i[4]=(u*I-l*k-c*A)*D,i[5]=(n*k-o*I+s*A)*D,i[6]=(y*w-_*S-x*b)*D,i[7]=(d*S-f*w+m*b)*D,i[8]=(l*z-h*I+c*M)*D,i[9]=(a*I-n*z-s*M)*D,i[10]=(_*E-g*w+x*v)*D,i[11]=(p*w-d*E-m*v)*D,i[12]=(h*A-l*C-u*M)*D,i[13]=(n*C-a*A+o*M)*D,i[14]=(g*b-_*T-y*v)*D,i[15]=(d*T-p*b+f*v)*D,i):null}function aF(i,r,n){var a=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],g=r[12],y=r[13],x=r[14],v=r[15],b=n[0],w=n[1],T=n[2],E=n[3];return i[0]=b*a+w*h+T*p+E*g,i[1]=b*o+w*u+T*f+E*y,i[2]=b*s+w*c+T*m+E*x,i[3]=b*l+w*d+T*_+E*v,i[4]=(b=n[4])*a+(w=n[5])*h+(T=n[6])*p+(E=n[7])*g,i[5]=b*o+w*u+T*f+E*y,i[6]=b*s+w*c+T*m+E*x,i[7]=b*l+w*d+T*_+E*v,i[8]=(b=n[8])*a+(w=n[9])*h+(T=n[10])*p+(E=n[11])*g,i[9]=b*o+w*u+T*f+E*y,i[10]=b*s+w*c+T*m+E*x,i[11]=b*l+w*d+T*_+E*v,i[12]=(b=n[12])*a+(w=n[13])*h+(T=n[14])*p+(E=n[15])*g,i[13]=b*o+w*u+T*f+E*y,i[14]=b*s+w*c+T*m+E*x,i[15]=b*l+w*d+T*_+E*v,i}function aU(i,r,n){var a,o,s,l,h,u,c,d,p,f,m,_,g=n[0],y=n[1],x=n[2];return r===i?(i[12]=r[0]*g+r[4]*y+r[8]*x+r[12],i[13]=r[1]*g+r[5]*y+r[9]*x+r[13],i[14]=r[2]*g+r[6]*y+r[10]*x+r[14],i[15]=r[3]*g+r[7]*y+r[11]*x+r[15]):(o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],i[0]=a=r[0],i[1]=o,i[2]=s,i[3]=l,i[4]=h,i[5]=u,i[6]=c,i[7]=d,i[8]=p,i[9]=f,i[10]=m,i[11]=_,i[12]=a*g+h*y+p*x+r[12],i[13]=o*g+u*y+f*x+r[13],i[14]=s*g+c*y+m*x+r[14],i[15]=l*g+d*y+_*x+r[15]),i}function aV(i,r,n){var a=n[0],o=n[1],s=n[2];return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[3]=r[3]*a,i[4]=r[4]*o,i[5]=r[5]*o,i[6]=r[6]*o,i[7]=r[7]*o,i[8]=r[8]*s,i[9]=r[9]*s,i[10]=r[10]*s,i[11]=r[11]*s,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function aN(i,r,n){var a=Math.sin(n),o=Math.cos(n),s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=s*o+c*a,i[5]=l*o+d*a,i[6]=h*o+p*a,i[7]=u*o+f*a,i[8]=c*o-s*a,i[9]=d*o-l*a,i[10]=p*o-h*a,i[11]=f*o-u*a,i}function aj(i,r,n){var a=Math.sin(n),o=Math.cos(n),s=r[0],l=r[1],h=r[2],u=r[3],c=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o-c*a,i[1]=l*o-d*a,i[2]=h*o-p*a,i[3]=u*o-f*a,i[8]=s*a+c*o,i[9]=l*a+d*o,i[10]=h*
vendor: 1,705 bytes, line 8
8a+p*o,i[11]=u*a+f*o,i}function aG(i,r){return i[0]=r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=r[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function aZ(i,r,n){var a,o,s,l=n[0],h=n[1],u=n[2],c=Math.hypot(l,h,u);return c<1e-6?null:(l*=c=1/c,h*=c,u*=c,a=Math.sin(r),o=Math.cos(r),i[0]=l*l*(s=1-o)+o,i[1]=h*l*s+u*a,i[2]=u*l*s-h*a,i[3]=0,i[4]=l*h*s-u*a,i[5]=h*h*s+o,i[6]=u*h*s+l*a,i[7]=0,i[8]=l*u*s+h*a,i[9]=h*u*s-l*a,i[10]=u*u*s+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i)}function a$(){var i=new aP(3);return aP!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function aq(i){var r=new aP(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function aW(i){return Math.hypot(i[0],i[1],i[2])}function aX(i,r,n){var a=new aP(3);return a[0]=i,a[1]=r,a[2]=n,a}function aH(i,r,n){return i[0]=r[0]+n[0],i[1]=r[1]+n[1],i[2]=r[2]+n[2],i}function aY(i,r,n){return i[0]=r[0]-n[0],i[1]=r[1]-n[1],i[2]=r[2]-n[2],i}function aK(i,r,n){return i[0]=r[0]*n[0],i[1]=r[1]*n[1],i[2]=r[2]*n[2],i}function aJ(i,r,n){return i[0]=Math.min(r[0],n[0]),i[1]=Math.min(r[1],n[1]),i[2]=Math.min(r[2],n[2]),i}function aQ(i,r,n){return i[0]=Math.max(r[0],n[0]),i[1]=Math.max(r[1],n[1]),i[2]=Math.max(r[2],n[2]),i}function a0(i,r,n){return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i}function a1(i,r,n,a){return i[0]=r[0]+n[0]*a,i[1]=r[1]+n[1]*a,i[2]=r[2]+n[2]*a,i}function a2(i,r){var n=r[0],a=r[1],o=r[2],s=n*n+a*a+o*o;return s>0&&(s=1/Math.sqrt(s)),i[0]=r[0]*s,i[1]=r[1]*s,i[2]=r[2]*s,i}function a3(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function a5(i,r,n){var a=r[0],o=r[1],s=r[2],l=n[0],h=n[1],u=n[2];return i[0]=o*u-s*h,i[1]=s*l-a*u,i[2]=a*h-o*l,i}function a4(i,r,n){var a=r[0],o=r[1],s=r[2],l=n[3]*a+n[7]*o+n[11]*s+n[15];
8return i[0]=(n[0]*a+n[4]*o+n[8]*s+n[12])/(l=l||1),i[1]=(n[1]*a+n[5]*o+n[9]*s+n[13])/l,i[2]=(n[2]*a+n[6]*o+n[10]*s+n[14])/l,i}function a6(i,r,n){var a=n[0],o=n[1],s=n[2],l=r[0],h=r[1],u=r[2],c=o*u-s*h,d=s*l-a*u,p=a*h-o*l,f=o*p-s*d,m=s*c-a*p,_=a*d-o*c,g=2*n[3];return d*=g,p*=g,m*=2,_*=2,i[0]=l+(c*=g)+(f*=2),i[1]=h+d+m,i[2]=u+p+_,i}function a8(i,r,n){return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i[3]=r[3]*n,i}function a9(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=n*n+a*a+o*o+s*s;return l>0&&(l=1/Math.sqrt(l)),i[0]=n*l,i[1]=a*l,i[2]=o*l,i[3]=s*l,i}function a7(i,r,n){var a=r[0],o=r[1],s=r[2],l=r[3];return i[0]=n[0]*a+n[4]*o+n[8]*s+n[12]*l,i[1]=n[1]*a+n[5]*o+n[9]*s+n[13]*l,i[2]=n[2]*a+n[6]*o+n[10]*s+n[14]*l,i[3]=n[3]*a+n[7]*o+n[11]*s+n[15]*l,i}function oe(){var i=new aP(4);return aP!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function ot(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function oi(i,r,n){n*=.5;var a=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(n),u=Math.cos(n);return i[0]=a*u+l*h,i[1]=o*u+s*h,i[2]=s*u-o*h,i[3]=l*u-a*h,i}function or(i,r,n){n*=.5;var a=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(n),u=Math.cos(n);return i[0]=a*u-s*h,i[1]=o*u+l*h,i[2]=s*u+a*h,i[3]=l*u-o*h,i}Math.hypot||(Math.hypot=function(){for(var i=0,r=arguments.length;r--;)i+=arguments[r]*arguments[r];return Math.sqrt(i)}),a$(),c=new aP(4),aP!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0,c[3]=0),a$(),aX(1,0,0),aX(0,1,0),oe(),oe(),aL();let{members:on}=nE([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),oa=nE([{name:"a_pos_3",components:3,type:"Int16"}]);var oo=nE([{name:"a_pos",type:"Int16",components:2}]);class os{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,n){let a=a3(r,this.dir);if(1e-6>Math.abs(a))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/a;return n[0]=this.pos[0]+this.dir[0]*o,n[1]=this.pos[1]+this.dir[1]*o,n[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(i,r,n){var a,o,s,l,h,u,c;if(o=(a=this.pos)[0],s=a[1],l=a[2],h=i[0],u=i[1],c=i[2],Math.abs(o-h)<=1e-6*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-u)<=1e-6*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(l-c)<=1e-6*Math.max(1,Math.abs(l),Math.abs(c))||0===r)return n[0]=n[1]=n[2]=0,!1;let[d,p,f]=this.dir,m=this.pos[0]-i[0],_=this.pos[1]-i[1],g=this.pos[2]-i[2],y=d*d+p*p+f*f,x=2*(m*d+_*p+g*f),v=x*x-4*y*(m*m+_*_+g*g-r*r);if(v<0){let i=Math.max(-x/2,0),a=m+d*i,o=_+p*i,s=g+f*i,l=Math.hypot(a,o,s);return n[0]=a*r/l,n[1]=o*r/l,n[2]=s*r/l,!1}{let i=(-x-Math.sqrt(v))/(2*y);if(i<0){let i=Math.hypot(m,_,g);return n[0]=m*r/i,n[1]=_*r/i,n[2]=g*r/i,!1}return n[0]=m+d*i,n[1]=_+p*i,n[2]=g+f*i,!0}}}class ol{constructor(i,r,n,a,o){this.TL=i,this.TR=r,this.BR=n,this.BL=a,this.horizon=o}static fromInvProjectionMatrix(i,r,n){let a=[-1,1,1],o=[1,1,1],s=[1,-1,1],l=[-1,-1,1],h=a4(a,a,i);return new ol(h,a4(o,o,i),a4(s,s,i),a4(l,l,i),r/n)}}class oh{constructor(i,r){this.points=i,this.planes=r}static fromInvProjectionMatrix(i,r,n,a){let o=Math.pow(2,n),s=[[-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(n=>{var s;let l=a7([],n,i),h=1/l[3]/r*o;return s=[h,h,a?1/l[3]:h,h],l[0]=l[0]*s[0],l[1]=l[1]*s[1],l[2]=l[2]*s[2],l[3]=l[3]*s[3],l}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{let r=a2([],a5([],aY([],s[i[0]],s[i[1]]),aY([],s[i[2]],s[i[1]]))),n=-a3(r,s[i[1]]);return r.concat(n)});return new oh(s,l)}}class ou{static fromPoints(i){let r=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(let a of i)aJ(r,r,a),aQ(n,n,a);return new ou(r,n)}static applyTransform(i,r){let n=i.getCorners();for(let i=0;i<n.length;++i)a4(n[i],n[i],r);return ou.fromPoints(n)}constructor(i,r){this.min=i,this.max=r,this.center=a0([],aH([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],n=aq(this.min),a=aq(this.max);for(let i=0;i<r.length;i++)n[i]=r[i]?this.min[i]:this.center[i],a[i]=r[i]?this.center[i]:this.max[i];return a[2]=this.max[2],new ou(n,a)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}distanceZ(i){return Math.max(Math.min(this.max[2],i[2]),this.min[2])-i[2]}getCorners(){let i=this.min,r=this.max;return[[i[0],i[1],i[2]],[r[0],i[1],i[2]],[r[0],r[1],i[2]],[i[0],r[1],i[2]],[i[0],i[1],r[2]],[r[0],i[1],r[2]],[r[0],r[1],r[2]],[i[0],r[1],r[2]]]}intersects(i){let r=this.getCorners(),n=!0;for(let a=0;a<i.planes.length;a++){let o=i.planes[a],s=0;for(let i=0;i<r.length;i++)s+=a3(o,r[i])+o[3]>=0;if(0===s)return 0;s!==r.length&&(n=!1)}if(n)return 2;for(let r=0;r<3;r++){let n=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let o=0;o<i.points.length;o++){let s=i.points[o][r]-this.min[r];n=Math.min(n,s),a=Math.max(a,s)}if(a<0||n>this.max[r]-this.min[r])return 0}return 1}}let oc=8192/Math.PI/2,od=[64,32,16],op=-oc,of=[new ou([op,op,op],[oc,oc,oc]),new ou([op,op,op],[0,0,oc]),new ou([0,op,op],[oc,0,oc]),new ou([op,0,op],[0,oc,oc]),new ou([0,0,op],[oc,oc,oc])];function om(i){return i*oc/oU}function o_(i,r,n,a=!0){let o=a0([],i._camera.position,i.worldSize),s=[r,n,1,1];a7(s,s,i.pixelMatrixInverse),a8(s,s,1/s[3]);let l=a2([],aY([],s,o)),h=i.globeMatrix,u=[h[12],h[13],h[14]],c=aY([],u,o),d=aW(c),p=a2([],c),f=i.worldSize/(2*Math.PI),m=a3(p,l),_=Math.asin(f/d);if(_<Math.acos(m)){if(!a)return null;let i=[],r=[];a0(i,l,d/m),a2(r,aY(r,i,c)),a2(l,aH(l,c,a0(l,r,Math.tan(_)*d)))}let g=[];new os(o,l).closestPointOnSphere(u,f,g);let y=a2([],ee(h,0)),x=a2([],ee(h,1)),v=a2([],ee(h,2)),b=a3(y,g),w=a3(x,g),T=Math.atan2(b,a3(v,g))*S;return new oX(oG(T=i.center.lng+function(i,r){let n=(r-i+180)%360-180;return n<-180?n+360:n}(i.center.lng,T)),z(oZ(Math.asin(-w/f)*S),0,1))}class og{constructor(i,r,n){this.a=aY([],i,n),this.b=aY([],r,n),this.center=n;let a=a2([],this.a),o=a2([],this.b);this.angle=Math.acos(a3(a,o))}}function oy(i,r){let n;return 0===i.angle?null:(n=0===i.a[r]?1/i.angle*.5*Math.PI:1/i.angle*Math.atan(i.b[r]/i.a[r]/Math.sin(i.angle)-1/Math.tan(i.angle)))<0||n>1?null:function(i,r,n,a){let o=Math.sin(n);return Math.sin((1-a)*n)/o*i+Math.sin(a*n)/o*r}(i.a[r],i.b[r],i.angle,z(n,0,1))+i.center[r]}function ox(i){if(i.z<=1)return of[i.z+2*i.y+i.x];let r=oE(oT(i));return ou.fromPoints(r)}function ov(i,r,n){return a0(i,i,1-n),a1(i,i,r,n)}function ob(i,r){let n=oP(r.zoom);if(0===n)return ox(i);let a=oT(i),o=oE(a),s=oG(a.getWest())*r.worldSize,l=oG(a.getEast())*r.worldSize,h=oZ(a.getNorth())*r.worldSize,u=oZ(a.getSouth())*r.worldSize,c=[s,h,0],d=[l,h,0],p=[s,u,0],f=[l,u,0],m=aO([],r.globeMatrix);return a4(c,c,m),a4(d,d,m),a4(p,p,m),a4(f,f,m),o[0]=ov(o[0],p,n),o[1]=ov(o[1],f,n),o[2]=ov(o[2],d,n),o[3]=ov(o[3],c,n),ou.fromPoints(o)}function ow(i,r,n){for(let a of i)a4(a,a,r),a0(a,a,n)}function oT({x:i,y:r,z:n}){let a=1/(1<<n);return new aD(new oN(o$(i*a),oq((r+1)*a)),new oN(o$((i+1)*a),oq(r*a)))}function oE(i){let r=i.getNorth()*E,n=i.getSouth()*E,a=Math.cos(r),o=Math.cos(n),s=Math.sin(r),l=Math.sin(n),h=i.getWest(),u=i.getEast();return[oS(o,l,h),oS(o,l,u),oS(a,s,u),oS(a,s,h)]}function oS(i,r,n,a=oc){return[i*Math.sin(n*=E)*a,-r*a,i*Math.cos(n)*a]}
8function oM(i,r,n){return oS(Math.cos(i*E),Math.sin(i*E),r,n)}function oA(i,r,n,a){let o=1<<n.z,s=(i/8192+n.x)/o;return oM(oq((r/8192+n.y)/o),o$(s),a)}function oI({min:i,max:r}){return 16383/Math.max(r[0]-i[0],r[1]-i[1],r[2]-i[2])}let oC=new Float64Array(16);function oz(i){var r,n;let a=oI(i),o=aG(oC,[a,a,a]);return aU(o,o,((r=[])[0]=-(n=i.min)[0],r[1]=-n[1],r[2]=-n[2],r))}function ok(i){var r;let n=(r=i.min,oC[0]=1,oC[1]=0,oC[2]=0,oC[3]=0,oC[4]=0,oC[5]=1,oC[6]=0,oC[7]=0,oC[8]=0,oC[9]=0,oC[10]=1,oC[11]=0,oC[12]=r[0],oC[13]=r[1],oC[14]=r[2],oC[15]=1,oC),a=1/oI(i);return aV(n,n,[a,a,a])}function oD(i,r,n,a,o){let s=n/(2*Math.PI)/(8192/(2*Math.PI)),l=aB(new Float64Array(16));return aU(l,l,[i,r,-n/(2*Math.PI)]),aV(l,l,[s,s,s]),aN(l,l,-o*E),aj(l,l,-a*E),l}function oP(i){return k(5,6,i)}function oL(i,r){var n,a,o,s,l,h,u,c;let d=oM(r.lat,r.lng);return a=(n=aY([],function(i){let r=oM(i._center.lat,i._center.lng),n=a5([],aX(0,1,0),r),a=aZ([],-i.angle,r);n=a4(n,n,a),aZ(a,-i._pitch,n);let o=a2([],r);return a0(o,o,om(i.cameraToCenterDistance/i.pixelsPerMeter)),a4(o,o,a),aH([],r,o)}(i),d))[0],o=n[1],s=n[2],Math.acos(Math.min(Math.max((c=Math.sqrt(a*a+o*o+s*s)*Math.sqrt((l=d[0])*l+(h=d[1])*h+(u=d[2])*u))&&a3(n,d)/c,-1),1))}function oR(i,r){return oL(i,r)>Math.PI/2*1.01}let oB=85*E,oO=Math.cos(oB),oF=Math.sin(oB),oU=6371008.8,oV=2*Math.PI*6371008.8;class oN{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new oN(D(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){let r=Math.PI/180,n=this.lat*r,a=i.lat*r;return oU*Math.acos(Math.min(Math.sin(n)*Math.sin(a)+Math.cos(n)*Math.cos(a)*Math.cos((i.lng-this.lng)*r),1))}toBounds(i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new aD(new oN(this.lng-n,this.lat-r),new oN(this.lng+n,this.lat+r))}toEcef(i){let r=om(i);return oM(this.lat,this.lng,oc+r)}static convert(i){if(i instanceof oN)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new oN(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new oN(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw 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>]")}}function oj(i){return oV*Math.cos(i*Math.PI/180)}function oG(i){return(180+i)/360}function oZ(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function o$(i){return 360*i-180}function oq(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}function oW(i){return 1/Math.cos(i*Math.PI/180)}class oX{constructor(i,r,n=0){this.x=+i,this.y=+r,this.z=+n}static fromLngLat(i,r=0){let n=oN.convert(i);return new oX(oG(n.lng),oZ(n.lat),r/oj(n.lat))}toLngLat(){return new oN(o$(this.x),oq(this.y))}toAltitude(){return this.z*oj(oq(this.y))}meterInMercatorCoordinateUnits(){return 1/oV*oW(oq(this.y))}}function oH(i,r,n){let a=i[0],o=a.x,s=a.y;r(a);let l=[a];for(let h=1;h<i.length;h++){let u=i[h],{x:c,y:d}=u;r(u),function i(r,n,a,o,s,l,h,u,c){let d=(n+o)/2,p=(a+s)/2,f=new w(d,p);u(f),function(i,r,n,a,o,s){let l=n-o,h=a-s;return Math.abs((a-r)*l-(n-i)*h)/Math.hypot(l,h)}(f.x,f.y,l.x,l.y,h.x,h.y)>=c?(i(r,n,a,d,p,l,f,u,c),i(r,d,p,o,s,f,h,u,c)):r.push(h)}(l,o,s,c,d,a,u,r,n),o=c,s=d,a=u}return l}let oY=-16383-1;function oK(i,r,n){let a=i.loadGeometry(),o=i.extent,s=8192/o;if(r&&n&&n.projection.isReprojectedInTileSpace){let s=1<<r.z,{scale:l,x:h,y:u,projection:c}=n,d=i=>{let n=o$((r.x+i.x/o)/s),a=oq((r.y+i.y/o)/s),d=c.project(n,a);i.x=(d.x*l-h)*o,i.y=(d.y*l-u)*o};for(let r=0;r<a.length;r++)if(1!==i.type)a[r]=oH(a[r],d,1);else{let i=[];for(let n of a[r])n.x<0||n.x>=o||n.y<0||n.y>=o||(d(n),i.push(n));a[r]=i}}for(let i of a)for(let r of i)!function(i,r){let n=Math.round(i.x*r),a=Math.round(i.y*r);i.x=z(n,oY,16383),i.y=z(a,oY,16383),(n<i.x||n>i.x+1||a<i.y||a>i.y+1)&&W("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(r,s);return a}function oJ(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?oK(i):[]}}function oQ(i,r,n,a,o){i.emplaceBack(2*r+(a+1)/2,2*n+(o+1)/2)}function o0(i,r,n){i.emplaceBack(r.x,r.y,r.z,16384*n[0],16384*n[1],16384*n[2])}class o1{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.projection=i.projection,this.layoutVertexArray=new nM,this.indexArray=new nj,this.segments=new ak,this.programConfigurations=new aw(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,a){let o=this.layers[0],s=[],l=null;for(let{feature:r,id:h,index:u,sourceLayerIndex:c}
8of("circle"===o.type&&(l=o.layout.get("circle-sort-key")),i)){let i=this.layers[0]._featureFilter.needGeometry,o=oJ(r,i);if(!this.layers[0]._featureFilter.filter(new ns(this.zoom),o,n))continue;let d=l?l.evaluate(o,{},n):void 0,p={id:h,properties:r.properties,type:r.type,sourceLayerIndex:c,index:u,geometry:i?o.geometry:oK(r,n,a),patterns:{},sortKey:d};s.push(p)}l&&s.sort((i,r)=>i.sortKey-r.sortKey);let h=null;for(let o of("globe"===a.projection.name&&(this.globeExtVertexArray=new nP,h=a.projection),s)){let{geometry:a,index:s,sourceLayerIndex:l}=o,u=i[s].feature;this.addFeature(o,a,s,r.availableImages,n,h),r.featureIndex.insert(u,a,s,l,this.index)}}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,aC.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,az.members))),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(i,r,n,a,o,s){for(let n of r)for(let r of n){let n=r.x,a=r.y;if(n<0||n>=8192||a<0||a>=8192)continue;if(s){let i=s.projectTilePoint(n,a,o),r=s.upVector(o,n,a),l=this.globeExtVertexArray;o0(l,i,r),o0(l,i,r),o0(l,i,r),o0(l,i,r)}let l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),h=l.vertexLength;oQ(this.layoutVertexArray,n,a,-1,-1),oQ(this.layoutVertexArray,n,a,1,-1),oQ(this.layoutVertexArray,n,a,1,1),oQ(this.layoutVertexArray,n,a,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+2,h+3),l.vertexLength+=4,l.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,{},a,o)}}function o2(i,r){for(let n=0;n<i.length;n++)if(o9(r,i[n]))return!0;for(let n=0;n<r.length;n++)if(o9(i,r[n]))return!0;return!!o5(i,r)}function o3(i,r){if(1===i.length)return o8(r,i[0]);for(let n=0;n<r.length;n++){let a=r[n];for(let r=0;r<a.length;r++)if(o9(i,a[r]))return!0}for(let n=0;n<i.length;n++)if(o8(r,i[n]))return!0;for(let n=0;n<r.length;n++)if(o5(i,r[n]))return!0;return!1}function o5(i,r){if(0===i.length||0===r.length)return!1;for(let o=0;o<i.length-1;o++){let s=i[o],l=i[o+1];for(let i=0;i<r.length-1;i++){var n,a;if(X(s,n=r[i],a=r[i+1])!==X(l,n,a)&&X(s,l,n)!==X(s,l,a))return!0}}return!1}function o4(i,r,n){let a=n*n;if(1===r.length)return i.distSqr(r[0])<a;for(let n=1;n<r.length;n++)if(o6(i,r[n-1],r[n])<a)return!0;return!1}function o6(i,r,n){let a=r.distSqr(n);if(0===a)return i.distSqr(r);let o=((i.x-r.x)*(n.x-r.x)+(i.y-r.y)*(n.y-r.y))/a;return i.distSqr(o<0?r:o>1?n:n.sub(r)._mult(o)._add(r))}function o8(i,r){let n,a,o,s=!1;for(let l=0;l<i.length;l++){n=i[l];for(let i=0,l=n.length-1;i<n.length;l=i++)a=n[i],o=n[l],a.y>r.y!=o.y>r.y&&r.x<(o.x-a.x)*(r.y-a.y)/(o.y-a.y)+a.x&&(s=!s)}return s}function o9(i,r){let n=!1;for(let a=0,o=i.length-1;a<i.length;o=a++){let s=i[a],l=i[o];s.y>r.y!=l.y>r.y&&r.x<(l.x-s.x)*(r.y-s.y)/(l.y-s.y)+s.x&&(n=!n)}return n}function o7(i,r,n,a,o){for(let s of i)if(r<=s.x&&n<=s.y&&a>=s.x&&o>=s.y)return!0;let s=[new w(r,n),new w(r,o),new w(a,o),new w(a,n)];if(i.length>2){for(let r of s)if(o9(i,r))return!0}for(let r=0;r<i.length-1;r++)if(function(i,r,n){let a=n[0],o=n[2];if(i.x<a.x&&r.x<a.x||i.x>o.x&&r.x>o.x||i.y<a.y&&r.y<a.y||i.y>o.y&&r.y>o.y)return!1;let s=X(i,r,n[0]);return s!==X(i,r,n[1])||s!==X(i,r,n[2])||s!==X(i,r,n[3])}(i[r],i[r+1],s))return!0;return!1}function se(i,r,n){let a=r.paint.get(i).value;return"constant"===a.kind?a.value:n.programConfigurations.get(r.id).getMaxValue(i)}function st(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function si(i,r,n,a,o){if(!r[0]&&!r[1])return i;let s=w.convert(r)._mult(o);"viewport"===n&&s._rotate(-a);let l=[];for(let r=0;r<i.length;r++)l.push(i[r].sub(s));return l}function sr(i,r,n,a){let o=w.convert(i)._mult(a);return"viewport"===r&&o._rotate(-n),o}rT(o1,"CircleBucket",{omit:["layers"]});let sn=new nx({"circle-sort-key":new ng(eW.layout_circle["circle-sort-key"])});var sa={paint:new nx({"circle-radius":new ng(eW.paint_circle["circle-radius"]),"circle-color":new ng(eW.paint_circle["circle-color"]),"circle-blur":new ng(eW.paint_circle["circle-blur"]),"circle-opacity":new ng(eW.paint_circle["circle-opacity"]),"circle-translate":new n_(eW.paint_circle["circle-translate"]),"circle-translate-anchor":new n_(eW.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new n_(eW.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new n_(eW.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ng(eW.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ng(eW.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ng(eW.paint_circle["circle-stroke-opacity"])}),layout:sn};function so(i,r,n,a,o,s,l,h,u){if(s&&i.queryGeometry.isAboveHorizon)return!1;s&&(u*=i.pixelToTileUnitsFactor);let c=i.tileID.canonical,d=n.projection.upVectorScale(c,n.center.lat,n.worldSize).metersToTile;for(let f of r)for(let r of f){var p;let f=r.add(h),m=o&&n.elevation?n.elevation.exaggeration()*o.getElevationAt(f.x,f.y,!0):0,_=n.projection.projectTilePoint(f.x,f.y,c);if(m>0){let i=n.projection.upVector(c,f.x,f.y);_.x+=i[0]*d*m,_.y+=i[1]*d*m,_.z+=i[2]*d*m}let g=s?f:function(i,r,n,a){let o=a7([],[i,r,n,1],a);return new w(o[0]/o[3],o[1]/o[3])}(_.x,_.y,_.z,a),y=s?i.tilespaceRays.map(i=>(function(i,r){let n=a$();return ss[2]=r,i.intersectsPlane(ss,sl,n),new w(n[0],n[1])})(i,m)):i.queryGeometry.screenGeometry,x=a7([],[_.x,_.y,_.z,1],a);if(!l&&s?u*=x[3]/n.cameraToCenterDistance:l&&!s&&(u*=n.cameraToCenterDistance/x[3]),s){let i=oq((r.y/8192+c.y)/(1<<c.z));u/=n.projection.pixelsPerMeter(i,1)/(1/oj(i))}if(p=u,o9(y,g)||o4(g,y,p))return!0}return!1}let ss=aX(0,0,0),sl=aX(0,0,1);class sh extends o1{}function su(i,{width:r,height:n},a,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==r*n*a)throw RangeError("mismatched image size")}else o=new Uint8Array(r*n*a);return i.width=r,i.height=n,i.data=o,i}function sc(i,r,n){let{width:a,height:o}=r;a===i.width&&o===i.height||(sd(i,r,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,a),height:Math.min(i.height,o)},n),i.width=a,i.height=o,i.data=r.data)}
8function sd(i,r,n,a,o,s){if(0===o.width||0===o.height)return r;if(o.width>i.width||o.height>i.height||n.x>i.width-o.width||n.y>i.height-o.height)throw RangeError("out of range source coordinates for image copy");if(o.width>r.width||o.height>r.height||a.x>r.width-o.width||a.y>r.height-o.height)throw RangeError("out of range destination coordinates for image copy");let l=i.data,h=r.data;for(let u=0;u<o.height;u++){let c=((n.y+u)*i.width+n.x)*s,d=((a.y+u)*r.width+a.x)*s;for(let i=0;i<o.width*s;i++)h[d+i]=l[c+i]}return r}rT(sh,"HeatmapBucket",{omit:["layers"]});class sp{constructor(i,r){su(this,i,1,r)}resize(i){sc(this,new sp(i),1)}clone(){return new sp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,n,a,o){sd(i,r,n,a,o,1)}}class sf{constructor(i,r){su(this,i,4,r)}resize(i){sc(this,new sf(i),4)}replace(i,r){r?this.data.set(i):this.data=i instanceof Uint8ClampedArray?new Uint8Array(i.buffer):i}clone(){return new sf({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,n,a,o){sd(i,r,n,a,o,4)}}rT(sp,"AlphaImage"),rT(sf,"RGBAImage");var sm={paint:new nx({"heatmap-radius":new ng(eW.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ng(eW.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new n_(eW.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ny(eW.paint_heatmap["heatmap-color"]),"heatmap-opacity":new n_(eW.paint_heatmap["heatmap-opacity"])})};function s_(i){let r={},n=i.resolution||256,a=i.clips?i.clips.length:1,o=i.image||new sf({width:n,height:a}),s=(n,a,s)=>{r[i.evaluationKey]=s;let l=i.expression.evaluate(r);o.data[n+a+0]=Math.floor(255*l.r/l.a),o.data[n+a+1]=Math.floor(255*l.g/l.a),o.data[n+a+2]=Math.floor(255*l.b/l.a),o.data[n+a+3]=Math.floor(255*l.a)};if(i.clips)for(let r=0,o=0;r<a;++r,o+=4*n)for(let a=0,l=0;a<n;a++,l+=4){let h=a/(n-1),{start:u,end:c}=i.clips[r];s(o,l,u*(1-h)+c*h)}else for(let i=0,r=0;i<n;i++,r+=4)s(0,r,i/(n-1));return o}var sg={paint:new nx({"hillshade-illumination-direction":new n_(eW.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new n_(eW.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new n_(eW.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new n_(eW.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new n_(eW.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new n_(eW.paint_hillshade["hillshade-accent-color"])})};let{members:sy}=nE([{name:"a_pos",components:2,type:"Int16"}],4);var sx={};function sv(i,r,n){n=n||2;var a,o,s,l,h,u,c,d=r&&r.length,p=d?r[0]*n:i.length,f=sb(i,0,p,n,!0),m=[];if(!f||f.next===f.prev)return m;if(d&&(f=function(i,r,n,a){var o,s,l,h=[];for(o=0,s=r.length;o<s;o++)(l=sb(i,r[o]*a,o<s-1?r[o+1]*a:i.length,a,!1))===l.next&&(l.steiner=!0),h.push(function(i){var r=i,n=i;do(r.x<n.x||r.x===n.x&&r.y<n.y)&&(n=r),r=r.next;while(r!==i);return n}(l));for(h.sort(sT),o=0;o<h.length;o++)n=function(i,r){var n=function(i,r){var n,a,o,s=r,l=i.x,h=i.y,u=-1/0;do{if(h<=s.y&&h>=s.next.y&&s.next.y!==s.y){var c=s.x+(h-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(c<=l&&c>u&&(u=c,o=s.x<s.next.x?s:s.next,c===l))return o}s=s.next}while(s!==r);if(!o)return null;var d,p=o,f=o.x,m=o.y,_=1/0;s=o;do l>=s.x&&s.x>=f&&l!==s.x&&sS(h<m?l:u,h,f,m,h<m?u:l,h,s.x,s.y)&&(d=Math.abs(h-s.y)/(l-s.x),sk(s,i)&&(d<_||d===_&&(s.x>o.x||s.x===o.x&&(n=o,a=s,0>sM(n.prev,n,a.prev)&&0>sM(a.next,n,n.next))))&&(o=s,_=d)),s=s.next;while(s!==p);return o}(i,r);if(!n)return r;var a=sD(n,i);return sw(a,a.next),sw(n,n.next)}(h[o],n);return n}(i,r,f,n)),i.length>80*n){a=s=i[0],o=l=i[1];for(var _=n;_<p;_+=n)(h=i[_])<a&&(a=h),(u=i[_+1])<o&&(o=u),h>s&&(s=h),u>l&&(l=u);c=0!==(c=Math.max(s-a,l-o))?32767/c:0}return function i(r,n,a,o,s,l,h){if(r){!h&&l&&function(i,r,n,a){var o=i;do 0===o.z&&(o.z=sE(o.x,o.y,r,n,a)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==i);o.prevZ.nextZ=null,o.prevZ=null,function(i){var r,n,a,o,s,l,h,u,c=1;do{for(n=i,i=null,s=null,l=0;n;){for(l++,a=n,h=0,r=0;r<c&&(h++,a=a.nextZ);r++);for(u=c;h>0||u>0&&a;)0!==h&&(0===u||!a||n.z<=a.z)?(o=n,n=n.nextZ,h--):(o=a,a=a.nextZ,u--),s?s.nextZ=o:i=o,o.prevZ=s,s=o;n=a}s.nextZ=null,c*=2}while(l>1)}(o)}(r,o,s,l);for(var u,c,d=r;r.prev!==r.next;)if(u=r.prev,c=r.next,l?function(i,r,n,a){var o=i.prev,s=i.next;if(sM(o,i,s)>=0)return!1;for(var l=o.x,h=i.x,u=s.x,c=o.y,d=i.y,p=s.y,f=l<h?l<u?l:u:h<u?h:u,m=c<d?c<p?c:p:d<p?d:p,_=l>h?l>u?l:u:h>u?h:u,g=c>d?c>p?c:p:d>p?d:p,y=sE(f,m,r,n,a),x=sE(_,g,r,n,a),v=i.prevZ,b=i.nextZ;v&&v.z>=y&&b&&b.z<=x;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&sS(l,c,h,d,u,p,v.x,v.y)&&sM(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&sS(l,c,h,d,u,p,b.x,b.y)&&sM(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&sS(l,c,h,d,u,p,v.x,v.y)&&sM(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&sS(l,c,h,d,u,p,b.x,b.y)&&sM(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(r,o,s,l):function(i){var r=i.prev,n=i.next;if(sM(r,i,n)>=0)return!1;for(var a=r.x,o=i.x,s=n.x,l=r.y,h=i.y,u=n.y,c=a<o?a<s?a:s:o<s?o:s,d=l<h?l<u?l:u:h<u?h:u,p=a>o?a>s?a:s:o>s?o:s,f=l>h?l>u?l:u:h>u?h:u,m=n.next;m!==r;){if(m.x>=c&&m.x<=p&&m.y>=d&&m.y<=f&&sS(a,l,o,h,s,u,m.x,m.y)&&sM(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(r))n.push(u.i/a|0),n.push(r.i/a|0),n.push(c.i/a|0),sL(r),r=c.next,d=c.next;else if((r=c)===d){h?1===h?i(r=function(i,r,n){var a=i;do{var o=a.prev,s=a.next.next;
8!sA(o,s)&&sI(o,a,a.next,s)&&sk(o,s)&&sk(s,o)&&(r.push(o.i/n|0),r.push(a.i/n|0),r.push(s.i/n|0),sL(a),sL(a.next),a=i=s),a=a.next}while(a!==i);return sw(a)}(sw(r),n,a),n,a,o,s,l,2):2===h&&function(r,n,a,o,s,l){var h=r;do{for(var u,c,d=h.next.next;d!==h.prev;){if(h.i!==d.i&&(u=h,c=d,u.next.i!==c.i&&u.prev.i!==c.i&&!function(i,r){var n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&sI(n,n.next,i,r))return!0;n=n.next}while(n!==i);return!1}(u,c)&&(sk(u,c)&&sk(c,u)&&function(i,r){var n=i,a=!1,o=(i.x+r.x)/2,s=(i.y+r.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&o<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(a=!a),n=n.next;while(n!==i);return a}(u,c)&&(sM(u.prev,u,c.prev)||sM(u,c.prev,c))||sA(u,c)&&sM(u.prev,u,u.next)>0&&sM(c.prev,c,c.next)>0))){var p=sD(h,d);return h=sw(h,h.next),p=sw(p,p.next),i(h,n,a,o,s,l,0),void i(p,n,a,o,s,l,0)}d=d.next}h=h.next}while(h!==r)}(r,n,a,o,s,l):i(sw(r),n,a,o,s,l,1);break}}}(f,m,n,a,o,c,0),m}function sb(i,r,n,a,o){var s,l;if(o===sB(i,r,n,a)>0)for(s=r;s<n;s+=a)l=sP(s,i[s],i[s+1],l);else for(s=n-a;s>=r;s-=a)l=sP(s,i[s],i[s+1],l);return l&&sA(l,l.next)&&(sL(l),l=l.next),l}function sw(i,r){if(!i)return i;r||(r=i);var n,a=i;do if(n=!1,a.steiner||!sA(a,a.next)&&0!==sM(a.prev,a,a.next))a=a.next;else{if(sL(a),(a=r=a.prev)===a.next)break;n=!0}while(n||a!==r);return r}function sT(i,r){return i.x-r.x}function sE(i,r,n,a,o){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-n)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-a)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function sS(i,r,n,a,o,s,l,h){return(o-l)*(r-h)>=(i-l)*(s-h)&&(i-l)*(a-h)>=(n-l)*(r-h)&&(n-l)*(s-h)>=(o-l)*(a-h)}function sM(i,r,n){return(r.y-i.y)*(n.x-r.x)-(r.x-i.x)*(n.y-r.y)}function sA(i,r){return i.x===r.x&&i.y===r.y}function sI(i,r,n,a){var o=sz(sM(i,r,n)),s=sz(sM(i,r,a)),l=sz(sM(n,a,i)),h=sz(sM(n,a,r));return o!==s&&l!==h||!(0!==o||!sC(i,n,r))||!(0!==s||!sC(i,a,r))||!(0!==l||!sC(n,i,a))||!(0!==h||!sC(n,r,a))}function sC(i,r,n){return r.x<=Math.max(i.x,n.x)&&r.x>=Math.min(i.x,n.x)&&r.y<=Math.max(i.y,n.y)&&r.y>=Math.min(i.y,n.y)}function sz(i){return i>0?1:i<0?-1:0}function sk(i,r){return 0>sM(i.prev,i,i.next)?sM(i,r,i.next)>=0&&sM(i,i.prev,r)>=0:0>sM(i,r,i.prev)||0>sM(i,i.next,r)}function sD(i,r){var n=new sR(i.i,i.x,i.y),a=new sR(r.i,r.x,r.y),o=i.next,s=r.prev;return i.next=r,r.prev=i,n.next=o,o.prev=n,a.next=n,n.prev=a,s.next=a,a.prev=s,a}function sP(i,r,n,a){var o=new sR(i,r,n);return a?(o.next=a.next,o.prev=a,a.next.prev=o,a.next=o):(o.prev=o,o.next=o),o}function sL(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 sR(i,r,n){this.i=i,this.x=r,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sB(i,r,n,a){for(var o=0,s=r,l=n-a;s<n;s+=a)o+=(i[l]-i[s])*(i[s+1]+i[l+1]),l=s;return o}function sO(i,r,n){var a=i[r];i[r]=i[n],i[n]=a}function sF(i,r){return i<r?-1:i>r?1:0}function sU(i,r){let n,a;let o=i.length;if(o<=1)return[i];let s=[];for(let r=0;r<o;r++){let o=function(i){let r=0;for(let n,a,o=0,s=i.length,l=s-1;o<s;l=o++)n=i[o],r+=((a=i[l]).x-n.x)*(n.y+a.y);return r}(i[r]);0!==o&&(i[r].area=Math.abs(o),void 0===a&&(a=o<0),a===o<0?(n&&s.push(n),n=[i[r]]):n.push(i[r]))}if(n&&s.push(n),r>1)for(let i=0;i<s.length;i++){var l;s[i].length<=r||(function i(r,n,a,o,s){for(;o>a;){if(o-a>600){var l=o-a+1,h=n-a+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);i(r,n,Math.max(a,Math.floor(n-h*c/l+d)),Math.min(o,Math.floor(n+(l-h)*c/l+d)),s)}var p=r[n],f=a,m=o;for(sO(r,a,n),s(r[o],p)>0&&sO(r,a,o);f<m;){for(sO(r,f,m),f++,m--;0>s(r[f],p);)f++;for(;s(r[m],p)>0;)m--}0===s(r[a],p)?sO(r,a,m):sO(r,++m,o),m<=n&&(a=m+1),n<=m&&(o=m-1)}}(l=s[i],r,1,s[i].length-1||l.length-1,sV||sF),s[i]=s[i].slice(0,r))}return s}function sV(i,r){return r.area-i.area}function sN(i,r,n){let a=n.patternDependencies,o=!1;for(let n of r){let r=n.paint.get(`${i}-pattern`);r.isConstant()||(o=!0);let s=r.constantOr(null);s&&(o=!0,a[s]=!0)}return o}function sj(i,r,n,a,o){let s=o.patternDependencies;for(let l of r){let r=l.paint.get(`${i}-pattern`).value;if("constant"!==r.kind){let i=r.evaluate({zoom:a},n,{},o.availableImages);s[i=i&&i.name?i.name:i]=!0,n.patterns[l.id]=i}}return n}({get exports(){return sx},set exports(t){sx=t}}
8).exports=sv,sx.default=sv,sv.deviation=function(i,r,n,a){var o=r&&r.length,s=Math.abs(sB(i,0,o?r[0]*n:i.length,n));if(o)for(var l=0,h=r.length;l<h;l++)s-=Math.abs(sB(i,r[l]*n,l<h-1?r[l+1]*n:i.length,n));var u=0;for(l=0;l<a.length;l+=3){var c=a[l]*n,d=a[l+1]*n,p=a[l+2]*n;u+=Math.abs((i[c]-i[p])*(i[d+1]-i[c+1])-(i[c]-i[d])*(i[p+1]-i[c+1]))}return 0===s&&0===u?0:Math.abs((u-s)/s)},sv.flatten=function(i){for(var r=i[0][0].length,n={vertices:[],holes:[],dimensions:r},a=0,o=0;o<i.length;o++){for(var s=0;s<i[o].length;s++)for(var l=0;l<r;l++)n.vertices.push(i[o][s][l]);o>0&&n.holes.push(a+=i[o-1].length)}return n};class sG{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new nM,this.indexArray=new nj,this.indexArray2=new nX,this.programConfigurations=new aw(i.layers,i.zoom),this.segments=new ak,this.segments2=new ak,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection}populate(i,r,n,a){this.hasPattern=sN("fill",this.layers,r);let o=this.layers[0].layout.get("fill-sort-key"),s=[];for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,d=oJ(l,i);if(!this.layers[0]._featureFilter.filter(new ns(this.zoom),d,n))continue;let p=o?o.evaluate(d,{},n,r.availableImages):void 0,f={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:i?d.geometry:oK(l,n,a),patterns:{},sortKey:p};s.push(f)}for(let a of(o&&s.sort((i,r)=>i.sortKey-r.sortKey),s)){let{geometry:o,index:s,sourceLayerIndex:l}=a;if(this.hasPattern){let i=sj("fill",this.layers,a,this.zoom,r);this.patternFeatures.push(i)}else this.addFeature(a,o,s,n,{},r.availableImages);r.featureIndex.insert(i[s].feature,o,s,l,this.index)}}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}addFeatures(i,r,n,a,o){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sy),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,r,n,a,o,s=[]){for(let i of sU(r,500)){let r=0;for(let n of i)r+=n.length;let n=this.segments.prepareSegment(r,this.layoutVertexArray,this.indexArray),a=n.vertexLength,o=[],s=[];for(let r of i){if(0===r.length)continue;r!==i[0]&&s.push(o.length/2);let n=this.segments2.prepareSegment(r.length,this.layoutVertexArray,this.indexArray2),a=n.vertexLength;this.layoutVertexArray.emplaceBack(r[0].x,r[0].y),this.indexArray2.emplaceBack(a+r.length-1,a),o.push(r[0].x),o.push(r[0].y);for(let i=1;i<r.length;i++)this.layoutVertexArray.emplaceBack(r[i].x,r[i].y),this.indexArray2.emplaceBack(a+i-1,a+i),o.push(r[i].x),o.push(r[i].y);n.vertexLength+=r.length,n.primitiveLength+=r.length}let l=sx(o,s);for(let i=0;i<l.length;i+=3)this.indexArray.emplaceBack(a+l[i],a+l[i+1],a+l[i+2]);n.vertexLength+=r,n.primitiveLength+=l.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,o,s,a)}}rT(sG,"FillBucket",{omit:["layers","patternFeatures"]});let sZ=new nx({"fill-sort-key":new ng(eW.layout_fill["fill-sort-key"])});var s$={paint:new nx({"fill-antialias":new n_(eW.paint_fill["fill-antialias"]),"fill-opacity":new ng(eW.paint_fill["fill-opacity"]),"fill-color":new ng(eW.paint_fill["fill-color"]),"fill-outline-color":new ng(eW.paint_fill["fill-outline-color"]),"fill-translate":new n_(eW.paint_fill["fill-translate"]),"fill-translate-anchor":new n_(eW.paint_fill["fill-translate-anchor"]),"fill-pattern":new ng(eW.paint_fill["fill-pattern"])}),layout:sZ};let sq=nE([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),sW=nE([{name:"a_centroid_pos",components:2,type:"Uint16"}]),sX=nE([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:sH}=sq;var sY={};function sK(i,r,n,a,o){this.properties={},this.extent=n,this.type=0,this._pbf=i,this._geometry=-1,this._keys=a,this._values=o,i.readFields(sJ,this,r)}function sJ(i,r,n){1==i?r.id=n.readVarint():2==i?function(i,r){for(var n=i.readVarint()+i.pos;i.pos<n;){var a=r._keys[i.readVarint()],o=r._values[i.readVarint()];r.properties[a]=o}}(n,r):3==i?r.type=n.readVarint():4==i&&(r._geometry=n.pos)}function sQ(i,r){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(s0,this,r),this.length=this._features.length}function s0(i,r,n){15===i?r.version=n.readVarint():1===i?r.name=n.readString():5===i?r.extent=n.readVarint():2===i?r._features.push(n.pos):3===i?r._keys.push(n.readString()):4===i&&r._values.push(function(i){for(var r=null,n=i.readVarint()+i.pos;i.pos<n;){var a=i.readVarint()>>3;r=1===a?i.readString():2===a?i.readFloat():3===a?i.readDouble():4===a?i.readVarint64():5===a?i.readVarint():6===a?i.readSVarint():7===a?i.readBoolean():null}return r}(n))}function s1(i,r,n){if(3===i){var a=new sQ(n,n.readVarint()+n.pos);a.length&&(r[a.name]=a)}}sK.types=["Unknown","Point","LineString","Polygon"],sK.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var r,n=i.readVarint()+i.pos,a=1,o=0,s=0,l=0,h=[];i.pos<n;){if(o<=0){var u=i.readVarint();a=7&u,o=u>>3}if(o--,1===a||2===a)s+=i.readSVarint(),l+=i.readSVarint(),1===a&&(r&&h.push(r),r=[]),r.push(new w(s,l));else{if(7!==a)throw Error("unknown command "+a);r&&r.push(r[0].clone())}}return r&&h.push(r),h},sK.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,n=1,a=0,o=0,s=0,l=1/0,h=-1/0,u=1/0,c=-1/0;i.pos<r;){if(a<=0){var d=i.readVarint();n=7&d,a=d>>3}if(a--,1===n||2===n)(o+=i.readSVarint())<l&&(l=o),o>h&&(h=o),(s+=i.readSVarint())<u&&(u=s),s>c&&(c=s);else if(7!==n)throw Error("unknown command "+n)}return[l,u,h,c]},sK.prototype.toGeoJSON=function(i,r,n){var a,o,s=this.extent*Math.pow(2,n),l=this.extent*i,h=this.extent*r,u=this.loadGeometry(),c=sK.types[this.type];function d(i){for(var r=0;r<i.length;r++){var n=i[r];i[r]=[360*(n.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+h)/s)*Math.PI/180)
8)-90]}}switch(this.type){case 1:var p=[];for(a=0;a<u.length;a++)p[a]=u[a][0];d(u=p);break;case 2:for(a=0;a<u.length;a++)d(u[a]);break;case 3:for(u=function(i){var r=i.length;if(r<=1)return[i];for(var n,a,o=[],s=0;s<r;s++){var l=function(i){for(var r,n,a=0,o=0,s=i.length,l=s-1;o<s;l=o++)a+=((n=i[l]).x-(r=i[o]).x)*(r.y+n.y);return a}(i[s]);0!==l&&(void 0===a&&(a=l<0),a===l<0?(n&&o.push(n),n=[i[s]]):n.push(i[s]))}return n&&o.push(n),o}(u),a=0;a<u.length;a++)for(o=0;o<u[a].length;o++)d(u[a][o])}1===u.length?u=u[0]:c="Multi"+c;var f={type:"Feature",geometry:{type:c,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f},sQ.prototype.feature=function(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new sK(this._pbf,r,this.extent,this._keys,this._values)};var s2=sY.VectorTile=function(i,r){this.layers=i.readFields(s1,{},r)},s3=sY.VectorTileFeature=sK;function s5(i,r,n,a){let o=[],s=0===a?(i,r,n,a,o,s)=>{i.push(new w(s,n+(s-r)/(a-r)*(o-n)))}:(i,r,n,a,o,s)=>{i.push(new w(r+(s-n)/(o-n)*(a-r),s))};for(let l of i){let i=[];for(let o of l){if(o.length<=2)continue;let l=[];for(let i=0;i<o.length-1;i++){let h=o[i].x,u=o[i].y,c=o[i+1].x,d=o[i+1].y,p=0===a?h:u,f=0===a?c:d;p<r?f>r&&s(l,h,u,c,d,r):p>n?f<n&&s(l,h,u,c,d,n):l.push(o[i]),f<r&&p>=r&&s(l,h,u,c,d,r),f>n&&p<=n&&s(l,h,u,c,d,n)}let h=o[o.length-1],u=0===a?h.x:h.y;u>=r&&u<=n&&l.push(h),l.length&&(h=l[l.length-1],l[0].x===h.x&&l[0].y===h.y||l.push(l[0]),i.push(l))}i.length&&o.push(i)}return o}sY.VectorTileLayer=sQ;let s4=s3.types;function s6(i,r,n,a,o,s,l,h){i.emplaceBack((r<<1)+l,(n<<1)+s,(Math.floor(8192*a)<<1)+o,Math.round(h))}function s8(i,r,n){i.emplaceBack(r.x,r.y,r.z,16384*n[0],16384*n[1],16384*n[2])}class s9{constructor(){this.acc=new w(0,0),this.polyCount=[]}startRing(i){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new w(i.x,i.y),this.max=new w(i.x,i.y))}append(i,r){this.currentPolyCount.edges++,this.acc._add(i);let n=this.min,a=this.max;i.x<n.x?n.x=i.x:i.x>a.x&&(a.x=i.x),i.y<n.y?n.y=i.y:i.y>a.y&&(a.y=i.y),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),r.x<0!=i.x<0&&this.addBorderIntersection(0,tK(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,tK(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,tK(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,tK(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,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]]);let n=this.borders[i];r<n[0]&&(n[0]=r),r>n[1]&&(n[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;let n=0===i.x?0:1;this.addBorderIntersection(n,r.y),this.addBorderIntersection(n,i.y)}else{let n=0===i.y?2:3;this.addBorderIntersection(n,r.x),this.addBorderIntersection(n,i.x)}}centroid(){let i=this.polyCount.reduce((i,r)=>i+r.edges,0);return 0!==i?this.acc.div(i)._round():new w(0,0)}span(){return new w(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0)}}class s7{constructor(i){this.zoom=i.zoom,this.canonical=i.canonical,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=i.projection,this.layoutVertexArray=new nI,this.centroidVertexArray=new n8,this.indexArray=new nj,this.programConfigurations=new aw(i.layers,i.zoom),this.segments=new ak,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.enableTerrain=i.enableTerrain}populate(i,r,n,a){for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.features=[],this.hasPattern=sN("fill-extrusion",this.layers,r),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(i){let r=Math.exp(Math.PI*(1-i.y/(1<<i.z)*2));return 80150034*r/(r*r+1)/8192/(1<<i.z)}(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,i)){let i=this.layers[0]._featureFilter.needGeometry,u=oJ(o,i);if(!this.layers[0]._featureFilter.filter(new ns(this.zoom),u,n))continue;let c={id:s,sourceLayerIndex:h,index:l,geometry:i?u.geometry:oK(o,n,a),properties:o.properties,type:o.type,patterns:{}},d=this.layoutVertexArray.length;this.hasPattern?this.features.push(sj("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,l,n,{},r.availableImages,a),r.featureIndex.insert(o,c.geometry,l,h,this.index,d)}this.sortBorders()}addFeatures(i,r,n,a,o){for(let i of this.features){let{geometry:s}=i;this.addFeature(i,s,i.index,r,n,a,o)}this.sortBorders()}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sH),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=i.createVertexBuffer(this.layoutVertexExtArray,sX.members,!0))),this.programConfigurations.upload(i),this.uploaded=!0}uploadCentroid(i){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,sW.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(i,r,n,a,o,s,l){var h;let u;let c=[new w(0,0),new w(8192,8192)],d=l.projection,p="globe"===d.name,f=this.enableTerrain&&!p?new s9:null,m="Polygon"===s4[i.type];p&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new nP);let _=sU(r,500);for(let i=_.length-1;i>=0;i--){let r=_[i];(0===r.length||(h=r[0]).every(i=>i.x<=0)||h.every(i=>i.x>=8192)||h.every(i=>i.y<=0)||h.every(i=>i.y>=8192))&&_.splice(i,1)}if(p)u=lo(_,c,a);else for(let i of(u=[],_))u.push({polygon:i,bounds:c});let g=m?this.edgeRadius:0;for(let{polygon:i,bounds:r}of u){let n=0,o=0;for(let r of i)m&&!r[0].equals(r[r.length-1])&&r.push(r[0]),o+=m?r.length-1:r.length;let s=this.segments.prepareSegment((m?5:4)*o,this.layoutVertexArray,this.indexArray);if(m){let r=[],o=[];for(let l of(n=s.vertexLength,i)){let n,h;l.length&&l!==i[0]&&o.push(r.length/2),n=l[1].sub(l[0])._perp()._unit();for(let i=1;i<l.length;i++){let o=l[i],u=l[i===l.length-1?1:i+1],{x:c,y:f}=o;
8if(g){h=u.sub(o)._perp()._unit();let i=n.add(h)._unit(),r=g*Math.min(4,1/(n.x*i.x+n.y*i.y));c+=r*i.x,f+=r*i.y,n=h}s6(this.layoutVertexArray,c,f,0,0,1,1,0),s.vertexLength++,r.push(o.x,o.y),p&&s8(this.layoutVertexExtArray,d.projectTilePoint(c,f,a),d.upVector(a,c,f))}}let l=sx(r,o);for(let i=0;i<l.length;i+=3)this.indexArray.emplaceBack(n+l[i],n+l[i+2],n+l[i+1]),s.primitiveLength++}for(let o of i){f&&o.length&&f.startRing(o[0]);let i,l,h,u=o.length>4&&lr(o[o.length-2],o[0],o[1]),c=g?function(i,r,n,a){let o=r.sub(i)._perp()._unit(),s=n.sub(r)._perp()._unit();return lt(i,r,n,le(o,s),a)}(o[o.length-2],o[0],o[1],g):0;l=o[1].sub(o[0])._perp()._unit();let _=!0;for(let y=1,x=0;y<o.length;y++){let v=o[y-1],b=o[y],w=o[y===o.length-1?1:y+1];if(f&&m&&f.currentPolyCount.top++,li(b,v,r)){g&&(l=w.sub(b)._perp()._unit(),_=!_);continue}f&&f.append(b,v);let T=b.sub(v)._perp(),E=T.x/(Math.abs(T.x)+Math.abs(T.y)),S=T.y>0?1:0,M=v.dist(b);if(x+M>32768&&(x=0),g){h=w.sub(b)._perp()._unit();let i=lt(v,b,w,le(l,h),g);isNaN(i)&&(i=0);let r=b.sub(v)._unit();v=v.add(r.mult(c))._round(),b=b.add(r.mult(-i))._round(),c=i,l=h}let A=s.vertexLength,I=o.length>4&&lr(v,b,w),C=ln(x,u,_);if(s6(this.layoutVertexArray,v.x,v.y,E,S,0,0,C),s6(this.layoutVertexArray,v.x,v.y,E,S,0,1,C),x+=M,C=ln(x,I,!_),u=I,s6(this.layoutVertexArray,b.x,b.y,E,S,0,0,C),s6(this.layoutVertexArray,b.x,b.y,E,S,0,1,C),s.vertexLength+=4,this.indexArray.emplaceBack(A+0,A+1,A+2),this.indexArray.emplaceBack(A+1,A+3,A+2),s.primitiveLength+=2,g){let a=n+(1===y?o.length-2:y-2),l=1===y?n:a+1;if(this.indexArray.emplaceBack(A+1,a,A+3),this.indexArray.emplaceBack(a,l,A+3),s.primitiveLength+=2,void 0===i&&(i=A),!li(w,o[y],r)){let r=y===o.length-1?i:s.vertexLength;this.indexArray.emplaceBack(A+2,A+3,r),this.indexArray.emplaceBack(A+3,r+1,r),this.indexArray.emplaceBack(A+3,l,r+1),s.primitiveLength+=3}_=!_}if(p){let i=this.layoutVertexExtArray,r=d.projectTilePoint(v.x,v.y,a),n=d.projectTilePoint(b.x,b.y,a),o=d.upVector(a,v.x,v.y),s=d.upVector(a,b.x,b.y);s8(i,r,o),s8(i,r,o),s8(i,n,s),s8(i,n,s)}}m&&(n+=o.length-1)}}if(f&&f.polyCount.length>0){if(f.borders){f.vertexArrayOffset=this.centroidVertexArray.length;let i=f.borders,r=this.featuresOnBorder.push(f)-1;for(let n=0;n<4;n++)i[n][0]!==Number.MAX_VALUE&&this.borders[n].push(r)}this.encodeCentroid(f.borders?void 0:f.centroid(),f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,o,s,a)}sortBorders(){for(let i=0;i<4;i++)this.borders[i].sort((r,n)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[n].borders[i][0])}encodeCentroid(i,r,n=!0){let a,o;if(i){if(0!==i.y){let n=r.span()._mult(this.tileToMeter);a=(Math.max(i.x,1)<<3)+Math.min(7,Math.round(n.x/10)),o=(Math.max(i.y,1)<<3)+Math.min(7,Math.round(n.y/10))}else a=Math.ceil(7*(i.x+450)),o=0}else a=0,o=+n;let s=n?this.centroidVertexArray.length:r.vertexArrayOffset;for(let i of r.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*i.edges+i.top);for(let r=0;r<i.top;r++)this.centroidVertexArray.emplace(s++,a,o);for(let r=0;r<2*i.edges;r++)this.centroidVertexArray.emplace(s++,0,o),this.centroidVertexArray.emplace(s++,a,o)}}}function le(i,r){let n=i.add(r)._unit();return i.x*n.x+i.y*n.y}function lt(i,r,n,a,o){let s=Math.sqrt(1-a*a);return Math.min(i.dist(r)/3,r.dist(n)/3,o*s/a)}function li(i,r,n){return i.x<n[0].x&&r.x<n[0].x||i.x>n[1].x&&r.x>n[1].x||i.y<n[0].y&&r.y<n[0].y||i.y>n[1].y&&r.y>n[1].y}function lr(i,r,n){if(i.x<0||i.x>=8192||r.x<0||r.x>=8192||n.x<0||n.x>=8192)return!1;let a=n.sub(r),o=a.perp(),s=i.sub(r);return(a.x*s.x+a.y*s.y)/Math.sqrt((a.x*a.x+a.y*a.y)*(s.x*s.x+s.y*s.y))>-.866&&o.x*s.x+o.y*s.y<0}function ln(i,r,n){let a=r?2|i:-3&i;return n?1|a:-2&a}function la(){let i=Math.tan(Math.PI/32);return oU*Math.sqrt(1+2*i*i)-oU}function lo(i,r,n){let a=1<<n.z,o=o$(n.x/a);return function(i,r,n,a,o=0,s){let l=[];if(!i.length||!n||!a)return l;let h=(i,r)=>{for(let n of i)l.push({polygon:n,bounds:r})},u=Math.ceil(Math.log2(n)),c=Math.ceil(Math.log2(a)),d=u-c,p=[];for(let i=0;i<Math.abs(d);i++)p.push(d>0?0:1);for(let i=0;i<Math.min(u,c);i++)p.push(0),p.push(1);let f=i;
8if(f=s5(f,r[0].y-o,r[1].y+o,1),!(f=s5(f,r[0].x-o,r[1].x+o,0)).length)return l;let m=[];for(p.length?m.push({polygons:f,bounds:r,depth:0}):h(f,r);m.length;){let i=m.pop(),r=i.depth,n=p[r],a=i.bounds[0],l=i.bounds[1],u=0===n?a.x:a.y,c=0===n?l.x:l.y,d=s?s(n,u,c):.5*(u+c),f=s5(i.polygons,u-o,d+o,n),_=s5(i.polygons,d-o,c+o,n);if(f.length){let i=[a,new w(0===n?d:l.x,1===n?d:l.y)];p.length>r+1?m.push({polygons:f,bounds:i,depth:r+1}):h(f,i)}if(_.length){let i=[new w(0===n?d:a.x,1===n?d:a.y),l];p.length>r+1?m.push({polygons:_,bounds:i,depth:r+1}):h(_,i)}}return l}(i,r,Math.ceil((o$((n.x+1)/a)-o)/11.25),Math.ceil((oq(n.y/a)-oq((n.y+1)/a))/11.25),1,(i,r,o)=>{if(0===i)return .5*(r+o);{let i=oq((n.y+r/8192)/a);return(oZ(.5*(oq((n.y+o/8192)/a)+i))*a-n.y)*8192}})}rT(s7,"FillExtrusionBucket",{omit:["layers","features"]}),rT(s9,"PartMetadata");let ls=new nx({"fill-extrusion-edge-radius":new n_(eW["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var ll={paint:new nx({"fill-extrusion-opacity":new n_(eW["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ng(eW["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new n_(eW["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new n_(eW["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ng(eW["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ng(eW["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ng(eW["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new n_(eW["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new n_(eW["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new n_(eW["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:ls};function lh(i,r,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[i*a-2*Math.PI*6378137/2,r*a-2*Math.PI*6378137/2]}class lu{constructor(i,r,n){this.z=i,this.x=r,this.y=n,this.key=lp(0,i,i,r,n)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}url(i,r){var n,a,o,s,l;let h=(n=this.x,a=this.y,s=lh(256*n,256*(a=Math.pow(2,o=this.z)-a-1),o),l=lh(256*(n+1),256*(a+1),o),s[0]+","+s[1]+","+l[0]+","+l[1]),u=function(i,r,n){let a,o="";for(let s=i;s>0;s--)o+=(r&(a=1<<s-1)?1:0)+(n&a?2:0);return o}(this.z,this.x,this.y);return i[(this.x+this.y)%i.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("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",u).replace("{bbox-epsg-3857}",h)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lc{constructor(i,r){this.wrap=i,this.canonical=r,this.key=lp(i,r.z,r.z,r.x,r.y)}}class ld{constructor(i,r,n,a,o){this.overscaledZ=i,this.wrap=r,this.canonical=new lu(n,+a,+o),this.key=0===r&&i===n?this.canonical.key:lp(r,i,n,a,o)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){let r=this.canonical.z-i;return i>this.canonical.z?new ld(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ld(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return lp(this.wrap*+r,i,this.canonical.z,this.canonical.x,this.canonical.y);{let n=this.canonical.z-i;return lp(this.wrap*+r,i,i,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;let r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ<this.overscaledZ&&i.canonical.x===this.canonical.x>>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new ld(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new ld(r,this.wrap,r,n,a),new ld(r,this.wrap,r,n+1,a),new ld(r,this.wrap,r,n,a+1),new ld(r,this.wrap,r,n+1,a+1)]}isLessThan(i){return this.wrap<i.wrap||!(this.wrap>i.wrap)&&(this.overscaledZ<i.overscaledZ||!(this.overscaledZ>
8i.overscaledZ)&&(this.canonical.x<i.canonical.x||!(this.canonical.x>i.canonical.x)&&this.canonical.y<i.canonical.y))}wrapped(){return new ld(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(i){return new ld(this.overscaledZ,i,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new lc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function lp(i,r,n,a,o){let s=1<<Math.min(n,22),l=o%s*s+a%s;return i&&n<22&&(l+=s*s*((i<0?-2*i-1:2*i)%(1<<2*(22-n)))),16*(32*l+n)+(r-n)}rT(lu,"CanonicalTileID"),rT(ld,"OverscaledTileID",{omit:["projMatrix"]});class lf extends w{constructor(i,r,n){super(i,r),this.z=n}}function lm(i,r){return i.x*r.x+i.y*r.y}function l_(i,r){if(1===i.length){let n,a=0,o=r[a++];for(;!n||o.equals(n);)if(!(n=r[a++]))return 1/0;for(;a<r.length;a++){let s=r[a],l=i[0],h=n.sub(o),u=s.sub(o),c=l.sub(o),d=lm(h,h),p=lm(h,u),f=lm(u,u),m=lm(c,h),_=lm(c,u),g=d*f-p*p,y=(f*m-p*_)/g,x=(d*_-p*m)/g,v=o.z*(1-y-x)+n.z*y+s.z*x;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let n of r)i=Math.min(i,n.z);return i}}function lg(i,r,n,a,o,s,l,h){let u=l*o.getElevationAt(i,r,!0,!0),c=0!==s[0],d=c?0===s[1]?l*(s[0]/7-450):l*function(i,r,n){var a,o;let s=Math.floor(r[0]/8),l=Math.floor(r[1]/8),h=10*(r[0]-8*s),u=10*(r[1]-8*l),c=i.getElevationAt(s,l,!0,!0),d=i.getMeterToDEM(n),p=Math.floor(.5*(h*d-1)),f=Math.floor(.5*(u*d-1)),m=i.tileCoordToPixel(s,l),_=2*p+1,g=2*f+1,y=(a=m.x-p,o=m.y-f,[i.getElevationAtPixel(a,o,!0),i.getElevationAtPixel(a+g,o,!0),i.getElevationAtPixel(a,o+g,!0),i.getElevationAtPixel(a+_,o+g,!0)]),x=Math.abs(y[0]-y[1]);return c+Math.max(Math.min(.25,.5*d*(x+Math.abs(y[2]-y[3]))/_)*h,Math.min(.25,.5*d*(Math.abs(y[0]-y[2])+Math.abs(y[1]-y[3]))/g)*u)}(o,s,h):u;return{base:u+(0===n)?-1:n,top:c?Math.max(d+a,u+n+2):u+a}}let{members:ly}=nE([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:lx}=nE([{name:"a_packed",components:4,type:"Float32"}]),lv=s3.types,lb=Math.cos(Math.PI/180*37.5);class lw{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.projection=i.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new nC,this.layoutVertexArray2=new nz,this.indexArray=new nj,this.programConfigurations=new aw(i.layers,i.zoom),this.segments=new ak,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,a){this.hasPattern=sN("line",this.layers,r);let o=this.layers[0].layout.get("line-sort-key"),s=[];for(let{feature:r,id:l,index:h,sourceLayerIndex:u}of i){let i=this.layers[0]._featureFilter.needGeometry,c=oJ(r,i);if(!this.layers[0]._featureFilter.filter(new ns(this.zoom),c,n))continue;let d=o?o.evaluate(c,{},n):void 0,p={id:l,properties:r.properties,type:r.type,sourceLayerIndex:u,index:h,geometry:i?c.geometry:oK(r,n,a),patterns:{},sortKey:d};s.push(p)}o&&s.sort((i,r)=>i.sortKey-r.sortKey);let{lineAtlas:l,featureIndex:h}=r,u=this.addConstantDashes(l);for(let a of s){let{geometry:o,index:s,sourceLayerIndex:c}=a;if(u&&this.addFeatureDashes(a,l),this.hasPattern){let i=sj("line",this.layers,a,this.zoom,r);this.patternFeatures.push(i)}else this.addFeature(a,o,s,n,l.positions,r.availableImages);h.insert(i[s].feature,o,s,c,this.index)}}addConstantDashes(i){let r=!1;for(let n of this.layers){let a=n.paint.get("line-dasharray").value,o=n.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==o.kind)r=!0;else{let r=o.value,n=a.value;if(!n)continue;i.addDash(n,r)}}return r}addFeatureDashes(i,r){let n=this.zoom;for(let a of this.layers){let o,s;let l=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if("constant"!==l.kind||"constant"!==h.kind){if("constant"===l.kind){if(!(o=l.value))continue}else o=l.evaluate({zoom:n},i);s="constant"===h.kind?h.value:h.evaluate({zoom:n},i),r.addDash(o,s),i.patterns[a.id]=r.getKey(o,s)}}}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}
8addFeatures(i,r,n,a,o){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,lx)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,ly),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&i.properties.hasOwnProperty("mapbox_clip_start")&&i.properties.hasOwnProperty("mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,r,n,a,o,s){let l=this.layers[0].layout,h=l.get("line-join").evaluate(i,{}),u=l.get("line-cap").evaluate(i,{}),c=l.get("line-miter-limit"),d=l.get("line-round-limit");for(let n of(this.lineClips=this.lineFeatureClips(i),r))this.addLine(n,i,h,u,c,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,o,s,a)}addLine(i,r,n,a,o,s){let l,h,u,c,d;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let r=0;r<i.length-1;r++)this.totalDistance+=i[r].dist(i[r+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let p="Polygon"===lv[r.type],f=i.length;for(;f>=2&&i[f-1].equals(i[f-2]);)f--;let m=0;for(;m<f-1&&i[m].equals(i[m+1]);)m++;if(f<(p?3:2))return;"bevel"===n&&(o=1.05);let _=this.overscaling<=16?122880/(512*this.overscaling):0,g=this.segments.prepareSegment(10*f,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,p&&(l=i[f-2],d=i[m].sub(l)._unit()._perp());for(let r=m;r<f;r++){if((u=r===f-1?p?i[m+1]:void 0:i[r+1])&&i[r].equals(u))continue;d&&(c=d),l&&(h=l),l=i[r],d=u?u.sub(l)._unit()._perp():c;let y=(c=c||d).add(d);0===y.x&&0===y.y||y._unit();let x=c.x*d.x+c.y*d.y,v=y.x*d.x+y.y*d.y,b=0!==v?1/v:1/0,w=2*Math.sqrt(2-2*v),T=v<lb&&h&&u,E=c.x*d.y-c.y*d.x>0;if(T&&r>m){let i=l.dist(h);if(i>2*_){let r=l.sub(l.sub(h)._mult(_/i)._round());this.updateDistance(h,r),this.addCurrentVertex(r,c,0,0,g),h=r}}let S=h&&u,M=S?n:p?"butt":a;if(S&&"round"===M&&(b<s?M="miter":b<=2&&(M="fakeround")),"miter"===M&&b>o&&(M="bevel"),"bevel"===M&&(b>2&&(M="flipbevel"),b<o&&(M="miter")),h&&this.updateDistance(h,l),"miter"===M)y._mult(b),this.addCurrentVertex(l,y,0,0,g);else if("flipbevel"===M){if(b>100)y=d.mult(-1);else{let i=b*c.add(d).mag()/c.sub(d).mag();y._perp()._mult(i*(E?-1:1))}this.addCurrentVertex(l,y,0,0,g),this.addCurrentVertex(l,y.mult(-1),0,0,g)}else if("bevel"===M||"fakeround"===M){let i=-Math.sqrt(b*b-1),r=E?i:0,n=E?0:i;if(h&&this.addCurrentVertex(l,c,r,n,g),"fakeround"===M){let i=Math.round(180*w/Math.PI/20);for(let r=1;r<i;r++){let n=r/i;if(.5!==n){let i=n-.5;n+=n*i*(n-1)*((1.0904+x*(x*(3.55645-1.43519*x)-3.2452))*i*i+(.848013+x*(.215638*x-1.06021)))}let a=d.sub(c)._mult(n)._add(c)._unit()._mult(E?-1:1);this.addHalfVertex(l,a.x,a.y,!1,E,0,g)}}u&&this.addCurrentVertex(l,d,-r,-n,g)}else if("butt"===M)this.addCurrentVertex(l,y,0,0,g);else if("square"===M){let i=h?1:-1;h||this.addCurrentVertex(l,y,i,i,g),this.addCurrentVertex(l,y,0,0,g),h&&this.addCurrentVertex(l,y,i,i,g)}else"round"===M&&(h&&(this.addCurrentVertex(l,c,0,0,g),this.addCurrentVertex(l,c,1,1,g,!0)),u&&(this.addCurrentVertex(l,d,-1,-1,g,!0),this.addCurrentVertex(l,d,0,0,g)));if(T&&r<f-1){let i=l.dist(u);if(i>2*_){let r=l.add(u.sub(l)._mult(_/i)._round());this.updateDistance(l,r),this.addCurrentVertex(r,d,0,0,g),l=r}}}}addCurrentVertex(i,r,n,a,o,s=!1){let l=r.y*a-r.x,h=-r.y-r.x*a;this.addHalfVertex(i,r.x+r.y*n,r.y-r.x*n,s,!1,n,o),this.addHalfVertex(i,l,h,s,!0,-a,o)}addHalfVertex({x:i,y:r},n,a,o,s,l,h){this.layoutVertexArray.emplaceBack((i<<1)+(o?1:0),(r<<1)+(s?1:0),Math.round(63*n)+128,Math.round(63*a)+128,1+(0===l?0:l<0?-1:1),0,this.lineS
8oFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);let u=h.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),h.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){if(this.lineClips){let i=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(i,r){this.distance+=i.dist(r),this.updateScaledDistance()}}rT(lw,"LineBucket",{omit:["layers","patternFeatures"]});let lT=new nx({"line-cap":new ng(eW.layout_line["line-cap"]),"line-join":new ng(eW.layout_line["line-join"]),"line-miter-limit":new n_(eW.layout_line["line-miter-limit"]),"line-round-limit":new n_(eW.layout_line["line-round-limit"]),"line-sort-key":new ng(eW.layout_line["line-sort-key"])});var lE={paint:new nx({"line-opacity":new ng(eW.paint_line["line-opacity"]),"line-color":new ng(eW.paint_line["line-color"]),"line-translate":new n_(eW.paint_line["line-translate"]),"line-translate-anchor":new n_(eW.paint_line["line-translate-anchor"]),"line-width":new ng(eW.paint_line["line-width"]),"line-gap-width":new ng(eW.paint_line["line-gap-width"]),"line-offset":new ng(eW.paint_line["line-offset"]),"line-blur":new ng(eW.paint_line["line-blur"]),"line-dasharray":new ng(eW.paint_line["line-dasharray"]),"line-pattern":new ng(eW.paint_line["line-pattern"]),"line-gradient":new ny(eW.paint_line["line-gradient"]),"line-trim-offset":new n_(eW.paint_line["line-trim-offset"])}),layout:lT};let lS=new class extends ng{possiblyEvaluate(i,r){return r=new ns(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,n,a){return r=R({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,n,a)}}(lE.paint.properties["line-width"].specification);lS.useIntegerZoom=!0;let lM=nE([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),lA=nE([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),lI=nE([{name:"a_projected_pos",components:4,type:"Float32"}],4);nE([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let lC=nE([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),lz=nE([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);nE([{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"}]);let lk=nE([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lD=nE([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function lP(i,r){let{expression:n}=r;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new ns(i+1))};if("source"===n.kind)return{kind:"source"};{let{zoomStops:r,interpolationType:a}=n,o=0;for(;o<r.length&&r[o]<=i;)o++;let s=o=Math.max(0,o-1);for(;s<r.length&&r[s]<i+1;)s++;s=Math.min(r.length-1,s);let l=r[o],h=r[s];return"composite"===n.kind?{kind:"composite",minZoom:l,maxZoom:h,interpolationType:a}:{kind:"camera",minZoom:l,maxZoom:h,minSize:n.evaluate(new ns(l)),maxSize:n.evaluate(new ns(h)),interpolationType:a}}}function lL(i,{uSize:r,uSizeT:n},{lowerSize:a,upperSize:o}){return"source"===i.kind?a/128:"composite"===i.kind?tK(a/128,o/128,n):r}function lR(i,r){let n=0,a=0;if("constant"===i.kind)a=i.layoutSize;else if("source"!==i.kind){let{interpolationType:o,minZoom:s,maxZoom:l}=i,h=o?z(ir.interpolationFactor(o,r,s,l),0,1):0;"camera"===i.kind?a=tK(i.minSize,i.maxSize,h):n=h}return{uSizeT:n,uSize:a}}nE([{name:"triangle",components:3,type:"Uint16"}]),nE([{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"}]),nE([{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"}]),nE([{type:"Float32",name:"offsetX"}]),nE([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var lB=Object.freeze({__proto__:null,getSizeData:lP,evaluateSizeForFeature:lL,evaluateSizeForZoom:lR,SIZE_PACK_FACTOR:128});let lO={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var lF=function(i,r,n,a,o){var s,l,h=8*o-a-1,u=(1<<h)-1,c=u>>1,d=-7,p=n?o-1:0,f=n?-1:1,m=i[r+p];for(p+=f,s=m&(1<<-d)-1,m>>=-d,d+=h;d>0;s=256*s+i[r+p],p+=f,d-=8);for(l=s&(1<<-d)-1,s>>=-d,d+=a;d>0;l=256*l+i[r+p],p+=f,d-=8);if(0===s)s=1-c;else{if(s===u)return l?NaN:1/0*(m?-1:1);l+=Math.pow(2,a),s-=c}return(m?-1:1)*l*Math.pow(2,s-a)},lU=function(i,r,n,a,o,s){var l,h,u,c=8*s-o-1,d=(1<<c)-1,p=d>>1,f=23===o?5960464477539062e-23:0,m=a?0:s-1,_=a?1:-1,g=r<0||0===r&&1/r<0?1:0;for(isNaN(r=Math.abs(r))||r===1/0?(h=isNaN(r)?1:0,l=d):(l=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-l))<1&&(l--,u*=2),(r+=l+p>=1?f/u:f*Math.pow(2,1-p))*u>=2&&(l++,u/=2),l+p>=d?(h=0,l=d):l+p>=1?(h=(r*u-1)*Math.pow(2,o),l+=p):(h=r*Math.pow(2,p-1)*Math.pow(2,o),l=0));o>=8;i[n+m]=255&h,m+=_,h/=256,o-=8);for(l=l<<o|h,c+=o;c>0;i[n+m]=255&l,m+=_,l/=256,c-=8);i[n+m-_]|=128*g};function lV(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}lV.Varint=0,lV.Fixed64=1,lV.Bytes=2,lV.Fixed32=5;var lN="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lj(i){return i.type===lV.Bytes?i.readVarint()+i.pos:i.pos+1}function lG(i,r,n){var a=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));n.realloc(a);for(var o=n.pos-1;o>=i;o--)n.buf[o+a]=n.buf[o]}function lZ(i,r){for(var n=0;n<i.length;n++)r.writeVarint(i[n])}function l$(i,r){for(var n=0;n<i.length;n++)r.writeSVarint(i[n])}function lq(i,r){for(var n=0;n<i.length;n++)r.writeFloat(i[n])}function lW(i,r){for(var n=0;n<i.length;n++)r.writeDouble(i[n])}function lX(i,r){for(var n=0;n<i.length;n++)r.writeBoolean(i[n])}function lH(i,r){for(var n=0;n<i.length;n++)r.writeFixed32(i[n])}function lY(i,r){for(var n=0;n<i.length;n++)r.writeSFixed32(i[n])}function lK(i,r){for(var n=0;n<i.length;
8n++)r.writeFixed64(i[n])}function lJ(i,r){for(var n=0;n<i.length;n++)r.writeSFixed64(i[n])}function lQ(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+16777216*i[r+3]}function l0(i,r,n){i[n]=r,i[n+1]=r>>>8,i[n+2]=r>>>16,i[n+3]=r>>>24}function l1(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}function l2(i,r,n){r.glyphs=[],1===i&&n.readMessage(l3,r)}function l3(i,r,n){if(3===i){let{id:i,bitmap:a,width:o,height:s,left:l,top:h,advance:u}=n.readMessage(l5,{});r.glyphs.push({id:i,bitmap:new sp({width:o+6,height:s+6},a),metrics:{width:o,height:s,left:l,top:h,advance:u}})}else 4===i?r.ascender=n.readSVarint():5===i&&(r.descender=n.readSVarint())}function l5(i,r,n){1===i?r.id=n.readVarint():2===i?r.bitmap=n.readBytes():3===i?r.width=n.readVarint():4===i?r.height=n.readVarint():5===i?r.left=n.readSVarint():6===i?r.top=n.readSVarint():7===i&&(r.advance=n.readVarint())}function l4(i){let r=0,n=0;for(let a of i)r+=a.w*a.h,n=Math.max(n,a.w);i.sort((i,r)=>r.h-i.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0}],o=0,s=0;for(let r of i)for(let i=a.length-1;i>=0;i--){let n=a[i];if(!(r.w>n.w||r.h>n.h)){if(r.x=n.x,r.y=n.y,s=Math.max(s,r.y+r.h),o=Math.max(o,r.x+r.w),r.w===n.w&&r.h===n.h){let r=a.pop();i<a.length&&(a[i]=r)}else r.h===n.h?(n.x+=r.w,n.w-=r.w):(r.w===n.w||a.push({x:n.x+r.w,y:n.y,w:n.w-r.w,h:r.h}),n.y+=r.h,n.h-=r.h);break}}return{w:o,h:s,fill:r/(o*s)||0}}lV.prototype={destroy:function(){this.buf=null},readFields:function(i,r,n){for(n=n||this.length;this.pos<n;){var a=this.readVarint(),o=a>>3,s=this.pos;this.type=7&a,i(o,r,this),this.pos===s&&this.skip(a)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=lQ(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=l1(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=lQ(this.buf,this.pos)+4294967296*lQ(this.buf,this.pos+4);return this.pos+=8,i},readSFixed64:function(){var i=lQ(this.buf,this.pos)+4294967296*l1(this.buf,this.pos+4);return this.pos+=8,i},readFloat:function(){var i=lF(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=lF(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,n,a=this.buf;return r=127&(n=a[this.pos++]),n<128?r:(r|=(127&(n=a[this.pos++]))<<7,n<128?r:(r|=(127&(n=a[this.pos++]))<<14,n<128?r:(r|=(127&(n=a[this.pos++]))<<21,n<128?r:function(i,r,n){var a,o,s,l=n.buf;if(o=(112&(s=l[n.pos++]))>>4,s<128||(o|=(127&(s=l[n.pos++]))<<3,s<128)||(o|=(127&(s=l[n.pos++]))<<10,s<128)||(o|=(127&(s=l[n.pos++]))<<17,s<128)||(o|=(127&(s=l[n.pos++]))<<24,s<128)||(o|=(1&(s=l[n.pos++]))<<31,s<128))return a=o,r?4294967296*a+(i>>>0):4294967296*(a>>>0)+(i>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(n=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?-((i+1)/2):i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i,r=this.readVarint()+this.pos,n=this.pos;return this.pos=r,r-n>=12&&lN?(i=this.buf,lN.decode(i.subarray(n,r))):function(i,r,n){for(var a="",o=r;o<n;){var s,l,h,u=i[o],c=null,d=u>239?4:u>223?3:u>191?2:1;if(o+d>n)break;1===d?u<128&&(c=u):2===d?128==(192&(s=i[o+1]))&&(c=(31&u)<<6|63&s)<=127&&(c=null):3===d?(l=i[o+2],128==(192&(s=i[o+1]))&&128==(192&l)&&((c=(15&u)<<12|(63&s)<<6|63&l)<=2047||c>=55296&&c<=57343)&&(c=null)):4===d&&(l=i[o+2],h=i[o+3],128==(192&(s=i[o+1]))&&128==(192&l)&&128==(192&h)&&((c=(15&u)<<18|(63&s)<<12|(63&l)<<6|63&h)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,d=1):c>65535&&(c-=65536,a+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),a+=String.fromCharCode(c),o+=d}return a}(this.buf,n,r)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==lV.Bytes)return i.push(this.readVarint(r));var n=lj(this);for(i=i||[];this.pos<n;)i.push(this.readVarint(r));return i},readPackedSVarint:function(i){if(this.type!==lV.Bytes)return i.push(this.readSVarint());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readSVarint());return i}
vendor: 5,296 bytes, line 8
8,readPackedBoolean:function(i){if(this.type!==lV.Bytes)return i.push(this.readBoolean());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==lV.Bytes)return i.push(this.readFloat());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==lV.Bytes)return i.push(this.readDouble());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==lV.Bytes)return i.push(this.readFixed32());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==lV.Bytes)return i.push(this.readSFixed32());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==lV.Bytes)return i.push(this.readFixed64());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==lV.Bytes)return i.push(this.readSFixed64());var r=lj(this);for(i=i||[];this.pos<r;)i.push(this.readSFixed64());return i},skip:function(i){var r=7&i;if(r===lV.Varint)for(;this.buf[this.pos++]>127;);else if(r===lV.Bytes)this.pos=this.readVarint()+this.pos;else if(r===lV.Fixed32)this.pos+=4;else{if(r!==lV.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r<this.pos+i;)r*=2;if(r!==this.length){var n=new Uint8Array(r);n.set(this.buf),this.buf=n,this.length=r}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),l0(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),l0(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),l0(this.buf,-1&i,this.pos),l0(this.buf,Math.floor(23283064365386963e-26*i),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),l0(this.buf,-1&i,this.pos),l0(this.buf,Math.floor(23283064365386963e-26*i),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(i,r){var n,a,o,s,l;if(i>=0?(n=i%4294967296|0,a=i/4294967296|0):(a=~(-i/4294967296),4294967295^(n=~(-i%4294967296))?n=n+1|0:(n=0,a=a+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),o=n,r.buf[r.pos++]=127&o|128,o>>>=7,r.buf[r.pos++]=127&o|128,o>>>=7,r.buf[r.pos++]=127&o|128,o>>>=7,r.buf[r.pos++]=127&o|128,r.buf[r.pos]=127&(o>>>=7),l=(7&(s=a))<<4,r.buf[r.pos++]|=l|((s>>>=3)?128:0),s&&(r.buf[r.pos++]=127&s|((s>>>=7)?128:0),s&&(r.buf[r.pos++]=127&s|((s>>>=7)?128:0),s&&(r.buf[r.pos++]=127&s|((s>>>=7)?128:0),s&&(r.buf[r.pos++]=127&s|((s>>>=7)?128:0),s&&(r.buf[r.pos++]=127&s)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?-(2*i)-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(i,r,n){for(var a,o,s=0;s<r.length;s++){if((a=r.charCodeAt(s))>55295&&a<57344){if(!o){a>56319||s+1===r.length?(i[n++]=239,i[n++]=191,i[n++]=189):o=a;continue}if(a<56320){i[n++]=239,i[n++]=191,i[n++]=189,o=a;continue}a=o-55296<<10|a-56320|65536,o=null}else o&&(i[n++]=239,i[n++]=191,i[n++]=189,o=null);a<128?i[n++]=a:(a<2048?i[n++]=a>>6|192:(a<65536?i[n++]=a>>12|224:(i[n++]=a>>18|240,i[n++]=a>>12&63|128),i[n++]=a>>6&63|128),i[n++]=63&a|128)}return n}(this.buf,i,this.pos);var n=this.pos-r;n>=128&&lG(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),lU(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),lU(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var n=0;n<r;n++)this.buf[this.pos++]=i[n]},writeRawMessage:function(i,r){this.pos++;var n=this.pos;i(r,this);var a=this.pos-n;a>=128&&lG(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,r,n){this.writeTag(i,lV.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,lZ,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,l$,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,lX,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,lq,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,lW,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,lH,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,lY,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,lK,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,lJ,r)},writeBytesField:function(i,r){this.writeTag(i,lV.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,lV.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,lV.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,lV.Fixed64),this.writeFixed64
8(r)},writeSFixed64Field:function(i,r){this.writeTag(i,lV.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,lV.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,lV.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,lV.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,lV.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,lV.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,!!r)}};class l6{constructor(i,{pixelRatio:r,version:n,stretchX:a,stretchY:o,content:s}){this.paddedRect=i,this.pixelRatio=r,this.stretchX=a,this.stretchY=o,this.content=s,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 l8{constructor(i,r){let n={},a={};this.haveRenderCallbacks=[];let o=[];this.addImages(i,n,o),this.addImages(r,a,o);let{w:s,h:l}=l4(o),h=new sf({width:s||1,height:l||1});for(let r in i){let a=i[r],o=n[r].paddedRect;sf.copy(a.data,h,{x:0,y:0},{x:o.x+1,y:o.y+1},a.data)}for(let i in r){let n=r[i],o=a[i].paddedRect,s=o.x+1,l=o.y+1,u=n.data.width,c=n.data.height;sf.copy(n.data,h,{x:0,y:0},{x:s,y:l},n.data),sf.copy(n.data,h,{x:0,y:c-1},{x:s,y:l-1},{width:u,height:1}),sf.copy(n.data,h,{x:0,y:0},{x:s,y:l+c},{width:u,height:1}),sf.copy(n.data,h,{x:u-1,y:0},{x:s-1,y:l},{width:1,height:c}),sf.copy(n.data,h,{x:0,y:0},{x:s+u,y:l},{width:1,height:c})}this.image=h,this.iconPositions=n,this.patternPositions=a}addImages(i,r,n){for(let a in i){let o=i[a],s={x:0,y:0,w:o.data.width+2,h:o.data.height+2};n.push(s),r[a]=new l6(s,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(i,r){for(let n in this.haveRenderCallbacks=this.haveRenderCallbacks.filter(r=>i.hasImage(r)),i.dispatchRenderCallbacks(this.haveRenderCallbacks),i.updatedImages)this.patchUpdatedImage(this.iconPositions[n],i.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],i.getImage(n),r)}patchUpdatedImage(i,r,n){if(!i||!r||i.version===r.version)return;i.version=r.version;let[a,o]=i.tl;n.update(r.data,void 0,{x:a,y:o})}}rT(l6,"ImagePosition"),rT(l8,"ImageAtlas");let l9={horizontal:1,vertical:2,horizontalOnly:3};class l7{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(i,r){let n=new l7;return n.scale=i||1,n.fontStack=r,n}static forImage(i){let r=new l7;return r.imageName=i,r}}class he{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r){let n=new he;for(let a=0;a<i.sections.length;a++){let o=i.sections[a];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(i){return this.sections[this.sectionIndex[i]]}getSections(){return this.sections}getSectionIndex(i){return this.sectionIndex[i]}getCharCode(i){return this.text.charCodeAt(i)}verticalizePunctuation(i){this.text=function(i,r){let n="";for(let a=0;a<i.length;a++){let o=i.charCodeAt(a+1)||null,s=i.charCodeAt(a-1)||null;n+=!r&&(o&&r3(o)&&!lO[i[a+1]]||s&&r3(s)&&!lO[i[a-1]])||!lO[i[a]]?i[a]:lO[i[a]]}return n}(this.text,i)}trim(){let i=0;for(let r=0;r<this.text.length&&hi[this.text.charCodeAt(r)];r++)i++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=i&&hi[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(i,r),this.sectionIndex=this.sectionIndex.slice(i,r)}substring(i,r){let n=new he;return n.text=this.text.substring(i,r),n.sectionIndex=this.sectionIndex.slice(i,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(l7.forText(i.scale,i.fontStack||r));let n=this.sections.length-1;for(let r=0;r<i.text.length;++r)this.sectionIndex.push(n)}addImageSection(i){let r=i.image?i.image.name:"";if(0===r.length)return void W("Can't add FormattedSection with an empty image.");let n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(l7.forImage(r)),this.sectionIndex.push(this.sections.length-1)):W("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ht(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_){let g=he.fromFeature(i,o);p===l9.vertical&&g.verticalizePunctuation(f);
8let y=[],x=function(i,r,n,a,o,s){if(!i)return[];let l=[],h=function(i,r,n,a,o,s){let l=0;for(let n=0;n<i.length();n++){let h=i.getSection(n);l+=hn(i.getCharCode(n),h,a,o,r,s)}return l/Math.max(1,Math.ceil(l/n))}(i,r,n,a,o,s),u=i.text.indexOf("​")>=0,c=0;for(let n=0;n<i.length();n++){let d=i.getSection(n),p=i.getCharCode(n);if(hi[p]||(c+=hn(p,d,a,o,r,s)),n<i.length()-1){let r=!(p<11904||!(rF(p)||rO(p)||rK(p)||rX(p)||rj(p)||rk(p)||rU(p)||rL(p)||rG(p)||rZ(p)||rN(p)||r0(p)||rR(p)||rP(p)||rD(p)||rV(p)||rB(p)||rY(p)||rq(p)||r$(p)));(hr[p]||r||d.imageName)&&l.push(ho(n+1,c,h,l,function(i,r,n){let a=0;return 10===i&&(a-=1e4),n&&(a+=150),40!==i&&65288!==i||(a+=50),41!==r&&65289!==r||(a+=50),a}(p,i.getCharCode(n+1),r&&u),!1))}}return function i(r){return r?i(r.priorBreak).concat(r.index):[]}(ho(i.length(),c,h,l,0,!0))}(g,c,s,r,a,m),{processBidirectionalText:v,processStyledBidirectionalText:b}=no;if(v&&1===g.sections.length)for(let i of v(g.toString(),x)){let r=new he;r.text=i,r.sections=g.sections;for(let n=0;n<i.length;n++)r.sectionIndex.push(0);y.push(r)}else if(b)for(let i of b(g.text,g.sectionIndex,x)){let r=new he;r.text=i[0],r.sectionIndex=i[1],r.sections=g.sections,y.push(r)}else y=function(i,r){let n=[],a=i.text,o=0;for(let a of r)n.push(i.substring(o,a)),o=a;return o<a.length&&n.push(i.substring(o,a.length)),n}(g,x);let w=[],T={positionedLines:w,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(i,r,n,a,o,s,l,h,u,c,d,p){let f=0,m=0,_=0,g="right"===h?1:"left"===h?0:.5,y=!1;for(let i of o){for(let n of i.getSections()){if(n.imageName)continue;let i=r[n.fontStack];if(i&&!(y=void 0!==i.ascender&&void 0!==i.descender))break}if(!y)break}let x=0;for(let l of o){l.trim();let o=l.getMaxScale(),h=(o-1)*24,v={positionedGlyphs:[],lineOffset:0};i.positionedLines[x]=v;let b=v.positionedGlyphs,w=0;if(!l.length()){m+=s,++x;continue}let T=0,E=0;for(let s=0;s<l.length();s++){let h=l.getSection(s),_=l.getSectionIndex(s),g=l.getCharCode(s),x=h.scale,v=null,S=null,M=null,A=24,I=0,C=!(u===l9.horizontal||!d&&!r2(g)||d&&(hi[g]||rI(g)||rC(g)||rz(g)||rH(g)||rQ(g)));if(h.imageName){let r=a[h.imageName];if(!r)continue;M=h.imageName,i.iconsInText=i.iconsInText||!0,S=r.paddedRect;let n=r.displaySize;x=24*x/p,v={width:n[0],height:n[1],left:1,top:-3,advance:C?n[1]:n[0],localGlyph:!1},I=y?-v.height*x:24*o-17-n[1]*x,A=v.advance;let s=(C?n[0]:n[1])*x-24*o;s>0&&s>w&&(w=s)}else{let i=n[h.fontStack];if(!i)continue;i[g]&&(S=i[g]);let a=r[h.fontStack];if(!a)continue;let s=a.glyphs[g];if(!s)continue;if(v=s.metrics,A=8203!==g?24:0,y){let i=void 0!==a.ascender?Math.abs(a.ascender):0,r=void 0!==a.descender?Math.abs(a.descender):0,n=(i+r)*x;T<n&&(T=n,E=(i-r)/2*x),I=-i*x}else I=(o-x)*24-17}C?(i.verticalizable=!0,b.push({glyph:g,imageName:M,x:f,y:m+I,vertical:C,scale:x,localGlyph:v.localGlyph,fontStack:h.fontStack,sectionIndex:_,metrics:v,rect:S}),f+=A*x+c):(b.push({glyph:g,imageName:M,x:f,y:m+I,vertical:C,scale:x,localGlyph:v.localGlyph,fontStack:h.fontStack,sectionIndex:_,metrics:v,rect:S}),f+=v.advance*x+c)}0!==b.length&&(_=Math.max(f-c,_),y?hl(b,g,w,E,s*o/2):hl(b,g,w,0,s/2)),f=0;let S=s*o+w;v.lineOffset=Math.max(w,h),m+=S,++x}let v=m,{horizontalAlign:b,verticalAlign:w}=hs(l);(function(i,r,n,a,o,s){let l=(r-n)*o,h=-s*a;for(let r of i)for(let i of r.positionedGlyphs)i.x+=l,i.y+=h})(i.positionedLines,g,b,w,_,v),i.top+=-w*v,i.bottom=i.top+v,i.left+=-b*_,i.right=i.left+_,i.hasBaseline=y}(T,r,n,a,y,l,h,u,p,c,f,_),!function(i){for(let r of i)if(0!==r.positionedGlyphs.length)return!1;return!0}(w)&&T}let hi={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},hr={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 hn(i,r,n,a,o,s){if(r.imageName){let i=a[r.imageName];return i?i.displaySize[0]*r.scale*24/s+o:0}{let a=n[r.fontStack],s=a&&a.glyphs[i];return s?s.metrics.advance*r.scale+o:0}}function ha(i,r,n,a){let o=Math.pow(i-r,2);return a?i<r?o/2:2*o:o+Math.abs(n)*n}
8function ho(i,r,n,a,o,s){let l=null,h=ha(r,n,o,s);for(let i of a){let a=ha(r-i.x,n,o,s)+i.badness;a<=h&&(l=i,h=a)}return{index:i,x:r,priorBreak:l,badness:h}}function hs(i){let r=.5,n=.5;switch(i){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:r,verticalAlign:n}}function hl(i,r,n,a,o){if(!(r||n||a||o))return;let s=i.length-1,l=i[s],h=(l.x+l.metrics.advance*l.scale)*r;for(let r=0;r<=s;r++)i[r].x-=h,i[r].y+=n+a+o}function hh(i,r,n,a,o,s){let l,h,u,c,d;let p=i.image;if(p.content){let i=p.content,r=p.pixelRatio||1;l=[i[0]/r,i[1]/r,p.displaySize[0]-i[2]/r,p.displaySize[1]-i[3]/r]}let f=r.left*s,m=r.right*s;"width"===n||"both"===n?(d=o[0]+f-a[3],u=o[0]+m+a[1]):u=(d=o[0]+(f+m-p.displaySize[0])/2)+p.displaySize[0];let _=r.top*s,g=r.bottom*s;return"height"===n||"both"===n?(h=o[1]+_-a[0],c=o[1]+g+a[2]):c=(h=o[1]+(_+g-p.displaySize[1])/2)+p.displaySize[1],{image:p,top:h,right:u,bottom:c,left:d,collisionPadding:l}}class hu extends w{constructor(i,r,n,a,o){super(i,r),this.angle=a,this.z=n,void 0!==o&&(this.segment=o)}clone(){return new hu(this.x,this.y,this.z,this.angle,this.segment)}}function hc(i,r,n,a,o){if(void 0===r.segment)return!0;let s=r,l=r.segment+1,h=0;for(;h>-n/2;){if(--l<0)return!1;h-=i[l].dist(s),s=i[l]}h+=i[l].dist(i[l+1]),l++;let u=[],c=0;for(;h<n/2;){let r=i[l],n=i[l+1];if(!n)return!1;let s=i[l-1].angleTo(r)-r.angleTo(n);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:h,angleDelta:s}),c+=s;h-u[0].distance>a;)c-=u.shift().angleDelta;if(c>o)return!1;l++,h+=r.dist(n)}return!0}function hd(i){let r=0;for(let n=0;n<i.length-1;n++)r+=i[n].dist(i[n+1]);return r}function hp(i,r){return Math.max(i?i.right-i.left:0,r?r.right-r.left:0)}function hf(i,r,n,a,o){let s=[];for(let l=0;l<i.length;l++){let h;let u=i[l];for(let i=0;i<u.length-1;i++){let l=u[i],c=u[i+1];l.x<r&&c.x<r||(l.x<r?l=new w(r,l.y+(r-l.x)/(c.x-l.x)*(c.y-l.y))._round():c.x<r&&(c=new w(r,l.y+(r-l.x)/(c.x-l.x)*(c.y-l.y))._round()),l.y<n&&c.y<n||(l.y<n?l=new w(l.x+(n-l.y)/(c.y-l.y)*(c.x-l.x),n)._round():c.y<n&&(c=new w(l.x+(n-l.y)/(c.y-l.y)*(c.x-l.x),n)._round()),l.x>=a&&c.x>=a||(l.x>=a?l=new w(a,l.y+(a-l.x)/(c.x-l.x)*(c.y-l.y))._round():c.x>=a&&(c=new w(a,l.y+(a-l.x)/(c.x-l.x)*(c.y-l.y))._round()),l.y>=o&&c.y>=o||(l.y>=o?l=new w(l.x+(o-l.y)/(c.y-l.y)*(c.x-l.x),o)._round():c.y>=o&&(c=new w(l.x+(o-l.y)/(c.y-l.y)*(c.x-l.x),o)._round()),h&&l.equals(h[h.length-1])||(h=[l],s.push(h)),h.push(c)))))}}return s}function hm(i,r,n,a,o,s,l,h,u){for(let c=r;c<r+a;c++)h_(i,n*s+c,s,o,l,h,u);for(let c=n;c<n+o;c++)h_(i,c*s+r,1,a,l,h,u)}function h_(i,r,n,a,o,s,l){s[0]=0,l[0]=-1e20,l[1]=1e20,o[0]=i[r];for(let h=1,u=0,c=0;h<a;h++){o[h]=i[r+h*n];let a=h*h;do{let i=s[u];c=(o[h]-o[i]+a-i*i)/(h-i)/2}while(c<=l[u]&&--u>-1);s[++u]=h,l[u]=c,l[u+1]=1e20}for(let h=0,u=0;h<a;h++){for(;l[u+1]<h;)u++;let a=s[u],c=h-a;i[r+h*n]=o[a]+c*c}}rT(hu,"Anchor");let hg={none:0,ideographs:1,all:2};class hy{constructor(i,r,n){this.requestManager=i,this.localGlyphMode=r,this.localFontFamily=n,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(i){this.url=i}getGlyphs(i,r){let n=[];for(let r in i)for(let a of i[r])n.push({stack:r,id:a});P(n,({stack:i,id:r},n)=>{let a=this.entries[i];a||(a=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=a.glyphs[r];if(void 0!==o)return void n(null,{stack:i,id:r,glyph:o});if(o=this._tinySDF(a,i,r))return a.glyphs[r]=o,void n(null,{stack:i,id:r,glyph:o});let s=Math.floor(r/256);if(256*s>65535)return void n(Error("glyphs > 65535 not supported"));if(a.ranges[s])return void n(null,{stack:i,id:r,glyph:o});let l=a.requests[s];l||(l=a.requests[s]=[],hy.loadGlyphRange(i,s,this.url,this.requestManager,(i,r)=>{if(r){for(let i in a.ascender=r.ascender,a.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+i)||(a.glyphs[+i]=r.glyphs[+i]);a.ranges[s]=!0}for(let n of l)n(i,r);delete a.requests[s]})),l.push((a,o)=>{a?n(a):o&&n(null,{stack:i,id:r,glyph:o.glyphs[r]||null})})},(i,n)=>{if(i)r(i);else if(n){let i={};for(let{stack:r,id:a,glyph:o}of n)void 0===i[r]&&(i[r]={}),void 0===i[r].glyphs&&(i[r].glyphs={}),i[r].glyphs[a]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics},i[r].ascender=this.entries[r].ascender,i[r].descender=this.entries[r].descender;r(null,i)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==hg.none&&(this.localGlyphMode===hg.all?!!this.localFontFamily:!!this.localFontFamily&&
8(rZ(i)||rW(i)||rR(i)||rB(i)||rL(i)))}_tinySDF(i,r,n){let a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(n))return;let o=i.tinySDF;if(!o){let n="400";/bold/i.test(r)?n="900":/medium/i.test(r)?n="500":/light/i.test(r)&&(n="200"),(o=i.tinySDF=new hy.TinySDF({fontFamily:a,fontWeight:n,fontSize:48,buffer:6,radius:16})).fontWeight=n}if(this.localGlyphs[o.fontWeight][n])return this.localGlyphs[o.fontWeight][n];let s=String.fromCharCode(n),{data:l,width:h,height:u,glyphWidth:c,glyphHeight:d,glyphLeft:p,glyphTop:f,glyphAdvance:m}=o.draw(s);return this.localGlyphs[o.fontWeight][n]={id:n,bitmap:new sp({width:h,height:u},l),metrics:{width:c/2,height:d/2,left:p/2,top:f/2-27,advance:m/2,localGlyph:!0}}}}function hx(i,r,n,a){let o=[],s=i.image,l=s.pixelRatio,h=s.paddedRect.w-2,u=s.paddedRect.h-2,c=i.right-i.left,d=i.bottom-i.top,p=s.stretchX||[[0,h]],f=s.stretchY||[[0,u]],m=(i,r)=>i+r[1]-r[0],_=p.reduce(m,0),g=f.reduce(m,0),y=h-_,x=u-g,v=0,b=_,T=0,E=g,S=0,M=y,A=0,I=x;if(s.content&&a){let i=s.content;v=hv(p,0,i[0]),T=hv(f,0,i[1]),b=hv(p,i[0],i[2]),E=hv(f,i[1],i[3]),S=i[0]-v,A=i[1]-T,M=i[2]-i[0]-b,I=i[3]-i[1]-E}let C=(a,o,h,u)=>{var p,f,m,y;let x=(a.stretch-v)/b*c+i.left,C=(p=a.fixed-S,p-M*a.stretch/_),z=(o.stretch-T)/E*d+i.top,k=(f=o.fixed-A,f-I*o.stretch/g),D=(h.stretch-v)/b*c+i.left,P=(m=h.fixed-S,m-M*h.stretch/_),L=(u.stretch-T)/E*d+i.top,R=(y=u.fixed-A,y-I*u.stretch/g),B=new w(x,z),O=new w(D,z),F=new w(D,L),U=new w(x,L),V=new w(C/l,k/l),N=new w(P/l,R/l),j=r*Math.PI/180;if(j){let i=Math.sin(j),r=Math.cos(j),n=[r,-i,i,r];B._matMult(n),O._matMult(n),U._matMult(n),F._matMult(n)}let G=a.stretch+a.fixed,Z=o.stretch+o.fixed;return{tl:B,tr:O,bl:U,br:F,tex:{x:s.paddedRect.x+1+G,y:s.paddedRect.y+1+Z,w:h.stretch+h.fixed-G,h:u.stretch+u.fixed-Z},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:V,pixelOffsetBR:N,minFontScaleX:M/l/c,minFontScaleY:I/l/d,isSDF:n}};if(a&&(s.stretchX||s.stretchY)){let i=hb(p,y,_),r=hb(f,x,g);for(let n=0;n<i.length-1;n++){let a=i[n],s=i[n+1];for(let i=0;i<r.length-1;i++)o.push(C(a,r[i],s,r[i+1]))}}else o.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:h+1},{fixed:0,stretch:u+1}));return o}function hv(i,r,n){let a=0;for(let o of i)a+=Math.max(r,Math.min(n,o[1]))-Math.max(r,Math.min(n,o[0]));return a}function hb(i,r,n){let a=[{fixed:-1,stretch:0}];for(let[r,n]of i){let i=a[a.length-1];a.push({fixed:r-i.stretch,stretch:i.stretch}),a.push({fixed:r-i.stretch,stretch:i.stretch+(n-r)})}return a.push({fixed:r+1,stretch:n}),a}hy.loadGlyphRange=function(i,r,n,a,o){let s=256*r;ef(a.transformRequest(a.normalizeGlyphsURL(n).replace("{fontstack}",i).replace("{range}",`${s}-${s+255}`),eu.Glyphs),(i,r)=>{if(i)o(i);else if(r){let i={},n=new lV(r).readFields(l2,{});for(let r of n.glyphs)i[r.id]=r;o(null,{glyphs:i,ascender:n.ascender,descender:n.descender})}})},hy.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:n=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:l="normal"}={}){this.buffer=r,this.cutoff=a,this.radius=n;let h=this.size=i+4*r,u=this._createCanvas(h),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${l} ${s} ${i}px ${o}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(i){let r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){let{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(i),l=Math.ceil(n),h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-o))),u=Math.min(this.size-this.buffer,l+Math.ceil(a)),c=h+2*this.buffer,d=u+2*this.buffer,p=Math.max(c*d,0),f=new Uint8ClampedArray(p),m={data:f,width:c,height:d,glyphWidth:h,glyphHeight:u,glyphTop:l,glyphLeft:0,glyphAdvance:r};if(0===h||0===u)return m;let{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;_.clearRect(g,g,h,u),_.fillText(i,g,g+l);let v=_.getImageData(g,g,h,u);x.fill(1e20,0,p),y.fill(0,0,p);for(let i=0;i<u;i++)for(let r=0;r<h;r++){let n=v.data[4*(i*h+r)+3]/255;if(0===n)continue;let a=(i+g)*c+r+g;if(1===n)x[a]=0,y[a]=1e20;else{let i=.5-n;x[a]=i>0?i*i:0,y[a]=i<0?i*i:0}}hm(x,0,0,c,d,c,this.f,this.v,this.z),hm(y,g,g,h,u,c,this.f,this.v,this.z);for(let i=0;i<p;i++){let r=Math.sqrt(x[i])-Math.sqrt(y[i]);f[i]=Math.round(255-255*(r/this.radius+this.cutoff))}return m}};class hw{constructor(i=[],r=hT){if(this.data=i,this.length=this.data.length,this.compare=r,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;let i=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:r,compare:n}=this,a=r[i];for(;i>0;){let o=i-1>>1,s=r[o];if(n(a,s)>=0)break;r[i]=s,i=o}r[i]=a}_down(i){let{data:r,compare:n}=this,a=this.length>>1,o=r[i];for(;i<a;){let a=1+(i<<1),s=r[a],l=a+1;if(l<this.length&&0>n(r[l],s)&&(a=l,s=r[l]),n(s,o)>=0)break;r[i]=s,i=a}r[i]=o}}function hT(i,r){return i<r?-1:i>r?1:0}function hE(i,r){return r.max-i.max}function hS(i,r,n,a){this.p=new w(i,r),this.h=n,this.d=function(i,r){let n=!1,a=1/0;for(let o=0;o<r.length;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;
8l=r++){let o=s[r],h=s[l];o.y>i.y!=h.y>i.y&&i.x<(h.x-o.x)*(i.y-o.y)/(h.y-o.y)+o.x&&(n=!n),a=Math.min(a,o6(i,o,h))}}return(n?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}let hM=Number.POSITIVE_INFINITY,hA=Math.sqrt(2);function hI(i,[r,n]){let a=0,o=0;if(n===hM){r<0&&(r=0);let n=r/hA;switch(i){case"top-right":case"top-left":o=n-7;break;case"bottom-right":case"bottom-left":o=7-n;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":a=-n;break;case"top-left":case"bottom-left":a=n;break;case"left":a=r;break;case"right":a=-r}}else{switch(r=Math.abs(r),n=Math.abs(n),i){case"top-right":case"top-left":case"top":o=n-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-n}switch(i){case"top-right":case"bottom-right":case"right":a=-r;break;case"top-left":case"bottom-left":case"left":a=r}}return[a,o]}function hC(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 hz(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=function(i,r,n,a,o,s,l,h){let u=[];if(0===r.positionedLines.length)return u;let c=a.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,d=function(i){let r=i[0],n=i[1],a=r*n;return a>0?[r,-n]:a<0?[-r,n]:0===r?[n,r]:[n,-r]}(n),p=Math.abs(r.top-r.bottom);for(let i of r.positionedLines)p-=i.lineOffset;let f=r.positionedLines.length,m=p/f,_=r.top-n[1];for(let i=0;i<f;++i){let a=r.positionedLines[i];for(let s of(_=function(i,r,n,a){let o=r+i.positionedLines[a].lineOffset;return 0===a?n+o/2:n+(o+(r+i.positionedLines[a-1].lineOffset))/2}(r,m,_,i),a.positionedGlyphs)){let i,a,p,f;if(!s.rect)continue;let m=s.rect||{},g=4,y=!0,x=1,v=0;if(s.imageName){let i=l[s.imageName];if(!i)continue;if(i.sdf){W("SDF images are not supported in formatted text and will be ignored.");continue}y=!1,g=1/(x=i.pixelRatio)}let b=(o||h)&&s.vertical,T=s.metrics.advance*s.scale/2,E=s.metrics,S=s.rect;if(null===S)continue;h&&r.verticalizable&&(v=s.imageName?T-s.metrics.width*s.scale/2:0);let M=o?[s.x+T,s.y]:[0,0],A=[0,0],I=[0,0],C=!1;o||(b?(I=[s.x+T+d[0],s.y+d[1]-v],C=!0):A=[s.x+T+n[0],s.y+n[1]-v]);let z=S.w*s.scale/(x*(s.localGlyph?2:1)),k=S.h*s.scale/(x*(s.localGlyph?2:1));if(b){let r=s.y-_,n=new w(-T,T-r),o=-Math.PI/2,l=new w(...I);(i=new w(-T+A[0],A[1]))._rotateAround(o,n)._add(l),i.x+=-r+T,i.y-=(E.left-g)*s.scale;let h=s.imageName?E.advance*s.scale:24*s.scale,u=String.fromCharCode(s.glyph);"︶"===u||"﹈"===u||"︸"===u||"﹄"===u||"﹂"===u||"︾"===u||"︼"===u||"︺"===u||"︘"===u||"﹀"===u||"︐"===u||"︓"===u||"︔"===u||"`"===u||" ̄"===u||"︑"===u||"︒"===u?i.x+=(1-g)*s.scale:"︵"===u||"﹇"===u||"︷"===u||"﹃"===u||"﹁"===u||"︽"===u||"︻"===u||"︹"===u||"︗"===u||"︿"===u?i.x+=h-E.height*s.scale+(-g-1)*s.scale:i.x+=s.imageName||E.width+2*g===S.w&&E.height+2*g===S.h?(h-k)/2:(h-(E.height+2*g)*s.scale)/2,a=new w(i.x,i.y-z),p=new w(i.x+k,i.y),f=new w(i.x+k,i.y-z)}else{let r=(E.left-g)*s.scale-T+A[0],n=(-E.top-g)*s.scale+A[1],o=r+z,l=n+k;i=new w(r,n),a=new w(o,n),p=new w(r,l),f=new w(o,l)}if(c){let r;r=o?new w(0,0):C?new w(d[0],d[1]):new w(n[0],n[1]),i._rotateAround(c,r),a._rotateAround(c,r),p._rotateAround(c,r),f._rotateAround(c,r)}let D=new w(0,0),P=new w(0,0);u.push({tl:i,tr:a,bl:p,br:f,tex:m,writingMode:r.writingMode,glyphOffset:M,sectionIndex:s.sectionIndex,isSDF:y,pixelOffsetTL:D,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}}return u}(0,a,u,s,l,h,o,i.allowVerticalPlacement),v=i.textSizeData,b=null;for(let a of("source"===v.kind?(b=[128*s.layout.get("text-size").evaluate(h,{},y)])[0]>32640&&W(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((b=[128*_.compositeTextSizes[0].evaluate(h,{},y),128*_.compositeTextSizes[1].evaluate(h,{},y)])[0]>32640||b[1]>32640)&&W(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),i.addSymbols(i.text,x,b,u,l,h,d,r,n,c.lineStartIndex,c.lineLength,m,g,y),p))f[a]=i.text.placedSymbolArray.length-1;return 4*x.length}function hk(i){for(let r in i)return i[r];return null}function hD(i,r,n,a,o,s,l,h,u,c){let d=l.top,p=l.bottom,f=l.left,m=l.right,_=l.collisionPadding;if(_&&(f-=_[0],d-=_[1],m+=_[2],p+=_[3]),u){let i=new w(f,d),r=new w(m,d),n=new w(f,p),a=new w(m,p),o=u*E,s=new w(0,0);
8c&&(s=new w(c[0],c[1])),i._rotateAround(o,s),r._rotateAround(o,s),n._rotateAround(o,s),a._rotateAround(o,s),f=Math.min(i.x,r.x,n.x,a.x),m=Math.max(i.x,r.x,n.x,a.x),d=Math.min(i.y,r.y,n.y,a.y),p=Math.max(i.y,r.y,n.y,a.y)}return i.emplaceBack(r.x,r.y,r.z,n.x,n.y,f,d,m,p,h,a,o,s),i.length-1}function hP(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);let r=i.bottom-i.top;return r>0?Math.max(10,r):null}function hL(i,r){let n=i.fovAboveCenter,a=i.elevation?i.elevation.getMinElevationBelowMSL()*r:0,o=(i._camera.position[2]*i.worldSize-a)/Math.cos(i._pitch),s=Math.sin(n)*o/Math.sin(Math.max(Math.PI/2-i._pitch-n,.01));return Math.min(1.01*(Math.sin(i._pitch)*s+o),1/i._horizonShift*o)}function hR(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<<i.z,x:i.x,y:i.y,x2:i.x+1,y2:i.y+1,projection:r};let n=Math.pow(2,-i.z),a=i.x*n,o=(i.x+1)*n,s=i.y*n,l=(i.y+1)*n,h=o$(a),u=o$(o),c=oq(s),d=oq(l),p=r.project(h,c),f=r.project(u,c),m=r.project(u,d),_=r.project(h,d),g=Math.min(p.x,f.x,m.x,_.x),y=Math.min(p.y,f.y,m.y,_.y),x=Math.max(p.x,f.x,m.x,_.x),v=Math.max(p.y,f.y,m.y,_.y),b=n/16;function w(i,n,a,o,s,l){let h=(a+s)/2,u=(o+l)/2,c=r.project(o$(h),oq(u)),d=Math.max(0,g-c.x,y-c.y,c.x-x,c.y-v);g=Math.min(g,c.x),x=Math.max(x,c.x),y=Math.min(y,c.y),v=Math.max(v,c.y),d>b&&(w(i,c,a,o,h,u),w(c,n,h,u,s,l))}w(p,f,a,s,o,s),w(f,m,o,s,o,l),w(m,_,o,l,a,l),w(_,p,a,l,a,s),g-=b,y-=b,x+=b,v+=b;let T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}let hB=aB(new Float32Array(16));class hO{constructor(i){this.spec=i,this.name=i.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(i,r){return{x:0,y:0,z:0}}unproject(i,r){return new oN(0,0)}projectTilePoint(i,r,n){return{x:i,y:r,z:0}}locationPoint(i,r,n=!0){return i._coordinatePoint(i.locationCoordinate(r),n)}pixelsPerMeter(i,r){return 1/oj(i)*r}pixelSpaceConversion(i,r,n){return 1}farthestPixelDistance(i){return hL(i,i.pixelsPerMeter)}pointCoordinate(i,r,n,a){let o=new w(r,Math.max(i.horizonLineFromTop(!1),n));return i.rayIntersectionCoordinate(i.pointRayIntersection(o,a))}pointCoordinate3D(i,r,n){let a=new w(r,n);if(i.elevation)return i.elevation.pointCoordinate(a);{let r=this.pointCoordinate(i,a.x,a.y,0);return[r.x,r.y,r.z]}}isPointAboveHorizon(i,r){if(i.elevation)return!this.pointCoordinate3D(i,r.x,r.y);let n=i.horizonLineFromTop();return r.y<n}createInversionMatrix(i,r){return hB}createTileMatrix(i,r,n){let a,o,s;let l=n.canonical,h=aB(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=hR(l,this);a=1,o=u.x+n.wrap*u.scale,s=u.y,aV(h,h,[a/u.scale,a/u.scale,i.pixelsPerMeter/r])}else a=r/i.zoomScale(l.z),o=(l.x+Math.pow(2,l.z)*n.wrap)*a,s=l.y*a;return aU(h,h,[o,s,0]),aV(h,h,[a/8192,a/8192,1]),h}upVector(i,r,n){return[0,0,1]}upVectorScale(i,r,n){return{metersToTile:1}}}class hF extends hO{constructor(i){super(i),this.range=[4,7],this.center=i.center||[-96,37.5];let[r,n]=this.parallels=i.parallels||[29.5,45.5],a=Math.sin(r*E);this.n=(a+Math.sin(n*E))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(i,r){let{n:n,c:a,r0:o}=this,s=(i-this.center[0])*E,l=Math.sqrt(a-2*n*Math.sin(r*E))/n;return{x:l*Math.sin(s*n),y:l*Math.cos(s*n)-o,z:0}}unproject(i,r){let{n:n,c:a,r0:o}=this,s=o+r,l=Math.atan2(i,Math.abs(s))*Math.sign(s);s*n<0&&(l-=Math.PI*Math.sign(i)*Math.sign(s));let h=this.center[0]*E*n,u=z((l=D(l,-Math.PI-h,Math.PI-h))/n*S+this.center[0],-180,180),c=Math.asin(z((a-(i*i+s*s)*n*n)/(2*n),-1,1));return new oN(u,z(c*S,-85.051129,85.051129))}}let hU=Math.sqrt(3)/2;class hV extends hO{project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;let n=Math.asin(hU*Math.sin(r)),a=n*n,o=a*a*a;return{x:.5*(i*Math.cos(n)/(hU*(1.340264+-.24331799999999998*a+o*(.0062510000000000005+.034164*a)))/M
8ath.PI+.5),y:1-.5*(n*(1.340264+-.081106*a+o*(893e-6+.003796*a))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,a=n*n,o=a*a*a;for(let i,s,l=0;l<12&&(s=n*(1.340264+-.081106*a+o*(893e-6+.003796*a))-r,o=(a=(n=z(n-(i=s/(1.340264+-.24331799999999998*a+o*(.0062510000000000005+.034164*a))),-Math.PI/3,Math.PI/3))*n)*a*a,!(1e-12>Math.abs(i)));++l);let s=hU*i*(1.340264+-.24331799999999998*a+o*(.0062510000000000005+.034164*a))/Math.cos(n),l=Math.asin(Math.sin(n)/hU);return new oN(z(180*s/Math.PI,-180,180),z(180*l/Math.PI,-85.051129,85.051129))}}class hN extends hO{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){return{x:.5+i/360,y:.5-r/360,z:0}}unproject(i,r){return new oN(360*(i-.5),z(360*(.5-r),-85.051129,85.051129))}}let hj=Math.PI/2;function hG(i){return Math.tan((hj+i)/2)}class hZ extends hO{constructor(i){super(i),this.center=i.center||[0,30];let[r,n]=this.parallels=i.parallels||[30,30],a=r*E,o=n*E;this.southernCenter=a+o<0,this.southernCenter&&(a=-a,o=-o);let s=Math.cos(a),l=hG(a);this.n=a===o?Math.sin(a):Math.log(s/Math.cos(o))/Math.log(hG(o)/l),this.f=s*Math.pow(hG(a),this.n)/this.n}project(i,r){r*=E,this.southernCenter&&(r=-r),i=(i-this.center[0])*E;let{n:n,f:a}=this;a>0?r<-hj+1e-6&&(r=-hj+1e-6):r>hj-1e-6&&(r=hj-1e-6);let o=a/Math.pow(hG(r),n),s=o*Math.sin(n*i),l=a-o*Math.cos(n*i);return s=.5*(s/Math.PI+.5),l=.5*(l/Math.PI+.5),{x:s,y:this.southernCenter?l:1-l,z:0}}unproject(i,r){i=(2*i-.5)*Math.PI,this.southernCenter&&(r=1-r);let{n:n,f:a}=this,o=a-(r=(2*(1-r)-.5)*Math.PI),s=Math.sign(o),l=Math.sign(n)*Math.sqrt(i*i+o*o),h=Math.atan2(i,Math.abs(o))*s;o*n<0&&(h-=Math.PI*Math.sign(i)*s);let u=z(h/n*S+this.center[0],-180,180),c=z((2*Math.atan(Math.pow(a/l,1/n))-hj)*S,-85.051129,85.051129);return new oN(u,this.southernCenter?-c:c)}}class h$ extends hO{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(i,r){return{x:oG(i),y:oZ(r),z:0}}unproject(i,r){return new oN(o$(i),oq(r))}}let hq=85.051129*E;class hW extends hO{project(i,r){let n=(r*=E)*r,a=n*n;return{x:.5*((i*=E)*(.8707-.131979*n+a*(a*(.003971*n-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+n*(.015085+a*(.028874*n-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,a=25,o=0,s=n*n;do{let i=(s=n*n)*s;o=(n*(1.007226+s*(.015085+i*(.028874*s-.044475-.005916*i)))-r)/(1.007226+s*(.045255+i*(.259866*s-.311325-.005916*11*i))),n=z(n-o,-hq,hq)}while(Math.abs(o)>1e-6&&--a>0);return new oN(z(i/(.8707+(s=n*n)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))*S,-180,180),n*S)}}let hX=85.051129*E;class hH extends hO{project(i,r){r*=E,i*=E;let n=Math.cos(r),a=Math.acos(n*Math.cos(i/2)),o=Math.sin(a)/a;return{x:.5*((.5*(2/Math.PI*i+2*n*Math.sin(i/2)/o)||0)/Math.PI+.5),y:1-.5*((.5*(r+Math.sin(r)/o)||0)/Math.PI+1),z:0}}unproject(i,r){let n=i=(2*i-.5)*Math.PI,a=r=(2*(1-r)-1)*Math.PI,o=25,s=0,l=0;do{let o=Math.cos(a),h=Math.sin(a),u=2*h*o,c=h*h,d=o*o,p=Math.cos(n/2),f=Math.sin(n/2),m=2*p*f,_=f*f,g=1-d*p*p,y=g?1/g:0,x=g?Math.acos(o*p)*Math.sqrt(1/g):0,v=.5*(2*x*o*f+2*n/Math.PI)-i,b=.5*(x*h+a)-r,w=.5*y*(d*_+x*o*p*c)+1/Math.PI,T=y*(m*u/4-x*h*f),E=.125*y*(u*f-x*h*d*m),S=.5*y*(c*p+x*_*o)+.5,M=T*E-S*w;s=(b*T-v*S)/M,l=(v*E-b*w)/M,n=z(n-s,-Math.PI,Math.PI),a=z(a-l,-hX,hX)}while((Math.abs(s)>1e-6||Math.abs(l)>1e-6)&&--o>0);return new oN(n*S,a*S)}}class hY extends hO{constructor(i){super(i),this.center=i.center||[0,0],this.parallels=i.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*E)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){let{scale:n,cosPhi:a}=this;return{x:i*E*a*n+.5,y:-Math.sin(r*E)/a*n+.5,z:0}}unproject(i,r){let{scale:n,cosPhi:a}=this,o=z((i-.5)/n*S/a,-180,180),s=Math.asin(z(-(r-.5)/n*a,-1,1));return new oN(o,z(s*S,-85.051129,85.051129))}}class hK extends h${constructor(i){super(i),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(i,r,n){let a=oA(i,r,n);return a4(a,a,oz(ox(n))),{x:a[0],y:a[1],z:a[2]}}locationPoint(i,r){let n=oM(r.lat,r.lng),a=a2([],n),o=i.elevation?i.elevation.getAtPointOrZero(i.locationCoordinate(r),i._centerAltitude):i._centerAltitude;a1(n,n,a,1/oj(0)*8192*o);let s=aB(new Float64Array(16));return aF(s,i.pixelMatrix,i.globeMatrix),a4(n,n,s),new w(n[0],n[1])}pixelsPerMeter(i,r){return 1/oj(0)*r}pixelSpaceConversion(i,r,n){let a=1/oj(i)*r,o=tK(1/oj(45)*r,a,n);return this.pixelsPerMeter(i,r)/o}createTileMatrix(i,r,n){let a=ok(ox(n.canonical));return aF(new Float64Array(16),i.globeMatrix,a)}createInversionMatrix(i,r){let{center:n}=i,a=oz(ox(r));return aj(a,a,n.lng*E),aN(a,a,n.lat*E),aV(a,a,[i._pixelsPerMercatorPixel,i._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(i,r,n,a){return o_(i,r,n,!0)||new oX(0,0)}pointCoordinate3D(i,r,n){let a=this.pointCoordinate(i,r,n,0);return[a.x,a.y,a.z]}isPointAboveHorizon(i,r){return!o_(i,r.x,r.y,!1)}farthestPixelDistance(i){let r=function(i,r){let n;let a=i.cameraToCenterDistance,o=i._centerAltitude*r,s=i._camera,l=i._camera.forward(),h=aH([],a0([],l,-a),[0,0,o]),u=i.worldSize/(2*Math.PI),c=[0,0,-u],d=i.width/i.height,p=Math.tan(i.fovAboveCenter),f=a0([],s.up(),p),m=a0([],s.right(),p*d),_=a2([],aH([],aH([],l,f),m)),g=[];if(new os(h,_).closestPointOnSphere(c,u,g)){let r=aY([],aH([],g,c),h);n=Math.cos(i.fovAboveCenter)*aW(r)}else{let i=aY([],h,c),r=aY([],c,h);a2(r,r);let a=aW(i)-u,o=Math.acos((n=Math.sqrt(a*(a+2*u)))/(u+a))-Math.acos(a3(l,r));n*=Math.cos(o)}return 1.01*n}(i,this.pixelsPerMeter(i.center.lat,i.worldSize)),n=oP(i.zoom);return n>0?tK(r,hL(i,1/oj(i.center.lat)*i.worldSize)+i.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(i.width,i.height)/i.worldSize*Math.PI)),Math.pow(n,10)):r}upVector(i,r,n){return oA(r,n,i,1)}upVectorScale(i){return{metersToTile:om(oI(ox(i)))}}}function hJ(i){let r=i.parallels,n=!!r&&.01>Math.abs(r[0]+r[1]);switch(i.name){case"mercator":return new h$(i);case"equirectangular":return new hN(i);case"naturalEarth":return new hW(i);case"equalEarth":return new hV(i);case"winkelTripel":return new hH(i);case"albers":return n?new hY(i):new hF(i);case"lambertConformalConic":return n?new hY(i):new hZ(i);case"globe":return new hK(i)}throw Error(`Invalid projection name: ${i.name}`)}let hQ=s3.types,h0=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function h1(i,r,n,a,o,s,l,h,u,c,d,p,f){let m=h?Math.min(32640,Math.round(h[0])):0,_=h?Math.min(32640,Math.round(h[1])):0;i.emplaceBack(r,n,Math.round(32*a),Math.round(32*o),s,l,(m<<1)+(u?1:0),_,16*c,16*d,256*p,256*f)}function h2(i,r,n,a,o,s,l){i.emplaceBack(r,n,a,o,s,l)}function h3(i,r,n,a,o){i.emplaceBack(r,n,a,o),i.emplaceBack(r,n,a,o),i.emplaceBack(r,n,a,o),i.emplaceBack(r,n,a,o)}class h5{constructor(i){this.layoutVertexArray=new nL,this.indexArray=new nj,this.programConfigurations=i,this.segments=new ak,this.dynamicLayoutVertexArray=new nz,this.opacityVertexArray=new nB,this.placedSymbolArray=new n0,this.globeExtVertexArray=new nR}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(i,r,n,a){this.isEmpty()||(n&&(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,lM.members),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,lI.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,h0,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,lA.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||a)&&this.programConfigurations.upload(i))}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())}}rT(h5,"SymbolBuffers");class h4{constructor(i,r,n){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new n,this.segments=new ak,this.collisionVertexArray=new nV,this.collisionVertexArrayExt=new nN}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,lC.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,lz.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
8stroy())}}rT(h4,"CollisionBuffers");class h6{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=aB([]),this.placementViewportMatrix=aB([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=lP(this.zoom,r["text-size"]),this.iconSizeData=lP(this.zoom,r["icon-size"]);let n=this.layers[0].layout,a=n.get("symbol-sort-key"),o=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="viewport-y"!==o&&void 0!==a.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(i=>l9[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID,this.projection=i.projection}createArrays(){this.text=new h5(new aw(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new h5(new aw(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new n3,this.lineVertexArray=new n5,this.symbolInstances=new n2}calculateGlyphDependencies(i,r,n,a,o){for(let n=0;n<i.length;n++)if(r[i.charCodeAt(n)]=!0,a&&o){let a=lO[i.charAt(n)];a&&(r[a.charCodeAt(0)]=!0)}}populate(i,r,n,a){let o=this.layers[0],s=o.layout,l="globe"===this.projection.name,h=s.get("text-font"),u=s.get("text-field"),c=s.get("icon-image"),d=("constant"!==u.value.kind||u.value.value instanceof tf&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==h.value.kind||h.value.value.length>0),p="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,f=s.get("symbol-sort-key");if(this.features=[],!d&&!p)return;let m=r.iconDependencies,_=r.glyphDependencies,g=r.availableImages,y=new ns(this.zoom);for(let{feature:r,id:u,index:c,sourceLayerIndex:x}of i){let i,v;let b=o._featureFilter.needGeometry,w=oJ(r,b);if(!o._featureFilter.filter(y,w,n))continue;if(b||(w.geometry=oK(r,n,a)),l&&1!==r.type&&n.z<=5){let i=w.geometry,r=(i,r)=>.98078528056>a3(oA(i.x,i.y,n,1),oA(r.x,r.y,n,1));for(let n=0;n<i.length;n++)i[n]=function(i,r){let n=i[0],a=[n];for(let o=1;o<i.length;o++){let s=i[o];(function i(r,n,a,o){if(o(n,a)){let s=n.add(a)._mult(.5);i(r,n,s,o),i(r,s,a,o)}else r.push(a)})(a,n,s,r),n=s}return a}(i[n],r)}if(d){let r=o.getValueAndResolveTokens("text-field",w,n,g),a=tf.factory(r);(function(i){for(let r of i.sections)if(function(i){for(let r of i)if(r5(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nn()||this.hasRTLText&&no.isParsed())&&(i=function(i,r,n){return i.sections.forEach(i=>{i.text=function(i,r,n){let a=r.layout.get("text-transform").evaluate(n,{});return"uppercase"===a?i=i.toLocaleUpperCase():"lowercase"===a&&(i=i.toLocaleLowerCase()),no.applyArabicShaping&&(i=no.applyArabicShaping(i)),i}(i.text,r,n)}),i}(a,o,w))}if(p){let i=o.getValueAndResolveTokens("icon-image",w,n,g);v=i instanceof tm?i:tm.fromString(i)}if(!i&&!v)continue;let T=this.sortFeaturesByKey?f.evaluate(w,{},n):void 0;if(this.features.push({id:u,text:i,icon:v,index:c,sourceLayerIndex:x,geometry:w.geometry,properties:r.properties,type:hQ[r.type],sortKey:T}),v&&(m[v.name]=!0),i){let r=h.evaluate(w,{},n).join(","),a="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let n of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l9.vertical)>=0,i.sections))if(n.image)m[n.image.name]=!0;else{let o=r1(i.toString()),s=n.fontStack||r,l=_[s]=_[s]||{};this.calculateGlyphDependencies(n.text,l,a,this.allowVerticalPlacement,o)}}}"line"===s.get("symbol-placement")&&(this.features=function(i){let r={},n={},a=[],o=0;function s(r){a.push(i[r]),o++}function l(i,r,o){let s=n[i];return delete n[i],n[r]=s,a[s].geometry[0].pop(),a[s].geometry[0]=a[s].geometry[0].concat(o[0]),s}function h(i,n,o){let s=r[n];return delete r[n],r[i]=s,a[s].geometry[0].shift(),a[s].geometry[0]=o[0].concat(a[s].geometry[0]),s}function u(i,r,n){let a=n?r[0][r[0].length-1]:r[0][0];return`${i}:${a.x}:${a.y}`}for(let c=0;c<i.length;c++){let d=i[c],p=d.geometry,f=d.text?d.text.toString():null;if(!f){s(c);continue}let m=u(f,p),_=u(f,p,!0);if(m in n&&_ in r&&n[m]!==r[_]){let i=h(m,_,p),o=l(m,_,a[i].geometry);delete r[m],delete n[_],n[u(f,a[o].geometry,!0)]=o,a[i].geometry=null}else m in n?l(m,_,p):_ in r?h(m,_,p):(s(c),r[m]=o-1,n[_]=o-1)}return a.filter(i=>i.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}update(i,r,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,r,this.layers,n,a),this.icon.programConfigurations.updatePaintArrays(i,r,this.layers,n,a))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=hJ(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(i,r){let n=this.lineVertexArray.length;if(void 0!==i.segment)for(let{x:i,y:n}of r)this.lineVertexArray.emplaceBack(i,n);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(i,r,n,a,o,s,l,h,u,c,d,p,f,m){let _=i.indexArray,g=i.layoutVertexArray,y=i.globeExtVertexArray,x=i.segments.prepareSegment(4*r.length,g,_,this.canOverlap?s.sortKey:void 0),v=this.glyphOffsetArray.length,b=x.vertexLength,w=this.allowVerticalPlacement&&l===l9.vertical?Math.PI/2:0,T=s.text&&s.text.sections;for(let a=0;a<r.length;a++){let{tl:o,tr:l,bl:c,br:d,tex:p,pixelOffsetTL:v,pixelOffsetBR:b,minFontScaleX:E,minFontScaleY:S,glyphOffset:M,isSDF:A,sectionIndex:I}=r[a],C=x.vertexLength,z=M[1];if(h1(g,u.x,u.y,o.x,z+o.y,p.x,p.y,n,A,v.x,v.y,E,S),h1(g,u.x,u.y,l.x,z+l.y,p.x+p.w,p.y,n,A,b.x,v.y,E,S),h1(g,u.x,u.y,c.x,z+c.y,p.x,p.y+p.h,n,A,v.x,b.y,E,S),h1(g,u.x,u.y,d.x,z+d.y,p.x+p.w,p.y+
8p.h,n,A,b.x,b.y,E,S),h){let{x:r,y:n,z:a}=h.anchor,[o,s,l]=h.up;h2(y,r,n,a,o,s,l),h2(y,r,n,a,o,s,l),h2(y,r,n,a,o,s,l),h2(y,r,n,a,o,s,l),h3(i.dynamicLayoutVertexArray,r,n,a,w)}else h3(i.dynamicLayoutVertexArray,u.x,u.y,u.z,w);_.emplaceBack(C,C+1,C+2),_.emplaceBack(C+1,C+2,C+3),x.vertexLength+=4,x.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(M[0]),a!==r.length-1&&I===r[a+1].sectionIndex||i.programConfigurations.populatePaintArrays(g.length,s,s.index,{},f,m,T&&T[I])}let E=h?h.anchor:u;i.placedSymbolArray.emplaceBack(E.x,E.y,E.z,u.x,u.y,v,this.glyphOffsetArray.length-v,b,c,d,u.segment,n?n[0]:0,n?n[1]:0,a[0],a[1],l,0,!1,0,p,0)}_commitLayoutVertex(i,r,n,a,o,s,l){i.emplaceBack(r,n,a,o,s,Math.round(l.x),Math.round(l.y))}_addCollisionDebugVertices(i,r,n,a,o,s,l){let h=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),u=h.vertexLength,c=l.tileAnchorX,d=l.tileAnchorY;for(let i=0;i<4;i++)n.collisionVertexArray.emplaceBack(0,0,0,0);n.collisionVertexArrayExt.emplaceBack(r,-i.padding,-i.padding),n.collisionVertexArrayExt.emplaceBack(r,i.padding,-i.padding),n.collisionVertexArrayExt.emplaceBack(r,i.padding,i.padding),n.collisionVertexArrayExt.emplaceBack(r,-i.padding,i.padding),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,d,new w(i.x1,i.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,d,new w(i.x2,i.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,d,new w(i.x2,i.y2)),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,d,new w(i.x1,i.y2)),h.vertexLength+=4;let p=n.indexArray;p.emplaceBack(u,u+1),p.emplaceBack(u+1,u+2),p.emplaceBack(u+2,u+3),p.emplaceBack(u+3,u),h.primitiveLength+=4}_addTextDebugCollisionBoxes(i,r,n,a,o,s){for(let l=a;l<o;l++){let a=n.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._addCollisionDebugVertices(a,o,this.textCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(i,r,n,a,o,s){for(let l=a;l<o;l++){let a=n.get(l),o=this.getSymbolInstanceIconSize(i,r,s.placedIconSymbolIndex);this._addCollisionDebugVertices(a,o,this.iconCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,s)}}generateCollisionDebugBuffers(i,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new h4(nF,lk.members,nX),this.iconCollisionBox=new h4(nF,lk.members,nX);let n=lR(this.iconSizeData,i),a=lR(this.textSizeData,i);for(let o=0;o<this.symbolInstances.length;o++){let s=this.symbolInstances.get(o);this._addTextDebugCollisionBoxes(a,i,r,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(a,i,r,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(i,r,n,a){let o=this.text.placedSymbolArray.get(r.rightJustifiedTextSymbolIndex>=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:a),s=lL(this.textSizeData,i,o)/24;return this.tilePixelRatio*s}getSymbolInstanceIconSize(i,r,n){let a=this.icon.placedSymbolArray.get(n),o=lL(this.iconSizeData,i,a);return this.tilePixelRatio*o}_commitDebugCollisionVertexUpdate(i,r,n){i.emplaceBack(r,-n,-n),i.emplaceBack(r,n,-n),i.emplaceBack(r,n,n),i.emplaceBack(r,-n,n)}_updateTextDebugCollisionBoxes(i,r,n,a,o,s){for(let l=a;l<o;l++){let a=n.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,o,a.padding)}}_updateIconDebugCollisionBoxes(i,r,n,a,o,s){for(let l=a;l<o;l++){let a=n.get(l),o=this.getSymbolInstanceIconSize(i,r,s);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,o,a.padding)}}updateCollisionDebugBuffers(i,r){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let n=lR(this.iconSizeData,i),a=lR(this.textSizeData,i);for(let o=0;o<this.symbolInstances.length;o++){let s=this.symbolInstances.get(o);this._updateTextDebugCollisionBoxes(a,i,r,s.textBoxStartIndex,s.textBoxEndIndex,s),this._updateTextDebugCollisionBoxes(a,i,r,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._updateIconDebugCollisionBoxes(n,i,r,s.iconBoxStartIndex,s.iconBoxEndIndex,s.placedIconSymbolIndex),this._updateIconDebugCollisionBoxes(n,i,r,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s.placedIconSymbolIndex)}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(i,r,n,a,o,s,l,h,u){let c={};if(r<n){let{x1:n,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(r);c.textBox={x1:n,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.textFeatureIndex=m}if(a<o){let{x1:r,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(a);c.verticalTextBox={x1:r,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalTextFeatureIndex=m}if(s<l){let{x1:r,y1:n,x2:a,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(s);c.iconBox={x1:r,y1:n,x2:a,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.iconFeatureIndex=m}if(h<u){let{x1:r,y1:n,x2:a,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(h);c.verticalIconBox={x1:r,y1:n,x2:a,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalIconFeatureIndex=m}return c}deserializeCollisionBoxes(i){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(i,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(i,r){let n=i.placedSymbolArray.get(r),a=n.vertexStartIndex+4*n.numGlyphs;for(let r=n.vertexStartIndex;r<a;r+=4)i.indexArray.emplaceBack(r,r+1,r+2),i.indexArray.emplaceBack(r+1,r+2,r+3)}
8getSortedSymbolIndexes(i){if(this.sortedAngle===i&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let r=Math.sin(i),n=Math.cos(i),a=[],o=[],s=[];for(let i=0;i<this.symbolInstances.length;++i){s.push(i);let l=this.symbolInstances.get(i);a.push(0|Math.round(r*l.tileAnchorX+n*l.tileAnchorY)),o.push(l.featureIndex)}return s.sort((i,r)=>a[i]-a[r]||o[r]-o[i]),s}addToSortKeyRanges(i,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex);let{rightJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:l,verticalPlacedIconSymbolIndex:h}=i;n>=0&&this.addIndicesForPlacedSymbol(this.text,n),a>=0&&a!==n&&this.addIndicesForPlacedSymbol(this.text,a),o>=0&&o!==a&&o!==n&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l),h>=0&&this.addIndicesForPlacedSymbol(this.icon,h)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}rT(h6,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),h6.MAX_GLYPHS=65535,h6.addDynamicAttributes=h3;let h8=new nx({"symbol-placement":new n_(eW.layout_symbol["symbol-placement"]),"symbol-spacing":new n_(eW.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new n_(eW.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ng(eW.layout_symbol["symbol-sort-key"]),"symbol-z-order":new n_(eW.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new n_(eW.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new n_(eW.layout_symbol["icon-ignore-placement"]),"icon-optional":new n_(eW.layout_symbol["icon-optional"]),"icon-rotation-alignment":new n_(eW.layout_symbol["icon-rotation-alignment"]),"icon-size":new ng(eW.layout_symbol["icon-size"]),"icon-text-fit":new n_(eW.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new n_(eW.layout_symbol["icon-text-fit-padding"]),"icon-image":new ng(eW.layout_symbol["icon-image"]),"icon-rotate":new ng(eW.layout_symbol["icon-rotate"]),"icon-padding":new n_(eW.layout_symbol["icon-padding"]),"icon-keep-upright":new n_(eW.layout_symbol["icon-keep-upright"]),"icon-offset":new ng(eW.layout_symbol["icon-offset"]),"icon-anchor":new ng(eW.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new n_(eW.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new n_(eW.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new n_(eW.layout_symbol["text-rotation-alignment"]),"text-field":new ng(eW.layout_symbol["text-field"]),"text-font":new ng(eW.layout_symbol["text-font"]),"text-size":new ng(eW.layout_symbol["text-size"]),"text-max-width":new ng(eW.layout_symbol["text-max-width"]),"text-line-height":new ng(eW.layout_symbol["text-line-height"]),"text-letter-spacing":new ng(eW.layout_symbol["text-letter-spacing"]),"text-justify":new ng(eW.layout_symbol["text-justify"]),"text-radial-offset":new ng(eW.layout_symbol["text-radial-offset"]),"text-variable-anchor":new n_(eW.layout_symbol["text-variable-anchor"]),"text-anchor":new ng(eW.layout_symbol["text-anchor"]),"text-max-angle":new n_(eW.layout_symbol["text-max-angle"]),"text-writing-mode":new n_(eW.layout_symbol["text-writing-mode"]),"text-rotate":new ng(eW.layout_symbol["text-rotate"]),"text-padding":new n_(eW.layout_symbol["text-padding"]),"text-keep-upright":new n_(eW.layout_symbol["text-keep-upright"]),"text-transform":new ng(eW.layout_symbol["text-transform"]),"text-offset":new ng(eW.layout_symbol["text-offset"]),"text-allow-overlap":new n_(eW.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new n_(eW.layout_symbol["text-ignore-placement"]),"text-optional":new n_(eW.layout_symbol["text-optional"])});var h9={paint:new nx({"icon-opacity":new ng(eW.paint_symbol["icon-opacity"]),"icon-color":new ng(eW.paint_symbol["icon-color"]),"icon-halo-color":new ng(eW.paint_symbol["icon-halo-color"]),"icon-halo-width":new ng(eW.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ng(eW.paint_symbol["icon-halo-blur"]),"icon-translate":new n_(eW.paint_symbol["icon-translate"]),"icon-translate-anchor":new n_(eW.paint_symbol["icon-translate-anchor"]),"text-opacity":new ng(eW.paint_symbol["text-opacity"]),"text-color":new ng(eW.paint_symbol["text-color"],{runtimeType:e3,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ng(eW.paint_symbol["text-halo-color"]),"text-halo-width":new ng(eW.paint_symbol["text-halo-width"]),"text-halo-blur":new ng(eW.paint_symbol["text-halo-blur"]),"text-translate":new n_(eW.paint_symbol["text-translate"]),"text-translate-anchor":new n_(eW.paint_symbol["text-translate-anchor"])}),layout:h8};class h7{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:eQ,this.defaultValue=i}evaluate(i){if(i.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}rT(h7,"FormatSectionOverride",{omit:["defaultValue"]});class ue extends aI{constructor(i){super(i,h9)}recalculate(i,r){super.recalculate(i,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let r of n)0>
8i.indexOf(r)&&i.push(r);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(i,r,n,a){var o;let s=this.layout.get(i).evaluate(r,{},n,a),l=this._unevaluatedLayout._values[i];return l.isDataDriven()||iZ(l.value)||!s?s:(o=r.properties,s.replace(/{([^{}]+)}/g,(i,r)=>r in o?String(o[r]):""))}createBucket(i){return new h6(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let i of h9.paint.overridableProperties){if(!ue.hasPaintOverride(this.layout,i))continue;let r=this.paint.get(i),n=new iG(new h7(r),r.property.specification),a=null;a="constant"===r.value.kind||"source"===r.value.kind?new iq("source",n):new iW("composite",n,r.value.zoomStops,r.value._interpolationType),this.paint._values[i]=new nf(r.property,a,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&ue.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){let n=i.get("text-field"),a=h9.paint.properties[r],o=!1,s=i=>{for(let r of i)if(a.overrides&&a.overrides.hasOverride(r))return void(o=!0)};if("constant"===n.value.kind&&n.value.value instanceof tf)s(n.value.value.sections);else if("source"===n.value.kind){let i=r=>{o||(r instanceof tv&&ty(r.value)===e8?s(r.value.sections):r instanceof tE?s(r.sections):r.eachChild(i))},r=n.value;r._styleExpression&&i(r._styleExpression.expression)}return o}getProgramConfiguration(i){return new ab(this,i)}}var ut={paint:new nx({"background-color":new n_(eW.paint_background["background-color"]),"background-pattern":new n_(eW.paint_background["background-pattern"]),"background-opacity":new n_(eW.paint_background["background-opacity"])})},ui={paint:new nx({"raster-opacity":new n_(eW.paint_raster["raster-opacity"]),"raster-hue-rotate":new n_(eW.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new n_(eW.paint_raster["raster-brightness-min"]),"raster-brightness-max":new n_(eW.paint_raster["raster-brightness-max"]),"raster-saturation":new n_(eW.paint_raster["raster-saturation"]),"raster-contrast":new n_(eW.paint_raster["raster-contrast"]),"raster-resampling":new n_(eW.paint_raster["raster-resampling"]),"raster-fade-duration":new n_(eW.paint_raster["raster-fade-duration"])})};class ur extends aI{constructor(i){super(i,{}),this.implementation=i}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isLayerDraped(){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}var un={paint:new nx({"sky-type":new n_(eW.paint_sky["sky-type"]),"sky-atmosphere-sun":new n_(eW.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new n_(eW.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new n_(eW.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new n_(eW.paint_sky["sky-gradient-radius"]),"sky-gradient":new ny(eW.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new n_(eW.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new n_(eW.paint_sky["sky-atmosphere-color"]),"sky-opacity":new n_(eW.paint_sky["sky-opacity"])})};function ua(i,r,n){let a=[0,0,1],o=ot([]);return or(o,o,n?-(i*E)+Math.PI:i*E),oi(o,o,-(r*E)),a6(a,a,o),a2(a,a)}let uo={circle:class extends aI{constructor(i){super(i,sa)}createBucket(i){return new o1(i)}queryRadius(i){return se("circle-radius",this,i)+se("circle-stroke-width",this,i)+st(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,n,a,o,s,l,h){let u=sr(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n);return so(i,a,s,l,h,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),u,c)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new ab(this,i)}},heatmap:class extends aI{createBucket(i){return new sh(i)}constructor(i){super(i,sm),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s_({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 se("heatmap-radius",this,i)}queryIntersectsFeature(i,r,n,a,o,s,l,h){let u=this.paint.get("heatmap-radius").evaluate(r,n);return so(i,a,s,l,h,!0,!0,new w(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new ab(this,i)}},hillshade:class extends aI{constructor(i){super(i,sg)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends aI{constructor(i){super(i,s$)}getProgramIds(){let i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),n=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(i){return new ab(this,i)}recalculate(i,r){super.recalculate(i,r);let n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new sG(i)}queryRadius(){return st(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,n,a,o,s){return!i.queryGeometry.isAboveHorizon&&o3(si(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),a)}isTileClipped(){return!0}},"fill-extrusion":class extends aI{constructor(i){super(i,ll)}createBucket(i){return new s7(i)}queryRadius(){return st(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 ab(this,i)}queryIntersectsFeature(i,r,n,a,o,s,l,h,u){var c,d,p,f;let m=sr(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),_=this.paint.get("fill-extrusion-height").evaluate(r,n),g=this.paint.get("fill-extrusion-base").evaluate(r,n),y=[0,0],x=h&&s.elevation,v=s.elevation?s.elevation.exaggeration():1,b=i.tile.getBucket(this);if(x&&b instanceof s7){let i=b.centroidVertexArray,r=u+1;r<i.length&&(y[0]=i.geta_centroid_pos0(r),y[1]=i.geta_centroid_pos1(r))}if(0===y[0]&&1===y[1])return!1;"globe"===s.projection.name&&(a=lo([a],[new w(0,0),new w(8192,8192)],i.tileID.canonical).map(i=>i.polygon).flat());let[T,E]=(c=a,d=x?h:null,p=s.center.lat,f=i.tileID.canonical,"globe"===s.projection.name?function(i,r,n,a,o,s,l,h,u,c,d){let p=[],f=[],m=i.projection.upVectorScale(d,i.center.lat,i.worldSize).metersToTile,_=[0,0,0,1],g=[0,0,0,1],y=(i,r,n,a)=>{i[0]=r,i[1]=n,i[2]=a,i[3]=1},x=la();for(let v of(n>0&&(n+=x),a+=x,r)){let r=[],x=[];for(let p of v){let f=p.x+o.x,v=p.y+o.y,b=i.projection.projectTilePoint(f,v,d),w=i.projection.upVector(d,p.x,p.y),T=n,E=a;if(l){let i=lg(f,v,n,a,l,h,u,c);T+=i.base,E+=i.top}0!==n?y(_,b.x+w[0]*m*T,b.y+w[1]*m*T,b.z+w[2]*m*T):y(_,b.x,b.y,b.z),y(g,b.x+w[0]*m*E,b.y+w[1]*m*E,b.z+w[2]*m*E),a4(_,_,s),a4(g,g,s),r.push(new lf(_[0],_[1],_[2])),x.push(new lf(g[0],g[1],g[2]))}p.push(r),f.push(x)}return[p,f]}(s,c,g,_,m,l,d,y,v,p,f):d?function(i,r,n,a,o,s,l,h,u){let c=[],d=[],p=[0,0,0,1];for(let f of i){let i=[],m=[];for(let c of f){let d=c.x+a.x,f=c.y+a.y,_=lg(d,f,r,n,s,l,h,u);p[0]=d,p[1]=f,p[2]=_.base,p[3]=1,a7(p,p,o),p[3]=Math.max(p[3],1e-5);let g=new lf(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=d,p[1]=f,p[2]=_.top,p[3]=1,a7(p,p,o),p[3]=Math.max(p[3],1e-5);let y=new lf(p[0]/p[3],p[1]/p[3],p[2]/p[3]);i.push(g),m.push(y)}c.push(i),d.push(m)}return[c,d]}(c,g,_,m,l,d,y,v,p):function(i,r,n,a,o){let s=[],l=[],h=o[8]*r,u=o[9]*r,c=o[10]*r,d=o[11]*r,p=o[8]*n,f=o[9]*n,m=o[10]*n,_=o[11]*n;for(let r of i){let i=[],n=[];for(let s of r){let r=s.x+a.x,l=s.y+a.y,g=o[0]*r+o[4]*l+o[12],y=o[1]*r+o[5]*l+o[13],x=o[2]*r+o[6]*l+o[14],v=o[3]*r
8+o[7]*l+o[15],b=g+h,w=y+u,T=x+c,E=Math.max(v+d,1e-5),S=g+p,M=y+f,A=x+m,I=Math.max(v+_,1e-5);i.push(new lf(b/E,w/E,T/E)),n.push(new lf(S/I,M/I,A/I))}s.push(i),l.push(n)}return[s,l]}(c,g,_,m,l)),S=i.queryGeometry;return function(i,r,n){let a=1/0;o3(n,r)&&(a=l_(n,r[0]));for(let o=0;o<r.length;o++){let s=r[o],l=i[o];for(let i=0;i<s.length-1;i++){let r=s[i],o=[r,s[i+1],l[i+1],l[i],r];o2(n,o)&&(a=Math.min(a,l_(n,o)))}}return a!==1/0&&a}(T,E,S.isPointQuery()?S.screenBounds:S.screenGeometry)}},line:class extends aI{constructor(i){super(i,lE),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){if("line-gradient"===i){let i=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=i._styleExpression&&i._styleExpression.expression instanceof tY,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(i,r){super.recalculate(i,r),this.paint._values["line-floorwidth"]=lS.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new lw(i)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(i){return new ab(this,i)}queryRadius(i){var r,n;return r=se("line-width",this,i),((n=se("line-gap-width",this,i))>0?n+2*r:r)/2+Math.abs(se("line-offset",this,i))+st(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,n,a,o,s){var l,h;if(i.queryGeometry.isAboveHorizon)return!1;let u=si(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=i.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(r,n),(h=this.paint.get("line-gap-width").evaluate(r,n))>0?h+2*l:l),d=this.paint.get("line-offset").evaluate(r,n);return d&&(a=function(i,r){let n=[],a=new w(0,0);for(let o=0;o<i.length;o++){let s=i[o],l=[];for(let i=0;i<s.length;i++){let n=s[i-1],o=s[i],h=s[i+1],u=0===i?a:o.sub(n)._unit()._perp(),c=i===s.length-1?a:h.sub(o)._unit()._perp(),d=u._add(c)._unit();d._mult(1/(d.x*c.x+d.y*c.y)),l.push(d._mult(r)._add(o))}n.push(l)}return n}(a,d*i.pixelToTileUnitsFactor)),function(i,r,n){for(let a=0;a<r.length;a++){let o=r[a];if(i.length>=3){for(let r=0;r<o.length;r++)if(o9(i,o[r]))return!0}if(function(i,r,n){if(i.length>1){if(o5(i,r))return!0;for(let a=0;a<r.length;a++)if(o4(r[a],i,n))return!0}for(let a=0;a<i.length;a++)if(o4(i[a],r,n))return!0;return!1}(i,o,n))return!0}return!1}(u,a,c)}isTileClipped(){return!0}},symbol:ue,background:class extends aI{constructor(i){super(i,ut)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends aI{constructor(i){super(i,ui)}getProgramIds(){return["raster"]}},sky:class extends aI{constructor(i){super(i,un),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"sky-gradient"===i?this._updateColorRamp():"sky-atmosphere-sun"!==i&&"sky-atmosphere-halo-color"!==i&&"sky-atmosphere-color"!==i&&"sky-atmosphere-sun-intensity"!==i||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=s_({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")){let r=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(i,r){if("atmosphere"===this.paint.get("sky-type")){let n=this.paint.get("sky-atmosphere-sun"),a=!n,o=i.style.light,s=o.properties.get("position");return a&&"viewport"===o.properties.get("anchor")&&W("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?ua(s.azimuthal,90-s.polar,r):ua(n[0],90-n[1],r)}let n=this.paint.get("sky-gradient-center");return ua(n[0],90-n[1],r)}is3D(){return!1}isSky(){return!0}
8markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let i=this.paint.get("sky-type");return"atmosphere"===i?["skyboxCapture","skybox"]:"gradient"===i?["skyboxGradient"]:null}}};class us{constructor(i,r,n,a){this.context=i,this.format=n,this.texture=i.gl.createTexture(),this.update(r,a)}update(i,r,n){let{width:a,height:o}=i,{context:s}=this,{gl:l}=s,{HTMLImageElement:h,HTMLCanvasElement:u,HTMLVideoElement:c,ImageData:p,ImageBitmap:f}=d;if(l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!r||!1!==r.premultiply)),n||this.size&&this.size[0]===a&&this.size[1]===o){let{x:r,y:s}=n||{x:0,y:0};i instanceof h||i instanceof u||i instanceof c||i instanceof p||f&&i instanceof f?l.texSubImage2D(l.TEXTURE_2D,0,r,s,l.RGBA,l.UNSIGNED_BYTE,i):l.texSubImage2D(l.TEXTURE_2D,0,r,s,a,o,l.RGBA,l.UNSIGNED_BYTE,i.data)}else this.size=[a,o],i instanceof h||i instanceof u||i instanceof c||i instanceof p||f&&i instanceof f?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,i):l.texImage2D(l.TEXTURE_2D,0,this.format,a,o,0,this.format,l.UNSIGNED_BYTE,i.data);this.useMipmap=!!(r&&r.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&l.generateMipmap(l.TEXTURE_2D)}bind(i,r){let{context:n}=this,{gl:a}=n;a.bindTexture(a.TEXTURE_2D,this.texture),i!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,this.useMipmap?i===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_NEAREST:i),this.filter=i),r!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,r),a.texParameteri(a.TEXTURE_2D,a.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(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}class ul{constructor(i){this._callback=i,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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 uh{constructor(){this.tasks={},this.taskQueue=[],N(["process"],this),this.invoker=new ul(this.process),this.nextId=0}add(i,r){let n=this.nextId++,a=function({type:i,isSymbolTile:r,zoom:n}){return n=n||0,"message"===i?0:"maybePrepare"!==i||r?"parseTile"!==i||r?"parseTile"===i&&r?300-n:"maybePrepare"===i&&r?400-n:500:200-n:100-n}(r);return 0===a?(H(),i(),{cancel:()=>{}}):(this.tasks[n]={fn:i,metadata:r,priority:a,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){H();{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;let i=this.pick();if(null===i)return;let r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let n=0;n<this.taskQueue.length;n++){let a=this.tasks[this.taskQueue[n]];a.priority<r&&(r=a.priority,i=n)}if(null===i)return null;let n=this.taskQueue[i];return this.taskQueue.splice(i,1),n}remove(){this.invoker.remove()}}class uu{constructor(i){this._stringToNumber={},this._numberToString=[];for(let r=0;r<i.length;r++){let n=i[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(i){return this._stringToNumber[i]}decode(i){return this._numberToString[i]}}let uc=["tile","layer","source","sourceLayer","state"];class ud{constructor(i,r,n,a,o){this.type="Feature",this._vectorTileFeature=i,this._z=r,this._x=n,this._y=a,this.properties=i.properties,this.id=o}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(i){this._geometry=i}toJSON(){let i={type:"Feature",geometry:this.geometry,properties:this.properties};for(let r of(void 0!==this.id&&(i.id=this.id),uc))void 0!==this[r]&&(i[r]=this[r]);return i}}let up=new Uint16Array(8184);for(let i=0;i<2046;i++){let r=i+2,n=0,a=0,o=0,s=0,l=0,h=0;for(1&r?o=s=l=32:n=a=h=32;(r>>=1)>1;){let i=n+o>>1,u=a+s>>1;1&r?(o=n,s=a,n=l,a=h):(n=o,a=s,o=l,s=h),l=i,h=u}let u=4*i;up[u+0]=n,up[u+1]=a,up[u+2]=o,up[u+3]=s}let uf=new Uint16Array(2178),um=new Uint8Array(1089),u_=new Uint16Array(1089);function ug(i){return 0===i?-.03125:32===i?.03125:0}var uy=nE([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);let ux={type:2,extent:8192,loadGeometry:()=>[[new w(0,0),new w(8193,0),new w(8193,8193),new w(0,8193),new w(0,0)]]};class uv{constructor(i,r,n,a,o){this.tileID=i,this.uid=O(),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=o,this.expiredRequestCount=0,this.state="loading",a&&a.transform&&(this.projection=a.transform.projection)}registerFadeDuration(i){let r=i+this.timeAdded;r<eN.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=hR(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,n){if(this.unloadVectorData(),this.state="loaded",i){for(let a in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=function(i,r){let n={};if(!r)return n;for(let a of i){let i=a.layerIds.map(i=>
8r.getLayer(i)).filter(Boolean);if(0!==i.length)for(let r of(a.layers=i,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(r=>i.filter(i=>i.id===r)[0])),i))n[r.id]=a}return n}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[a];if(i instanceof h6){if(this.hasSymbolBuckets=!0,!n)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof h6&&r.hasRTLText){this.hasRTLText=!0,no.isLoading()||no.isLoaded()||"deferred"!==nn()||na();break}}for(let i in this.queryPadding=0,this.buckets){let n=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(i).queryRadius(n))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas)}else this.collisionBoxArray=new nJ}unloadVectorData(){if(this.hasData()){for(let i in this.buckets)this.buckets[i].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._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=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(i){return this.buckets[i.id]}upload(i){for(let r in this.buckets){let n=this.buckets[r];n.uploadPending()&&n.upload(i)}let r=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new us(i,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new us(i,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new us(i,this.lineAtlas.image,r.ALPHA),this.lineAtlas.uploaded=!0)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,r,n,a,o,s,l,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:a,pixelPosMatrix:l,transform:s,params:o,tileTransform:this.tileTransform},i,r,n):{}}querySourceFeatures(i,r){let n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;let a=n.loadVTLayers(),o=r?r.sourceLayer:"",s=a._geojsonTileLayer||a[o];if(!s)return;let l=i5(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let a=s.feature(r);if(l.needGeometry){let i=oJ(a,!0);if(!l.filter(new ns(this.tileID.overscaledZ),i,this.tileID.canonical))continue}else if(!l.filter(new ns(this.tileID.overscaledZ),a))continue;let p=n.getId(a,o),f=new ud(a,h,u,c,p);f.tile=d,i.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=Y(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let i=Date.now(),n=!1;if(this.expirationTime>i)n=!1;else if(r){if(this.expirationTime<r)n=!0;else{let a=this.expirationTime-r;a?this.expirationTime=i+Math.max(a,3e4):n=!0}}else n=!0;n?(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(),2147483647)}setFeatureState(i,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(i).length||!r)return;let n=this.latestFeatureIndex.loadVTLayers(),a=r.style.listImages();for(let o in this.buckets){if(!r.style.hasLayer(o))continue;let s=this.buckets[o],l=s.layers[0].sourceLayer||"_geojsonTileLayer",h=n[l],u=i[l];if(!h||!u||0===Object.keys(u).length)continue;if(s.update(u,h,a,this.imageAtlas&&this.imageAtlas.patternPositions||{}),s instanceof lw||s instanceof sG){let i=r.style._getSourceCache(s.layers[0].source);r._terrain&&r._terrain.enabled&&i&&s.programConfigurations.needsUpload&&r._terrain._clearRenderCacheForTile(i.id,this.tileID)}let c=r&&r.style&&r.style.getLayer(o);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<eN.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=eN.now()+i}setTexture(i,r){let n=r.context,a=n.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture?this.texture.update(i,{useMipmap:!0}):(this.texture=new us(n,i,a.RGBA,{useMipmap:!0}),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),n.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax))}
8setDependencies(i,r){let n={};for(let i of r)n[i]=!0;this.dependencies[i]=n}hasDependency(i,r){for(let n of i){let i=this.dependencies[n];if(i){for(let n of r)if(i[n])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let n=oK(ux,this.tileID.canonical,this.tileTransform)[0],a=new nM,o=new nH;for(let i=0;i<n.length;i++){let{x:r,y:s}=n[i];a.emplaceBack(r,s),o.emplaceBack(i)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(a,oo.members),this._tileDebugSegments=ak.simpleSegment(0,0,a.length,o.length)}_makeTileBoundsBuffers(i,r){let n,a;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=oK(ux,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let n=hR(i,r),a=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=o$((i.x+(s+ug(s))/32)/a),h=oq((i.y+(o+ug(o))/32)/a),u=r.project(l,h),c=33*o+s;uf[2*c+0]=Math.round((u.x*n.scale-n.x)*8192),uf[2*c+1]=Math.round((u.y*n.scale-n.y)*8192)}um.fill(0),u_.fill(0);for(let i=2045;i>=0;i--){let r=4*i,n=up[r+0],a=up[r+1],o=up[r+2],s=up[r+3],l=n+o>>1,h=a+s>>1,u=l+h-a,c=h+n-l,d=33*a+n,p=33*s+o,f=33*h+l,m=Math.hypot((uf[2*d+0]+uf[2*p+0])/2-uf[2*f+0],(uf[2*d+1]+uf[2*p+1])/2-uf[2*f+1])>=16;if(um[f]=um[f]||(m?1:0),i<1022){let i=(a+c>>1)*33+(n+u>>1),r=(s+c>>1)*33+(o+u>>1);um[f]=um[f]||um[i]||um[r]}}let o=new nI,s=new nj,l=0;function h(i,r){let n=33*r+i;return 0===u_[n]&&(o.emplaceBack(uf[2*n+0],uf[2*n+1],8192*i/32,8192*r/32),u_[n]=++l),u_[n]-1}function u(i,r,n,a,o,l){let c=i+n>>1,d=r+a>>1;if(Math.abs(i-o)+Math.abs(r-l)>1&&um[33*d+c])u(o,l,i,r,c,d),u(n,a,o,l,c,d);else{let u=h(i,r),c=h(n,a),d=h(o,l);s.emplaceBack(u,c,d)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);n=i.vertices,a=i.indices}else{for(let{x:i,y:r}of(n=new nI,a=new nj,o))n.emplaceBack(i,r,0,0);let i=sx(n.int16,void 0,4);for(let r=0;r<i.length;r+=3)a.emplaceBack(i[r],i[r+1],i[r+2])}this._tileBoundsBuffer=i.createVertexBuffer(n,uy.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(a),this._tileBoundsSegments=ak.simpleSegment(0,0,n.length,a.length)}_makeGlobeTileDebugBuffers(i,r){let n;let a=r.projection;if(!a||"globe"!==a.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=oz(ob(o,r)),l=oP(r.zoom);l>0&&(n=aO(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,o,r,s,n,l),this._makeGlobeTileDebugTextBuffer(i,o,r,s,n,l)}_globePoint(i,r,n,a,o,s,l){let h=oA(i,r,n);if(s){let o=1<<n.z,u=oG(a.center.lng),c=oZ(a.center.lat),d=(n.x+.5)/o-u,p=0;d>.5?p=-1:d<-.5&&(p=1);let f=(i/8192+n.x)/o+p,m=(r/8192+n.y)/o;f=(f-u)*a._pixelsPerMercatorPixel+u,m=(m-c)*a._pixelsPerMercatorPixel+c;let _=[f*a.worldSize,m*a.worldSize,0];a4(_,_,s),h=ov(h,_,l)}return a4(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,n,a,o,s){let l=new nM,h=new nH,u=new nA,c=(i,c,d,p,f)=>{let m=(d-i)/(f-1),_=(p-c)/(f-1),g=l.length;for(let d=0;d<f;d++){let p=i+d*m,f=c+d*_;l.emplaceBack(p,f);let y=this._globePoint(p,f,r,n,a,o,s);u.emplaceBack(y[0],y[1],y[2]),h.emplaceBack(g+d)}};c(0,0,8192,0,16),c(8192,0,8192,8192,16),c(8192,8192,0,8192,16),c(0,8192,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(h),this._tileDebugBuffer=i.createVertexBuffer(l,oo.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,oa.members),this._tileDebugSegments=ak.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,n,a,o,s){let l=new nM,h=new nj,u=new nA;h.reserve(32),l.reserve(25),u.reserve(25);let c=(i,r)=>25*i+r;for(let i=0;i<25;i++){let h=2048*i;for(let i=0;i<25;i++){let c=2048*i;l.emplaceBack(c,h);let d=this._globePoint(c,h,r,n,a,o,s);u.emplaceBack(d[0],d[1],d[2])}}for(let i=0;i<4;i++)for(let r=0;r<4;r++){let n=c(i,r),a=c(i,r+1),o=c(i+1,r),s=c(i+1,r+1);h.emplaceBack(n,a,o),h.emplaceBack(o,a,s)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(h),this._tileDebugTextBuffer=i.createVertexBuffer(l,oo.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(u,oa.members),this._tileDebugTextSegments=ak.simpleSegment(0,0,25,32)}}
8class ub{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,n){let a=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][a]=this.stateChanges[i][a]||{},R(this.stateChanges[i][a],n),null===this.deletedStates[i])for(let r in this.deletedStates[i]={},this.state[i])r!==a&&(this.deletedStates[i][r]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][a])for(let r in this.deletedStates[i][a]={},this.state[i][a])n[r]||(this.deletedStates[i][a][r]=null);else for(let r in n)this.deletedStates[i]&&this.deletedStates[i][a]&&null===this.deletedStates[i][a][r]&&delete this.deletedStates[i][a][r]}removeFeatureState(i,r,n){if(null===this.deletedStates[i])return;let a=String(r);if(this.deletedStates[i]=this.deletedStates[i]||{},n&&void 0!==r)null!==this.deletedStates[i][a]&&(this.deletedStates[i][a]=this.deletedStates[i][a]||{},this.deletedStates[i][a][n]=null);else if(void 0!==r){if(this.stateChanges[i]&&this.stateChanges[i][a])for(n in this.deletedStates[i][a]={},this.stateChanges[i][a])this.deletedStates[i][a][n]=null;else this.deletedStates[i][a]=null}else this.deletedStates[i]=null}getState(i,r){let n=String(r),a=R({},(this.state[i]||{})[n],(this.stateChanges[i]||{})[n]);if(null===this.deletedStates[i])return{};if(this.deletedStates[i]){let n=this.deletedStates[i][r];if(null===n)return{};for(let i in n)delete a[i]}return a}initializeTileState(i,r){i.setFeatureState(this.state,r)}coalesceChanges(i,r){let n={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let n in this.stateChanges[i])this.state[i][n]||(this.state[i][n]={}),R(this.state[i][n],this.stateChanges[i][n]),r[n]=this.state[i][n];n[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};if(null===this.deletedStates[i])for(let n in this.state[i])r[n]={},this.state[i][n]={};else for(let n in this.deletedStates[i]){if(null===this.deletedStates[i][n])this.state[i][n]={};else if(this.state[i][n])for(let r of Object.keys(this.deletedStates[i][n]))delete this.state[i][n][r];r[n]=this.state[i][n]}n[i]=n[i]||{},R(n[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(let a in i)i[a].setFeatureState(n,r)}}class uw{constructor(i){this.size=i,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(i,r){let n=this.toIdx(i,r);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(i,r){return this.leaves[this.toIdx(i,r)]}toIdx(i,r){return r*this.size+i}}function uT(i,r,n,a){let o=0,s=Number.MAX_VALUE;for(let l=0;l<3;l++)if(1e-15>Math.abs(a[l])){if(n[l]<i[l]||n[l]>r[l])return null}else{let h=1/a[l],u=(i[l]-n[l])*h,c=(r[l]-n[l])*h;if(u>c){let i=u;u=c,c=i}if(u>o&&(o=u),c<s&&(s=c),o>s)return null}return o}function uE(i,r,n,a,o,s,l,h,u,c,d){let p=a-i,f=o-r,m=s-n,_=l-i,g=h-r,y=u-n,x=d[1]*y-d[2]*g,v=d[2]*_-d[0]*y,b=d[0]*g-d[1]*_,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;let T=1/w,E=c[0]-i,S=c[1]-r,M=c[2]-n,A=(E*x+S*v+M*b)*T;if(A<0||A>1)return null;let I=S*m-M*f,C=M*p-E*m,z=E*f-S*p,k=(d[0]*I+d[1]*C+d[2]*z)*T;return k<0||A+k>1?null:(_*I+g*C+y*z)*T}function uS(i,r,n,a,o,s,l,h,u){let c=1<<n,d=s-a,p=l-o;h[0]=(i+0)/c*d+a,h[1]=(r+0)/c*p+o,u[0]=(i+1)/c*d+a,u[1]=(r+1)/c*p+o}class uM{constructor(i){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=i,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;let r=function(i){let r=Math.ceil(Math.log2(i.dim/8)),n=[],a=Math.ceil(Math.pow(2,r)),o=1/a,s=(i,r,n,a,o)=>{let s=a?1:0;o[0]=i*n,o[1]=r*n,o[2]=(i+1)*n-s,o[3]=(r+1)*n-s},l=new uw(a),h=[];for(let r=0;r<a*a;r++){s(r%a,Math.floor(r/a),o,!1,h);let n=uI(h[0],h[1],i),u=uI(h[2],h[1],i),c=uI(h[2],h[3],i),d=uI(h[0],h[3],i);l.minimums.push(Math.min(n,u,c,d)),l.maximums.push(Math.max(n,u,c,d)),l.leaves.push(1)}for(n.push(l),a/=2;a>=1;a/=2){let i=n[n.length-1];l=new uw(a);for(let r=0;r<a*a;r++){s(r%a,Math.floor(r/a),2,!0,h);let n=i.getElevation(h[0],h[1]),o=i.getElevation(h[2],h[1]),u=i.getElevation(h[2],h[3]),c=i.getElevation(h[0],h[3]),d=i.isLeaf(h[0],h[1]),p=i.isLeaf(h[2],h[1]),f=i.isLeaf(h[2],h[3]),m=i.isLeaf(h[0],h[3]),_=Math.min(n.min,o.min,u.min,c.min),g=Math.max(n.max,o.max,u.max,c.max),y=d&&p&&f&&m;l.maximums.push(g),l.minimums.push(_),l.leaves.push(g-_<=5&&y?1:0)}n.push(l)}return n}(this.dem),n=r.length-1,a=r[n];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(r,0,0,n,0)}raycastRoot(i,r,n,a,o,s,l=1){return uT([i,r,-100],[n,a,this.maximums[0]*l],o,s)}raycast(i,r,n,a,o,s,l=1){if(!this.nodeCount)return null;let h=this.raycastRoot(i,r,n,a,o,s,l);if(null==h)return null;let u=[],c=[],d=[],p=[],f=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;f.length>0;){let{idx:h,t:g,nodex:y,nodey:x,depth:v}=f.pop();if(this.leaves[h]){uS(y,x,v,i,r,n,a,d,p);let h=1<<v,u=(y+0)/h,c=(y+1)/h,f=(x+0)/h,b=(x+1)/h,w=uI(u,f,this.dem)*l,T=uI(c,f,this.dem)*l,E=uI(c,b,this.dem)*l,S=uI(u,b,this.dem)*l,M=uE(d[0],d[1],w,p[0],d[1],T,p[0],p[1],E,o,s),A=uE(p[0],p[1],E,d[0],p[1],S,d[0],d[1],w,o,s),I=Math.min(null!==M?M:Number.MAX_VALUE,null!==A?A:Number.MAX_VALUE);if(I!==Number.MAX_VALUE)return I;{var m,_;let i=a1([],o,s,g);if(uA(w,T,S,E,(i[0]-(m=d[0]))/(p[0]-m),(i[1]-(_=d[1]))/(p[1]-_))>=i[2])return g}continue}let b=0;for(let f=0;f<this._siblingOffset.length;f++){uS((y<<1)+this._siblingOffset[f][0],(x<<1)+this._siblingOffset[f][1],v+1,i,r,n,a,d,p),d[2]=-100,p[2]=this.maximums[this.childOffsets[h]+f]*l;let m=uT(d,p,o,s);if(null!=m){u[f]=m;let i=!1;for(let r=0;r<b&&!i;r++)m>=u[c[r]]&&(c.splice(r,0,f),i=!0);i||(c[b]=f),b++}}for(let i=0;i<b;i++){let r=c[i];f.push({idx:this.childOffsets[h]+r,t:u[r],nodex:(y<<1)+this._siblingOffset[r][0],nodey:(x<<1)+this._siblingOffset[r][1],depth:v+1})}}return null}_addNode(i,r,n){return this.minimums.push(i),this.maximums.push(r),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(i,r,n,a,o){if(1===i[a].isLeaf(r,n))return;
8this.childOffsets[o]||(this.childOffsets[o]=this.nodeCount);let s=a-1,l=i[s],h=0,u=0;for(let i=0;i<this._siblingOffset.length;i++){let a=2*r+this._siblingOffset[i][0],o=2*n+this._siblingOffset[i][1],s=l.getElevation(a,o),c=l.isLeaf(a,o),d=this._addNode(s.min,s.max,c);c&&(h|=1<<i),u||(u=d)}for(let a=0;a<this._siblingOffset.length;a++)h&1<<a||this._construct(i,2*r+this._siblingOffset[a][0],2*n+this._siblingOffset[a][1],s,u+a)}}function uA(i,r,n,a,o,s){return tK(tK(i,n,s),tK(r,a,s),o)}function uI(i,r,n){let a=n.dim,o=z(i*a-.5,0,a-1),s=z(r*a-.5,0,a-1),l=Math.floor(o),h=Math.floor(s),u=Math.min(l+1,a-1),c=Math.min(h+1,a-1);return uA(n.get(l,h),n.get(u,h),n.get(l,c),n.get(u,c),o-l,s-h)}let uC={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class uz{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(i,r,n,a=!1,o=!1){if(this.uid=i,r.height!==r.width)throw RangeError("DEM tiles must be square");if(n&&"mapbox"!==n&&"terrarium"!==n)return W(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;let s=this.dim=r.height-2,l=new Uint32Array(r.data.buffer);if(this.pixels=new Uint8Array(r.data.buffer),this.encoding=n||"mapbox",this.borderReady=a,!a){for(let i=0;i<s;i++)l[this._idx(-1,i)]=l[this._idx(0,i)],l[this._idx(s,i)]=l[this._idx(s-1,i)],l[this._idx(i,-1)]=l[this._idx(i,0)],l[this._idx(i,s)]=l[this._idx(i,s-1)];l[this._idx(-1,-1)]=l[this._idx(0,0)],l[this._idx(s,-1)]=l[this._idx(s-1,0)],l[this._idx(-1,s)]=l[this._idx(0,s-1)],l[this._idx(s,s)]=l[this._idx(s-1,s-1)],o&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new uM(this)}get(i,r,n=!1){n&&(i=z(i,-1,this.dim),r=z(r,-1,this.dim));let a=4*this._idx(i,r);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(this.pixels[a],this.pixels[a+1],this.pixels[a+2])}static getUnpackVector(i){return uC[i]}get unpackVector(){return uC[this.encoding]}_idx(i,r){if(i<-1||i>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}_unpackMapbox(i,r,n){return(256*i*256+256*r+n)/10-1e4}_unpackTerrarium(i,r,n){return 256*i+r+n/256-32768}static pack(i,r){let n=[0,0,0,0],a=uz.getUnpackVector(r),o=Math.floor((i+a[3])/a[2]);return n[2]=o%256,o=Math.floor(o/256),n[1]=o%256,o=Math.floor(o/256),n[0]=o,n}getPixels(){return new sf({width:this.stride,height:this.stride},this.pixels)}backfillBorder(i,r,n){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let a=r*this.dim,o=r*this.dim+this.dim,s=n*this.dim,l=n*this.dim+this.dim;switch(r){case -1:a=o-1;break;case 1:o=a+1}switch(n){case -1:s=l-1;break;case 1:l=s+1}let h=-r*this.dim,u=-n*this.dim;for(let r=s;r<l;r++)for(let n=a;n<o;n++){let a=4*this._idx(n,r),o=4*this._idx(n+h,r+u);this.pixels[a+0]=i.pixels[o+0],this.pixels[a+1]=i.pixels[o+1],this.pixels[a+2]=i.pixels[o+2],this.pixels[a+3]=i.pixels[o+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}rT(uz,"DEMData"),rT(uM,"DemMinMaxQuadTree",{omit:["dem"]});class uk{constructor(i,r){this.max=i,this.onRemove=r,this.reset()}reset(){for(let i in this.data)for(let r of this.data[i])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(i,r,n){let a=i.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let o={value:r,timeout:void 0};if(void 0!==n&&(o.timeout=setTimeout(()=>{this.remove(i,o)},n)),this.data[a].push(o),this.order.push(a),this.order.length>this.max){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){let r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){let r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;let n=i.wrapped().key,a=void 0===r?0:this.data[n].indexOf(r),o=this.data[n][a];return this.data[n].splice(a,1),o.timeout&&clearTimeout(o.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(o.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(i){let r=[];for(let n in this.data)for(let a of this.data[n])i(a.value)||r.push(a);for(let i of r)this.remove(i.value.tileID,i)}}class uD{constructor(i,r,n){this.func=i,this.mask=r,this.range=n}}uD.ReadOnly=!1,uD.ReadWrite=!0,uD.disabled=new uD(519,uD.ReadOnly,[0,1]);class uP{constructor(i,r,n,a,o,s){this.test=i,this.ref=r,this.mask=n,this.fail=a,this.depthFail=o,this.pass=s}}uP.disabled=new uP({func:519,mask:0},0,0,7680,7680,7680);class uL{constructor(i,r,n){this.blendFunction=i,this.blendColor=r,this.mask=n}}uL.Replace=[1,0],uL.disabled=new uL(uL.Replace,tc.transparent,[!1,!1,!1,!1]),uL.unblended=new uL(uL.Replace,tc.transparent,[!0,!0,!0,!0]),uL.alphaBlended=new uL([1,771],tc.transparent,[!0,!0,!0,!0]);class uR{constructor(i,r,n){this.enable=i,this.mode=r,this.frontFace=n}}uR.disabled=new uR(!1,1029,2305),uR.backCCW=new uR(!0,1029,2305),uR.backCW=new uR(!0,1029,2304),uR.frontCW=new uR(!0,1028,2304),uR.frontCCW=new uR(!0,1028,2305);class uB extends eq{constructor(i,r,n){super(),this.id=i,this._onlySymbols=n,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new uk(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
8,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new ub,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(i){this.map=i,this._minTileCacheSize=void 0===this._minTileCacheSize&&i?i._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&i?i._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let i in this._tiles){let r=this._tiles[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(i,r){return i.isSymbolTile=this._onlySymbols,this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i,()=>{})}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i,()=>{})}serialize(){return this._source.serialize()}prepare(i){for(let r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let n=this._tiles[r];n.upload(i),n.prepare(this.map.style.imageManager)}}getIds(){return L(this._tiles).map(i=>i.tileID).sort(uO).map(i=>i.key)}getRenderableIds(i){let r=[];for(let n in this._tiles)this._isIdRenderable(+n,i)&&r.push(this._tiles[n]);return i?r.sort((i,r)=>{let n=i.tileID,a=r.tileID,o=new w(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),s=new w(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-a.overscaledZ||s.y-o.y||s.x-o.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(uO).map(i=>i.key)}hasRenderableParent(i){let r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){let n=this._tiles[i];n&&("loading"!==n.state&&(n.state=r),this._loadTile(n,this._tileLoaded.bind(this,n,i,r)))}_tileLoaded(i,r,n,a){if(a){if(i.state="errored",404!==a.status)this._source.fire(new e$(a,{tile:i}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let i=this.map.painter.terrain;this.update(this.transform,i.getScaledDemTileSize(),!0),i.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=eN.now(),"expired"===n&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new eZ("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(i){let r=this.getRenderableIds();for(let a=0;a<r.length;a++){let o=r[a];if(i.neighboringTiles&&i.neighboringTiles[o]){let r=this.getTileByID(o);n(i,r),n(r,i)}}function n(i,r){if(!i.dem||i.dem.borderReady)return;i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0;let n=r.tileID.canonical.x-i.tileID.canonical.x,a=r.tileID.canonical.y-i.tileID.canonical.y,o=Math.pow(2,i.tileID.canonical.z),s=r.tileID.key;0===n&&0===a||Math.abs(a)>1||(Math.abs(n)>1&&(1===Math.abs(n+o)?n+=o:1===Math.abs(n-o)&&(n-=o)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,n,a),i.neighboringTiles&&i.neighboringTiles[s]&&(i.neighboringTiles[s].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,n,a){for(let o in this._tiles){let s=this._tiles[o];if(a[o]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>n)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>r+1;){let i=s.tileID.scaledTo(s.tileID.overscaledZ-1);(s=this._tiles[i.key])&&s.hasData()&&(l=i)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){a[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){let n=this._loadedParentTiles[i.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let n=i.overscaledZ-1;n>=r;n--){let r=i.scaledTo(n),a=this._getLoadedTile(r);if(a)return a}}_getLoadedTile(i){let r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;let n=Math.floor((Math.ceil(i.width/r)+1)*(Math.ceil(i.height/r)+1)*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,o="number"==typeof this._maxTileC
8acheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(o)}handleWrapJump(i){let r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){let i={};for(let n in this._tiles){let a=this._tiles[n];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+r),i[a.tileID.key]=a}for(let r in this._tiles=i,this._timers)clearTimeout(this._timers[r]),delete this._timers[r];for(let i in this._tiles)this._setTileReloadTimer(+i,this._tiles[i])}}update(i,r,n){let a;if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new ld(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y)):(a=i.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&&(a=a.filter(i=>this._source.hasTile(i)))):a=[];let o=this._updateRetainedTiles(a);if(uF(this._source.type)&&0!==a.length){let i={},r={};for(let n of Object.keys(o)){let a=o[n],s=this._tiles[n];if(!s||s.fadeEndTime&&s.fadeEndTime<=eN.now())continue;let l=this.findLoadedParent(a,Math.max(a.overscaledZ-uB.maxOverzooming,this._source.minzoom));l&&(this._addTile(l.tileID),i[l.tileID.key]=l.tileID),r[n]=a}let n=a[a.length-1].overscaledZ;for(let i in this._tiles){let a=this._tiles[i];if(o[i]||!a.hasData())continue;let s=a.tileID;for(;s.overscaledZ>n;){s=s.scaledTo(s.overscaledZ-1);let n=this._tiles[s.key];if(n&&n.hasData()&&r[s.key]){o[i]=a.tileID;break}}}for(let r in i)o[r]||(this._coveredTiles[r]=!0,o[r]=i[r])}for(let i in o)this._tiles[i].clearFadeHold();for(let i of function(i,r){let n=[];for(let a in i)a in r||n.push(a);return n}(this._tiles,o)){let r=this._tiles[i];r.hasSymbolBuckets&&!r.holdingForFade()?r.setHoldDuration(this.map._fadeDuration):r.hasSymbolBuckets&&!r.symbolFadeFinished()||this._removeTile(+i)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){let r={};if(0===i.length)return r;let n={},a=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),o=i[0].overscaledZ,s=Math.max(o-uB.maxOverzooming,this._source.minzoom),l=Math.max(o+uB.maxUnderzooming,this._source.minzoom),h={};for(let n of i){let i=this._addTile(n);r[n.key]=n,i.hasData()||a<this._source.maxzoom&&(h[n.key]=n)}for(let o of(this._retainLoadedChildren(h,a,l,r),i)){let i=this._tiles[o.key];if(i.hasData())continue;if(o.canonical.z>=this._source.maxzoom){let i=o.children(this._source.maxzoom)[0],n=this.getTile(i);if(n&&n.hasData()){r[i.key]=i;continue}}else{let i=o.children(this._source.maxzoom);if(r[i[0].key]&&r[i[1].key]&&r[i[2].key]&&r[i[3].key])continue}let a=i.wasRequested();for(let l=o.overscaledZ-1;l>=s;--l){let s=o.scaledTo(l);if(n[s.key]||(n[s.key]=!0,(i=this.getTile(s))||!a||(i=this._addTile(s)),i&&(r[s.key]=s,a=i.wasRequested(),i.hasData())))break}}return r}_updateLoadedParentTileCache(){for(let i in this._loadedParentTiles={},this._tiles){let r=[],n,a=this._tiles[i].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){n=this._loadedParentTiles[a.key];break}r.push(a.key);let i=a.scaledTo(a.overscaledZ-1);if(n=this._getLoadedTile(i))break;a=i}for(let i of r)this._loadedParentTiles[i]=n}}_addTile(i){let r=this._tiles[i.key];if(r)return r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));let n=!!r;if(!n){let n=this.map?this.map.painter:null;r=new uv(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,n,this._isRaster),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,n||this._source.fire(new eZ("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);let n=r.getExpiryTimeout();n&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},n))}_removeTile(i){let r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(let i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id
8)}tilesIn(i,r,n){let a=[],o=this.transform;if(!o)return a;let s="globe"===o.projection.name,l=oG(o.center.lng);for(let h in this._tiles){let u;let c=this._tiles[h];if(n&&c.clearQueryDebugViz(),!c.holdingForFade()){if(s){let i=c.tileID.canonical;if(0===i.z){let r=[Math.abs(z(l,...uU(i,-1))-l),Math.abs(z(l,...uU(i,1))-l)];u=[0,2*r.indexOf(Math.min(...r))-1]}else{let r=[Math.abs(z(l,...uU(i,-1))-l),Math.abs(z(l,...uU(i,0))-l),Math.abs(z(l,...uU(i,1))-l)];u=[r.indexOf(Math.min(...r))-1]}}else u=[0];for(let n of u){let s=i.containsTile(c,o,r,n);s&&a.push(s)}}}return a}getVisibleCoordinates(i){let r=this.getRenderableIds(i).map(i=>this._tiles[i].tileID);for(let i of r)i.projMatrix=this.transform.calculateProjMatrix(i.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(uF(this._source.type))for(let i in this._tiles){let r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=eN.now())return!0}return!1}setFeatureState(i,r,n){this._state.updateState(i=i||"_geojsonTileLayer",r,n)}removeFeatureState(i,r,n){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,n)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,n){let a=this._tiles[i];a&&a.setDependencies(r,n)}reloadTilesForDependencies(i,r){for(let n in this._tiles)this._tiles[n].hasDependency(i,r)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(i,r))}_preloadTiles(i,r){let n=new Map,a=Array.isArray(i)?i:[i],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(let i of a){for(let r of i.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))n.set(r.key,r);this.usedForTerrain&&i.updateElevation(!1)}P(Array.from(n.values()),(i,r)=>{let n=new uv(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),r(i,n)})},r)}}function uO(i,r){let n=Math.abs(2*i.wrap)-+(i.wrap<0),a=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||a-n||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function uF(i){return"raster"===i||"image"===i||"video"===i||"custom"===i}function uU(i,r){let n=1<<i.z;return[i.x/n+r,(i.x+1)/n+r]}uB.maxOverzooming=10,uB.maxUnderzooming=3;class uV{constructor(i,r,n){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=n}static create(i,r,n){let a=n||i.findDEMTileFor(r);if(!a||!a.dem)return;let o=a.dem,s=a.tileID,l=1<<r.canonical.z-s.canonical.z;return new uV(a,a.tileSize/8192/l,[(r.canonical.x/l-s.canonical.x)*o.dim,(r.canonical.y/l-s.canonical.y)*o.dim])}tileCoordToPixel(i,r){let n=r*this._scale+this._offset[1];return new w(Math.floor(i*this._scale+this._offset[0]),Math.floor(n))}getElevationAt(i,r,n,a){let o=i*this._scale+this._offset[0],s=r*this._scale+this._offset[1],l=Math.floor(o),h=Math.floor(s),u=this._dem;return a=!!a,n?tK(tK(u.get(l,h,a),u.get(l,h+1,a),s-h),tK(u.get(l+1,h,a),u.get(l+1,h+1,a),s-h),o-l):u.get(l,h,a)}getElevationAtPixel(i,r,n){return this._dem.get(i,r,!!n)}getMeterToDEM(i){return(1<<this._demTile.tileID.canonical.z)*(1/oj(i))*this._dem.stride}}class uN{constructor(i,r){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new rb(8192,16,0),this.featureIndexArray=new n6,this.promoteId=r}insert(i,r,n,a,o,s=0){let l=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,a,o,s);let h=this.grid;for(let i=0;i<r.length;i++){let n=r[i],a=[1/0,1/0,-1/0,-1/0];for(let i=0;i<n.length;i++){let r=n[i];a[0]=Math.min(a[0],r.x),a[1]=Math.min(a[1],r.y),a[2]=Math.max(a[2],r.x),a[3]=Math.max(a[3],r.y)}a[0]<8192&&a[1]<8192&&a[2]>=0&&a[3]>=0&&h.insert(l,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(let i in this.vtLayers=new s2(new lV(this.rawTileData)).layers,this.sourceLayerCoder=new uu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r,n,a){let o;this.loadVTLayers();let s=i.params||{},l=i5(s.filter),h=i.tileResult,u=i.transform,c=h.bufferedTilespaceBounds,d=this.grid.query(c.min.x,c.min.y,c.max.x,c.max.y,(i,r,n,a)=>o7(h.bufferedTilespaceGeometry,i,r,n,a));d.sort(uG);let p=null;u.elevation&&d.length>0&&(p=uV.create(u.elevation,this.tileID));let f={};for(let u=0;u<d.length;u++){let c=d[u];if(c===o)continue;o=c;let m=this.featureIndexArray.get(c),_=null;
8this.loadMatchingFeature(f,m,l,s.layers,s.availableImages,r,n,a,(r,n,a,o=0)=>(_||(_=oK(r,this.tileID.canonical,i.tileTransform)),n.queryIntersectsFeature(h,r,a,_,this.z,i.transform,i.pixelPosMatrix,p,o)))}return f}loadMatchingFeature(i,r,n,a,o,s,l,h,u){let{featureIndex:c,bucketIndex:d,sourceLayerIndex:p,layoutVertexArrayOffset:f}=r,m=this.bucketLayerIDs[d];if(a&&!function(i,r){for(let n=0;n<i.length;n++)if(r.indexOf(i[n])>=0)return!0;return!1}(a,m))return;let _=this.sourceLayerCoder.decode(p),g=this.vtLayers[_].feature(c);if(n.needGeometry){let i=oJ(g,!0);if(!n.filter(new ns(this.tileID.overscaledZ),i,this.tileID.canonical))return}else if(!n.filter(new ns(this.tileID.overscaledZ),g))return;let y=this.getId(g,_);for(let r=0;r<m.length;r++){let n=m[r];if(a&&0>a.indexOf(n))continue;let d=s[n];if(!d)continue;let p={};void 0!==y&&h&&(p=h.getState(d.sourceLayer||"_geojsonTileLayer",y));let _=R({},l[n]);_.paint=uj(_.paint,d.paint,g,p,o),_.layout=uj(_.layout,d.layout,g,p,o);let x=!u||u(g,d,p,f);if(!x)continue;let v=new ud(g,this.z,this.x,this.y,y);v.layer=_;let b=i[n];void 0===b&&(b=i[n]=[]),b.push({featureIndex:c,feature:v,intersectionZ:x})}}lookupSymbolFeatures(i,r,n,a,o,s,l,h){let u={};this.loadVTLayers();let c=i5(o);for(let o of i)this.loadMatchingFeature(u,{bucketIndex:n,sourceLayerIndex:a,featureIndex:o,layoutVertexArrayOffset:0},c,s,l,h,r);return u}loadFeature(i){let{featureIndex:r,sourceLayerIndex:n}=i;this.loadVTLayers();let a=this.sourceLayerCoder.decode(n),o=this.vtFeatures[a];if(o[r])return o[r];let s=this.vtLayers[a].feature(r);return o[r]=s,s}hasLayer(i){for(let r of this.bucketLayerIDs)for(let n of r)if(i===n)return!0;return!1}getId(i,r){let n=i.id;if(this.promoteId){let a="string"==typeof this.promoteId?this.promoteId:this.promoteId[r];null!=a&&(n=i.properties[a]),"boolean"==typeof n&&(n=Number(n))}return n}}function uj(i,r,n,a,o){return G(i,(i,s)=>{let l=r instanceof nm?r.get(s):null;return l&&l.evaluate?l.evaluate(n,a,o):l})}function uG(i,r){return r-i}rT(uN,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class uZ{constructor(i,r){this.width=i,this.height=r,this.nextRow=0,this.image=new sp({width:i,height:r}),this.positions={},this.uploaded=!1}getDash(i,r){let n=this.getKey(i,r);return this.positions[n]}trim(){let i=this.width,r=this.height=U(this.nextRow);this.image.resize({width:i,height:r})}getKey(i,r){return i.join(",")+r}getDashRanges(i,r,n){let a=[],o=i.length%2==1?-i[i.length-1]*n:0,s=i[0]*n,l=!0;a.push({left:o,right:s,isDash:l,zeroLength:0===i[0]});let h=i[0];for(let r=1;r<i.length;r++){l=!l;let u=i[r];o=h*n,h+=u,s=h*n,a.push({left:o,right:s,isDash:l,zeroLength:0===u})}return a}addRoundDash(i,r,n){let a=r/2;for(let r=-n;r<=n;r++){let o=this.width*(this.nextRow+n+r),s=0,l=i[0];for(let h=0;h<this.width;h++){let u;h/l.right>1&&(l=i[++s]);let c=Math.min(Math.abs(h-l.left),Math.abs(h-l.right)),d=r/n*(a+1);if(l.isDash){let i=a-Math.abs(d);u=Math.sqrt(c*c+i*i)}else u=a-Math.sqrt(c*c+d*d);this.image.data[o+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(i,r){for(let r=i.length-1;r>=0;--r){let n=i[r],a=i[r+1];n.zeroLength?i.splice(r,1):a&&a.isDash===n.isDash&&(a.left=n.left,i.splice(r,1))}let n=i[0],a=i[i.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);let o=this.width*this.nextRow,s=0,l=i[0];for(let n=0;n<this.width;n++){n/l.right>1&&(l=i[++s]);let a=Math.min(Math.abs(n-l.left),Math.abs(n-l.right));this.image.data[o+n]=Math.max(0,Math.min(255,(l.isDash?a:-a)+r+128))}}addDash(i,r){let n=this.getKey(i,r);if(this.positions[n])return this.positions[n];let a="round"===r,o=a?7:0,s=2*o+1;if(this.nextRow+s>this.height)return W("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let r=0;r<i.length;r++)i[r]<0&&(W("Negative value is found in line dasharray, replacing values with 0"),i[r]=0),l+=i[r];if(0!==l){let n=this.width/l,s=this.getDashRanges(i,this.width,n);a?this.addRoundDash(s,n,o):this.addRegularDash(s,"square"===r?.5*n:0)}let h=this.nextRow+o;this.nextRow+=s;let u={tl:[h,o],br:[l,0]};return this.positions[n]=u,u}}rT(uZ,"LineAtlas");class u${constructor(i){let r={},n=[];for(let a in i){let o=i[a],s=r[a]={};for(let i in o.glyphs){let r=o.glyphs[+i];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;let a=r.metrics.localGlyph?2:1,l={x:0,y:0,w:r.bitmap.width+2*a,h:r.bitmap.height+2*a};n.push(l),s[i]=l}}let{w:a,h:o}=l4(n),s=new sp({width:a||1,height:o||1});for(let n in i){let a=i[n];for(let i in a.glyphs){let o=a.glyphs[+i];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;let l=r[n][i],h=o.metrics.localGlyph?2:1;sp.copy(o.bitmap,s,{x:0,y:0},{x:l.x+h,y:l.y+h},o.bitmap)}}this.image=s,this.positions=r}}rT(u$,"GlyphAtlas");class uq{constructor(i){this.tileID=new ld(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.returnDependencies=!!i.returnDependencies,this.promoteId=i.promoteId,this.enableTerrain=!!i.enableTerrain,this.isSymbolTile=i.isSymbolTile,this.tileTransform=hR(i.tileID.canonical,i.projection),this.projection=i.projection}parse(i,r,n,a,o){let s,l,h,u;this.status="parsing",this.data=i,this.collisionBoxArray=new nJ;let c=new uu(Object.keys(i.layers).sort()),d=new uN(this.tileID,this.promoteId);d.bucketLayerIDs=[];let p={},f=new uZ(256,256),m={featureIndex:d,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:f,availableImages:n},_=r.familiesBySource[this.source];for(let r in _){let a=i.layers[r];if(!a)continue;let o=!1,s=!1;for(let i of _[r])"symbol"===i[0].type?o=!0:s=!0;if(!0===this.isSymbolTile&&!o||!1===this.isSymbolTile&&!s)continue;1===a.version&&W(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let l=c.encode(r),h=[];for(let i=0;i<a.length;i++){let n=a.feature(i),o=d.getId(n,r);h.push({feature:n,id:o,index:i,sourceLayerIndex:l})}for(let i of _[r]){let r=i[0];void 0!==this.isSymbolTile&&"symbol"===r.type!==this.isSymbolTile||r.minzoom&&this.zoom<Math.floor(r.minzoom)||r.maxzoom&&this.zoom>=r.maxzoom||"none"!==r.visibility&&(uW(i,this.zoom,n),(p[r.id]=r.createBucket({index:d.bucketLayerIDs.length,layers:i,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:l,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:n})).populate(h,m,this.tileID.canonical,this.tileTransform),d.bucketLayerIDs.push(i.map(i=>i.id)))}}f.trim();let g={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},y=G(m.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(y).length?a.send("getGlyphs",{uid:this.uid,stacks:y},(i,r)=>{s||(s=i,l=r,b.call(this))}
8,void 0,!1,g):l={};let x=Object.keys(m.iconDependencies);x.length?a.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"icons"},(i,r)=>{s||(s=i,h=r,b.call(this))},void 0,!1,g):h={};let v=Object.keys(m.patternDependencies);function b(){if(s)return o(s);if(l&&h&&u){let i=new u$(l),r=new l8(h,u);for(let a in p){let o=p[a];o instanceof h6?(uW(o.layers,this.zoom,n),function(i,r,n,a,o,s,l,h,u,c){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let d=i.layers[0].layout,p=i.layers[0]._unevaluatedLayout._values,f={};if("composite"===i.textSizeData.kind){let{minZoom:r,maxZoom:n}=i.textSizeData;f.compositeTextSizes=[p["text-size"].possiblyEvaluate(new ns(r),h),p["text-size"].possiblyEvaluate(new ns(n),h)]}if("composite"===i.iconSizeData.kind){let{minZoom:r,maxZoom:n}=i.iconSizeData;f.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new ns(r),h),p["icon-size"].possiblyEvaluate(new ns(n),h)]}f.layoutTextSize=p["text-size"].possiblyEvaluate(new ns(u+1),h),f.layoutIconSize=p["icon-size"].possiblyEvaluate(new ns(u+1),h),f.textMaxSize=p["text-size"].possiblyEvaluate(new ns(18),h);let m="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),_=d.get("text-size");for(let s of i.features){let u=d.get("text-font").evaluate(s,{},h).join(","),p=_.evaluate(s,{},h),g=f.layoutTextSize.evaluate(s,{},h),y=(f.layoutIconSize.evaluate(s,{},h),{horizontal:{},vertical:void 0}),x=s.text,v,b=[0,0];if(x){let a=x.toString(),l=24*d.get("text-letter-spacing").evaluate(s,{},h),c=24*d.get("text-line-height").evaluate(s,{},h),f=!function(i){for(let n of i){var r;if(rI(r=n.charCodeAt(0))||rC(r)||rz(r)||rH(r)||rQ(r))return!1}return!0}(a)?0:l,_=d.get("text-anchor").evaluate(s,{},h),v=d.get("text-variable-anchor");if(!v){let i=d.get("text-radial-offset").evaluate(s,{},h);b=i?hI(_,[24*i,hM]):d.get("text-offset").evaluate(s,{},h).map(i=>24*i)}let w=m?"center":d.get("text-justify").evaluate(s,{},h),T="point"===d.get("symbol-placement"),E=T?24*d.get("text-max-width").evaluate(s,{},h):1/0,S=s=>{i.allowVerticalPlacement&&r1(a)&&(y.vertical=ht(x,r,n,o,u,E,c,_,s,f,b,l9.vertical,!0,g,p))};if(!m&&v){let i="auto"===w?v.map(i=>hC(i)):[w],a=!1;for(let s=0;s<i.length;s++){let l=i[s];if(!y.horizontal[l]){if(a)y.horizontal[l]=y.horizontal[0];else{let i=ht(x,r,n,o,u,E,c,"center",l,f,b,l9.horizontal,!1,g,p);i&&(y.horizontal[l]=i,a=1===i.positionedLines.length)}}}S("left")}else{if("auto"===w&&(w=hC(_)),T||d.get("text-writing-mode").indexOf("horizontal")>=0||!r1(a)){let i=ht(x,r,n,o,u,E,c,_,w,f,b,l9.horizontal,!1,g,p);i&&(y.horizontal[w]=i)}S(T?"left":w)}}let T=!1;if(s.icon&&s.icon.name){let r=a[s.icon.name];r&&(v=function(i,r,n){let{horizontalAlign:a,verticalAlign:o}=hs(n),s=r[0]-i.displaySize[0]*a,l=r[1]-i.displaySize[1]*o;return{image:i,top:l,bottom:l+i.displaySize[1],left:s,right:s+i.displaySize[0]}}(o[s.icon.name],d.get("icon-offset").evaluate(s,{},h),d.get("icon-anchor").evaluate(s,{},h)),T=r.sdf,void 0===i.sdfIcons?i.sdfIcons=r.sdf:i.sdfIcons!==r.sdf&&W("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(r.pixelRatio!==i.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0))}let S=hk(y.horizontal)||y.vertical;i.iconsInText||(i.iconsInText=!!S&&S.iconsInText),(S||v)&&function(i,r,n,a,o,s,l,h,u,c,d,p,f){var m;let _,g=s.textMaxSize.evaluate(r,{},p);void 0===g&&(g=l);let y=i.layers[0].layout,x=y.get("icon-offset").evaluate(r,{},p),v=hk(n.horizontal)||n.vertical,b="globe"===f.name,T=l/24,S=i.tilePixelRatio*g/24,M=(m=i.overscaling,i.zoom>18&&m>2&&(m>>=1),Math.max(8192/(512*m),1)*y.get("symbol-spacing")),A=y.get("text-padding")*i.tilePixelRatio,I=y.get("icon-padding")*i.tilePixelRatio,C=y.get("text-max-angle")*E,z="map"===y.get("text-rotation-alignment")&&"point"!==y.get("symbol-placement"),k="map"===y.get("icon-rotation-alignment")&&"point"!==y.get("symbol-placement"),D=y.get("symbol-placement"),P=M/2,L=y.get("icon-text-fit");a&&"none"!==L&&(i.allowVerticalPlacement&&n.vertical&&(_=hh(a,n.vertical,L,y.get("icon-text-fit-padding"),x,T)),v&&(a=hh(a,v,L,y.get("icon-text-fit-padding"),x,T)));let R=(l,h,m)=>{if(h.x<0||h.x>=8192||h.y<0||h.y>=8192)return;let g=null;if(b){let{x:i,y:r,z:n}=f.projectTilePoint(h.x,h.y,m);g={anchor:new hu(i,r,n,0,void 0),up:f.upVector(m,h.x,h.y)}}!function(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,E,S,M){let A=i.addToLineVertexArray(r,a),I,C,z,k,D,P,L,R=0,B=0,O=0,F=0,U=-1,V=-1,N={},j=ae(""),G=n?n.anchor:r,Z=0,$=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")?[Z,$]=u.layout.get("text-offset").evaluate(w,{},M).map(i=>24*i):(Z=24*u.layout.get("text-radial-offset").evaluate(w,{},M),$=hM),i.allowVerticalPlacement&&o.vertical){let i=o.vertical;if(_)P=hP(i),h&&(L=hP(h));else{let n=u.layout.get("text-rotate").evaluate(w,{},M)+90;z=hD(c,G,r,d,p,f,i,m,n,g),h&&(k=hD(c,G,r,d,p,f,h,x,n))}}if(s){let a=u.layout.get("icon-rotate").evaluate(w,{},M),o="none"!==u.layout.get("icon-text-fit"),l=hx(s,a,E,o),m=h?hx(h,a,E,o):void 0;C=hD(c,G,r,d,p,f,s,x,a),R=4*l.length;let _=i.iconSizeData,g=null;"source"===_.kind?(g=[128*u.layout.get("icon-size").evaluate(w,{},M)])[0]>32640&&W(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===_.kind&&((g=[128*T.compositeIconSizes[0].evaluate(w,{},M),128*T.compositeIconSizes[1].evaluate(w,{},M)])[0]>32640||g[1]>32640)&&W(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,l,g,b,v,w,!1,n,r,A.lineStartIndex,A.lineLength,-1,S,M),U=i.icon.placedSymbolArray.length-1,m&&(B=4*m.length,i.addSymbols(i.icon,m,g,b,v,w,l9.vertical,n,r,A.lineStartIndex,A.lineLength,-1,S,M),V=i.icon.placedSymbolArray.length-1)}for(let a in o.horizontal){let s=o.horizontal[a];I||(j=ae(s.text),_?D=hP(s):I=hD(c,G,r,d,p,f,s,m,u.layout.get("text-rotate").evaluate(w,{},M),g));let h=1===s.positionedLines.length;if(O+=hz(i,n,r,s,l,u,_,w,g,A,o.vertical?l9.horizontal:l9.horizontalOnly,h?Object.keys(o.horizontal):[a],N,U,T,S,M),h)break}o.vertical&&(F+=hz(i,n,r,o.vertical,l,u,_,w,g,A,l9.vertical,["vertical"],N,V,T,S,M));let q=-1,X=(i,r)=>i?Math.max(i,r):r;q=X(D,-1),q=X(P,q);let H=(q=X(L,q))>-1?1:0;i.glyphOffsetArray.length>=h6.MAX_GLYPHS&&W("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKey
8Ranges(i.symbolInstances.length,w.sortKey),i.symbolInstances.emplaceBack(G.x,G.y,G.z,r.x,r.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,U,V,j,void 0!==I?I:i.collisionBoxArray.length,void 0!==I?I+1:i.collisionBoxArray.length,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==C?C:i.collisionBoxArray.length,void 0!==C?C+1:i.collisionBoxArray.length,k||i.collisionBoxArray.length,k?k+1:i.collisionBoxArray.length,d,O,F,R,B,H,0,Z,$,q)}(i,h,g,l,n,a,o,_,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,A,z,u,0,I,k,x,r,s,c,d,p)};if("line"===D)for(let o of hf(r.geometry,0,0,8192,8192))for(let r of function(i,r,n,a,o,s,l,h,u){let c=a?.6*24*l:0,d=hp(a,o),p=d*l,f=0===i[0].x||8192===i[0].x||0===i[0].y||8192===i[0].y;return r-p<r/4&&(r=p+r/4),function i(r,n,a,o,s,l,h,u,c){let d=l/2,p=hd(r),f=0,m=n-a,_=[];for(let i=0;i<r.length-1;i++){let n=r[i],h=r[i+1],u=n.dist(h),g=h.angleTo(n);for(;m+a<f+u;){let y=((m+=a)-f)/u,x=tK(n.x,h.x,y),v=tK(n.y,h.y,y);if(x>=0&&x<c&&v>=0&&v<c&&m-d>=0&&m+d<=p){let n=new hu(x,v,0,g,i);n._round(),o&&!hc(r,n,l,o,s)||_.push(n)}}f+=u}return u||_.length||h||(_=i(r,f/2,a,o,s,l,h,!0,c)),_}(i,f?r/2*h%r:(d/2+48)*l*h%r,r,c,n,p,f,!1,8192)}(o,M,C,n.vertical||v,a,0,S,i.overscaling,8192))v&&function(i,r,n,a){let o=i.compareText;if(r in o){let i=o[r];for(let r=i.length-1;r>=0;r--)if(a.dist(i[r])<n)return!0}else o[r]=[];return o[r].push(a),!1}(i,v.text,P,r)||R(o,r,p);else if("line-center"===D){for(let i of r.geometry)if(i.length>1){let r=function(i,r,n,a,o,s){let l=n?.6*24*s:0,h=hp(n,a)*s,u=0,c=hd(i)/2;for(let n=0;n<i.length-1;n++){let a=i[n],o=i[n+1],s=a.dist(o);if(u+s>c){let d=(c-u)/s,p=new hu(tK(a.x,o.x,d),tK(a.y,o.y,d),0,o.angleTo(a),n);return!l||hc(i,p,h,l,r)?p:void 0}u+=s}}(i,C,n.vertical||v,a,0,S);r&&R(i,r,p)}}else if("Polygon"===r.type)for(let i of sU(r.geometry,0)){let r=function(i,r=1,n=!1){let a=1/0,o=1/0,s=-1/0,l=-1/0,h=i[0];for(let i=0;i<h.length;i++){let r=h[i];(!i||r.x<a)&&(a=r.x),(!i||r.y<o)&&(o=r.y),(!i||r.x>s)&&(s=r.x),(!i||r.y>l)&&(l=r.y)}let u=Math.min(s-a,l-o),c=u/2,d=new hw([],hE);if(0===u)return new w(a,o);for(let r=a;r<s;r+=u)for(let n=o;n<l;n+=u)d.push(new hS(r+c,n+c,c,i));let p=function(i){let r=0,n=0,a=0,o=i[0];for(let i=0,s=o.length,l=s-1;i<s;l=i++){let s=o[i],h=o[l],u=s.x*h.y-h.x*s.y;n+=(s.x+h.x)*u,a+=(s.y+h.y)*u,r+=3*u}return new hS(n/r,a/r,0,i)}(i),f=d.length;for(;d.length;){let a=d.pop();(a.d>p.d||!p.d)&&(p=a,n&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,f)),a.max-p.d<=r||(c=a.h/2,d.push(new hS(a.p.x-c,a.p.y-c,c,i)),d.push(new hS(a.p.x+c,a.p.y-c,c,i)),d.push(new hS(a.p.x-c,a.p.y+c,c,i)),d.push(new hS(a.p.x+c,a.p.y+c,c,i)),f+=4)}return n&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}(i,16);R(i[0],new hu(r.x,r.y,0,0,void 0),p)}else if("LineString"===r.type)for(let i of r.geometry)R(i,new hu(i[0].x,i[0].y,0,0,void 0),p);else if("Point"===r.type)for(let i of r.geometry)for(let r of i)R([r],new hu(r.x,r.y,0,0,void 0),p)}(i,s,y,v,a,f,g,0,b,T,l,h,c)}s&&i.generateCollisionDebugBuffers(u,i.collisionBoxArray)}(o,l,i.positions,h,r.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection)):o.hasPattern&&(o instanceof lw||o instanceof sG||o instanceof s7)&&(uW(o.layers,this.zoom,n),o.addFeatures(m,this.tileID.canonical,r.patternPositions,n,this.tileTransform))}this.status="done",o(null,{buckets:L(p).filter(i=>!i.isEmpty()),featureIndex:d,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:f,imageAtlas:r,glyphMap:this.returnDependencies?l:null,iconMap:this.returnDependencies?h:null,glyphPositions:this.returnDependencies?i.positions:null})}}v.length?a.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},(i,r)=>{s||(s=i,u=r,b.call(this))},void 0,!1,g):u={},b.call(this)}}function uW(i,r,n){let a=new ns(r);for(let r of i)r.recalculate(a,n)}class uX{constructor(i){this.entries={},this.scheduler=i}request(i,r,n,a){let o=this.entries[i]=this.entries[i]||{callbacks:[]};if(o.result){let[i,n]=o.result;return this.scheduler?this.scheduler.add(()=>{a(i,n)},r):a(i,n),()=>{}}return o.callbacks.push(a),o.cancel||(o.cancel=n((n,a)=>{for(let i of(o.result=[n,a],o.callbacks))this.scheduler?this.scheduler.add(()=>{i(n,a)},r):i(n,a);setTimeout(()=>delete this.entries[i],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(i=>
8i!==a),o.callbacks.length||(o.cancel(),delete this.entries[i]))}}}function uH(i,r,n){let a=JSON.stringify(i.request);return i.data&&(this.deduped.entries[a]={result:[null,i.data]}),this.deduped.request(a,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},r=>{let a=ef(i.request,(i,a,o,s)=>{i?r(i):a&&r(null,{vectorTile:n?void 0:new s2(new lV(a)),rawData:a,cacheControl:o,expires:s})});return()=>{a.cancel(),r()}},r)}i.ARRAY_TYPE=aP,i.AUTH_ERR_MSG=eg,i.Aabb=ou,i.Actor=class{constructor(i,r,n){this.target=i,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},N(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=H()?i:d,this.scheduler=new uh}send(i,r,n,a,o=!1,s){let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=s,this.callbacks[l]=n);let h=J(this.globalScope)?void 0:[];return this.target.postMessage({id:l,type:i,hasCallback:!!n,targetMapId:a,mustQueue:o,sourceMapId:this.mapId,data:rM(r,h)},h),{cancel:()=>{n&&delete this.callbacks[l],this.target.postMessage({id:l,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(i){let r=i.data,n=r.id;if(n&&(!r.targetMapId||this.mapId===r.targetMapId)){if("<cancel>"===r.type){let i=this.cancelCallbacks[n];delete this.cancelCallbacks[n],i&&i.cancel()}else if(r.mustQueue||H()){let i=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add(()=>this.processTask(n,r),i&&i.metadata||{type:"message"})}else this.processTask(n,r)}}processTask(i,r){if("<response>"===r.type){let n=this.callbacks[i];delete this.callbacks[i],n&&(r.error?n(rA(r.error)):n(null,rA(r.data)))}else{let n=J(this.globalScope)?void 0:[],a=r.hasCallback?(r,a)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:r?rM(r):null,data:rM(a,n)},n)}:i=>{},o=rA(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,o,a);else if(this.parent.getWorkerSource){let i=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,i[0],o.source)[i[1]](o,a)}else a(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=lu,i.Color=tc,i.ColorMode=uL,i.CullFaceMode=uR,i.DEMData=uz,i.DataConstantProperty=n_,i.DedupedRequest=uX,i.DepthMode=uD,i.EXTENT=8192,i.Elevation=class{isDataAvailableAtPoint(i){let r=this._source();if(this.isUsingMockSource()||!r||i.y<0||i.y>1)return!1;let n=r.getSource().maxzoom,a=1<<n,o=Math.floor(i.x),s=Math.floor((i.x-o)*a),l=Math.floor(i.y*a),h=this.findDEMTileFor(new ld(n,o,n,s,l));return!(!h||!h.dem)}
8getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,n=!0){if(this.isUsingMockSource())return null;null==r&&(r=null);let a=this._source();if(!a||i.y<0||i.y>1)return r;let o=a.getSource().maxzoom,s=1<<o,l=Math.floor(i.x),h=i.x-l,u=new ld(o,l,o,Math.floor(h*s),Math.floor(i.y*s)),c=this.findDEMTileFor(u);if(!c||!c.dem)return r;let d=c.dem,p=1<<c.tileID.canonical.z,f=(h*p-c.tileID.canonical.x)*d.dim,m=(i.y*p-c.tileID.canonical.y)*d.dim,_=Math.floor(f),g=Math.floor(m);return(n?this.exaggeration():1)*tK(tK(d.get(_,g),d.get(_,g+1),m-g),tK(d.get(_+1,g),d.get(_+1,g+1),m-g),f-_)}getAtTileOffset(i,r,n){let a=1<<i.canonical.z;return this.getAtPointOrZero(new oX(i.wrap+(i.canonical.x+r/8192)/a,(i.canonical.y+n/8192)/a))}getAtTileOffsetFunc(i,r,n,a){return o=>{let s=this.getAtTileOffset(i,o.x,o.y),l=a.upVector(i.canonical,o.x,o.y);return a0(l,l,s*a.upVectorScale(i.canonical,r,n).metersToTile),l}}getForTilePoints(i,r,n,a){if(this.isUsingMockSource())return!1;let o=uV.create(this,i,a);return!!o&&(r.forEach(i=>{i[2]=this.exaggeration()*o.getElevationAt(i[0],i[1],n)}),!0)}getMinMaxForTile(i){if(this.isUsingMockSource())return null;let r=this.findDEMTileFor(i);if(!r||!r.dem)return null;let n=r.dem.tree,a=r.tileID,o=1<<i.canonical.z-a.canonical.z,s=i.canonical.x/o-a.canonical.x,l=i.canonical.y/o-a.canonical.y,h=0;for(let r=0;r<i.canonical.z-a.canonical.z&&!n.leaves[h];r++){let i=2*Math.floor(l*=2)+Math.floor(s*=2);h=n.childOffsets[h]+i,s%=1,l%=1}return{min:this.exaggeration()*n.minimums[h],max:this.exaggeration()*n.maximums[h]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(i,r,n){throw Error("Pure virtual method called.")}pointCoordinate(i){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}isUsingMockSource(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(i){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}},i.ErrorEvent=e$,i.EvaluationParameters=ns,i.Event=eZ,i.Evented=eq,i.FillExtrusionBucket=s7,i.Frustum=oh,i.FrustumCorners=ol,i.GLOBE_RADIUS=oc,i.GLOBE_SCALE_MATCH_LATITUDE=45,i.GLOBE_ZOOM_THRESHOLD_MAX=6,i.GLOBE_ZOOM_THRESHOLD_MIN=5,i.GlobeSharedBuffers=class{constructor(i){this._createGrid(i),this._createPoles(i)}destroy(){for(let i of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))i.destroy();for(let i of this._gridSegments)i.withSkirts.destroy(),i.withoutSkirts.destroy();if(this._wireframeIndexBuffer)for(let i of(this._wireframeIndexBuffer.destroy(),this._wireframeSegments))i.destroy()}_fillGridMeshWithLods(i,r){let n=new nM,a=new nj,o=[],s=i+1+2,l=r[0]+1,h=r[0]+1+(1+r.length),u=(i,r,n)=>{let a=i===s-1?i-2:0===i?i:i-1;return[a+=n?24575:0,r]};for(let i=0;i<s;++i)n.emplaceBack(...u(i,0,!0));for(let i=0;i<l;++i)for(let r=0;r<s;++r)n.emplaceBack(...u(r,i,0===r||r===s-1));for(let i=0;i<r.length;++i){let a=r[i];for(let i=0;i<s;++i)n.emplaceBack(...u(i,a,!0))}for(let i=0;i<r.length;++i){let l=a.length,u=r[i]+1+2,c=new nj;for(let n=0;n<u-1;n++){let o=n===u-2,l=o?s*(h-r.length+i-n):s;for(let i=0;i<s-1;i++){let r=n*s+i;0===n||o||0===i||i===s-2?(c.emplaceBack(r+1,r,r+l),c.emplaceBack(r+l,r+l+1,r+1)):(a.emplaceBack(r+1,r,r+l),a.emplaceBack(r+l,r+l+1,r+1))}}let d=ak.simpleSegment(0,l,n.length,a.length-l);for(let i=0;i<c.uint16.length;i+=3)a.emplaceBack(c.uint16[i],c.uint16[i+1],c.uint16[i+2]);let p=ak.simpleSegment(0,l,n.length,a.length-l);o.push({withoutSkirts:d,withSkirts:p})}return{vertices:n,indices:a,segments:o}}_createGrid(i){let r=this._fillGridMeshWithLods(64,od);this._gridSegments=r.segments,this._gridBuffer=i.createVertexBuffer(r.vertices,oo.members),this._gridIndexBuffer=i.createIndexBuffer(r.
8indices,!0)}_createPoles(i){let r=new nj;for(let i=0;i<=64;i++)r.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=i.createIndexBuffer(r,!0);let n=new nq,a=new nq;this._poleSegments=[];for(let i=0,r=0;i<5;i++){let o=360/(1<<i);n.emplaceBack(0,-oc,0,.5,0),a.emplaceBack(0,-oc,0,.5,1);for(let i=0;i<=64;i++){let r=i/64,[s,l,h]=oS(oO,oF,tK(0,o,r),oc);n.emplaceBack(s,l,h,r,0),a.emplaceBack(s,l,h,r,1)}this._poleSegments.push(ak.simpleSegment(r,0,66,64)),r+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(n,on,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(a,on,!1)}getGridBuffers(i,r){return[this._gridBuffer,this._gridIndexBuffer,r?this._gridSegments[i].withSkirts:this._gridSegments[i].withoutSkirts]}getPoleBuffers(i){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[i]]}getWirefameBuffers(i,r){if(!this._wireframeSegments){let r=new nX;this._wireframeSegments=[];for(let i=0,n=0;i<od.length;i++){let a=od[i];for(let i=1;i<a+1;i++)for(let n=1;n<65;n++){let a=67*i+n;r.emplaceBack(a,a+1),r.emplaceBack(a,a+67),r.emplaceBack(a,a+67+1)}let o=192*a;this._wireframeSegments.push(ak.simpleSegment(0,n,(a+1)*67,o)),n+=o}this._wireframeIndexBuffer=i.createIndexBuffer(r)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[r]]}},i.GlyphManager=hy,i.ImagePosition=l6,i.LivePerformanceUtils={mark(i){d.performance.mark(i)},measure(i,r,n){d.performance.measure(i,r,n)}},i.LngLat=oN,i.LngLatBounds=aD,i.LocalGlyphMode=hg,i.MAX_MERCATOR_LATITUDE=85.051129,i.MercatorCoordinate=oX,i.ONE_EM=24,i.OverscaledTileID=ld,i.PerformanceMarkers=eO,i.Properties=nx,i.RGBAImage=sf,i.Ray=os,i.RequestManager=class{constructor(i,r,n){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!n,this._createSkuToken()}_createSkuToken(){let i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!ey(i))return i;let n=eE(i);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!ey(i))return i;let n=eE(i);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeSourceURL(i,r,n,a){if(!ey(i))return i;let o=eE(i);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),n&&o.params.push(`language=${n}`),a&&o.params.push(`worldview=${a}`),this._makeAPIURL(o,this._customAccessToken||r)}normalizeSpriteURL(i,r,n,a){let o=eE(i);return ey(i)?(o.path=`/styles/v1${o.path}/sprite${r}${n}`,this._makeAPIURL(o,this._customAccessToken||a)):(o.path+=`${r}${n}`,eS(o))}normalizeTileURL(i,r,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!ey(i))return i;let a=eE(i);a.path=a.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||n&&"raster"!==a.authority&&512===n?"@2x":""}${m.supported?".webp":"$1"}`),"raster"===a.authority?a.path=`/${f.RASTER_URL_PREFIX}${a.path}`:(a.path=a.path.replace(/^.+\/v4\//,"/"),a.path=`/${f.TILE_URL_VERSION}${a.path}`);let o=this._customAccessToken||function(i){for(let r of i){let i=r.match(/^access_token=(.*)$/);if(i)return i[1]}return null}(a.params)||f.ACCESS_TOKEN;return f.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&a.params.push(`sku=${this._skuToken}`),this._makeAPIURL(a,o)}canonicalizeTileURL(i,r){let n=eE(i);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return i;let a="mapbox://";n.path.match(/^\/raster\/v1\//)?a+=`raster/${n.path.replace(`/${f.RASTER_URL_PREFIX}/`,"")}`:a+=`tiles/${n.path.replace(`/${f.TILE_URL_VERSION}/`,"")}`;let o=n.params;return r&&(o=o.filter(i=>!i.match(/^access_token=/))),o.length&&(a+=`?${o.join("&")}`),a}canonicalizeTileset(i,r){let n=!!r&&ey(r),a=[];for(let r of i.tiles||[])ex(r)?a.push(this.canonicalizeTileURL(r,n)):a.push(r);return a}_makeAPIURL(i,r){let n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",a=eE(f.API_URL);if(i.protocol=a.protocol,i.authority=a.authority,"http"===i.protocol){let r=i.params.indexOf("secure");r>=0&&i.params.splice(r,1)}if("/"!==a.path&&(i.path=`${a.path}${i.path}`),!f.REQUIRE_ACCESS_TOKEN)return eS(i);if(r=r||f.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return i.params=i.params.filter(i=>-1===i.indexOf("access_token")),i.params.push(`access_token=${r||""}`),eS(i)}},i.ResourceType=eu,i.SegmentVector=ak,i.SourceCache=uB,i.StencilMode=uP,i.StructArrayLayout1ui2=nH,i.StructArrayLayout2f1f2i16=nU,i.StructArrayLayout2i4=nM,i.StructArrayLayout2ui4=nX,i.StructArrayLayout3f12=nN,i.StructArrayLayout3ui6=nj,i.StructArrayLayout4i8=nI,i.StructArrayLayout5f20=nq,i.Texture=us,i.Tile=uv,i.Transitionable=nu,i.Uniform1f=ah,i.Uniform1i=class extends al{constructor(i){super(i),this.current=0}set(i,r,n){this.fetchUniformLocation(i,r)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},i.Uniform2f=class extends al{constructor(i){super(i),this.current=[0,0]}set(i,r,n){this.fetchUniformLocation(i,r)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}},i.Uniform3f=class extends al{constructor(i){super(i),this.current=[0,0,0]}set(i,r,n){this.fetchUniformLocation(i,r)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}},i.Uniform4f=au,i.UniformColor=ac,i.UniformMatrix2f=class extends al{constructor(i){super(i),this.current=af}set(i,r,n){if(this.fetchUniformLocation(i,r)){for(let i=0;i<4;i++)if(n[i]!==this.current[i]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}},i.UniformMatrix3f=class extends al{constructor(i){super(i),this.current=ap}set(i,r,n){if(this.fetchUniformLocation(i,r)){for(let i=0;i<9;i++)if(n[i]!==this.current[i]){this.current=n,this.gl.uniformMatrix3fv(this.location,!1,n);break}}}},i.UniformMatrix4f=class extends al{constructor(i){super(i),this.current=ad}set(i,r,n){if(this.fetchUniformLocation(i,r)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let i=1;i<16;i++)if(n[i]!==this.current[i]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}},i.UnwrappedTileID=lc,i.ValidationError=iY,i.VectorTileFeature=s3,i.VectorTileWorkerSource=class extends eq{constructor(i,r,n,a,o){super(),this.actor=i,this.layerIndex=r,this.availableImages=n,this.loadVectorData=o||uH,this.loading={},this.loaded={},this.deduped=new uX(i.scheduler),this.isSpriteLoaded=a,this.scheduler
8=i.scheduler}loadTile(i,r){let n=i.uid,a=i&&i.request,o=a&&a.collectResourceTiming,s=this.loading[n]=new uq(i);s.abort=this.loadVectorData(i,(l,h)=>{let u=!this.loading[n];if(delete this.loading[n],u||l||!h)return s.status="done",u||(this.loaded[n]=s),r(l);let c=h.rawData,d={};h.expires&&(d.expires=h.expires),h.cacheControl&&(d.cacheControl=h.cacheControl),s.vectorTile=h.vectorTile||new s2(new lV(c));let p=()=>{s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,(i,n)=>{if(i||!n)return r(i);let s={};if(o){let i=eV(a);i.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(i)))}r(null,R({rawTileData:c.slice(0)},n,d,s))})};this.isSpriteLoaded?p():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):p()}),this.loaded=this.loaded||{},this.loaded[n]=s})}reloadTile(i,r){let n=this.loaded,a=i.uid,o=this;if(n&&n[a]){let s=n[a];s.showCollisionBoxes=i.showCollisionBoxes,s.enableTerrain=!!i.enableTerrain,s.projection=i.projection,s.tileTransform=hR(i.tileID.canonical,i.projection);let l=(i,n)=>{let a=s.reloadCallback;a&&(delete s.reloadCallback,s.parse(s.vectorTile,o.layerIndex,this.availableImages,o.actor,a)),r(i,n)};"parsing"===s.status?s.reloadCallback=l:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}}abortTile(i,r){let n=i.uid,a=this.loading[n];a&&(a.abort&&a.abort(),delete this.loading[n]),r()}removeTile(i,r){let n=this.loaded,a=i.uid;n&&n[a]&&delete n[a],r()}},i.WritingMode=l9,i.ZoomDependentExpression=iW,i.add=aH,i.addDynamicAttributes=h3,i.adjoint=function(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8];return i[0]=l*d-h*c,i[1]=o*c-a*d,i[2]=a*h-o*l,i[3]=h*u-s*d,i[4]=n*d-o*u,i[5]=o*s-n*h,i[6]=s*c-l*u,i[7]=a*u-n*c,i[8]=n*l-a*s,i},i.asyncAll=P,i.bezier=I,i.bindAll=N,i.boundsAttributes=uy,i.bufferConvexPolygon=function(i,r){let n=[];for(let a=0;a<i.length;a++){let o=D(a-1,-1,i.length-1),s=D(a+1,-1,i.length-1),l=i[a],h=i[s],u=i[o].sub(l).unit(),c=h.sub(l).unit(),d=c.angleWithSep(u.x,u.y),p=u.add(c).unit().mult(-1*r/Math.sin(d/2));n.push(l.add(p))}return n},i.cacheEntryPossiblyAdded=function(i){++eh>ea&&(i.getActor().send("enforceCacheSizeLimit",en),eh=0)},i.calculateGlobeLabelMatrix=function(i,r){let{x:n,y:a}=i.point,o=oD(n,a,i.worldSize/i._pixelsPerMercatorPixel,0,0);return aF(o,o,ok(ox(r)))},i.calculateGlobeMatrix=function(i){let{x:r,y:n}=i.point,{lng:a,lat:o}=i._center;return oD(r,n,i.worldSize,a,o)},i.calculateGlobeMercatorMatrix=function(i){let r=i.pixelsPerMeter,n=r/(1/oj(i.center.lat)),a=aB(new Float64Array(16));return aU(a,a,[i.point.x,i.point.y,0]),aV(a,a,[n,n,r]),Float32Array.from(a)},i.circumferenceAtLatitude=oj,i.clamp=z,i.clearTileCache=function(i){if(!eo())return;let r=d.caches.delete(et);i&&r.catch(i).then(()=>i())},i.clipLine=hf,i.clone=function(i){var r=new aP(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},i.clone$1=$,i.collisionCircleLayout=lD,i.config=f,i.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},i.create=function(){var i=new aP(16);return aP!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},i.create$1=aL,i.createExpression=i$,i.createLayout=nE,i.createStyleLayer=function(i){return"custom"===i.type?new ur(i):new uo[i.type](i)},i.cross=a5,i.degToRad=function(i){return i*E},i.distance=function(i,r){return Math.hypot(r[0]-i[0],r[1]-i[1],r[2]-i[2])},i.div=function(i,r,n){return i[0]=r[0]/n[0],i[1]=r[1]/n[1],i[2]=r[2]/n[2],i},i.dot=a3,i.earthRadius=oU,i.ease=C,i.easeCubicInOut=A,i.ecefToLatLng=function([i,r,n]){let a=Math.hypot(i,r,n);return new oN(Math.atan2(i,n)*S,(.5*Math.PI-Math.acos(-r/a))*S)},i.emitValidationErrors=rv,i.endsWith=j,i.enforceCacheSizeLimit=function(i){es(),ei&&ei.then(r=>{r.keys().then(n=>{for(let a=0;a<n.length-i;a++)r.delete(n[a])})})},i.evaluateSizeForFeature=lL,i.evaluateSizeForZoom=lR,i.evaluateVariableOffset=hI,i.evented=nr,i.exactEquals=function(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]},i.exactEquals$1=function(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]},i.exported=eN,i.exported$1=m,i.extend=R,i.extend$1=eX,i.fillExtrusionHeightLift=la,i.filterObject=Z,i.fromMat4=function(i,r){return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[4],i[4]=r[5],i[5]=r[6],i[6]=r[8],i[7]=r[9],i[8]=r[10],i},i.fromQuat=function(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=n+n,h=a+a,u=o+o,c=n*l,d=a*l,p=a*h,f=o*l,m=o*h,_=o*u,g=s*l,y=s*h,x=s*u;return i[0]=1-p-_,i[1]=d+x,i[2]=f-y,i[3]=0,i[4]=d-x,i[5]=1-c-_,i[6]=m+g,i[7]=0,i[8]=f+y,i[9]=m-g,i[10]=1-c-p,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},i.fromRotation=function(i,r){var n=Math.sin(r),a=Math.cos(r);return i[0]=a,i[1]=n,i[2]=0,i[3]=-n,i[4]=a,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},i.fromScaling=aG,i.furthestTileCorner=function(i){return M[Math.round((i+45+360)%360/90)%4]},i.getAABBPointSquareDist=function(i,r,n){let a=0;for(let o=0;o<2;++o){let s=n?n[o]:0;i[o]>s&&(a+=(i[o]-s)*(i[o]-s)),r[o]<s&&(a+=(s-r[o])*(s-r[o]))}return a},i.getAnchorAlignment=hs,i.getAnchorJustification=hC,i.getBounds=function(i){let r=1/0,n=1/0,a=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),n=Math.min(n,s.y),a=Math.max(a,s.x),o=Math.max(o,s.y);return{min:new w(r,n),max:new w(a,o)}},i.getColumn=ee,i.getGridMatrix=function(i,r,n,a){let o=r.getNorth(),s=r.getSouth(),l=r.getWest(),h=r.getEast(),u=1<<i.z,c=h-l,d=o-s,p=c/64,f=-d/od[n],m=[0,p,0,f,0,0,o,l,0];if(i.z>0){let i=180/a;aR(m,m,[i/c+1,0,0,0,i/d+1,0,-.5*i/p,.5*i/f,1])}return m[2]=u,m[5]=i.x,m[8]=i.y,m},i.getImage=e_,i.getJSON=function(i,r){return ep(R(i,{type:"json"}),r)},i.getLatitudinalLod=function(i){return Math.round(Math.pow(Math.abs(Math.sin((i=z(i,-80.051129,80.051129)/80.051129*90)*E)),3)*(od.length-1))},i.getMapSessionAPI=eR,i.getPerformanceMeasurement=eV,i.getProjection=hJ,i.getRTLTextPluginStatus=nn,i.getReferrer=ed,i.getTilePoint=function(i,{x:r,y:n},a=0){return new w(((r-a)*i.scale-i.x)*8192,(n*i.scale-i.y)*8192)},i.getTileVec3=function(i,r,n=0){return aX(((r.x-n)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,r.z*oj(oq(r.y)))},i.getVideo=function(i,r){let n=d.document.createElement("video");n.muted=!0,n.onloadstart=function(){r(null,n)};for(let r=0;r<i.length;r++){let a=d.document.createElement("source");(function(i){let r=d.document.createElement("a");return r.href=i,r.protocol===d.document.location.protocol&&r.host===d.document.location.host})(i[r])||(n.crossOrigin="Anonymous"),a.src=i[r],n.appendChild(a)}return{cancel:()=>{}}}
8,i.globeCenterToScreenPoint=function(i){let r=[0,0,0],n=aB(new Float64Array(16));return aF(n,i.pixelMatrix,i.globeMatrix),a4(r,r,n),new w(r[0],r[1])},i.globeDenormalizeECEF=ok,i.globeECEFOrigin=function(i,r){let n=[0,0,0];return a4(n,n,oz(ox(r.canonical))),a4(n,n,i),n},i.globeMetersToEcef=om,i.globeNormalizeECEF=oz,i.globePixelsToTileUnits=function(i,r){return 8192/(512*Math.pow(2,i))*oI(ox(r))},i.globePoleMatrixForTile=function(i,r,n){let a=aB(new Float64Array(16));return aj(a,n.globeMatrix,(r/(1<<i)-.5)*Math.PI*2),Float32Array.from(a)},i.globeTileBounds=ox,i.globeTiltAtLngLat=oL,i.globeToMercatorTransition=oP,i.globeUseCustomAntiAliasing=function(i,r,n){let a=oP(n.zoom),o=i.style.map._antialias,s=!!r.extStandardDerivatives,l=r.extStandardDerivativesForceOff||i.terrain&&i.terrain.exaggeration()>0;return 0===a&&!o&&!l&&s},i.identity=aB,i.identity$1=ot,i.invert=aO,i.isFullscreen=function(){return!!d.document.fullscreenElement||!!d.document.webkitFullscreenElement},i.isLngLatBehindGlobe=oR,i.isMapAuthenticated=function(i){return eB.has(i)},i.isMapboxURL=ey,i.isSafariWithAntialiasingBug=function(i){let r=i.navigator?i.navigator.userAgent:null;return!!J(i)&&r&&(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},i.latFromMercatorY=oq,i.latLngToECEF=oM,i.len=aW,i.length=aW,i.length$1=function(i){return Math.hypot(i[0],i[1],i[2],i[3])},i.lngFromMercatorX=o$,i.loadVectorTile=uH,i.makeRequest=ep,i.mapValue=function(i,r,n,a,o){return z((i-r)/(n-r)*(o-a)+a,a,o)},i.mercatorScale=oW,i.mercatorXfromLng=oG,i.mercatorYfromLat=oZ,i.mercatorZfromAltitude=function(i,r){return i/oj(r)},i.mul=aF,i.mul$1=aK,i.multiply=aF,i.multiply$1=aR,i.multiply$2=aK,i.nextPowerOfTwo=U,i.normalize=a2,i.normalize$1=a9,i.normalize$2=a9,i.number=tK,i.ortho=function(i,r,n,a,o,s,l){var h=1/(r-n),u=1/(a-o),c=1/(s-l);return i[0]=-2*h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*u,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(r+n)*h,i[13]=(o+a)*u,i[14]=(l+s)*c,i[15]=1,i},i.pbf=lV,i.perspective=function(i,r,n,a,o){var s,l=1/Math.tan(r/2);return i[0]=l/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=o&&o!==1/0?(i[10]=(o+a)*(s=1/(a-o)),i[14]=2*o*a*s):(i[10]=-1,i[14]=-2*a),i},i.pick=function(i,r){let n={};for(let a=0;a<r.length;a++){let o=r[a];o in i&&(n[o]=i[o])}return n},i.plugin=no,i.pointGeometry=w,i.polesInViewport=function(i){let r=aB(new Float64Array(16));aF(r,i.pixelMatrix,i.globeMatrix);let n=[0,op,0],a=[0,oc,0];return a4(n,n,r),a4(a,a,r),[n[0]>0&&n[0]<=i.width&&n[1]>0&&n[1]<=i.height&&!oR(i,new oN(i.center.lat,90)),a[0]>0&&a[0]<=i.width&&a[1]>0&&a[1]<=i.height&&!oR(i,new oN(i.center.lat,-90))]},i.polygonContainsPoint=o9,i.polygonIntersectsBox=o7,i.polygonIntersectsPolygon=o2,i.polygonizeBounds=function(i,r,n=0,a=!0){let o=new w(n,n),s=i.sub(o),l=r.add(o),h=[s,new w(l.x,s.y),l,new w(s.x,l.y)];return a&&h.push(s.clone()),h},i.posAttributes=oo,i.postMapLoadEvent=ek,i.postPerformanceEvent=eP,i.postTurnstileEvent=eC,i.potpack=l4,i.prevPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log(i)/Math.LN2))},i.radToDeg=function(i){return i*S},i.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.registerForPluginStateChange=function(i){return i({pluginStatus:r7,pluginURL:ne}),nr.on("pluginStateChange",i),i},i.removeAuthState=function(i){eB.delete(i)},i.renderColorRamp=s_,i.resample=oH,i.rotateX=aN,i.rotateX$1=oi,i.rotateY=aj,i.rotateY$1=or,i.rotateZ=function(i,r,n){var a=Math.sin(n),o=Math.cos(n),s=r[0],l=r[1],h=r[2],u=r[3],c=r[4],d=r[5],p=r[6],f=r[7];return r!==i&&(i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o+c*a,i[1]=l*o+d*a,i[2]=h*o+p*a,i[3]=u*o+f*a,i[4]=c*o-s*a,i[5]=d*o-l*a,i[6]=p*o-h*a,i[7]=f*o-u*a,i},i.rotateZ$1=function(i,r,n){n*=.5;var a=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(n),u=Math.cos(n);return i[0]=a*u+o*h,i[1]=o*u-a*h,i[2]=s*u+l*h,i[3]=l*u-s*h,i},i.scale=aV,i.scale$1=a8,i.scale$2=a0,i.scaleAndAdd=a1,i.set=function(i,r,n,a){return i[0]=r,i[1]=n,i[2]=a,i},i.setCacheLimits=function(i,r){en=i,ea=r},i.setColumn=function(i,r,n){i[4*r+0]=n[0],i[4*r+1]=n[1],i[4*r+2]=n[2],i[4*r+3]=n[3]},i.setRTLTextPlugin=function(i,r,n=!1){if(r7===r4||r7===r6||r7===r8)throw Error("setRTLTextPlugin cannot be called multiple times.");ne=eN.resolveURL(i),r7=r4,r9=r,ni(),n||na()},i.smoothstep=k,i.spec=eW,i.squaredLength=function(i){var r=i[0],n=i[1],a=i[2];return r*r+n*n+a*a},i.storeAuthState=function(i,r){r?eB.add(i):eB.delete(i)},i.sub=aY,i.subtract=aY,i.symbolSize=lB,i.tileAABB=function(i,r,n,a,o,s,l,h,u){if("globe"===u.name)return function(i,r,n){let a=r/i.worldSize,o=i.globeMatrix;if(n.z<=1){let i=ox(n).getCorners();return ow(i,o,a),ou.fromPoints(i)}let s=oT(n),l=oE(s);ow(l,o,a);let h=Number.MAX_VALUE,u=[-h,-h,-h],c=[h,h,h];
8if(s.contains(i.center)){for(let i of l)aJ(c,c,i),aQ(u,u,i);u[2]=0;let r=i.point,n=[r.x*a,r.y*a,0];return aJ(c,c,n),aQ(u,u,n),new ou(c,u)}let d=[o[12]*a,o[13]*a,o[14]*a],p=s.getCenter(),f=z(i.center.lat,-85.051129,85.051129),m=z(p.lat,-85.051129,85.051129),_=oG(i.center.lng),g=oZ(f),y=_-oG(p.lng),x=g-oZ(m);y>.5?y-=1:y<-.5&&(y+=1);let v=0;Math.abs(y)>Math.abs(x)?v=y>=0?1:3:(v=x>=0?0:2,a1(d,d,[o[4]*a,o[5]*a,o[6]*a],-Math.sin((x>=0?s.getSouth():s.getNorth())*E)*oc));let b=l[v],w=l[(v+1)%4],T=new og(b,w,d),S=[oy(T,0)||b[0],oy(T,1)||b[1],oy(T,2)||b[2]],M=oP(i.zoom);if(M>0){let a=function({x:i,y:r,z:n},a,o,s,l){let h=1/(1<<n),u=i*h,c=u+h,d=r*h,p=d+h,f=0,m=(u+c)/2-s;return m>.5?f=-1:m<-.5&&(f=1),u=((u+f)*a-(s*=a))*o+s,c=((c+f)*a-s)*o+s,d=(d*a-(l*=a))*o+l,[[u,p=(p*a-l)*o+l,0],[c,p,0],[c,d,0],[u,d,0]]}(n,r,i._pixelsPerMercatorPixel,_,g);for(let i=0;i<l.length;i++)ov(l[i],a[i],M);let o=aH([],a[v],a[(v+1)%4]);a0(o,o,.5),ov(S,o,M)}for(let i of l)aJ(c,c,i),aQ(u,u,i);return c[2]=Math.min(b[2],w[2]),aJ(c,c,S),aQ(u,u,S),new ou(c,u)}(i,r,new lu(n,a,o));let c=hR({z:n,x:a,y:o},u);return new ou([(s+c.x/c.scale)*r,c.y/c.scale*r,l],[(s+c.x2/c.scale)*r,c.y2/c.scale*r,h])},i.tileCornersToBounds=oT,i.tileTransform=hR,i.transformMat3=function(i,r,n){var a=r[0],o=r[1],s=r[2];return i[0]=a*n[0]+o*n[3]+s*n[6],i[1]=a*n[1]+o*n[4]+s*n[7],i[2]=a*n[2]+o*n[5]+s*n[8],i},i.transformMat4=a4,i.transformMat4$1=a7,i.transformQuat=a6,i.transitionTileAABBinECEF=ob,i.translate=aU,i.transpose=function(i,r){if(i===r){var n=r[1],a=r[2],o=r[5];i[1]=r[3],i[2]=r[6],i[3]=n,i[5]=r[7],i[6]=a,i[7]=o}else i[0]=r[0],i[1]=r[3],i[2]=r[6],i[3]=r[1],i[4]=r[4],i[5]=r[7],i[6]=r[2],i[7]=r[5],i[8]=r[8];return i},i.triggerPluginCompletionEvent=nt,i.uniqueId=O,i.updateGlobeVertexNormal=function(i,r,n,a,o){let s=5*r+2;i.float32[s+0]=n,i.float32[s+1]=a,i.float32[s+2]=o},i.validateCustomStyleLayer=function(i){let r=[],n=i.id;return void 0===n&&r.push({message:`layers.${n}: missing required property "id"`}),void 0===i.render&&r.push({message:`layers.${n}: missing required method "render"`}),i.renderingMode&&"2d"!==i.renderingMode&&"3d"!==i.renderingMode&&r.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),r},i.validateFilter=i=>rx(ri(i)),i.validateFog=i=>rx(rd(i)),i.validateLayer=i=>rx(ro(i)),i.validateLight=i=>rx(ru(i)),i.validateSource=i=>rx(rh(i)),i.validateStyle=r_,i.validateTerrain=i=>rx(rc(i)),i.values=L,i.vectorTile=sY,i.version=p,i.warnOnce=W,i.window=d,i.wrap=D}),a(["./shared"],function(i){class r{constructor(i){this.keyCache={},i&&this.replace(i)}replace(i){this._layerConfigs={},this._layers={},this.update(i,[])}update(r,n){for(let n of r)this._layerConfigs[n.id]=n,(this._layers[n.id]=i.createStyleLayer(n)).compileFilter(),this.keyCache[n.id]&&delete this.keyCache[n.id];for(let i of n)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];for(let r of(this.familiesBySource={},function(r,n){let a={};for(let o=0;o<r.length;o++){let s=n&&n[r[o].id]||function(r){let n="";for(let a of i.refProperties)n+=`/${function i(r){if("number"==typeof r||"boolean"==typeof r||"string"==typeof r||null==r)return JSON.stringify(r);if(Array.isArray(r)){let n="[";for(let a of r)n+=`${i(a)},`;return`${n}]`}let n="{";for(let a of Object.keys(r).sort())n+=`${a}:${i(r[a])},`;return`${n}}`}(r[a])}`;return n}(r[o]);n&&(n[r[o].id]=s);let l=a[s];l||(l=a[s]=[]),l.push(r[o])}let o=[];for(let i in a)o.push(a[i]);return o}(i.values(this._layerConfigs),this.keyCache))){let i=r.map(i=>this._layers[i.id]),n=i[0];if("none"===n.visibility)continue;let a=n.source||"",o=this.familiesBySource[a];o||(o=this.familiesBySource[a]={});let s=n.sourceLayer||"_geojsonTileLayer",l=o[s];l||(l=o[s]=[]),l.push(i)}}}class n{loadTile(r,n){let{uid:a,encoding:o,rawImageData:s,padding:l,buildQuadTree:h}=r,u=i.window.ImageBitmap&&s instanceof i.window.ImageBitmap?this.getImageData(s,l):s;n(null,new i.DEMData(a,u,o,l<1,h))}getImageData(i,r){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(i.width,i.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=i.width,this.offscreenCanvas.height=i.height,this.offscreenCanvasContext.drawImage(i,0,0,i.width,i.height);let n=this.offscreenCanvasContext.getImageData(-r,-r,i.width+2*r,i.height+2*r);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),n}}var a,o=function i(r,n){var a,o=r&&r.type;if("FeatureCollection"===o)for(a=0;a<r.features.length;a++)i(r.features[a],n);else if("GeometryCollection"===o)for(a=0;a<r.geometries.length;a++)i(r.geometries[a],n);else if("Feature"===o)i(r.geometry,n);else if("Polygon"===o)s(r.coordinates,n);else if("MultiPolygon"===o)for(a=0;a<r.coordinates.length;a++)s(r.coordinates[a],n);return r};function s(i,r){if(0!==i.length){l(i[0],r);for(var n=1;n<i.length;n++)l(i[n],!r)}}function l(i,r){for(var n=0,a=0,o=0,s=i.length,l=s-1;o<s;l=o++){var h=(i[o][0]-i[l][0])*(i[l][1]+i[o][1]),u=n+h;a+=Math.abs(n)>=Math.abs(h)?n-u+h:h-u+n,n=u}n+a>=0!=!!r&&i.reverse()}let h=i.VectorTileFeature.prototype.toGeoJSON;class u{constructor(r){this._feature=r,this.extent=i.EXTENT,this.type=r.type,this.properties=r.tags,"id"in r&&!isNaN(r.id)&&
8(this.id=parseInt(r.id,10))}loadGeometry(){if(1===this._feature.type){let r=[];for(let n of this._feature.geometry)r.push([new i.pointGeometry(n[0],n[1])]);return r}{let r=[];for(let n of this._feature.geometry){let a=[];for(let r of n)a.push(new i.pointGeometry(r[0],r[1]));r.push(a)}return r}}toGeoJSON(i,r,n){return h.call(this,i,r,n)}}class c{constructor(r){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=r.length,this._features=r}feature(i){return new u(this._features[i])}}var d={},p=i.pointGeometry,f=i.vectorTile.VectorTileFeature;function m(i,r){this.options=r||{},this.features=i,this.length=i.length}function _(i,r){this.id="number"==typeof i.id?i.id:void 0,this.type=i.type,this.rawGeometry=1===i.type?[i.geometry]:i.geometry,this.properties=i.tags,this.extent=r||4096}m.prototype.feature=function(i){return new _(this.features[i],this.options.extent)},_.prototype.loadGeometry=function(){var i=this.rawGeometry;this.geometry=[];for(var r=0;r<i.length;r++){for(var n=i[r],a=[],o=0;o<n.length;o++)a.push(new p(n[o][0],n[o][1]));this.geometry.push(a)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var i=this.geometry,r=1/0,n=-1/0,a=1/0,o=-1/0,s=0;s<i.length;s++)for(var l=i[s],h=0;h<l.length;h++){var u=l[h];r=Math.min(r,u.x),n=Math.max(n,u.x),a=Math.min(a,u.y),o=Math.max(o,u.y)}return[r,a,n,o]},_.prototype.toGeoJSON=f.prototype.toGeoJSON;var g=i.pbf;function y(i){var r=new g;return function(i,r){for(var n in i.layers)r.writeMessage(3,x,i.layers[n])}(i,r),r.finish()}function x(i,r){r.writeVarintField(15,i.version||1),r.writeStringField(1,i.name||""),r.writeVarintField(5,i.extent||4096);var n,a={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<i.length;n++)a.feature=i.feature(n),r.writeMessage(2,v,a);var o=a.keys;for(n=0;n<o.length;n++)r.writeStringField(3,o[n]);var s=a.values;for(n=0;n<s.length;n++)r.writeMessage(4,T,s[n])}function v(i,r){var n=i.feature;void 0!==n.id&&r.writeVarintField(1,n.id),r.writeMessage(2,b,i),r.writeVarintField(3,n.type),r.writeMessage(4,w,n)}function b(i,r){var n=i.feature,a=i.keys,o=i.values,s=i.keycache,l=i.valuecache;for(var h in n.properties){var u=n.properties[h],c=s[h];if(null!==u){void 0===c&&(a.push(h),s[h]=c=a.length-1),r.writeVarint(c);var d=typeof u;"string"!==d&&"boolean"!==d&&"number"!==d&&(u=JSON.stringify(u));var p=d+":"+u,f=l[p];void 0===f&&(o.push(u),l[p]=f=o.length-1),r.writeVarint(f)}}}function w(i,r){for(var n=i.loadGeometry(),a=i.type,o=0,s=0,l=n.length,h=0;h<l;h++){var u=n[h],c=1;1===a&&(c=u.length),r.writeVarint((c<<3)+1);for(var d=3===a?u.length-1:u.length,p=0;p<d;p++){1===p&&1!==a&&r.writeVarint((d-1<<3)+2);var f=u[p].x-o,m=u[p].y-s;r.writeVarint(f<<1^f>>31),r.writeVarint(m<<1^m>>31),o+=f,s+=m}3===a&&r.writeVarint(15)}}function T(i,r){var n=typeof i;"string"===n?r.writeStringField(1,i):"boolean"===n?r.writeBooleanField(7,i):"number"===n&&(i%1!=0?r.writeDoubleField(3,i):i<0?r.writeSVarintField(6,i):r.writeVarintField(5,i))}function E(i,r,n,a){S(i,n,a),S(r,2*n,2*a),S(r,2*n+1,2*a+1)}function S(i,r,n){let a=i[r];i[r]=i[n],i[n]=a}function M(i,r,n,a){let o=i-n,s=r-a;return o*o+s*s}({get exports(){return d},set exports(e){d=e}}).exports=y,d.fromVectorTileJs=y,d.fromGeojsonVt=function(i,r){r=r||{};var n={};for(var a in i)n[a]=new m(i[a].features,r),n[a].name=a,n[a].version=r.version,n[a].extent=r.extent;return y({layers:n})},d.GeoJSONWrapper=m;let A=i=>i[0],I=i=>i[1];class C{constructor(i,r=A,n=I,a=64,o=Float64Array){this.nodeSize=a,this.points=i;let s=i.length<65536?Uint16Array:Uint32Array,l=this.ids=new s(i.length),h=this.coords=new o(2*i.length);for(let a=0;a<i.length;a++)l[a]=a,h[2*a]=r(i[a]),h[2*a+1]=n(i[a]);!function i(r,n,a,o,s,l){if(s-o<=a)return;let h=o+s>>1;(function i(r,n,a,o,s,l){for(;s>o;){if(s-o>600){let h=s-o+1,u=a-o+1,c=Math.log(h),d=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*d*(h-d)/h)*(u-h/2<0?-1:1);i(r,n,a,Math.max(o,Math.floor(a-u*d/h+p)),Math.min(s,Math.floor(a+(h-u)*d/h+p)),l)}let h=n[2*a+l],u=o,c=s;for(E(r,n,o,a),n[2*s+l]>h&&E(r,n,o,s);u<c;){for(E(r,n,u,c),u++,c--;n[2*u+l]<h;)u++;for(;n[2*c+l]>h;)c--}n[2*o+l]===h?E(r,n,o,c):E(r,n,++c,s),c<=a&&(o=c+1),a<=c&&(s=c-1)}}
8)(r,n,h,o,s,l%2),i(r,n,a,o,h-1,l+1),i(r,n,a,h+1,s,l+1)}(l,h,a,0,l.length-1,0)}range(i,r,n,a){return function(i,r,n,a,o,s,l){let h,u;let c=[0,i.length-1,0],d=[];for(;c.length;){let p=c.pop(),f=c.pop(),m=c.pop();if(f-m<=l){for(let l=m;l<=f;l++)h=r[2*l],u=r[2*l+1],h>=n&&h<=o&&u>=a&&u<=s&&d.push(i[l]);continue}let _=Math.floor((m+f)/2);h=r[2*_],u=r[2*_+1],h>=n&&h<=o&&u>=a&&u<=s&&d.push(i[_]);let g=(p+1)%2;(0===p?n<=h:a<=u)&&(c.push(m),c.push(_-1),c.push(g)),(0===p?o>=h:s>=u)&&(c.push(_+1),c.push(f),c.push(g))}return d}(this.ids,this.coords,i,r,n,a,this.nodeSize)}within(i,r,n){return function(i,r,n,a,o,s){let l=[0,i.length-1,0],h=[],u=o*o;for(;l.length;){let c=l.pop(),d=l.pop(),p=l.pop();if(d-p<=s){for(let o=p;o<=d;o++)M(r[2*o],r[2*o+1],n,a)<=u&&h.push(i[o]);continue}let f=Math.floor((p+d)/2),m=r[2*f],_=r[2*f+1];M(m,_,n,a)<=u&&h.push(i[f]);let g=(c+1)%2;(0===c?n-o<=m:a-o<=_)&&(l.push(p),l.push(f-1),l.push(g)),(0===c?n+o>=m:a+o>=_)&&(l.push(f+1),l.push(d),l.push(g))}return h}(this.ids,this.coords,i,r,n,this.nodeSize)}}let z={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},k=Math.fround||(a=new Float32Array(1),i=>(a[0]=+i,a[0]));class D{constructor(i){this.options=O(Object.create(z),i),this.trees=Array(this.options.maxZoom+1)}load(i){let{log:r,minZoom:n,maxZoom:a,nodeSize:o}=this.options;r&&console.time("total time");let s=`prepare ${i.length} points`;r&&console.time(s),this.points=i;let l=[];for(let r=0;r<i.length;r++)i[r].geometry&&l.push(function(i,r){let[n,a]=i.geometry.coordinates;return{x:k(R(n)),y:k(B(a)),zoom:1/0,index:r,parentId:-1}}(i[r],r));this.trees[a+1]=new C(l,F,U,o,Float32Array),r&&console.timeEnd(s);for(let i=a;i>=n;i--){let n=+Date.now();l=this._cluster(l,i),this.trees[i]=new C(l,F,U,o,Float32Array),r&&console.log("z%d: %d clusters in %dms",i,l.length,+Date.now()-n)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let n=((i[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,i[1])),o=180===i[2]?180:((i[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)n=-180,o=180;else if(n>o){let i=this.getClusters([n,a,180,s],r),l=this.getClusters([-180,a,o,s],r);return i.concat(l)}let l=this.trees[this._limitZoom(r)],h=l.range(R(n),B(s),R(o),B(a)),u=[];for(let i of h){let r=l.points[i];u.push(r.numPoints?P(r):this.points[r.index])}return u}getChildren(i){let r=this._getOriginId(i),n=this._getOriginZoom(i),a="No cluster with the specified id.",o=this.trees[n];if(!o)throw Error(a);let s=o.points[r];if(!s)throw Error(a);let l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),h=o.within(s.x,s.y,l),u=[];for(let r of h){let n=o.points[r];n.parentId===i&&u.push(n.numPoints?P(n):this.points[n.index])}if(0===u.length)throw Error(a);return u}getLeaves(i,r,n){let a=[];return this._appendLeaves(a,i,r=r||10,n=n||0,0),a}getTile(i,r,n){let a=this.trees[this._limitZoom(i)],o=Math.pow(2,i),{extent:s,radius:l}=this.options,h=l/s,u=(n-h)/o,c=(n+1+h)/o,d={features:[]};return this._addTileFeatures(a.range((r-h)/o,u,(r+1+h)/o,c),a.points,r,n,o,d),0===r&&this._addTileFeatures(a.range(1-h/o,u,1,c),a.points,o,n,o,d),r===o-1&&this._addTileFeatures(a.range(0,u,h/o,c),a.points,-1,n,o,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(i);if(r++,1!==n.length)break;i=n[0].properties.cluster_id}return r}_appendLeaves(i,r,n,a,o){for(let s of this.getChildren(r)){let r=s.properties;if(r&&r.cluster?o+r.point_count<=a?o+=r.point_count:o=this._appendLeaves(i,r.cluster_id,n,a,o):o<a?o++:i.push(s),i.length===n)break}return o}_addTileFeatures(i,r,n,a,o,s){for(let l of i){let i,h,u,c;let d=r[l],p=d.numPoints;if(p)i=L(d),h=d.x,u=d.y;else{let r=this.points[d.index];i=r.properties,h=R(r.geometry.coordinates[0]),u=B(r.geometry.coordinates[1])}let f={type:1,geometry:[[Math.round(this.options.extent*(h*o-n)),Math.round(this.options.extent*(u*o-a))]],tags:i};p?c=d.id:this.options.generateId?c=d.index:this.points[d.index].id&&(c=this.points[d.index].id),void 0!==c&&(f.id=c),s.features.push(f)}}_limitZoom(i){return Math.max(this.options.minZoom,Math.min(Math.floor(+i),this.options.maxZoom+1))}_cluster(i,r){let n=[],{radius:a,extent:o,reduce:s,minPoints:l}=this.options,h=a/(o*Math.pow(2,r));for(let a=0;a<i.length;a++){let o=i[a];if(o.zoom<=r)continue;o.zoom=r;let f=this.trees[r+1],m=f.within(o.x,o.y,h),_=o.numPoints||1,g=_;for(let i of m){let n=f.points[i];n.zoom>r&&(g+=n.numPoints||1)}if(g>_&&g>=l){var u,c,d,p;let i=o.x*_,l=o.y*_,h=s&&_>1?this._map(o,!0):null,y=(a<<5)+(r+1)+this.points.length;for(let n of m){let a=f.points[n];if(a.zoom<=r)continue;a.zoom=r;let u=a.numPoints||1;i+=a.x*u,l+=a.y*u,a.parentId=y,s&&(h||(h=this._map(o,!0)),s(h,this._map(a)))}o.parentId=y,n.push((u=i/g,c=l/g,d=g,p=h,{x:k(u),y:k(c),zoom:1/0,id:y,parentId:-1,numPoints:d,properties:p}))}else if(n.push(o),g>1)for(let i of m){let a=f.points[i];a.zoom<=r||(a.zoom=r,n.push(a))}}return n}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r){if(i.numPoints)return r?O({},i.properties):i.properties;let n=this.points[i.index].properties,a=this.options.map(n);return r&&a===n?O({},a):a}}function P(i){return{type:"Feature",id:i.id,properties:L(i),geometry:{type:"Point",coordinates:[360*(i.x-.5),360*Math.atan(Math.exp((180-360*i.y)*Math.PI/180)
vendor: 4,201 bytes, line 8
8)/Math.PI-90]}}}function L(i){let r=i.numPoints,n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r;return O(O({},i.properties),{cluster:!0,cluster_id:i.id,point_count:r,point_count_abbreviated:n})}function R(i){return i/360+.5}function B(i){let r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function O(i,r){for(let n in r)i[n]=r[n];return i}function F(i){return i.x}function U(i){return i.y}function V(i,r,n,a){var o={id:void 0===i?null:i,type:r,geometry:n,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(i){var r=i.geometry,n=i.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)N(i,r);else if("Polygon"===n||"MultiLineString"===n)for(var a=0;a<r.length;a++)N(i,r[a]);else if("MultiPolygon"===n)for(a=0;a<r.length;a++)for(var o=0;o<r[a].length;o++)N(i,r[a][o])}(o),o}function N(i,r){for(var n=0;n<r.length;n+=3)i.minX=Math.min(i.minX,r[n]),i.minY=Math.min(i.minY,r[n+1]),i.maxX=Math.max(i.maxX,r[n]),i.maxY=Math.max(i.maxY,r[n+1])}function j(i,r,n,a){if(r.geometry){var o=r.geometry.coordinates,s=r.geometry.type,l=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),h=[],u=r.id;if(n.promoteId?u=r.properties[n.promoteId]:n.generateId&&(u=a||0),"Point"===s)G(o,h);else if("MultiPoint"===s)for(var c=0;c<o.length;c++)G(o[c],h);else if("LineString"===s)Z(o,h,l,!1);else if("MultiLineString"===s){if(n.lineMetrics){for(c=0;c<o.length;c++)Z(o[c],h=[],l,!1),i.push(V(u,"LineString",h,r.properties));return}$(o,h,l,!1)}else if("Polygon"===s)$(o,h,l,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(c=0;c<r.geometry.geometries.length;c++)j(i,{id:u,geometry:r.geometry.geometries[c],properties:r.properties},n,a);return}throw Error("Input data is not a valid GeoJSON object.")}for(c=0;c<o.length;c++){var d=[];$(o[c],d,l,!0),h.push(d)}}i.push(V(u,s,h,r.properties))}}function G(i,r){r.push(i[0]/360+.5),r.push(q(i[1])),r.push(0)}function Z(i,r,n,a){for(var o,s,l=0,h=0;h<i.length;h++){var u=i[h][0]/360+.5,c=q(i[h][1]);r.push(u),r.push(c),r.push(0),h>0&&(l+=a?(o*c-u*s)/2:Math.sqrt(Math.pow(u-o,2)+Math.pow(c-s,2))),o=u,s=c}var d=r.length-3;r[2]=1,function i(r,n,a,o){for(var s,l=o,h=a-n>>1,u=a-n,c=r[n],d=r[n+1],p=r[a],f=r[a+1],m=n+3;m<a;m+=3){var _=function(i,r,n,a,o,s){var l=o-n,h=s-a;if(0!==l||0!==h){var u=((i-n)*l+(r-a)*h)/(l*l+h*h);u>1?(n=o,a=s):u>0&&(n+=l*u,a+=h*u)}return(l=i-n)*l+(h=r-a)*h}(r[m],r[m+1],c,d,p,f);if(_>l)s=m,l=_;else if(_===l){var g=Math.abs(m-h);g<u&&(s=m,u=g)}}l>o&&(s-n>3&&i(r,n,s,o),r[s+2]=l,a-s>3&&i(r,s,a,o))}(r,0,d,n),r[d+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function $(i,r,n,a){for(var o=0;o<i.length;o++){var s=[];Z(i[o],s,n,a),r.push(s)}}function q(i){var r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function W(i,r,n,a,o,s,l,h){if(a/=r,s>=(n/=r)&&l<a)return i;if(l<n||s>=a)return null;for(var u=[],c=0;c<i.length;c++){var d=i[c],p=d.geometry,f=d.type,m=0===o?d.minX:d.minY,_=0===o?d.maxX:d.maxY;if(m>=n&&_<a)u.push(d);else if(!(_<n||m>=a)){var g=[];if("Point"===f||"MultiPoint"===f)(function(i,r,n,a,o){for(var s=0;s<i.length;s+=3){var l=i[s+o];l>=n&&l<=a&&(r.push(i[s]),r.push(i[s+1]),r.push(i[s+2]))}})(p,g,n,a,o);else if("LineString"===f)X(p,g,n,a,o,!1,h.lineMetrics);else if("MultiLineString"===f)Y(p,g,n,a,o,!1);else if("Polygon"===f)Y(p,g,n,a,o,!0);else if("MultiPolygon"===f)for(var y=0;y<p.length;y++){var x=[];Y(p[y],x,n,a,o,!0),x.length&&g.push(x)}if(g.length){if(h.lineMetrics&&"LineString"===f){for(y=0;y<g.length;y++)u.push(V(d.id,f,g[y],d.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===g.length?(f="LineString",g=g[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===g.length?"Point":"MultiPoint"),u.push(V(d.id,f,g,d.tags))}}}return u.length?u:null}function X(i,r,n,a,o,s,l){for(var h,u,c=H(i),d=0===o?J:Q,p=i.start,f=0;f<i.length-3;f+=3){var m=i[f],_=i[f+1],g=i[f+2],y=i[f+3],x=i[f+4],v=0===o?m:_,b=0===o?y:x,w=!1;l&&(h=Math.sqrt(Math.pow(m-y,2)+Math.pow(_-x,2))),v<n?b>n&&(u=d(c,m,_,y,x,n),l&&(c.start=p+h*u)):v>a?b<a&&(u=d(c,m,_,y,x,a),l&&(c.start=p+h*u)):K(c,m,_,g),b<n&&v>=n&&(u=d(c,m,_,y,x,n),w=!0),b>a&&v<=a&&(u=d(c,m,_,y,x,a),w=!0),!s&&w&&(l&&(c.end=p+h*u),r.push(c),c=H(i)),l&&(p+=
vendor: 6,811 bytes, line 8
8h)}var T=i.length-3;m=i[T],_=i[T+1],g=i[T+2],(v=0===o?m:_)>=n&&v<=a&&K(c,m,_,g),T=c.length-3,s&&T>=3&&(c[T]!==c[0]||c[T+1]!==c[1])&&K(c,c[0],c[1],c[2]),c.length&&r.push(c)}function H(i){var r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function Y(i,r,n,a,o,s){for(var l=0;l<i.length;l++)X(i[l],r,n,a,o,s,!1)}function K(i,r,n,a){i.push(r),i.push(n),i.push(a)}function J(i,r,n,a,o,s){var l=(s-r)/(a-r);return i.push(s),i.push(n+(o-n)*l),i.push(1),l}function Q(i,r,n,a,o,s){var l=(s-n)/(o-n);return i.push(r+(a-r)*l),i.push(s),i.push(1),l}function ee(i,r){for(var n=[],a=0;a<i.length;a++){var o,s=i[a],l=s.type;if("Point"===l||"MultiPoint"===l||"LineString"===l)o=et(s.geometry,r);else if("MultiLineString"===l||"Polygon"===l){o=[];for(var h=0;h<s.geometry.length;h++)o.push(et(s.geometry[h],r))}else if("MultiPolygon"===l)for(o=[],h=0;h<s.geometry.length;h++){for(var u=[],c=0;c<s.geometry[h].length;c++)u.push(et(s.geometry[h][c],r));o.push(u)}n.push(V(s.id,l,o,s.tags))}return n}function et(i,r){var n=[];n.size=i.size,void 0!==i.start&&(n.start=i.start,n.end=i.end);for(var a=0;a<i.length;a+=3)n.push(i[a]+r,i[a+1],i[a+2]);return n}function ei(i,r){if(i.transformed)return i;var n,a,o,s=1<<i.z,l=i.x,h=i.y;for(n=0;n<i.features.length;n++){var u=i.features[n],c=u.geometry,d=u.type;if(u.geometry=[],1===d)for(a=0;a<c.length;a+=2)u.geometry.push(er(c[a],c[a+1],r,s,l,h));else for(a=0;a<c.length;a++){var p=[];for(o=0;o<c[a].length;o+=2)p.push(er(c[a][o],c[a][o+1],r,s,l,h));u.geometry.push(p)}}return i.transformed=!0,i}function er(i,r,n,a,o,s){return[Math.round(n*(i*a-o)),Math.round(n*(r*a-s))]}function en(i,r,n,a,o,s){var l=a*a;if(a>0&&r.size<(o?l:a))n.numPoints+=r.length/3;else{for(var h=[],u=0;u<r.length;u+=3)(0===a||r[u+2]>l)&&(n.numSimplified++,h.push(r[u]),h.push(r[u+1])),n.numPoints++;o&&function(i,r){for(var n=0,a=0,o=i.length,s=o-2;a<o;s=a,a+=2)n+=(i[a]-i[s])*(i[a+1]+i[s+1]);if(n>0===r)for(a=0,o=i.length;a<o/2;a+=2){var l=i[a],h=i[a+1];i[a]=i[o-2-a],i[a+1]=i[o-1-a],i[o-2-a]=l,i[o-1-a]=h}}(h,s),i.push(h)}}function ea(i,r){var n,a,o,s,l,h,u=(r=this.options=function(i,r){for(var n in r)i[n]=r[n];return i}(Object.create(this.options),r)).debug;if(u&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");var c=function(i,r){var n=[];if("FeatureCollection"===i.type)for(var a=0;a<i.features.length;a++)j(n,i.features[a],r,a);else j(n,"Feature"===i.type?i:{geometry:i},r);return n}(i,r);this.tiles={},this.tileCoords=[],u&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=c,o=(a=r).buffer/a.extent,s=n,l=W(n,1,-1-o,o,0,-1,2,a),h=W(n,1,1-o,2+o,0,-1,2,a),(l||h)&&(s=W(n,1,-o,1+o,0,-1,2,a)||[],l&&(s=ee(l,1).concat(s)),h&&(s=s.concat(ee(h,-1)))),(c=s).length&&this.splitTile(c,0,0,0),u&&(c.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 eo(i,r,n){return 32*((1<<i)*n+r)+i}function es(i,r){let n=i.tileID.canonical;if(!this._geoJSONIndex)return r(null,null);let a=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!a)return r(null,null);let o=new c(a.features),s=d(o);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),r(null,{vectorTile:o,rawData:s.buffer})}ea.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ea.prototype.splitTile=function(i,r,n,a,o,s,l){for(var h=[i,r,n,a],u=this.options,c=u.debug;h.length;){a=h.pop(),n=h.pop(),r=h.pop(),i=h.pop();var d=1<<r,p=eo(r,n,a),f=this.tiles[p];if(!f&&(c>1&&console.time("creation"),f=this.tiles[p]=function(i,r,n,a,o){for(var s=r===o.maxZoom?0:o.tolerance/((1<<r)*o.extent),l={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:a,z:r,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},h=0;h<i.length;h++){l.numFeatures++,function(i,r,n,a){var o=r.geometry,s=r.type,l=[];if("Point"===s||"MultiPoint"===s)for(var h=0;h<o.length;h+=3)l.push(o[h]),l.push(o[h+1]),i.numPoints++,i.numSimplified++;else if("LineString"===s)en(l,o,i,n,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(h=0;h<o.length;h++)en(l,o[h],i,n,"Polygon"===s,0===h);else if("MultiPolygon"===s)for(var u=0;u<o.length;u++){var c=o[u];for(h=0;h<c.length;h++)en(l,c[h],i,n,!0,0===h)}if(l.length){var d=r.tags||null;if("LineString"===s&&a.lineMetrics){for(var p in d={},r.tags)d[p]=r.tags[p];d.mapbox_clip_start=o.start/o.size,d.mapbox_clip_end=o.end/o.size}var f={geometry:l,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:d};null!==r.id&&(f.id=r.id),i.features.push(f)}}(l,i[h],s,o);var u=i[h].minX,c=i[h].minY,d=i[h].maxX,p=i[h].maxY;u<l.minX&&(l.minX=u),c<l.minY&&(l.minY=c),d>l.maxX&&(l.maxX=d),p>l.maxY&&(l.maxY=p)}return l}(i,r,n,a,u),this.tileCoords.push({z:r,x:n,y:a}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,a,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var m="z"+r;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(f.source=i,o){if(r===u.maxZoom||r===o)continue;var _=1<<o-r;if(n!==Math.floor(s/_)||a!==Math.floor(l/_))continue}else if(r===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue;if(f.source=null,0!==i.length){c>1&&console.time("clipping");var g,y,x,v,b,w,T=.5*u.buffer/u.extent,E=.5-T,S=.5+T,M=1+T;g=y=x=v=null,b=W(i,d,n-T,n+S,0,f.minX,f.maxX,u),w=W(i,d,n+E,n+M,0,f.minX,f.maxX,u),i=null,b&&(g=W(b,d,a-T,a+S,1,f.minY,f.maxY,u),y=W(b,d,a+E,a+M,1,f.minY,f.maxY,u),b=null),w&&(x=W(w,d,a-T,a+S,1,f.minY,f.maxY,u),v=W(w,d,a+E,a+M,1,f.minY,f.maxY,u),w=null),c>1&&console.timeEnd("clipping"),h.push(g||[],r+1,2*n,2*a),h.push(y||[],r+1,2*n,2*a+1),h.push(x||[],r+1,2*n+1,2*a),h.push(v||[],r+1,2*n+1,2*a+1)}}},ea.prototype.getTile=function(i,r,n){var a=this.options,o=a.extent,s=a.debug;if(i<0||i>24)return null;var l=1<<i,h=eo(i,r=(r%l+l)%l,n);if(this.tiles[h])return ei(this.tiles[h],o);s>1&&console.log("drilling down to z%d-%d-%d",i,r,n);for(var u,c=i,d=r,p=n;!u&&c>0;)c--,d=Math.floor(d/2),p=Math.floor(p/2),u=this.tiles[eo(c,d,p)];return u&&u.source?(s>1&&console.log("found parent tile z%d-%d-%d",c,d,p),s>1&&console.time("drilling down"),this.splitTile(u.source,c,d,p,i,r,n),s>1&&console.timeEnd("drilling down"),this.tiles[h]?ei(this.tiles[h],o):null):null};class el extends i.VectorTileWorkerSource{constructor(i,r,n,a,o){super(i,r,n,a,es),o&&(this.loadGeoJSON=o)}loadData(r,n){let a=r&&r.request,s=a&&a.collectResourceTiming;this.loadGeoJSON(r,(l,h)=>
8{if(l||!h)return n(l);if("object"!=typeof h)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{o(h,!0);try{var u,c;if(r.filter){let n=i.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));let a=h.features.filter(i=>n.value.evaluate({zoom:0},i));h={type:"FeatureCollection",features:a}}this._geoJSONIndex=r.cluster?new D(function({superclusterOptions:r,clusterProperties:n}){if(!n||!r)return r;let a={},o={},s={accumulated:null,zoom:0},l={properties:null},h=Object.keys(n);for(let r of h){let[s,l]=n[r],h=i.createExpression(l),u=i.createExpression("string"==typeof s?[s,["accumulated"],["get",r]]:s);a[r]=h.value,o[r]=u.value}return r.map=i=>{l.properties=i;let r={};for(let i of h)r[i]=a[i].evaluate(s,l);return r},r.reduce=(i,r)=>{for(let n of(l.properties=r,h))s.accumulated=i[n],i[n]=o[n].evaluate(s,l)},r}(r)).load(h.features):(u=h,c=r.geojsonVtOptions,new ea(u,c))}catch(i){return n(i)}this.loaded={};let l={};if(s){let n=i.getPerformanceMeasurement(a);n&&(l.resourceTiming={},l.resourceTiming[r.source]=JSON.parse(JSON.stringify(n)))}n(null,l)}})}reloadTile(i,r){let n=this.loaded;return n&&n[i.uid]?super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(r,n){if(r.request)i.getJSON(r.request,n);else{if("string"!=typeof r.data)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(r.data))}catch(i){return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(i){r(i)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(i){r(i)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(i){r(i)}}}class eh{constructor(r){this.self=r,this.actor=new i.Actor(r,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:el},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=r=>{if(i.plugin.isParsed())throw Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=r.applyArabicShaping,i.plugin.processBidirectionalText=r.processBidirectionalText,i.plugin.processStyledBidirectionalText=r.processStyledBidirectionalText}}clearCaches(i,r,n){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],n()}checkIfReady(i,r,n){n()}setReferrer(i,r){this.referrer=r}spriteLoaded(r,n){for(let a in this.isSpriteLoaded[r]=n,this.workerSources[r]){let o=this.workerSources[r][a];for(let r in o)o[r]instanceof i.VectorTileWorkerSource&&(o[r].isSpriteLoaded=n,o[r].fire(new i.Event("isSpriteLoaded")))}}setImages(i,r,n){for(let n in this.availableImages[i]=r,this.workerSources[i]){let a=this.workerSources[i][n];for(let i in a)a[i].availableImages=r}n()}enableTerrain(i,r,n){this.terrain=r,n()}setProjection(r,n){this.projections[r]=i.getProjection(n)}setLayers(i,r,n){this.getLayerIndex(i).replace(r),n()}updateLayers(i,r,n){this.getLayerIndex(i).update(r.layers,r.removedIds),n()}loadTile(r,n,a){let o=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;o.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).loadTile(o,a)}loadDEMTile(r,n,a){let o=this.enableTerrain?i.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(r,n.source).loadTile(o,a)}reloadTile(r,n,a){let o=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;o.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).reloadTile(o,a)}abortTile(i,r,n){this.getWorkerSource(i,r.type,r.source).abortTile(r,n)}removeTile(i,r,n){this.getWorkerSource(i,r.type,r.source).removeTile(r,n)}
8removeSource(i,r,n){if(!this.workerSources[i]||!this.workerSources[i][r.type]||!this.workerSources[i][r.type][r.source])return;let a=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==a.removeSource?a.removeSource(r,n):n()}loadWorkerSource(i,r,n){try{this.self.importScripts(r.url),n()}catch(i){n(i.toString())}}syncRTLPluginState(r,n,a){try{i.plugin.setState(n);let r=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&null!=r){this.self.importScripts(r);let n=i.plugin.isParsed();a(n?void 0:Error(`RTL Text Plugin failed to import scripts from ${r}`),n)}}catch(i){a(i.toString())}}getAvailableImages(i){let r=this.availableImages[i];return r||(r=[]),r}getLayerIndex(i){let n=this.layerIndexes[i];return n||(n=this.layerIndexes[i]=new r),n}getWorkerSource(i,r,n){if(this.workerSources[i]||(this.workerSources[i]={}),this.workerSources[i][r]||(this.workerSources[i][r]={}),!this.workerSources[i][r][n]){let a={send:(r,n,a,o,s,l)=>{this.actor.send(r,n,a,i,s,l)},scheduler:this.actor.scheduler};this.workerSources[i][r][n]=new this.workerSourceTypes[r](a,this.getLayerIndex(i),this.getAvailableImages(i),this.isSpriteLoaded[i])}return this.workerSources[i][r][n]}getDEMWorkerSource(i,r){return this.demWorkerSources[i]||(this.demWorkerSources[i]={}),this.demWorkerSources[i][r]||(this.demWorkerSources[i][r]=new n),this.demWorkerSources[i][r]}enforceCacheSizeLimit(r,n){i.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(i,r,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new eh(self)),eh}),a(["./shared"],function(i){let r,n,a,o;function s(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let n=0;n<i.length;n++)if(!s(i[n],r[n]))return!1;return!0}if("object"==typeof i&&null!==i&&null!==r){if("object"!=typeof r||Object.keys(i).length!==Object.keys(r).length)return!1;for(let n in i)if(!s(i[n],r[n]))return!1;return!0}return i===r}function l(i){var r;return"undefined"!=typeof window&&"undefined"!=typeof document&&!!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 i,r,n=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(n);try{r=new Worker(a),i=!0}catch(r){i=!1}return r&&r.terminate(),URL.revokeObjectURL(a),i}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var n=r.getImageData(0,0,1,1);return n&&n.width===i.width}()&&(void 0===h[r=i&&i.failIfMajorPerformanceCaveat]&&(h[r]=function(i){var r,n,a,o=(r=document.createElement("canvas"),(n=Object.create(l.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl",n)||r.getContext("experimental-webgl",n));if(!o)return!1;try{a=o.createShader(o.VERTEX_SHADER)}catch(i){return!1}return!(!a||o.isContextLost())&&(o.shaderSource(a,"void main() {}"),o.compileShader(a),!0===o.getShaderParameter(a,o.COMPILE_STATUS))}(r)),!!h[r]&&!document.documentMode)}var h={};function u(r,n,a){let o=i.window.document.createElement(r);return void 0!==n&&(o.className=n),a&&a.appendChild(o),o}function c(r,n,a){let o=i.window.document.createElementNS("http://www.w3.org/2000/svg",r);for(let i of Object.keys(n))o.setAttributeNS(null,i,n[i]);return a&&a.appendChild(o),o}l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};let d=i.window.document&&i.window.document.documentElement.style,p=d&&void 0!==d.userSelect?"userSelect":"WebkitUserSelect";function f(){d&&p&&(r=d[p],d[p]="none")}function m(){d&&p&&(d[p]=r)}function _(r){r.preventDefault(),r.stopPropagation(),i.window.removeEventListener("click",_,!0)}function g(){i.window.addEventListener("click",_,!0),i.window.setTimeout(()=>{i.window.removeEventListener("click",_,!0)},0)}function y(i,r){let n=i.getBoundingClientRect();return b(i,n,r)}function x(i,r){let n=i.getBoundingClientRect(),a=[];for(let o=0;o<r.length;o++)a.push(b(i,n,r[o]));return a}function v(r){return void 0!==i.window.InstallTrigger&&2===r.button&&r.ctrlKey&&i.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:r.button}function b(r,n,a){let o=r.offsetWidth===n.width?1:r.offsetWidth/n.width;return new i.pointGeometry((a.clientX-n.left)*o,(a.clientY-n.top)*o)}function w(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=n*s-o*a;return l?(i[0]=s*(l=1/l),i[1]=-a*l,i[2]=-o*l,i[3]=n*l,i):null}class T extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(let{ids:i,callback:r}of this.requestors)this._notify(i,r);this.requestors=[]}}hasImage(i){return!!this.getImage(i)}getImage(i){return this.images[i]}
8addImage(i,r){this._validate(i,r)&&(this.images[i]=r)}_validate(r,n){let a=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "content" value`))),a=!1),a}_validateStretch(i,r){if(!i)return!0;let n=0;for(let a of i){if(a[0]<n||a[1]<a[0]||r<a[1])return!1;n=a[1]}return!0}_validateContent(i,r){return!(i&&(4!==i.length||i[0]<0||r.data.width<i[0]||i[1]<0||r.data.height<i[1]||i[2]<0||r.data.width<i[2]||i[3]<0||r.data.height<i[3]||i[2]<i[0]||i[3]<i[1]))}updateImage(i,r){r.version=this.images[i].version+1,this.images[i]=r,this.updatedImages[i]=!0}removeImage(i){let r=this.images[i];delete this.images[i],delete this.patterns[i],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(i,r){let n=!0;if(!this.isLoaded())for(let r of i)this.images[r]||(n=!1);this.isLoaded()||n?this._notify(i,r):this.requestors.push({ids:i,callback:r})}_notify(r,n){let a={};for(let n of r){this.images[n]||this.fire(new i.Event("styleimagemissing",{id:n}));let r=this.images[n];r?a[n]={data:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,version:r.version,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,hasRenderCallback:!!(r.userImage&&r.userImage.render)}:i.warnOnce(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,a)}getPixelSize(){let{width:i,height:r}=this.atlasImage;return{width:i,height:r}}getPattern(r){let n=this.patterns[r],a=this.getImage(r);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{let n={w:a.data.width+2,h:a.data.height+2,x:0,y:0},o=new i.ImagePosition(n,a);this.patterns[r]={bin:n,position:o}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){let n=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.Texture(r,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let r=[];for(let i in this.patterns)r.push(this.patterns[i].bin);let{w:n,h:a}=i.potpack(r),o=this.atlasImage;for(let r in o.resize({width:n||1,height:a||1}),this.patterns){let{bin:n}=this.patterns[r],a=n.x+1,s=n.y+1,l=this.images[r].data,h=l.width,u=l.height;i.RGBAImage.copy(l,o,{x:0,y:0},{x:a,y:s},{width:h,height:u}),i.RGBAImage.copy(l,o,{x:0,y:u-1},{x:a,y:s-1},{width:h,height:1}),i.RGBAImage.copy(l,o,{x:0,y:0},{x:a,y:s+u},{width:h,height:1}),i.RGBAImage.copy(l,o,{x:h-1,y:0},{x:a-1,y:s},{width:1,height:u}),i.RGBAImage.copy(l,o,{x:0,y:0},{x:a+h,y:s},{width:1,height:u})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(i){for(let r of i){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let i=this.images[r];(function(i){let{userImage:r}=i;return!!(r&&r.render&&r.render())&&(i.data.replace(new Uint8Array(r.data.buffer)),!0)})(i)&&this.updateImage(r,i)}}}let E=new i.Properties({anchor:new i.DataConstantProperty(i.spec.light.anchor),position:new class{constructor(){this.specification=i.spec.light.position}possiblyEvaluate(r,n){return function([r,n,a]){let o=i.degToRad(n+90),s=i.degToRad(a);return{x:r*Math.cos(o)*Math.sin(s),y:r*Math.sin(o)*Math.sin(s),z:r*Math.cos(s),azimuthal:n,polar:a}}(r.expression.evaluate(n))}interpolate(r,n,a){return{x:i.number(r.x,n.x,a),y:i.number(r.y,n.y,a),z:i.number(r.z,n.z,a),azimuthal:i.number(r.azimuthal,n.azimuthal,a),polar:i.number(r.polar,n.polar,a)}}},color:new i.DataConstantProperty(i.spec.light.color),intensity:new i.DataConstantProperty(i.spec.light.intensity)}),S="-transition";class M extends i.Evented{constructor(r){super(),this._transitionable=new i.Transitionable(E),this.setLight(r),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,n={}
8){if(!this._validate(i.validateLight,r,n))for(let n in r){let a=r[n];i.endsWith(n,S)?this._transitionable.setTransition(n.slice(0,-S.length),a):this._transitionable.setValue(n,a)}}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,n,a){return(!a||!1!==a.validate)&&i.emitValidationErrors(this,r.call(i.validateStyle,i.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}let A=new i.Properties({source:new i.DataConstantProperty(i.spec.terrain.source),exaggeration:new i.DataConstantProperty(i.spec.terrain.exaggeration)}),I="-transition";class C extends i.Evented{constructor(r,n){super(),this._transitionable=new i.Transitionable(A),this.set(r),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=n}get(){return this._transitionable.serialize()}set(r){for(let n in r){let a=r[n];i.endsWith(n,I)?this._transitionable.setTransition(n.slice(0,-I.length),a):this._transitionable.setValue(n,a)}}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}}function z(r,n,a,o){let s=i.smoothstep(45,65,a),[l,h]=k(r,o),u=1-Math.min(1,Math.exp(-((i.length(n)-l)/(h-l)*6)));return u*=u*u,(u=Math.min(1,1.00747*u))*s*r.alpha}function k(i,r){let n=.5/Math.tan(.5*r);return[i.range[0]+n,i.range[1]+n]}let D=new i.Properties({range:new i.DataConstantProperty(i.spec.fog.range),color:new i.DataConstantProperty(i.spec.fog.color),"high-color":new i.DataConstantProperty(i.spec.fog["high-color"]),"space-color":new i.DataConstantProperty(i.spec.fog["space-color"]),"horizon-blend":new i.DataConstantProperty(i.spec.fog["horizon-blend"]),"star-intensity":new i.DataConstantProperty(i.spec.fog["star-intensity"])}),P="-transition";class L extends i.Evented{constructor(r,n){super(),this._transitionable=new i.Transitionable(D),this.set(r),this._transitioning=this._transitionable.untransitioned(),this._transform=n}get state(){let r=this._transform,n="globe"===r.projection.name,a=i.globeToMercatorTransition(r.zoom),o=this.properties.get("range");return{range:n?[i.number(.5,o[0],a),i.number(3,o[1],a)]:o,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,n={}){if(!this._validate(i.validateFog,r,n)){for(let n of Object.keys(i.spec.fog))r&&void 0===r[n]&&(r[n]=i.spec.fog[n].default);for(let n in r){let a=r[n];i.endsWith(n,P)?this._transitionable.setTransition(n.slice(0,-P.length),a):this._transitionable.setValue(n,a)}}}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;let n=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:i.smoothstep(45,65,r))*n.a}getOpacityAtLatLng(r,n){return this._transform.projection.supportsFog?function(r,n,a){let o=i.MercatorCoordinate.fromLngLat(n),s=a.elevation?a.elevation.getAtPointOrZero(o):0,l=[o.x,o.y,s];return i.transformMat4(l,l,a.mercatorFogMatrix),z(r,l,a.pitch,a._fov)}(this.state,r,n):0}getFovAdjustedRange(i){return this._transform.projection.supportsFog?k(this.state,i):[0,1]}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,n,a){return(!a||!1!==a.validate)&&i.emitValidationErrors(this,r.call(i.validateStyle,i.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}class R{constructor(r,n){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=i.uniqueId();let a=this.workerPool.acquire(this.id);for(let i=0;i<a.length;i++){let r=new R.Actor(a[i],n,this.id);r.name=`Worker ${i}`,this.actors.push(r)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,n,a){i.asyncAll(this.actors,(i,a)=>{i.send(r,n,a)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}
8remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}function B(r,n,a){return i.EXTENT/(r.tileSize*Math.pow(2,a-r.tileID.overscaledZ))*n}R.Actor=i.Actor;class O{constructor(i,r,n,a){this.screenBounds=i,this.cameraPoint=r,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(r,n){let a,o;if(r instanceof i.pointGeometry||"number"==typeof r[0]){let s=i.pointGeometry.convert(r);a=[s],o=n.isPointAboveHorizon(s)}else{let s=i.pointGeometry.convert(r[0]),l=i.pointGeometry.convert(r[1]);a=[s,l],o=i.polygonizeBounds(s,l).every(i=>n.isPointAboveHorizon(i))}return new O(a,n.getCameraPoint(),o,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){let n=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],o=i.polygonizeBounds(n,a,0,!1);return this.cameraPoint.y>a.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<a.x?o.splice(3,0,this.cameraPoint):this.cameraPoint.x>=a.x?o[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(o[3]=this.cameraPoint)),i.bufferConvexPolygon(o,r)}bufferedCameraGeometryGlobe(r){let n=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],o=i.polygonizeBounds(n,a,r),s=this.cameraPoint.clone();switch(3*((s.y>n.y)+(s.y>a.y))+((s.x>n.x)+(s.x>a.x))){case 0:o[0]=s,o[4]=s.clone();break;case 1:o.splice(1,0,s);break;case 2:o[1]=s;break;case 3:o.splice(4,0,s);break;case 5:o.splice(2,0,s);break;case 6:o[3]=s;break;case 7:o.splice(3,0,s);break;case 8:o[2]=s}return o}containsTile(r,n,a,o=0){var s;let l=r.queryPadding/n._pixelsPerMercatorPixel+1,h=a?this._bufferedCameraMercator(l,n):this._bufferedScreenMercator(l,n),u=r.tileID.wrap+(h.unwrapped?o:0),c=h.polygon.map(n=>i.getTilePoint(r.tileTransform,n,u));if(!i.polygonIntersectsBox(c,0,0,i.EXTENT,i.EXTENT))return;u=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?o:0);let d=this.screenGeometryMercator.polygon.map(n=>i.getTileVec3(r.tileTransform,n,u)),p=d.map(r=>new i.pointGeometry(r[0],r[1])),f=n.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),m=i.getTileVec3(r.tileTransform,f,u),_=d.map(r=>{let n=i.sub(r,r,m);return i.normalize(n,n),new i.Ray(m,n)}),g=B(r,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:p,tilespaceRays:_,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.getBounds(c)).min.x=i.clamp(s.min.x,0,i.EXTENT),s.min.y=i.clamp(s.min.y,0,i.EXTENT),s.max.x=i.clamp(s.max.x,0,i.EXTENT),s.max.y=i.clamp(s.max.y,0,i.EXTENT),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:g}}_bufferedScreenMercator(i,r){let n=100*i|0;if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{let a;return a="globe"===r.projection.name?this._projectAndResample(this.bufferedScreenGeometry(i),r):{polygon:this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._screenRaycastCache[n]=a,a}}_bufferedCameraMercator(i,r){let n=100*i|0;if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{let a;return a="globe"===r.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(i),r):{polygon:this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._cameraRaycastCache[n]=a,a}}_projectAndResample(r,n){let a=function(r,n){let a=i.multiply([],n.pixelMatrix,n.globeMatrix),o=[0,-i.GLOBE_RADIUS,0,1],s=[0,i.GLOBE_RADIUS,0,1],l=[0,0,0,1];i.transformMat4$1(o,o,a),i.transformMat4$1(s,s,a),i.transformMat4$1(l,l,a);let h=new i.pointGeometry(o[0]/o[3],o[1]/o[3]),u=new i.pointGeometry(s[0]/s[3],s[1]/s[3]),c=i.polygonContainsPoint(r,h)&&o[3]<l[3],d=i.polygonContainsPoint(r,u)&&s[3]<l[3];if(!c&&!d)return null;let p=function(i,r,n){for(let a=1;a<i.length;a++){let o=U(r.pointCoordinate3D(i[a-1]).x),s=U(r.pointCoordinate3D(i[a]).x);if(n<0){if(o<s)return{idx:a,t:-o/(s-1-o)}}else if(s<o)return{idx:a,t:(1-o)/(s+1-o)}}return null}(r,n,c?-1:1);if(!p)return null;let{idx:f,t:m}=p,_=f>1?F(r.slice(0,f),n):[],g=f<r.length?F(r.slice(f),n):[];_=_.map(r=>new i.pointGeometry(U(r.x),r.y)),g=g.map(r=>new i.pointGeometry(U(r.x),r.y));let y=[..._];0===y.length&&y.push(g[g.length-1]);let x=i.number(y[y.length-1].y,(0===g.length?_[0]:g[0]).y,m);return y.push(...c?[new i.pointGeometry(0,x),new i.pointGeometry(0,0),new i.pointGeometry(1,0),new i.pointGeometry(1,x)]:[new i.pointGeometry(1,x),new i.pointGeometry(1,1),new i.pointGeometry(0,1),new i.pointGeometry(0,x)]),0===g.length?y.push(_[0]):y.push(...g),{polygon:y.map(r=>new i.MercatorCoordinate(r.x,r.y)),unwrapped:!1}}(r,n);if(a)return a;let o=function(r,n){let a=!1,o=-1/0,s=0;for(let i=0;i<r.length-1;i++)r[i].x>o&&(o=r[i].x,s=i);for(let i=0;i<r.length-1;i++){let n=(s+i)%(r.length-1),o=r[n],l=r[n+1];Math.abs(o.x-l.x)>.5&&(o.x<l.x?(o.x+=1,0===n&&(r[r.length-1].x+=1)):(l.x+=1,n+1===r.length-1&&(r[0].x+=1)),a=!0)}let l=i.mercatorXfromLng(n.center.lng);return a&&l<Math.abs(l-1)&&r.forEach(i=>
8{i.x-=1}),{polygon:r,unwrapped:a}}(F(r,n).map(r=>new i.pointGeometry(U(r.x),r.y)),n);return{polygon:o.polygon.map(r=>new i.MercatorCoordinate(r.x,r.y)),unwrapped:o.unwrapped}}}function F(r,n){return i.resample(r,i=>{let r=n.pointCoordinate3D(i);i.x=r.x,i.y=r.y},1/256)}function U(i){return i<0?1+i%1:i%1}function V(r,n,a,o,s){let l=function(a,o){if(a)return s(a);if(o){r.url&&o.tiles&&r.tiles&&delete r.tiles;let a=i.pick(i.extend(o,r),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map(i=>i.id)),a.tiles=n.canonicalizeTileset(a,r.url),s(null,a)}};return r.url?i.getJSON(n.transformRequest(n.normalizeSourceURL(r.url,null,a,o),i.ResourceType.Source),l):i.exported.frame(()=>l(null,r))}class N{constructor(r,n,a){this.bounds=i.LngLatBounds.convert(this.validateBounds(r)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}contains(r){let n=Math.pow(2,r.z),a=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*n),o=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*n),s=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*n),l=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*n);return r.x>=a&&r.x<s&&r.y>=o&&r.y<l}}class j{constructor(i,r,n){this.context=i;let a=i.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||r.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){let r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let G={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Z{constructor(i,r,n,a){this.length=r.length,this.attributes=n,this.itemSize=r.bytesPerElement,this.dynamicDraw=a,this.context=i;let o=i.gl;this.buffer=o.createBuffer(),i.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||r.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let n=0;n<this.attributes.length;n++){let a=r.attributes[this.attributes[n].name];void 0!==a&&i.enableVertexAttribArray(a)}}setVertexAttribPointers(i,r,n){for(let a=0;a<this.attributes.length;a++){let o=this.attributes[a],s=r.attributes[o.name];void 0!==s&&i.vertexAttribPointer(s,o.components,i[G[o.type]],!1,this.itemSize,o.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ${constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class q extends ${getDefault(){return i.Color.transparent}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class W extends ${getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class X extends ${getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class H extends ${getDefault(){return[!0,!0,!0,!0]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Y extends ${getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class K extends ${getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class J extends ${getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let r=this.current;(i.func!==r.func||i.ref!==r.ref||i.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class Q extends ${getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class ee extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=i,this.dirty=!1}}class et extends ${getDefault(){return[0,1]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class ei extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=i,this.dirty=!1}}class er extends ${getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class en extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.BLEND):r.disable(r.BLEND),this.current=i,this.dirty=!1}}class ea extends ${getDefault(){let i=this.gl;return[i.ONE,i.ZERO]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||this.dirty)&&(this.gl.blendFunc(i[0],i[1]),this.current=i,this.dirty=!1)}}class eo extends ${getDefault(){return i.Color.transparent}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.blendColor
8(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class es extends ${getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquation(i),this.current=i,this.dirty=!1)}}class el extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=i,this.dirty=!1}}class eh extends ${getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class eu extends ${getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class ec extends ${getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class ed extends ${getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class ep extends ${getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class ef extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class em extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class e_ extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class eg extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class ey extends ${getDefault(){return null}set(i){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class ex extends ${constructor(i){super(i),this.vao=i.extVertexArrayObject}getDefault(){return null}set(i){this.vao&&(i!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(i),this.current=i,this.dirty=!1)}}class ev extends ${getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class eb extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class ew extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class eT extends ${constructor(i,r){super(i),this.context=i,this.parent=r}getDefault(){return null}}class eE extends eT{setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class eS extends eT{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,this.attachment(),r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class eM extends eS{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class eA{constructor(i,r,n,a){this.context=i,this.width=r,this.height=n;let o=this.framebuffer=i.gl.createFramebuffer();this.colorAttachment=new eE(i,o),a&&(this.depthAttachment=new eS(i,o))}destroy(){let i=this.context.gl,r=this.colorAttachment.get();if(r&&i.deleteTexture(r),this.depthAttachment){let r=this.depthAttachment.get();r&&i.deleteRenderbuffer(r)}i.deleteFramebuffer(this.framebuffer)}}class eI{constructor(i,r=!1){this.gl=i,this.isWebGL2=r,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),r&&(this.extVertexArrayObject={createVertexArrayOES:i.createVertexArray.bind(i),deleteVertexArrayOES:i.deleteVertexArray.bind(i),bindVertexArrayOES:i.bindVertexArray.bind(i)}),this.clearColor=new q(this),this.clearDepth=new W(this),this.clearStencil=new X(this),this.colorMask=new H(this),this.depthMask=new Y(this),this.stencilMask=new K(this),this.stencilFunc=new J(this),this.stencilOp=new Q(this),this.stencilTest=new ee(this),this.depthRange=new et(this),this.depthTest=new ei(this),this.depthFunc=new er(this),this.blend=new en(this),this.blendFunc=new ea(this),this.blendColor=new eo(this),this.blendEquation=new es(this),this.cullFace=new el(this),this.cullFaceSide=new eh(this),this.frontFace=new eu(this),this.program=new ec(this),this.activeTexture=new ed(this),this.viewport=new ep(this),this.bindFramebuffer=new ef(this),this.bindRenderbuffer=new em(this),this.bindTexture=new e_(this),this.bindVertexBuffer=new eg(this),this.bindElementBuffer=new ey(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ex(this),this.pixelStoreUnpack=new ev(this),this.pixelStoreUnpackPremultiplyAlpha=new eb(this),this.pixelStoreUnpackFlipY=new ew(this),this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extDebugRendererInfo=i.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=i.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=i.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),r||(this.extTextureHalfFloat=i.getExtension("OES_texture_half_float")),(r||this.extTextureHalfFloat&&i.getExtension("OES_texture_half_float_linear"))&&(this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=r||i.getExtension("OES_standard_derivatives"),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=i.getParameter(i.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(i,r){return new j(this,i,r)}createVertexBuffer(i,r,n){return new Z(this,i,r,n)}createRenderbuffer(i,r,n){let a=this.gl,o=a.createRenderbuffer();return this.bindRenderbuffer.set(o),a.renderbufferStorage(a.RENDERBUFFER,i,r,n),this.bindRenderbuffer.set(null),o}createFramebuffer(i,r,n){return new eA(this,i,r,n)}clear({color:i,depth:r,stencil:n}){let a=this.gl,o=0;
8i&&(o|=a.COLOR_BUFFER_BIT,this.clearColor.set(i),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(o|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==n&&(o|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),a.clear(o)}setCullFace(i){!1===i.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(r){s(r.blendFunction,i.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor)),this.colorMask.set(r.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class eC extends i.Evented{constructor(r,n,a,o){if(super(),this.id=r,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(n,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(r){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"}));let n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=V(this._options,this.map._requestManager,n,a,(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),a&&2!==a.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new i.ErrorEvent(o))):s&&(i.extend(this,s),s.bounds&&(this.tileBounds=new N(s.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)})}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>this.map.style._clearSource(this.id))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return i.extend({},this._options)}loadTile(r,n){let a=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),o={request:this.map._requestManager.transformRequest(a,i.ResourceType.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile};if(o.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=n:r.request=r.actor.send("reloadTile",o,s.bind(this));else if(r.actor=this._tileWorkers[a]=this._tileWorkers[a]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",o,s.bind(this),void 0,!0);else{let n=i.loadVectorTile.call({deduped:this._deduped},o,(i,n)=>{i||!n?s.call(this,i):(o.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},r.actor&&r.actor.send("loadTile",o,s.bind(this),void 0,!0))},!0);r.request={cancel:n}}function s(a,o){return delete r.request,r.aborted?n(null):a&&404!==a.status?n(a):(o&&o.resourceTiming&&(r.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&o&&r.setExpiryData(o),r.loadVectorData(o,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.t
8ype,source:this.id})}unloadTile(i){i.unloadVectorData(),i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ez extends i.Evented{constructor(r,n,a,o){super(),this.id=r,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.extend({type:"raster"},n),i.extend(this,i.pick(n,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=V(this._options,this.map._requestManager,null,null,(n,a)=>{this._tileJSONRequest=null,this._loaded=!0,n?this.fire(new i.ErrorEvent(n)):a&&(i.extend(this,a),a.bounds&&(this.tileBounds=new N(a.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(a.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))),r&&r(n)})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>this.map.style._clearSource(this.id))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return i.extend({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){let a=i.exported.devicePixelRatio>=2,o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),a,this.tileSize);r.request=i.getImage(this.map._requestManager.transformRequest(o,i.ResourceType.Tile),(a,o,s,l)=>(delete r.request,r.aborted?(r.state="unloaded",n(null)):a?(r.state="errored",n(a)):o?(this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:s,expires:l}),r.setTexture(o,this.map.painter),r.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),void n(null)):n(null)))}static loadTileData(i,r,n){i.setTexture(r,n)}static unloadTileData(i,r){i.texture&&r.saveTileTexture(i.texture)}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r()}unloadTile(i,r){i.texture&&this.map.painter.saveTileTexture(i.texture),r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function ek(r,n,a,o,s,l,h,u){let c=[r,a,s,n,o,l,1,1,1],d=[h,u,1],p=i.adjoint([],c),[f,m,_]=i.transformMat3(d,d,i.transpose(p,p));return i.multiply$1(c,[f,0,0,0,m,0,0,0,_],c)}class eD extends i.Evented{constructor(i,r,n,a){super(),this.id=i,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=r,this._dirty=!1}load(r,n){this._loaded=n||!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(n,a)=>{if(this._imageRequest=null,this._loaded=!0,n)this.fire(new i.ErrorEvent(n));else if(a){let{HTMLImageElement:n}=i.window;this.image=a instanceof n?i.exported.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),this._finishLoading()}})}loaded(){return this._loaded}updateImage(i){return this.image&&i.url&&(this._imageRequest&&i.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=i.url,this.load(i.coordinates,this._loaded)),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(r){this.coordinates=r,this._boundsArray=void 0;let n=r.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(r){let n=1/0,a=1/0,o=-1/0,s=-1/0;for(let i of r)n=Math.min(n,i.x),a=Math.min(a,i.y),o=Math.max(o,i.x),s=Math.max(s,i.y);let l=Math.max(0,Math.floor(-Math.log(Math.max(o-n,s-a))/Math.LN2)),h=Math.pow(2,l);return new i.CanonicalTileID(l,Math.floor((n+o)/2*h),Math.floor((a+s)/2*h))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(r){for(let i in this.tiles){let r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(this._boundsArray)return;let n=i.tileTransform(this.tileID,this.map.transform.projection),[a,o,s,l]=this.coordinates.map(r=>{let a=n.projection.project(r[0],r[1]);return i.getTilePoint(n,a)._round()});this.perspectiveTransform=function(r,n,a,o,s,l,h,u,c,d){let p=ek(0,0,r,0,0,n,r,n),f=ek(a,o,s,l,h,u,c,d);return i.multiply$1(f,i.adjoint(p,p),f),[f[6]/f[8]*r/i.EXTENT,f[7]/f[8]*n/i.EXTENT]}(this.width,this.height,a.x,a.y,o.x,o.y,l.x,l.y,s.x,s.y);let h=this._boundsArray=new i.StructArrayLayout4i8;h.emplaceBack(a.x,a.y,0,0),h.emplaceBack(o.x,o.y,i.EXTENT,0),h.emplaceBack(l.x,l.y,0,i.EXTENT),h.emplaceBack(s.x,s.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=r.createVertexBuffer(h,i.boundsAttributes.members),this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let r=this.map.painter.context,n=r.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new i.Texture(r,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(r)}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={}):i.state="errored",r(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}let eP={vector:eC,raster:ez,"raster-dem":class extends ez{constructor(r,n,a,o){super(r,n,a,o),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(r,a){let o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);
vendor: 4,538 bytes, line 8
8function s(i,n){i&&(r.state="errored",a(i)),n&&(r.dem=n,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0,r.state="loaded",a(null))}r.request=i.getImage(this.map._requestManager.transformRequest(o,i.ResourceType.Tile),(function(o,l,h,u){if(delete r.request,r.aborted)r.state="unloaded",a(null);else if(o)r.state="errored",a(o);else if(l){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:h,expires:u});let a=i.window.ImageBitmap&&l instanceof i.window.ImageBitmap&&(null==n&&(n=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof i.window.createImageBitmap),n),o=1-(l.width-i.prevPowerOfTwo(l.width))/2;o<1||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID));let c=a?l:i.exported.getImageData(l,o),d={uid:r.uid,coord:r.tileID,source:this.id,rawImageData:c,encoding:this.encoding,padding:o};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.actor.send("loadDEMTile",d,s.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(r){let n=r.canonical,a=Math.pow(2,n.z),o=(n.x-1+a)%a,s=0===n.x?r.wrap-1:r.wrap,l=(n.x+1+a)%a,h=n.x+1===a?r.wrap+1:r.wrap,u={};return u[new i.OverscaledTileID(r.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,h,n.z,l,n.y).key]={backfilled:!1},n.y>0&&(u[new i.OverscaledTileID(r.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,h,n.z,l,n.y-1).key]={backfilled:!1}),n.y+1<a&&(u[new i.OverscaledTileID(r.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,h,n.z,l,n.y+1).key]={backfilled:!1}),u}unloadTile(i){i.demTexture&&this.map.painter.saveTileTexture(i.demTexture),i.fbo&&(i.fbo.destroy(),delete i.fbo),i.dem&&delete i.dem,delete i.neighboringTiles,i.state="unloaded"}},geojson:class extends i.Evented{constructor(r,n,a,o){super(),this.id=r,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(o),this._data=n.data,this._options=i.extend({},n),this._collectResourceTiming=n.collectResourceTiming,void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let s=i.EXTENT/this.tileSize;this.workerOptions=i.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*s,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*s,extent:i.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:i.EXTENT,radius:(void 0!==n.clusterRadius?n.clusterRadius:50)*s,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}onAdd(i){this.map=i,this.setData(this._data)}setData(i){return this._data=i,this._updateWorkerData(),this}getClusterExpansionZoom(i,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:i,source:this.id},r),this}getClusterChildren(i,r){return this.actor.send("geojson.getClusterChildren",{clusterId:i,source:this.id},r),this}getClusterLeaves(i,r,n,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:i,limit:r,offset:n},a),this}_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.Event("dataloading",{dataType:"source"})),this._loaded=!1;let r=i.extend({},this.workerOptions),n=this._data;"string"==typeof n?(r.request=this.map._requestManager.transformRequest(i.exported.resolveURL(n),i.ResourceType.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(r,n)=>{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new i.ErrorEvent(r));else{let r={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(r.resourceTiming=n.resourceTiming[this.id]),this.fire(new i.Event("data",r)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(r,n){let a=r.actor?"reloadTile":"loadTile";
8r.actor=this.actor,r.request=this.actor.send(a,{type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(i,o)=>(delete r.request,r.unloadVectorData(),r.aborted?n(null):i?n(i):(r.loadVectorData(o,this.map.painter,"reloadTile"===a),n(null))),void 0,"loadTile"===a)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i){i.unloadVectorData(),this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends eD{constructor(i,r,n,a){super(i,r,n,a),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;let r=this.options;for(let n of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(n,i.ResourceType.Source).url);i.getVideo(this.urls,(r,n)=>{this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(this.video=n,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(r){if(this.video){let n=this.video.seekable;r<n.start(0)||r>n.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}
8onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let r=this.map.painter.context,n=r.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(r,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(r)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:eD,canvas:class extends eD{constructor(r,n,a,o){super(r,n,a,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,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 i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(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(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let n=this.map.painter.context;this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(n,this.canvas,n.gl.RGBA,{premultiply:!0}),this._prepareData(n)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}},custom:class extends i.Evented{constructor(r,n,a,o){super(),this.id=r,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=n,this.setEventedParent(o),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.ErrorEvent(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.ErrorEvent(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new N(this._implementation.bounds,this.minzoom,this.maxzoom)),n.update=this._update.bind(this),n.clearTiles=this._clearTiles.bind(this),n.coveringTiles=this._coveringTiles.bind(this),i.extend(this,i.pick(n,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(r){this._map=r,this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(r),this.load()}onRemove(i){this._implementation.onRemove&&this._implementation.onRemove(i)}hasTile(i){if(this._implementation.hasTile){let{x:r,y:n,z:a}=i.canonical;return this._implementation.hasTile({x:r,y:n,z:a})}
8return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){let{x:a,y:o,z:s}=r.tileID.canonical,l=new i.window.AbortController;r.request=Promise.resolve(this._implementation.loadTile({x:a,y:o,z:s},{signal:l.signal})).then((function(a){return delete r.request,r.aborted?(r.state="unloaded",n(null)):void 0===a?(r.state="errored",n(null)):null===a?(this.loadTileData(r,{width:this.tileSize,height:this.tileSize,data:null}),r.state="loaded",n(null)):a instanceof i.window.ImageData||a instanceof i.window.HTMLCanvasElement||a instanceof i.window.ImageBitmap||a instanceof i.window.HTMLImageElement?(this.loadTileData(r,a),r.state="loaded",void n(null)):(r.state="errored",n(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(i=>{20!==i.code&&(r.state="errored",n(i))}),r.request.cancel=()=>l.abort()}loadTileData(i,r){ez.loadTileData(i,r,this._map.painter)}unloadTileData(i){ez.unloadTileData(i,this._map.painter)}unloadTile(i,r){if(this.unloadTileData(i),this._implementation.unloadTile){let{x:r,y:n,z:a}=i.tileID.canonical;this._implementation.unloadTile({x:r,y:n,z:a})}r()}abortTile(i,r){i.request&&i.request.cancel&&(i.request.cancel(),delete i.request),r()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(i=>({x:i.canonical.x,y:i.canonical.y,z:i.canonical.z}))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}}},eL=function(r,n,a,o){let s=new eP[n.type](r,n,a,o);if(s.id!==r)throw Error(`Expected Source id to be ${r} instead of ${s.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],s),s};function eR(i,r){let n=i.tileID,a=r.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function eB(){return null!=r8.workerClass?new r8.workerClass:new i.window.Worker(r8.workerUrl)}let eO="mapboxgl_preloaded_worker_pool";class eF{constructor(){this.active={}}acquire(i){if(!this.workers)for(this.workers=[];this.workers.length<eF.workerCount;)this.workers.push(new eB);return this.active[i]=!0,this.workers.slice()}release(i){delete this.active[i],0===this.numActive()&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[eO]}numActive(){return Object.keys(this.active).length}}function eU(){return a||(a=new eF),a}function eV(r){r=r.slice();let n=Object.create(null);for(let i=0;i<r.length;i++)n[r[i].id]=r[i];for(let a=0;a<r.length;a++)"ref"in r[a]&&(r[a]=function(r,n){let a={};for(let i in r)"ref"!==i&&(a[i]=r[i]);return i.refProperties.forEach(i=>{i in n&&(a[i]=n[i])}),a}(r[a],n[r[a].ref]));return r}eF.workerCount=2;let eN={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 ej(i,r,n){n.push({command:eN.addSource,args:[i,r[i]]})}function eG(i,r,n){r.push({command:eN.removeSource,args:[i]}),n[i]=!0}function eZ(i,r,n,a,o,l){let h;for(h in r=r||{},i=i||{})i.hasOwnProperty(h)&&(s(i[h],r[h])||n.push({command:l,args:[a,h,r[h],o]}));for(h in r)r.hasOwnProperty(h)&&!i.hasOwnProperty(h)&&(s(i[h],r[h])||n.push({command:l,args:[a,h,r[h],o]}))}function e$(i){return i.id}function eq(i,r){return i[r.id]=r,i}class eW{constructor(i,r){this.reset(i,r)}reset(i,r){this.points=i||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(1===this.points.length)return this.points[0];r=i.clamp(r,0,1);let n=1,a=this._distances[n],o=r*this.paddedLength+this.padding;
8for(;a<o&&n<this._distances.length;)a=this._distances[++n];let s=n-1,l=this._distances[s],h=a-l,u=h>0?(o-l)/h:0;return this.points[s].mult(1-u).add(this.points[n].mult(u))}}class eX{constructor(i,r,n){let a=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(i/n),this.yCellCount=Math.ceil(r/n);for(let i=0;i<this.xCellCount*this.yCellCount;i++)a.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=i,this.height=r,this.xScale=this.xCellCount/i,this.yScale=this.yCellCount/r,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(i,r,n,a,o){this._forEachCell(r,n,a,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(o)}insertCircle(i,r,n,a){this._forEachCell(r-a,n-a,r+a,n+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(i),this.circles.push(r),this.circles.push(n),this.circles.push(a)}_insertBoxCell(i,r,n,a,o,s){this.boxCells[o].push(s)}_insertCircleCell(i,r,n,a,o,s){this.circleCells[o].push(s)}_query(i,r,n,a,o,s){if(n<0||i>this.width||a<0||r>this.height)return!o&&[];let l=[];if(i<=0&&r<=0&&this.width<=n&&this.height<=a){if(o)return!0;for(let i=0;i<this.boxKeys.length;i++)l.push({key:this.boxKeys[i],x1:this.bboxes[4*i],y1:this.bboxes[4*i+1],x2:this.bboxes[4*i+2],y2:this.bboxes[4*i+3]});for(let i=0;i<this.circleKeys.length;i++){let r=this.circles[3*i],n=this.circles[3*i+1],a=this.circles[3*i+2];l.push({key:this.circleKeys[i],x1:r-a,y1:n-a,x2:r+a,y2:n+a})}return s?l.filter(s):l}return this._forEachCell(i,r,n,a,this._queryCell,l,{hitTest:o,seenUids:{box:{},circle:{}}},s),o?l.length>0:l}_queryCircle(i,r,n,a,o){let s=i-n,l=i+n,h=r-n,u=r+n;if(l<0||s>this.width||u<0||h>this.height)return!a&&[];let c=[];return this._forEachCell(s,h,l,u,this._queryCellCircle,c,{hitTest:a,circle:{x:i,y:r,radius:n},seenUids:{box:{},circle:{}}},o),a?c.length>0:c}query(i,r,n,a,o){return this._query(i,r,n,a,!1,o)}hitTest(i,r,n,a,o){return this._query(i,r,n,a,!0,o)}hitTestCircle(i,r,n,a){return this._queryCircle(i,r,n,!0,a)}_queryCell(i,r,n,a,o,s,l,h){let u=l.seenUids,c=this.boxCells[o];if(null!==c){let o=this.bboxes;for(let d of c)if(!u.box[d]){u.box[d]=!0;let c=4*d;if(i<=o[c+2]&&r<=o[c+3]&&n>=o[c+0]&&a>=o[c+1]&&(!h||h(this.boxKeys[d]))){if(l.hitTest)return s.push(!0),!0;s.push({key:this.boxKeys[d],x1:o[c],y1:o[c+1],x2:o[c+2],y2:o[c+3]})}}}let d=this.circleCells[o];if(null!==d){let o=this.circles;for(let c of d)if(!u.circle[c]){u.circle[c]=!0;let d=3*c;if(this._circleAndRectCollide(o[d],o[d+1],o[d+2],i,r,n,a)&&(!h||h(this.circleKeys[c]))){if(l.hitTest)return s.push(!0),!0;{let i=o[d],r=o[d+1],n=o[d+2];s.push({key:this.circleKeys[c],x1:i-n,y1:r-n,x2:i+n,y2:r+n})}}}}}_queryCellCircle(i,r,n,a,o,s,l,h){let u=l.circle,c=l.seenUids,d=this.boxCells[o];if(null!==d){let i=this.bboxes;for(let r of d)if(!c.box[r]){c.box[r]=!0;let n=4*r;if(this._circleAndRectCollide(u.x,u.y,u.radius,i[n+0],i[n+1],i[n+2],i[n+3])&&(!h||h(this.boxKeys[r])))return s.push(!0),!0}}let p=this.circleCells[o];if(null!==p){let i=this.circles;for(let r of p)if(!c.circle[r]){c.circle[r]=!0;let n=3*r;if(this._circlesCollide(i[n],i[n+1],i[n+2],u.x,u.y,u.radius)&&(!h||h(this.circleKeys[r])))return s.push(!0),!0}}}_forEachCell(i,r,n,a,o,s,l,h){let u=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r),d=this._convertToXCellCoord(n),p=this._convertToYCellCoord(a);for(let f=u;f<=d;f++)for(let u=c;u<=p;u++)if(o.call(this,i,r,n,a,this.xCellCount*u+f,s,l,h))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,r,n,a,o,s){let l=a-i,h=o-r,u=n+s;return u*u>l*l+h*h}_circleAndRectCollide(i,r,n,a,o,s,l){let h=(s-a)/2,u=Math.abs(i-(a+h));if(u>h+n)return!1;let c=(l-o)/2,d=Math.abs(r-(o+c));if(d>c+n)return!1;if(u<=h||d<=c)return!0;let p=u-h,f=d-c;return p*p+f*f<=n*n}}let eH=Math.tan(85*Math.PI/180);function eY(r,n,a,o,s,l,h){let u=i.create();if(a){if("globe"===l.name){let r=i.calculateGlobeLabelMatrix(s,n);i.multiply(u,u,r)}else{let r=w([],h);u[0]=r[0],u[1]=r[1],u[4]=r[2],u[5]=r[3],o||i.rotateZ(u,u,s.angle)}}
8else i.multiply(u,s.labelPlaneMatrix,r);return u}function eK(i,r,n,a,o,s,l){let h=eY(i,r,n,a,o,s,l);return"globe"===s.name&&n||(h[2]=h[6]=h[10]=h[14]=0),h}function eJ(r,n,a,o,s,l,h){if(a){if("globe"===l.name){let u=eY(r,n,a,o,s,l,h);return i.invert(u,u),i.multiply(u,r,u),u}{let n=i.clone(r),a=i.identity([]);return a[0]=h[0],a[1]=h[1],a[4]=h[2],a[5]=h[3],i.multiply(n,n,a),o||i.rotateZ(n,n,-s.angle),n}}return s.glCoordMatrix}function eQ(r,n,a,o){let s=[r,n,a,1];a?i.transformMat4$1(s,s,o):e9(s,s,o);let l=s[3];return s[0]/=l,s[1]/=l,s[2]/=l,s}function e0(i,r){return Math.min(.5+i/r*.5,1.5)}function e1(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g){let{lineStartIndex:y,glyphStartIndex:x,segment:v}=h,b=x+h.numGlyphs,w=y+h.lineLength,T=r.getoffsetX(x),E=r.getoffsetX(b-1),S=e6(i*T,n,a,o,s,l,v,y,w,u,c,d,p,f,!0,m,_,g);if(!S)return null;let M=e6(i*E,n,a,o,s,l,v,y,w,u,c,d,p,f,!0,m,_,g);return M?{first:S,last:M}:null}function e2(r,n,a,o){return r===i.WritingMode.horizontal&&Math.abs(o)>Math.abs(a)?{useVertical:!0}:r===i.WritingMode.vertical?o>0?{needsFlipping:!0}:null:0!==n&&(0===a||Math.abs(o/a)>eH)?1===n?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function e3(r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=n/24,T=r.lineOffsetX*w,E=r.lineOffsetY*w,{lineStartIndex:S,glyphStartIndex:M,numGlyphs:A,segment:I,writingMode:C,flipState:z}=r,k=S+r.lineLength,D=r=>{if(p){let[n,a,o]=r.up,s=d.length;i.updateGlobeVertexNormal(p,s+0,n,a,o),i.updateGlobeVertexNormal(p,s+1,n,a,o),i.updateGlobeVertexNormal(p,s+2,n,a,o),i.updateGlobeVertexNormal(p,s+3,n,a,o)}let[n,a,o]=r.point;i.addDynamicAttributes(d,n,a,o,r.angle)};if(A>1){let i=e1(w,u,T,E,a,f,m,r,c,l,_,y,!1,x,v,b);if(!i)return{notEnoughRoom:!0};if(o&&!a){let[n,a,o]=i.first.point,[s,l,u]=i.last.point;[n,a]=eQ(n,a,o,h),[s,l]=eQ(s,l,u,h);let c=e2(C,z,(s-n)*g,l-a);if(r.flipState=c&&c.needsFlipping?1:2,c)return c}D(i.first);for(let i=M+1;i<M+A-1;i++){let r=e6(w*u.getoffsetX(i),T,E,a,f,m,I,S,k,c,l,_,y,!1,!1,x,v,b);if(!r)return d.length-=4*(i-M),{notEnoughRoom:!0};D(r)}D(i.last)}else{if(o&&!a){let n=eQ(m.x,m.y,0,s),a=S+I+1,o=new i.pointGeometry(c.getx(a),c.gety(a)),l=eQ(o.x,o.y,0,s),h=l[3]>0?l:e4(m,o,n,1,s,void 0,x,v.canonical),u=e2(C,z,(h[0]-n[0])*g,h[1]-n[1]);if(r.flipState=u&&u.needsFlipping?1:2,u)return u}let n=e6(w*u.getoffsetX(M),T,E,a,f,m,I,S,k,c,l,_,y,!1,!1,x,v,b);if(!n)return{notEnoughRoom:!0};D(n)}return{}}function e5(i,r,n,a,o){let{x:s,y:l,z:h}=a.projectTilePoint(i.x,i.y,r);if(!o)return eQ(s,l,h,n);let[u,c,d]=o(i);return eQ(s+u,l+c,h+d,n)}function e4(r,n,a,o,s,l,h,u){let c=e5(r.sub(n)._unit()._add(r),u,s,h,l);return i.sub(c,a,c),i.normalize(c,c),i.scaleAndAdd(c,a,c,o)}function e6(r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=o?r-n:r+n,w=b>0?1:-1,T=0;o&&(w*=-1,T=Math.PI),w<0&&(T+=Math.PI);let E=u+h+(w>0?0:1)|0,S=s,M=s,A=0,I=0,C=Math.abs(b),z=[],k=[],D=l,P=D,L=()=>e4(P,D,M,C-A+1,p,m,y,x.canonical);for(;A+I<=C;){if((E+=w)<u||E>=c)return null;if(M=S,P=D,z.push(M),_&&k.push(P),D=new i.pointGeometry(d.getx(E),d.gety(E)),!(S=f[E])){let i=e5(D,x.canonical,p,y,m);S=i[3]>0?f[E]=i:L()}A+=I,I=i.distance(M,S)}g&&m&&(f[E]&&(S=L(),I=i.distance(M,S)),f[E]=S);let R=(C-A)/I,B=D.sub(P)._mult(R)._add(P),O=i.sub([],S,M),F=i.scaleAndAdd([],M,O,R),U=[0,0,1],V=O[0],N=O[1];if(v&&(0!==(U=y.upVector(x.canonical,B.x,B.y))[0]||0!==U[1]||1!==U[2])){let r=[U[2],0,-U[0]],n=i.cross([],U,r);i.normalize(r,r),i.normalize(n,n),V=i.dot(O,r),N=i.dot(O,n)}if(a){let r=i.cross([],U,O);i.normalize(r,r),i.scaleAndAdd(F,F,r,a*w)}let j=T+Math.atan2(N,V);return z.push(F),_&&k.push(B),{point:F,angle:j,path:z,tilePath:k,up:U}}function e8(i,r){let n=r.length,a=n+4*i;r.resize(a),r.float32.fill(-1/0,4*n,4*a)}function e9(i,r,n){let a=r[0],o=r[1];return i[0]=n[0]*a+n[4]*o+n[12],i[1]=n[1]*a+n[5]*o+n[13],i[3]=n[3]*a+n[7]*o+n[15],i}class e7{constructor(i,r,n=new eX(i.width+200,i.height+200,25),a=new eX(i.width+200,i.height+200,25)){this.transform=i,this.grid=n,this.ignoredGrid=a,this.pitchfactor=Math.cos(i._pitch)*i.cameraToCenterDistance,this.screenRightBoundary=i.width+100,this.screenBottomBoundary=i.height+100,this.gridRightBoundary=i.width+200,this.gridBottomBoundary=i.height+200,this.fogState=r}placeCollisionBox(i,r,n,a,o,s,l,h){let u=n.projectedAnchorX,c=n.projectedAnchorY,d=n.projectedAnchorZ,p=n.elevation,f=n.tileID,m=i.getProjection();if(p&&f){let[i,r,a]=m.upVector(f.canonical,n.tileAnchorX,n.tileAnchorY),o=m.upVectorScale(f.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;u+=i*p*o,c+=r*p*o,d+=a*p*o}let _=this.projectAndGetPerspectiveRatio(l,u,c,d,n.tileID,"globe"===m.name||!!p||this.transform.pitch>0,m),g=s*_.perspectiveRatio,y=(n.x1*r+a.x-n.padding)*g+_.point.x,x=(n.y1*r+a.y-n.padding)*g+_.point.y,v=(n.x2*r+a.x+n.padding)*g+_.point.x,b=(n.y2*r+a.y+n.padding)*g+_.point.y,w=_.perspectiveRatio<=.55||_.occluded;return!this.isInsideGrid(y,x,v,b)||!o&&this.grid.hitTest(y,x,v,b,h)||w?{box:[],offscreen:!1,occluded:_.occluded}:{box:[y,x,v,b],offscreen:this.isOffscreen(y,x,v,b),occluded:!1}}placeCollisionCircles(r,n,a,o,s,l,h,u,c,d,p,f,m,_,g){let y=[],x=this.transform.elevation,v=r.getProjection(),b=x?x.getAtTileOffsetFunc(g,this.transform.center.lat,this.transform.worldSize,v):null,w=new i.pointGeometry(a.tileAnchorX,a.tileAnchorY),{x:T,y:E,z:S}=v.projectTilePoint(w.x,w.y,g.canonical);if(b){let[i,r,n]=b(w);T+=i,E+=r,S+=n}let M="globe"===v.name,A=this.projectAndGetPerspectiveRatio(h,T,E,S,g,M||!!x||this.transform.pitch>0,v),{perspectiveRatio:I}=A,C=(p?l/I:l*I)/i.ONE_EM,z=eQ(T,E,S,u),k=A.signedDistanceFromCamera>0?e1(C,s,a.lineOffsetX*C,a.lineOffsetY*C,!1,z,w,a,o,u,{},x&&!p?b:null,p&&!!x,v,g,p):null,D=!1,P=!1,L=!0;if(k&&!A.occluded){let r=.5*m*I+_,a=new i.pointGeometry(-100,-100),o=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),s=new eW,{first:l,last:h}=k,u=l.path.length,p=[];for(let i=u-1;i>=1;i--)p.push(l.path[i]);for(let i=1;i<h.path.length;i++)p.push(h.path[i]);let g=2.5*r;c&&(p=p.map(([i,r,n],a)=>(b&&!M&&(n=b(a<u-1?l.tilePath[u-1-a]:h.tilePath[a-u+2])[2]),eQ(i,r,n,c)))).some(i=>i[3]<=0)&&(p=[]);let x=[];if(p.length>0){let r=1/0,n=-1/0,s=1/0,l=-1/0;for(let i of p)r=Math.min(r,i[0]),s=Math.min(s,i[1]),n=Math.max(n,i[0]),l=Math.max(l,i[1]);n>=a.x&&r<=o.x&&l>=a.y&&s<=o.y&&(x=[p.map(r=>new i.pointGeometry(r[0],r[1]))],(r<a.x||n>o.x||s<a.y||l>o.y)&&(x=i.clipLine(x,a.x,a.y,o.x,o.y)))}for(let i of x){s.reset(i,.25*r);let a=0;a=s.length<=.5*r?1:Math.ceil(s.paddedLength/g)+1;for(let i=0;i<a;i++){let o=i/Math.max(a-1,1),l=s.lerp(o),h=l.x+100,u=l.y+100;y.push(h,u,r,0);let c=h-r,p=u-r,m=h+r,_=u+r;if(L=L&&this.isOffscreen(c,p,m,_),P=P||this.isInsideGrid(c,p,m,_),!n&&this.grid.hitTestCircle(h,u,r,f)&&(D=!0,!d))return{circles:[],offscreen:!1,collisionDetected:D,occluded:!1}}}}return{circles:(d||!D)&&P?y:[],offscreen:L,collisionDetected:D,occluded:A.occluded}}queryRenderedSymbols(r){if(0===r.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let n=[],a=1/0,o=1/0,s=-1/0,l=-1/0;for(let h of r){let r=new i.pointGeometry(h.x+100,h.y+100);a=Math.min(a,r.x),o=Math.min(o,r.y),s=Math.max(s,r.x),l=Math.max(l,r.y),n.push(r)}let h=this.grid.query(a,o,s,l).concat(this.ignoredGrid.query(a,o,s,l)),u={},c={};for(let r of h){let a=r.key;if(void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]={}),u[a.bucketInstanceId][a.featureIndex])continue;let o=[new i.pointGeometry(r.x1,r.y1),new i.pointGeometry(r.x2,r.y1),new i.pointGeometry(r.x2,r.y2),new i.pointGeometry(r.x1,r.y2)];i.polygonIntersectsPolygon(n,o)&&(u[a.bucketInstanceId][a.featureIndex]=!0,void 0===c[a.bucketInstanceId]&&(c[a.bucketInstanceId]=[]),c[a.bucketInstanceId].push(a.featureIndex))}return c}insertCollisionBox(i,r,n,a,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:a,collisionGroupID:o},i[0],i[1],i[2],i[3])}insertCollisionCircles(i,r,n,a,o){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:n,featureIndex:a,collisionGroupID:o};for(let r=0;r<i.length;
8r+=4)s.insertCircle(l,i[r],i[r+1],i[r+2])}projectAndGetPerspectiveRatio(r,n,a,o,s,l,h){let u=[n,a,o,1],c=!1;if(o||this.transform.pitch>0){i.transformMat4$1(u,u,r);let l="globe"===h.name;this.fogState&&s&&!l&&(c=function(r,n,a,o,s,l){let h=l.calculateFogTileMatrix(s),u=[n,a,o];return i.transformMat4(u,u,h),z(r,u,l.pitch,l._fov)}(this.fogState,n,a,o,s.toUnwrapped(),this.transform)>.9)}else e9(u,u,r);let d=u[3];return{point:new i.pointGeometry((u[0]/d+1)/2*this.transform.width+100,(-u[1]/d+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(h)/d*.5,1.5),signedDistanceFromCamera:d,occluded:l&&u[2]>d||c}}isOffscreen(i,r,n,a){return n<100||i>=this.screenRightBoundary||a<100||r>this.screenBottomBoundary}isInsideGrid(i,r,n,a){return n>=0&&i<this.gridRightBoundary&&a>=0&&r<this.gridBottomBoundary}getViewportMatrix(){let r=i.identity([]);return i.translate(r,r,[-100,-100,0]),r}}function te(r,n,a){let o=n.createTileMatrix(r,r.worldSize,a.toUnwrapped());return i.multiply(new Float32Array(16),r.projMatrix,o)}function tt(i,r,n){return r.name===n.projection.name?i.projMatrix:te(n,r,i)}class ti{constructor(i,r,n,a){this.opacity=i?Math.max(0,Math.min(1,i.opacity+(i.placed?r:-r))):a&&n?1:0,this.placed=n}isHidden(){return 0===this.opacity&&!this.placed}}class tr{constructor(i,r,n,a,o,s=!1){this.text=new ti(i?i.text:null,r,n,o),this.icon=new ti(i?i.icon:null,r,a,o),this.clipped=s}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class tn{constructor(i,r,n,a=!1){this.text=i,this.icon=r,this.skipFade=n,this.clipped=a}}class ta{constructor(){this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]}}class to{constructor(i,r,n,a,o){this.bucketInstanceId=i,this.featureIndex=r,this.sourceLayerIndex=n,this.bucketIndex=a,this.tileID=o}}class ts{constructor(i){this.crossSourceCollisions=i,this.maxGroupID=0,this.collisionGroups={}}get(i){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[i]){let r=++this.maxGroupID;this.collisionGroups[i]={ID:r,predicate:i=>i.collisionGroupID===r}}return this.collisionGroups[i]}}function tl(r,n,a,o,s){let{horizontalAlign:l,verticalAlign:h}=i.getAnchorAlignment(r),u=i.evaluateVariableOffset(r,o);return new i.pointGeometry(-(l-.5)*n+u[0]*s,-(h-.5)*a+u[1]*s)}function th(r,n,a,o,s){let l=new i.pointGeometry(r,n);return a&&l._rotate(o?s:-s),l}class tu{constructor(i,r,n,a,o){this.transform=i.clone(),this.projection=i.projection.name,this.collisionIndex=new e7(this.transform,o),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new ts(n),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,n,a,o){var s,l,h;let u=a.getBucket(n),c=a.latestFeatureIndex;if(!u||!c||n.id!==u.layerIds[0])return;let d=u.layers[0].layout,p=a.collisionBoxArray,f=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),m=a.tileSize/i.EXTENT,_=a.tileID.toUnwrapped();this.transform.setProjection(u.projection);let g=(s=a.tileID,l=u.getProjection(),h=this.transform,l.name===this.projection?h.calculateProjMatrix(s.toUnwrapped()):te(h,l,s)),y="map"===d.get("text-pitch-alignment"),x="map"===d.get("text-rotation-alignment");n.compileFilter();let v=n.dynamicFilter(),b=n.dynamicFilterNeedsFeature(),w=this.transform.calculatePixelsToTileUnitsMatrix(a),T=eK(g,a.tileID.canonical,y,x,this.transform,u.getProjection(),w),E=null;if(y){let r=eJ(g,a.tileID.canonical,y,x,this.transform,u.getProjection(),w);E=i.multiply([],this.transform.labelPlaneMatrix,r)}let S=null;v&&a.latestFeatureIndex&&(S={unwrappedTileID:_,dynamicFilter:v,dynamicFilterNeedsFeature:b,featureIndex:a.latestFeatureIndex}),this.retainedQueryData[u.bucketInstanceId]=new to(u.bucketInstanceId,c,u.sourceLayerIndex,u.index,a.tileID);let M={bucket:u,layout:d,posMatrix:g,textLabelPlaneMatrix:T,labelToScreenMatrix:E,clippingData:S,scale:f,textPixelRatio:m,holdingForFade:a.holdingForFade(),collisionBoxArray:p,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(u.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(u.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(o)for(let i of u.sortKeyRanges){let{sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:o}=i;r.push({sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:o,parameters:M})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:M})}attemptAnchorPlacement(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x){let{textOffset0:v,textOffset1:b,crossTileID:w}=p,T=[v,b],E=tl(i,n,a,T,o),S=this.collisionIndex.placeCollisionBox(m,o,r,th(E.x,E.y,s,l,this.transform.angle),d,h,u,c.predicate);if(g){let i=m.getSymbolInstanceIconSize(x,this.transform.zoom,p.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(m,i,g,th(E.x,E.y,s,l,this.transform.angle),d,h,u,c.predicate).box.length)return}if(S.box.length>0){let r;return this.prevPlacement&&this.prevPlacement.variableOffsets[w]&&this.prevPlacement.placements[w]&&this.prevPlacement.placements[w].text&&(r=this.prevPlacement.variableOffsets[w].anchor),this.variableOffsets[w]={textOffset:T,width:n,height:a,anchor:i,textScale:o,prevAnchor:r},this.markUsedJustification(m,i,p,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,p),this.placedOrientations[w]=_),{shift:E,placedGlyphBoxes:S}}}placeLayerBucketPart(r,n,a,o){let{bucket:s,layout:l,posMatrix:h,textLabelPlaneMatr
8ix:u,labelToScreenMatrix:c,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:_,partiallyEvaluatedIconSize:g,collisionGroup:y}=r.parameters,x=l.get("text-optional"),v=l.get("icon-optional"),b=l.get("text-allow-overlap"),w=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),M="viewport-y"===l.get("symbol-z-order");this.transform.setProjection(s.projection);let A=b&&(w||!s.hasIconData()||v),I=w&&(b||!s.hasTextData()||x);!s.collisionArrays&&m&&s.deserializeCollisionBoxes(m),a&&o&&s.updateCollisionDebugBuffers(this.transform.zoom,m);let C=(r,o,m)=>{let{crossTileID:M,numVerticalGlyphVertices:C}=r;if(d){let a={zoom:this.transform.zoom,pitch:this.transform.pitch},o=null;if(d.dynamicFilterNeedsFeature){let i=this.retainedQueryData[s.bucketInstanceId];o=d.featureIndex.loadFeature({featureIndex:r.featureIndex,bucketIndex:i.bucketIndex,sourceLayerIndex:i.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(a,o,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new i.pointGeometry(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[M]=new tn(!1,!1,!1,!0),void(n[M]=!0)}if(n[M])return;if(f)return void(this.placements[M]=new tn(!1,!1,!1));let z=!1,k=!1,D=!0,P=!1,L=!1,R=null,B={box:null,offscreen:null,occluded:null},O={box:null,offscreen:null,occluded:null},F=null,U=null,V=null,N=0,j=0,G=0;m.textFeatureIndex?N=m.textFeatureIndex:r.useRuntimeCollisionCircles&&(N=r.featureIndex),m.verticalTextFeatureIndex&&(j=m.verticalTextFeatureIndex);let Z=i=>{i.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;let r=this.transform.elevation;(r||i.elevation)&&(i.elevation=r?r.getAtTileOffset(i.tileID,i.tileAnchorX,i.tileAnchorY):0)},$=m.textBox;if($){Z($);let n=n=>{let a=i.WritingMode.horizontal;if(s.allowVerticalPlacement&&!n&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[M];i&&(this.placedOrientations[M]=i,a=i,this.markUsedOrientation(s,a,r))}return a},a=(r,n)=>{if(s.allowVerticalPlacement&&C>0&&m.verticalTextBox){for(let a of s.writingModes)if(a===i.WritingMode.vertical?O=B=n():B=r(),B&&B.box&&B.box.length)break}else B=r()};if(l.get("text-variable-anchor")){let u=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[M]){let i=this.prevPlacement.variableOffsets[M];u.indexOf(i.anchor)>0&&(u=u.filter(r=>r!==i.anchor)).unshift(i.anchor)}let c=(i,n,a)=>{let l=s.getSymbolInstanceTextSize(_,r,this.transform.zoom,o),c=(i.x2-i.x1)*l+2*i.padding,d=(i.y2-i.y1)*l+2*i.padding,f=S&&!w?n:null;f&&Z(f);let m={box:[],offscreen:!1,occluded:!1},x=b?2*u.length:u.length;for(let n=0;n<x;++n){let x=this.attemptAnchorPlacement(u[n%u.length],i,c,d,l,T,E,p,h,y,n>=u.length,r,o,s,a,f,_,g);if(x&&(m=x.placedGlyphBoxes)&&m.box&&m.box.length){z=!0,R=x.shift;break}}return m};a(()=>c($,m.iconBox,i.WritingMode.horizontal),()=>{let r=m.verticalTextBox;return r&&Z(r),s.allowVerticalPlacement&&!(B&&B.box&&B.box.length)&&C>0&&r?c(r,m.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),B&&(z=B.box,D=B.offscreen,P=B.occluded);let d=n(B&&B.box);if(!z&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[M];i&&(this.variableOffsets[M]=i,this.markUsedJustification(s,i.anchor,r,d))}}else{let l=(n,a)=>{let l=s.getSymbolInstanceTextSize(_,r,this.transform.zoom,o),u=this.collisionIndex.placeCollisionBox(s,l,n,new i.pointGeometry(0,0),b,p,h,y.predicate);return u&&u.box&&u.box.length&&(this.markUsedOrientation(s,a,r),this.placedOrientations[M]=a),u};a(()=>l($,i.WritingMode.horizontal),()=>{let r=m.verticalTextBox;return s.allowVerticalPlacement&&C>0&&r?(Z(r),l(r,i.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),n(B&&B.box&&B.box.length)}}if(z=(F=B)&&F.box&&F.box.length>0,D=F&&F.offscreen,P=F&&F.occluded,r.useRuntimeCollisionCircles){let n=s.text.placedSymbolArray.get(r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex),o=i.evaluateSizeForFeature
8(s.textSizeData,_,n),d=l.get("text-padding");U=this.collisionIndex.placeCollisionCircles(s,b,n,s.lineVertexArray,s.glyphOffsetArray,o,h,u,c,a,E,y.predicate,r.collisionCircleDiameter*o/i.ONE_EM,d,this.retainedQueryData[s.bucketInstanceId].tileID),z=b||U.circles.length>0&&!U.collisionDetected,D=D&&U.offscreen,P=U.occluded}if(m.iconFeatureIndex&&(G=m.iconFeatureIndex),m.iconBox){let n=n=>{Z(n);let a=S&&R?th(R.x,R.y,T,E,this.transform.angle):new i.pointGeometry(0,0),o=s.getSymbolInstanceIconSize(g,this.transform.zoom,r.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,o,n,a,w,p,h,y.predicate)};k=O&&O.box&&O.box.length&&m.verticalIconBox?(V=n(m.verticalIconBox)).box.length>0:(V=n(m.iconBox)).box.length>0,D=D&&V.offscreen,L=V.occluded}let q=x||0===r.numHorizontalGlyphVertices&&0===C,W=v||0===r.numIconVertices;if(q||W?W?q||(k=k&&z):z=k&&z:k=z=k&&z,z&&F&&F.box&&this.collisionIndex.insertCollisionBox(F.box,l.get("text-ignore-placement"),s.bucketInstanceId,O&&O.box&&j?j:N,y.ID),k&&V&&this.collisionIndex.insertCollisionBox(V.box,l.get("icon-ignore-placement"),s.bucketInstanceId,G,y.ID),U&&(z&&this.collisionIndex.insertCollisionCircles(U.circles,l.get("text-ignore-placement"),s.bucketInstanceId,N,y.ID),a)){let i=s.bucketInstanceId,r=this.collisionCircleArrays[i];void 0===r&&(r=this.collisionCircleArrays[i]=new ta);for(let i=0;i<U.circles.length;i+=4)r.circles.push(U.circles[i+0]),r.circles.push(U.circles[i+1]),r.circles.push(U.circles[i+2]),r.circles.push(U.collisionDetected?1:0)}let X="globe"!==s.projection.name;A=A&&(X||!P),I=I&&(X||!L),this.placements[M]=new tn(z||A,k||I,D||s.justReloaded),n[M]=!0};if(M){let i=s.getSortedSymbolIndexes(this.transform.angle);for(let r=i.length-1;r>=0;--r){let n=i[r];C(s.symbolInstances.get(n),n,s.collisionArrays[n])}}else for(let i=r.symbolInstanceStart;i<r.symbolInstanceEnd;i++)C(s.symbolInstances.get(i),i,s.collisionArrays[i]);if(a&&s.bucketInstanceId in this.collisionCircleArrays){let r=this.collisionCircleArrays[s.bucketInstanceId];i.invert(r.invProjMatrix,h),r.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}markUsedJustification(r,n,a,o){let{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u,crossTileID:c}=a,d=i.getAnchorJustification(n),p=o===i.WritingMode.vertical?u:"left"
8===d?s:"center"===d?l:"right"===d?h:-1;s>=0&&(r.text.placedSymbolArray.get(s).crossTileID=p>=0&&s!==p?0:c),l>=0&&(r.text.placedSymbolArray.get(l).crossTileID=p>=0&&l!==p?0:c),h>=0&&(r.text.placedSymbolArray.get(h).crossTileID=p>=0&&h!==p?0:c),u>=0&&(r.text.placedSymbolArray.get(u).crossTileID=p>=0&&u!==p?0:c)}markUsedOrientation(r,n,a){let o=n===i.WritingMode.horizontal||n===i.WritingMode.horizontalOnly?n:0,s=n===i.WritingMode.vertical?n:0,{leftJustifiedTextSymbolIndex:l,centerJustifiedTextSymbolIndex:h,rightJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:c}=a,d=r.text.placedSymbolArray;l>=0&&(d.get(l).placedOrientation=o),h>=0&&(d.get(h).placedOrientation=o),u>=0&&(d.get(u).placedOrientation=o),c>=0&&(d.get(c).placedOrientation=s)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;let r=this.prevPlacement,n=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;let a=r?r.symbolFadeChange(i):1,o=r?r.opacities:{},s=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(let i in this.placements){let r=this.placements[i],s=o[i];s?(this.opacities[i]=new tr(s,a,r.text,r.icon,null,r.clipped),n=n||r.text!==s.text.placed||r.icon!==s.icon.placed):(this.opacities[i]=new tr(null,a,r.text,r.icon,r.skipFade,r.clipped),n=n||r.text||r.icon)}for(let i in o){let r=o[i];if(!this.opacities[i]){let o=new tr(r,a,!1,!1);o.isHidden()||(this.opacities[i]=o,n=n||r.text.placed||r.icon.placed)}}for(let i in s)this.variableOffsets[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.variableOffsets[i]=s[i]);for(let i in l)this.placedOrientations[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.placedOrientations[i]=l[i]);n?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r){let n={};for(let a of r){let r=a.getBucket(i);r&&a.latestFeatureIndex&&i.id===r.layerIds[0]&&this.updateBucketOpacities(r,n,a.collisionBoxArray)}}updateBucketOpacities(r,n,a){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();let o=r.layers[0].layout,s=!!r.layers[0].dynamicFilter(),l=new tr(null,0,!1,!1,!0),h=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),c=o.get("text-variable-anchor"),d="map"===o.get("text-rotation-alignment"),p="map"===o.get("text-pitch-alignment"),f="none"!==o.get("icon-text-fit"),m=new tr(null,0,h&&(u||!r.hasIconData()||o.get("icon-optional")),u&&(h||!r.hasTextData()||o.get("text-optional")),!0);!r.collisionArrays&&a&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(a);let _=(i,r,n)=>{for(let a=0;a<r/4;a++)i.opacityVertexArray.emplaceBack(n)},g=0;for(let a=0;a<r.symbolInstances.length;a++){let o=r.symbolInstances.get(a),{numHorizontalGlyphVertices:h,numVerticalGlyphVertices:u,crossTileID:y,numIconVertices:x}=o,v=this.opacities[y];n[y]?v=l:v||(v=m,this.opacities[y]=v),n[y]=!0;let b=h>0||u>0,w=x>0,T=this.placedOrientations[y],E=T===i.WritingMode.vertical,S=T===i.WritingMode.horizontal||T===i.WritingMode.horizontalOnly;if(!b&&!w||v.isHidden()||g++,b){let i=td(v.text);_(r.text,h,E?tp:i),_(r.text,u,S?tp:i);let n=v.text.isHidden(),{leftJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=o,d=r.text.placedSymbolArray,p=n||E?1:0;a>=0&&(d.get(a).hidden=p),s>=0&&(d.get(s).hidden=p),l>=0&&(d.get(l).hidden=p),c>=0&&(d.get(c).hidden=n||S?1:0);let f=this.variableOffsets[y];f&&this.markUsedJustification(r,f.anchor,o,T);let m=this.placedOrientations[y];m&&(this.markUsedJustification(r,"left",o,m),this.markUsedOrientation(r,m,o))}if(w){let i=td(v.icon),{placedIconSymbolIndex:n,verticalPlacedIconSymbolIndex:a}=o,s=r.icon.placedSymbolArray,l=v.icon.isHidden()?1:0;n>=0&&(_(r.icon,x,E?tp:i),s.get(n).hidden=l),a>=0&&(_(r.icon,o.numVerticalIconVertices,S?tp:i),s.get(a).hidden=l)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){let n=r.collisionArrays[a];if(n){let a=new i.pointGeometry(0,0),o=!0;if(n.textBox||n.verticalTextBox){if(c){let i=this.variableOffsets[y];i?(a=tl(i.anchor,i.width,i.height,i.textOffset,i.textScale),d&&a._rotate(p?this.transform.angle:-this.transform.angle)):o=!1}s&&(o=!v.clipped),n.textBox&&tc(r.textCollisionBox.collisionVertexArray,v.text.placed,!o||E,a.x,a.y),n.verticalTextBox&&tc(r.textCollisionBox.collisionVertexArray,v.text.placed,!o||S,a.x,a.y)}let l=o&&!!(!S&&n.verticalIconBox);n.iconBox&&tc(r.iconCollisionBox.collisionVertexArray,v.icon.placed,l,f?a.x:0,f?a.y:0),n.verticalIconBox&&tc(r.iconCollisionBox.collisionVertexArray,v.icon.placed,!l,f?a.x:0,f?a.y:0)}}}if(r.fullyClipped=0===g,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=i.invProjMatrix,r.placementViewportMatrix=i.viewportMatrix,r.collisionCircleArray=i.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(i,r){let n=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*n>i}setStale(){this.stale=!0}}function tc(i,r,n,a,o){i.emplaceBack(r?1:0,n?1:0,a||0,o||0),i.emplaceBack(r?1:0,n?1:0,a||0,o||0),i.emplaceBack(r?1:0,n?1:0,a||0,o||0),i.emplaceBack(r?1:0,n?1:0,a||0,o||0)}function td(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 4294967295;let r=i.placed?1:0,n=Math.floor(127*i.opacity);return 33554432*n+16777216*r+131072*n+65536*r+512*n+256*r+2*n+r}let tp=0;class tf{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,r,n,a,o){let s=this._bucketParts;for(;this._currentTileIndex<i.length;)if(r.getBucketParts(s,a,i[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,o())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((i,r)=>i.sortKey-r.sortKey));this._currentPartIndex<s.length;){let i=s[this._currentPartIndex];if(r.placeLayerBucketPart(i,this._seenCrossTileIDs,n,0===i.symbolInstanceStart),this._currentPartIndex++,o())return!0}return!1}}class tm{constructor(i,r,n,a,o,s,l,h){this.placement=new tu(i,o,s,l,h),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(r,n,a){let o=i.exported.now(),s=()=>{let r=i.exported.now()-o;return!this._forceFullPlacement&&r>2};for(;this._currentPlacementIndex>=0;){let i=n[r[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new tf(i)),this._inProgressLayer.continuePlacement(a[i.source],this.placement,this._showCollisionBoxes,i,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}let t_=512/i.EXTENT/2;class tg{constructor(i,r,n){this.tileID=i,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;n<r.length;n++){let a=r.get(n),o=a.key;
8this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:a.crossTileID,coord:this.getScaledCoordinates(a,i)})}}getScaledCoordinates(r,n){let a=t_/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*i.EXTENT+r.tileAnchorX)*a),y:Math.floor((n.canonical.y*i.EXTENT+r.tileAnchorY)*a)}}findMatches(i,r,n){let a=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z);for(let o=0;o<i.length;o++){let s=i.get(o);if(s.crossTileID)continue;let l=this.indexedSymbolInstances[s.key];if(!l)continue;let h=this.getScaledCoordinates(s,r);for(let i of l)if(Math.abs(i.coord.x-h.x)<=a&&Math.abs(i.coord.y-h.y)<=a&&!n[i.crossTileID]){n[i.crossTileID]=!0,s.crossTileID=i.crossTileID;break}}}}class ty{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class tx{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){let r=Math.round((i-this.lng)/360);if(0!==r)for(let i in this.indexes){let n=this.indexes[i],a={};for(let i in n){let o=n[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),a[o.tileID.key]=o}this.indexes[i]=a}this.lng=i}addBucket(i,r,n){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let i=0;i<r.symbolInstances.length;i++)r.symbolInstances.get(i).crossTileID=0;this.usedCrossTileIDs[i.overscaledZ]||(this.usedCrossTileIDs[i.overscaledZ]={});let a=this.usedCrossTileIDs[i.overscaledZ];for(let n in this.indexes){let o=this.indexes[n];if(Number(n)>i.overscaledZ)for(let n in o){let s=o[n];s.tileID.isChildOf(i)&&s.findMatches(r.symbolInstances,i,a)}else{let s=o[i.scaledTo(Number(n)).key];s&&s.findMatches(r.symbolInstances,i,a)}}for(let i=0;i<r.symbolInstances.length;i++){let o=r.symbolInstances.get(i);o.crossTileID||(o.crossTileID=n.generate(),a[o.crossTileID]=!0)}return void 0===this.indexes[i.overscaledZ]&&(this.indexes[i.overscaledZ]={}),this.indexes[i.overscaledZ][i.key]=new tg(i,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(i,r){for(let n in r.indexedSymbolInstances)for(let a of r.indexedSymbolInstances[n])delete this.usedCrossTileIDs[i][a.crossTileID]}removeStaleBuckets(i){let r=!1;for(let n in this.indexes){let a=this.indexes[n];for(let o in a)i[a[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,a[o]),delete a[o],r=!0)}return r}}class tv{constructor(){this.layerIndexes={},this.crossTileIDs=new ty,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(i,r,n,a){let o=this.layerIndexes[i.id];void 0===o&&(o=this.layerIndexes[i.id]=new tx);let s=!1,l={};for(let h of("globe"!==a.name&&o.handleWrapJump(n),r)){let r=h.getBucket(i);r&&i.id===r.layerIds[0]&&(r.bucketInstanceId||(r.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(h.tileID,r,this.crossTileIDs)&&(s=!0),l[r.bucketInstanceId]=!0)}return o.removeStaleBuckets(l)&&(s=!0),s}pruneUnusedLayers(i){let r={};for(let n in i.forEach(i=>{r[i]=!0}),this.layerIndexes)r[n]||delete this.layerIndexes[n]}}let tb=(r,n)=>i.emitValidationErrors(r,n&&n.filter(i=>"source.canvas"!==i.identifier)),tw=i.pick(eN,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),tT=i.pick(eN,["setCenter","setZoom","setBearing","setPitch"]),tE={version:8,layers:[],sources:{}},tS={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class tM extends i.Evented{constructor(r,n={}){super(),this.map=r,this.dispatcher=new R(eU(),this),this.imageManager=new T,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(r._requestManager,n.localFontFamily?i.LocalGlyphMode.all:n.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.crossTileSymbolIndex=new tv,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedU
8pdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());let a=this;this._rtlTextPluginCallback=tM.registerForPluginStateChange(r=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,n)=>{if(i.triggerPluginCompletionEvent(r),n&&n.every(i=>i))for(let i in a._sourceCaches){let r=a._sourceCaches[i],n=r.getSource().type;"vector"!==n&&"geojson"!==n||r.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;let r=this.getSource(i.sourceId);if(r&&r.vectorLayerIds)for(let i in this._layers){let n=this._layers[i];n.source===r.id&&this._validateLayer(n)}})}loadURL(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"}));let a="boolean"==typeof n.validate?n.validate:!i.isMapboxURL(r);r=this.map._requestManager.normalizeStyleURL(r,n.accessToken);let o=this.map._requestManager.transformRequest(r,i.ResourceType.Style);this._request=i.getJSON(o,(r,n)=>{this._request=null,r?this.fire(new i.ErrorEvent(r)):n&&this._load(n,a)})}loadJSON(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(r,!1!==n.validate)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(tE,!1)}_updateLayerCount(i,r){let n=r?1:-1;i.is3D()&&(this._num3DLayers+=n),"circle"===i.type&&(this._numCircleLayers+=n),"symbol"===i.type&&(this._numSymbolLayers+=n)}_load(r,n){if(n&&tb(this,i.validateStyle(r)))return;for(let n in this._loaded=!0,this.stylesheet=i.clone$1(r),this._updateMapProjection(),r.sources)this.addSource(n,r.sources[n],{validate:!1});this._changed=!1,r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(r.glyphs);let a=eV(this.stylesheet.layers);for(let r of(this._order=a.map(i=>i.id),this._layers={},this._serializedLayers={},a))(r=i.createStyleLayer(r)).setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=r,this._serializedLayers[r.id]=r.serialize(),this._updateLayerCount(r,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new M(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 i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this._updateMapProjection()}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))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(r){this._spriteRequest=function(r,n,a){let o,s,l;let h=i.exported.devicePixelRatio>1?"@2x":"",u=i.getJSON(n.transformRequest(n.normalizeSpriteURL(r,h,".json"),i.ResourceType.SpriteJSON),(i,r)=>{u=null,l||(l=i,o=r,d())}),c=i.getImage(n.transformRequest(n.normalizeSpriteURL(r,h,".png"),i.ResourceType.SpriteImage),(i,r)=>{c=null,l||(l=i,s=r,d())});function d(){if(l)a(l);else if(o&&s){let r=i.exported.getImageData(s),n={};for(let a in o){let{width:s,height:l,x:h,y:u,sdf:c,pixelRatio:d,stretchX:p,stretchY:f,content:m}=o[a],_=new i.RGBAImage({width:s,height:l});i.RGBAImage.copy(r,_,{x:h,y:u},{x:0,y:0},{width:s,height:l}),n[a]={data:_,pixelRatio:d,sdf:c,stretchX:p,stretchY:f,content:m}}a(null,n)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(r,this.map._requestManager,(r,n)=>{if(this._spriteRequest=null,r)this.fire(new i.ErrorEvent(r));else if(n)for(let i in n)this.imageManager.addImage(i,n[i]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(r){let n=this.getSource(r.source);if(!n)return;let a=r.sourceLayer;a&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(a))&&this.fire(new i.ErrorEvent(Error(`Source layer "${a}" does not exist on source "${n.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(i){let r=[];for(let n of i){let i=this._layers[n];
8"custom"!==i.type&&r.push(i.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(let i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(i){return!!this.terrain&&("function"==typeof i.isLayerDraped?i.isLayerDraped():tS[i.type])}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(r){if(!this._loaded)return;let n=this._changed;if(this._changed){let i=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);for(let r in(i.length||n.length)&&this._updateWorkerLayers(i,n),this._updatedSources){let i=this._updatedSources[r];"reload"===i?this._reloadSource(r):"clear"===i&&this._clearSource(r)}for(let i in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[i].updateTransitions(r);this.light.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._resetUpdates()}let a={};for(let i in this._sourceCaches){let r=this._sourceCaches[i];a[i]=r.used,r.used=!1}for(let i of this._order){let n=this._layers[i];if(n.recalculate(r,this._availableImages),!n.isHidden(r.zoom)){let i=this._getLayerSourceCache(n);i&&(i.used=!0)}let a=this.map.painter;if(a){let i=n.getProgramIds();if(!i)continue;let o=n.getProgramConfiguration(r.zoom);for(let r of i)a.useProgram(r,o)}}for(let r in a){let n=this._sourceCaches[r];a[r]!==n.used&&n.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:n.getSource().id}))}this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){let i=Object.keys(this._changedImages);if(i.length){for(let r in this._sourceCaches)this._sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateWorkerLayers(i,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(i),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(r){if(this._checkLoaded(),tb(this,i.validateStyle(r)))return!1;(r=i.clone$1(r)).layers=eV(r.layers);let n=(function(i,r){if(!i)return[{command:eN.setStyle,args:[r]}];let n=[];try{if(!s(i.version,r.version))return[{command:eN.setStyle,args:[r]}];s(i.center,r.center)||n.push({command:eN.setCenter,args:[r.center]}),s(i.zoom,r.zoom)||n.push({command:eN.setZoom,args:[r.zoom]}),s(i.bearing,r.bearing)||n.push({command:eN.setBearing,args:[r.bearing]}),s(i.pitch,r.pitch)||n.push({command:eN.setPitch,args:[r.pitch]}),s(i.sprite,r.sprite)||n.push({command:eN.setSprite,args:[r.sprite]}),s(i.glyphs,r.glyphs)||n.push({command:eN.setGlyphs,args:[r.glyphs]}),s(i.transition,r.transition)||n.push({command:eN.setTransition,args:[r.transition]}),s(i.light,r.light)||n.push({command:eN.setLight,args:[r.light]}),s(i.fog,r.fog)||n.push({command:eN.setFog,args:[r.fog]}),s(i.projection,r.projection)||n.push({command:eN.setProjection,args:[r.projection]});let a={},o=[];!function(i,r,n,a){let o;for(o in r=r||{},i=i||{})i.hasOwnProperty(o)&&(r.hasOwnProperty(o)||eG(o,n,a));for(o in r){var l,h;r.hasOwnProperty(o)&&(i.hasOwnProperty(o)?s(i[o],r[o])||("geojson"===i[o].type&&"geojson"===r[o].type&&function(i,r,n){let a;for(a in i[n])if(i[n].hasOwnProperty(a)&&"data"!==a&&!s(i[n][a],r[n][a]))return!1;for(a in r[n])if(r[n].hasOwnProperty(a)&&"data"!==a&&!s(i[n][a],r[n][a]))return!1;return!0}(i,r,o)?n.push({command:eN.setGeoJSONSourceData,args:[o,r[o].data]}):(l=o,h=r,eG(l,n,a),ej(l,h,n))):ej(o,r,n))}}(i.sources,r.sources,o,a);let l=[];i.layers&&i.layers.forEach(i=>{i.source&&a[i.source]?n.push({command:eN.removeLayer,args:[i.id]}):l.push(i)});let h=i.terrain;h&&a[h.source]&&(n.push({command:eN.setTerrain,args:[void 0]}),h=void 0),n=n.concat(o),s(h,r.terrain)||n.push({command:eN.setTerrain,args:[r.terrain]}),function(i,r,n){let a,o,l,h,u,c,d;r=r||[];let p=(i=i||[]).map(e$),f=r.map(e$),m=i.reduce(eq,{}),_=r.reduce(eq,{}),g=p.slice(),y=Object.create(null);for(a=0,o=0;a<p.length;a++)l=p[a],_.hasOwnProperty(l)?o++:(n.push({command:eN.removeLayer,args:[l]}),g.splice(g.indexOf(l,o),1));for(a=0,o=0;a<f.length;a++)l=f[f.length-1-a],g[g.length-1-a]!==l&&(m.hasOwnProperty(l)?(n.push({command:eN.removeLayer,args:[l]}),g.splice(g.lastIndexOf(l,g.length-o),1)):o++,c=g[g.length-a],n.push({command:eN.addLayer,args:[_[l],c]}),g.splice(g.length-a,0,l),y[l]=!0);for(a=0;a<f.length;a++)if(h=m[l=f[a]],u=_[l],!y[l]&&!s(h,u)){if(s(h.source,u.source)&&s(h["source-layer"],u["source-layer"])&&s(h.type,u.type)){for(d in eZ(h.layout,u.layout,n,l,null,eN.setLayoutProperty),eZ(h.paint,u.paint,n,l,null,eN.setPaintProperty),s(h.filter,u.filter)||n.push({command:eN.setFilter,args:[l,u.filter]}),s(h.minzoom,u.minzoom)&&s(h.maxzoom,u.maxzoom)||n.push({command:eN.setLayerZoomRange,args:[l,u.minzoom,u.maxzoom]}),h)h.hasOwnProperty(d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?eZ(h[d],u[d],n,l,d.slice(6),eN.setPaintProperty):s(h[d],u[d])||n.push({command:eN.setLayerProperty,args:[l,d,u[d]]}));for(d in u)u.hasOwnProperty(d)&&!h.hasOwnProperty(d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?eZ(h[d],u[d],n,l,d.slice(6),eN.setPaintProperty):s(h[d],u[d])||n.push({command:eN.setLayerProperty,args:[l,d,u[d]]}))}else n.push({command:eN.removeLayer,args:[l]}),c=g[g.lastIndexOf(l)+1],n.push({command:eN.addLayer,args:[u,c]})}}(l,r.layers,n)}catch(i){console.warn("Unable to compute style diff:",i),n=[{command:eN.setStyle,args:[r]}]}return n})(this.serialize(),r).filter(i=>!(i.command in tT));if(0===n.length)return!1;let a=n.filter(i=>!(i.command in tw));if(a.length>0)throw Error(`Unimplemented: ${a.map(i=>i.command).join(", ")}.`);
8return n.forEach(i=>{"setTransition"!==i.command&&"setProjection"!==i.command&&this[i.command].apply(this,i.args)}),this.stylesheet=r,this._updateMapProjection(),!0}addImage(r,n){return this.getImage(r)?this.fire(new i.ErrorEvent(Error("An image with this name already exists."))):(this.imageManager.addImage(r,n),this._afterImageUpdated(r),this)}updateImage(i,r){this.imageManager.updateImage(i,r)}getImage(i){return this.imageManager.getImage(i)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r),this._afterImageUpdated(r),this):this.fire(new i.ErrorEvent(Error("No image with this name exists.")))}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(r,n,a={}){if(this._checkLoaded(),void 0!==this.getSource(r))throw Error("There is already a source with this ID");if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(i.validateSource,`sources.${r}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let o=eL(r,n,this.dispatcher,this);o.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(r),source:o.serialize(),sourceId:r}));let s=n=>{let a=(n?"symbol:":"other:")+r,s=this._sourceCaches[a]=new i.SourceCache(a,o,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[r]=s,s.style=this,s.onAdd(this.map)};s(!1),"vector"!==n.type&&"geojson"!==n.type||s(!0),o.onAdd&&o.onAdd(this.map),this._changed=!0}removeSource(r){this._checkLoaded();let n=this.getSource(r);if(!n)throw Error("There is no source with this ID");for(let n in this._layers)if(this._layers[n].source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while layer "${n}" is using it.`)));if(this.terrain&&this.terrain.get().source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while terrain is using it.`)));for(let n of this._getSourceCaches(r))delete this._sourceCaches[n.id],delete this._updatedSources[n.id],n.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:n.getSource().id})),n.setEventedParent(null),n.clearTiles();return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0,this}
8setGeoJSONSourceData(i,r){this._checkLoaded(),this.getSource(i).setData(r),this._changed=!0}getSource(i){let r=this._getSourceCache(i);return r&&r.getSource()}_getSources(){let i=[];for(let r in this._otherSourceCaches){let n=this._getSourceCache(r);n&&i.push(n.getSource())}return i}addLayer(r,n,a={}){let o;this._checkLoaded();let s=r.id;if(this.getLayer(s))return void this.fire(new i.ErrorEvent(Error(`Layer with id "${s}" already exists on this map`)));if("custom"===r.type){if(tb(this,i.validateCustomStyleLayer(r)))return;o=i.createStyleLayer(r)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=i.clone$1(r),r=i.extend(r,{source:s})),this._validate(i.validateLayer,`layers.${s}`,r,{arrayIndex:-1},a))return;o=i.createStyleLayer(r),this._validateLayer(o),o.setEventedParent(this,{layer:{id:s}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}let l=n?this._order.indexOf(n):this._order.length;if(n&&-1===l)return void this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(l,0,s),this._layerOrderChanged=!0,this._layers[s]=o;let h=this._getLayerSourceCache(o);if(this._removedLayers[s]&&o.source&&h&&"custom"!==o.type){let i=this._removedLayers[s];delete this._removedLayers[s],i.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",h.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(r,n){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===n)return;let a=this._order.indexOf(r);this._order.splice(a,1);let o=n?this._order.indexOf(n):this._order.length;
8n&&-1===o?this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(o,0,r),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(r){this._checkLoaded();let n=this._layers[r];if(!n)return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);let a=this._order.indexOf(r);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=n,delete this._layers[r],delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(i){return this._layers[i]}hasLayer(i){return i in this._layers}hasLayerType(i){for(let r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(r,n,a){this._checkLoaded();let o=this.getLayer(r);o?o.minzoom===n&&o.maxzoom===a||(null!=n&&(o.minzoom=n),null!=a&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(r,n,a={}){this._checkLoaded();let o=this.getLayer(r);if(o){if(!s(o.filter,n))return null==n?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(i.validateFilter,`layers.${o.id}.filter`,n,{layerType:o.type},a)||(o.filter=i.clone$1(n),this._updateLayer(o)))}else this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be filtered.`)))}getFilter(r){let n=this.getLayer(r);return n&&i.clone$1(n.filter)}setLayoutProperty(r,n,a,o={}){this._checkLoaded();let l=this.getLayer(r);l?s(l.getLayoutProperty(n),a)||(l.setLayoutProperty(n,a,o),this._updateLayer(l)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(r,n){let a=this.getLayer(r);if(a)return a.getLayoutProperty(n);this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style.`)))}setPaintProperty(r,n,a,o={}){this._checkLoaded();let l=this.getLayer(r);l?s(l.getPaintProperty(n),a)||(l.setPaintProperty(n,a,o)&&this._updateLayer(l),this._changed=!0,this._updatedPaintProps[r]=!0):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(i,r){let n=this.getLayer(i);return n&&n.getPaintProperty(r)}setFeatureState(r,n){this._checkLoaded();let a=r.source,o=r.sourceLayer,s=this.getSource(a);if(!s)return void this.fire(new i.ErrorEvent(Error(`The source '${a}' does not exist in the map's style.`)));let l=s.type;if("geojson"===l&&o)return void this.fire(new i.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!o)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));for(let s of(void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(a)))s.setFeatureState(o,r.id,n)}removeFeatureState(r,n){this._checkLoaded();let a=r.source,o=this.getSource(a);if(!o)return void this.fire(new i.ErrorEvent(Error(`The source '${a}' does not exist in the map's style.`)));let s=o.type,l="vector"===s?r.sourceLayer:void 0;if("vector"===s&&!l)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.ErrorEvent(Error("A feature id is required to remove its specific state property.")));for(let i of this._getSourceCaches(a))i.removeFeatureState(l,r.id,n)}getFeatureState(r){this._checkLoaded();let n=r.source,a=r.sourceLayer,o=this.getSource(n);if(o){if("vector"!==o.type||a)return void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(a,r.id);this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){let r={};for(let i in this._sourceCaches){let n=this._sourceCaches[i].getSource();r[n.id]||(r[n.id]=n.serialize())}return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,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:r,layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateLayer(i){this._updatedLayers[i.id]=!0;let r=this._getLayerSourceCache(i);i.source&&!this._updatedSources[i.source]&&r&&"raster"!==r.getSource().type&&(this._updatedSources[i.source]="reload",r.pause()),this._changed=!0,i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){let r=i=>"fill-extrusion"===this._layers[i].type,n={},a=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(r(s))for(let r of(n[s]=o,i)){let i=r[s];if(i)for(let r of i)a.push(r)}}a.sort((i,r)=>r.intersectionZ-i.intersectionZ);let o=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(r(l))for(let i=a.length-1;i>=0;i--){let r=a[i].feature;if(n[r.layer.id]<s)break;o.push(r),a.pop()}else for(let r of i){let i=r[l];if(i)for(let r of i)o.push(r.feature)}}return o}
8queryRenderedFeatures(r,n,a){n&&n.filter&&this._validate(i.validateFilter,"queryRenderedFeatures.filter",n.filter,null,n);let o={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new i.ErrorEvent(Error("parameters.layers must be an Array."))),[];for(let r of n.layers){let n=this._layers[r];if(!n)return this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be queried for features.`))),[];o[n.source]=!0}}let s=[];n.availableImages=this._availableImages;let l=n&&n.layers?n.layers.some(i=>{let r=this.getLayer(i);return r&&r.is3D()}):this.has3DLayers(),h=O.createFromScreenPoints(r,a);for(let r in this._sourceCaches){let u=this._sourceCaches[r].getSource().id;n.layers&&!o[u]||s.push(function(r,n,a,o,s,l,h,u=!1){let c=r.tilesIn(o,h,u);c.sort(eR);let d=[];for(let o of c)d.push({wrappedTileID:o.tile.tileID.wrapped().key,queryResults:o.tile.queryRenderedFeatures(n,a,r._state,o,s,l,function(r,n){let a=i.identity([]);return i.scale(a,a,[.5*r.width,-(.5*r.height),1]),i.translate(a,a,[1,-1,0]),i.multiply(a,a,r.calculateProjMatrix(n.toUnwrapped())),Float32Array.from(a)}(r.transform,o.tile.tileID),u)});let p=function(i){let r={},n={};for(let a of i){let i=a.queryResults,o=a.wrappedTileID,s=n[o]=n[o]||{};for(let n in i){let a=i[n],o=s[n]=s[n]||{},l=r[n]=r[n]||[];for(let i of a)o[i.featureIndex]||(o[i.featureIndex]=!0,l.push(i))}}return r}(d);for(let i in p)p[i].forEach(i=>{let n=i.feature,a=n.layer;a&&"background"!==a.type&&"sky"!==a.type&&(n.source=a.source,a["source-layer"]&&(n.sourceLayer=a["source-layer"]),n.state=void 0!==n.id?r.getFeatureState(a["source-layer"],n.id):{})});return p}(this._sourceCaches[r],this._layers,this._serializedLayers,h,n,a,l,!!this.map._showQueryGeometry))}return this.placement&&s.push(function(i,r,n,a,o,s,l){let h={},u=s.queryRenderedSymbols(a),c=[];for(let i of Object.keys(u).map(Number))c.push(l[i]);for(let n of(c.sort(eR),c)){let a=n.featureIndex.lookupSymbolFeatures(u[n.bucketInstanceId],r,n.bucketIndex,n.sourceLayerIndex,o.filter,o.layers,o.availableImages,i);for(let i in a){let r=h[i]=h[i]||[],o=a[i];for(let i of(o.sort((i,r)=>{let a=n.featureSortOrder;if(a){let n=a.indexOf(i.featureIndex);return a.indexOf(r.featureIndex)-n}return r.featureIndex-i.featureIndex}),o))r.push(i)}}for(let r in h)h[r].forEach(a=>{let o=a.feature,s=n(i[r]).getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s});return h}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),h.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(r,n){n&&n.filter&&this._validate(i.validateFilter,"querySourceFeatures.filter",n.filter,null,n);let a=this._getSourceCaches(r),o=[];for(let i of a)o=o.concat(function(i,r){let n=i.getRenderableIds().map(r=>i.getTileByID(r)),a=[],o={};for(let i=0;i<n.length;i++){let s=n[i],l=s.tileID.canonical.key;o[l]||(o[l]=!0,s.querySourceFeatures(a,r))}return a}(i,n));return o}addSourceType(i,r,n){return tM.getSourceType(i)?n(Error(`A source type called "${i}" already exists.`)):(tM.setSourceType(i,r),r.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:r.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(i,r={}){this._checkLoaded();let n=this.light.getLight(),a=!1;for(let r in i)if(!s(i[r],n[r])){a=!0;break}if(!a)return;let o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(i,r),this.light.updateTransitions(o)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(r,n=1){if(this._checkLoaded(),!r)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===n){if("object"==typeof r.source){let n="terrain-dem-src";this.addSource(n,r.source),r=i.clone$1(r),r=i.extend(r,{source:n})}
8if(this._validate(i.validateTerrain,"terrain",r))return}if(!this.terrain||this.terrain&&n!==this.terrain.drapeRenderMode)this._createTerrain(r,n);else{let n=this.terrain,a=n.get();for(let n of Object.keys(i.spec.terrain))!r.hasOwnProperty(n)&&i.spec.terrain[n].default&&(r[n]=i.spec.terrain[n].default);for(let i in r)if(!s(r[i],a[i])){n.set(r),this.stylesheet.terrain=r;let i=this._setTransitionParameters({duration:0});n.updateTransitions(i);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){let r=this.fog=new L(i,this.map.transform);this.stylesheet.fog=i;let n=this._setTransitionParameters({duration:0});r.updateTransitions(n)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(i){if(this._checkLoaded(),!i)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){let r=this.fog,n=r.get();for(let a in 0===Object.keys(i).length&&r.set(i),i)if(!s(i[a],n[a])){r.set(i),this.stylesheet.fog=i;let n=this._setTransitionParameters({duration:0});r.updateTransitions(n);break}}else this._createFog(i);this._markersNeedUpdate=!0}_setTransitionParameters(r){return{now:i.exported.now(),transition:i.extend(r,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;let i=this._order.filter(i=>this.isLayerDraped(this._layers[i])),r=this._order.filter(i=>!this.isLayerDraped(this._layers[i]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(i,r){let n=this.terrain=new C(i,r);this.stylesheet.terrain=i,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();let a=this._setTransitionParameters({duration:0});n.updateTransitions(a)}_force3DLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,n,a,o,s={}){return(!s||!1!==s.validate)&&tb(this,r.call(i.validateStyle,i.extend({key:n,style:this.serialize(),value:a,styleSpec:i.spec},o)))}_remove(){for(let r in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[r].setEventedParent(null);for(let i in this._sourceCaches)this._sourceCaches[i].clearTiles(),this._sourceCaches[i].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(i){for(let r of this._getSourceCaches(i))r.clearTiles()}_reloadSource(i){for(let r of this._getSourceCaches(i))r.resume(),r.reload()}_reloadSources(){for(let i of this._getSources())i.reload&&i.reload()}_updateSources(i){for(let r in this._sourceCaches)this._sourceCaches[r].update(i)}_generateCollisionBoxes(){for(let i in this._sourceCaches){let r=this._sourceCaches[i];r.resume(),r.reload()}}_updatePlacement(r,n,a,o,s=!1){let l=!1,h=!1,u={};for(let i of this._order){let n=this._layers[i];if("symbol"!==n.type)continue;if(!u[n.source]){let i=this._getLayerSourceCache(n);if(!i)continue;u[n.source]=i.getRenderableIds(!0).map(r=>i.getTileByID(r)).sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}let a=this.crossTileSymbolIndex.addLayer(n,u[n.source],r.center.lng,r.projection);l=l||a}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),s=s||this._layerOrderChanged||0===a,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(s||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),r.zoom))&&(this.pauseablePlacement=new tm(r,this._order,s,n,a,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),h=!0),l&&this.pauseablePlacement.placement.setStale()),h||l)for(let i of this._order){let r=this._layers[i];"symbol"===r.type&&this.placement.updateLayerOpacities(r,u[r.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(let i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,r,n){this.imageManager.getImages(r.icons,n),this._updateTilesForChangedImages();let a=i=>{i&&i.setDependencies(r.tileID.key,r.type,r.icons)};a(this._otherSourceCaches[r.source]),a(this._symbolSourceCaches[r.source])}getGlyphs(i,r,n){this.glyphManager.getGlyphs(r.stacks,n)}
8getResource(r,n,a){return i.makeRequest(n,a)}_getSourceCache(i){return this._otherSourceCaches[i]}_getLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:this._otherSourceCaches[i.source]}_getSourceCaches(i){let r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),r}_isSourceCacheLoaded(r){let n=this._getSourceCaches(r);return 0===n.length?(this.fire(new i.ErrorEvent(Error(`There is no source with ID '${r}'`))),!1):n.every(i=>i.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)}}tM.getSourceType=function(i){return eP[i]},tM.setSourceType=function(i,r){eP[i]=r},tM.registerForPluginStateChange=i.registerForPluginStateChange;var tA="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",tI="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;}",tC="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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(\nmix(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;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\nconst float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform 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) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 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;\n#else\nfloat 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));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat 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);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 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;\n#else\nfloat 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);\n#endif\n}
8\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);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(\nunpack_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))\n);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) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat 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;\n#else\nvec4 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);\n#endif\nreturn 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;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);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",tz="#ifdef FOG\nuniform 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);}\n#endif",tk="#ifdef FOG\nuniform 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;
8highp vec3 ray_dir=mix(\nmix(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);}\n#endif";let tD={},tP={},tL=[];tF(tA,tL),tF(tC,tL),tF(tz,tL),tF(tk,tL),tD=tU("",tC),tP=tU(tk,tz);let tR=tU("\n#if __VERSION__ >=300\n#define varying in\n#define gl_FragColor glFragColor\n#define texture2D texture\n#define textureCube texture\nout vec4 glFragColor;\n#endif\nhighp 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);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\n#if __VERSION__ >=300\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\nfloat 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;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat 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;\n#else\nreturn vec3(0.0);\n#endif\n}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);}\n#endif\nvec2 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(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}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);
8return (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."),tB="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";var tO={background:tU("uniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nvarying vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform vec4 u_color;varying vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(u_color);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:tU("uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:tU("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute 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;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
8iew_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) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}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);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;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);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(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);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:tU("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:tU("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat 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);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute 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;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:tU("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;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","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:tU("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(\n0.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:tU("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(\nmix(-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(\n0.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:tU("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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying 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;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
8);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:tU("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:tU("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:tU("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:tU("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:tU("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
8),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute 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;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;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));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=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*h);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);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
8\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(color,NdotL);\n#else\nv_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef LIGHTING_3D_MODE\nv_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));\n#else\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:tU("uniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,v_NdotL)*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute 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;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;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=(pattern_br-pattern_tl)/pixel_ratio;
8base=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);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=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);\n#endif\nfloat 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\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
8ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_NdotL=NdotL;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:tU("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}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+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=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(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:tU("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;\n#ifdef LIGHTING_3D_MODE\ngl_FragColor=apply_lighting(gl_FragColor);\n#endif\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:tU("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;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nfloat linearstep(float edge0,float edge1,float x) {return  
8clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat 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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp 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);trimmed=0.0;}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}\n#else\nout_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform 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;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;\n#ifndef RENDER_TO_TEXTURE\nfloat 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;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat 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];\n#ifdef RENDER_LINE_GRADIENT\nhighp 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);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:tU("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;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;\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.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=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute 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;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat 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;\n#ifndef RENDER_TO_TEXTURE\nfloat 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;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:tU("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(\ndot(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);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:tU("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 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);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);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;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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) {vec4 offsetProjected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 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);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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));\n#else\ngl_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));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_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:tU("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;u
8niform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat 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);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 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);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);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;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 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);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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));\n#else\ngl_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));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 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:tU("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
8gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}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);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 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);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);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;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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));\n#else\ngl_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));\n#endif\nfloat 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;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_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
8df);}"),terrainRaster:tU("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=wireframeOffset;\n#endif\nv_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:tU("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;varying float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:tU("\nvarying 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(\ncos_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
8nd-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;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_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);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",tI),skyboxGradient:tU("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));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",tI),skyboxCapture:tU
vendor: 3,851 bytes, line 8
8("\nvarying 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;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\n#define MIE_G                   0.76\n#define DENSITY_HEIGHT_SCALE_R  8000.0\n#define DENSITY_HEIGHT_SCALE_M  1200.0\n#define PLANET_RADIUS           6360e3\n#define ATMOSPHERE_RADIUS       6420e3\n#define SAMPLE_STEPS            10\n#define DENSITY_STEPS           4\nfloat 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);}float 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))/(end-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:
8tU("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform 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;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(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);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\ncolor=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying 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() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:tU("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;
8highp 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));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_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;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp 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));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-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);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_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:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_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(\nmix(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(\nmix(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 tF(i,r){for(let n of i.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"))if("#"===(n=n.trim())[0]&&n.includes("if")&&!n.includes("endif"))for(let i of(n=n.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "))r.includes(i)||r.push(i)}function tU(i,r){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=r.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),o={},s=[...tL];return tF(i,s),tF(r,s),{fragmentSource:i=i.replace(n,(i,r,n,a,s)=>(o[s]=!0,"define"===r?`
9#ifndef HAS_UNIFORM_u_${s}
10varying ${n} ${a} ${s};
11#else
12uniform ${n} ${a} u_${s};
13#endif
14`:`
15#ifdef HAS_UNIFORM_u_${s}
16    ${n} ${a} ${s} = u_${s};
17#endif
18`)),vertexSource:r=r.replace(n,(i,r,n,a,s)=>{let l="float"===a?"vec2":"vec4",h=s.match(/color/)?"color":l;return o[s]?"define"===r?`
19#ifndef HAS_UNIFORM_u_${s}
20uniform lowp float u_${s}_t;
21attribute ${n} ${l} a_${s};
22varying ${n} ${a} ${s};
23#else
24uniform ${n} ${a} u_${s};
25#endif
26`:"vec4"===h?`
27#ifndef HAS_UNIFORM_u_${s}
28    ${s} = a_${s};
29#else
30    ${n} ${a} ${s} = u_${s};
31#endif
32`:`
33#ifndef HAS_UNIFORM_u_${s}
34    ${s} = unpack_mix_${h}(a_${s}, u_${s}_t);
35#else
36    ${n} ${a} ${s} = u_${s};
37#endif
38`:"define"===r?`
39#ifndef HAS_UNIFORM_u_${s}
40uniform lowp float u_${s}_t;
41attribute ${n} ${l} a_${s};
42#else
43uniform ${n} ${a} u_${s};
44#endif
45`:"vec4"===h?`
46#ifndef HAS_UNIFORM_u_${s}
47    ${n} ${a} ${s} = a_${s};
48#else
49    ${n} ${a} ${s} = u_${s};
50#endif
51`:`
52#ifndef HAS_UNIFORM_u_${s}
53    ${n} ${a} ${s} = unpack_mix_${h}(a_${s}, u_${s}_t);
54#else
55    ${n} ${a} ${s} = u_${s};
56#endif
57`}),staticAttributes:a,usedDefines:s}}class tV{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(i,r,n,a,o,s,l){this.context=i;let h=this.boundPaintVertexBuffers.length!==a.length;for(let i=0;!h&&i<a.length;i++)this.boundPaintVertexBuffers[i]!==a[i]&&(h=!0);let u=this.boundDynamicVertexBuffers.length!==l.length;for(let i=0;!u&&i<l.length;i++)this.boundDynamicVertexBuffers[i]!==l[i]&&(u=!0);if(!i.extVertexArrayObject||!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==n||h||u||this.boundIndexBuffer!==o||this.boundVertexOffset!==s)this.freshBind(r,n,a,o,s,l);else{for(let r of(i.bindVertexArrayOES.set(this.vao),l))r&&r.bind();o&&o.dynamicDraw&&o.bind()}}freshBind(i,r,n,a,o,s){let l;let h=i.numAttributes,u=this.context,c=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),l=0,this.boundProgram=i,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=a,this.boundVertexOffset=o,this.boundDynamicVertexBuffers=s;else{l=u.currentNumAttributes||0;for(let i=h;i<l;i++)c.disableVertexAttribArray(i)}for(let a of(r.enableAttributes(c,i),r.bind(),r.setVertexAttribPointers(c,i,o),n))a.enableAttributes(c,i),a.bind(),a.setVertexAttribPointers(c,i,o);for(let r of s)r&&(r.enableAttributes(c,i),r.bind(),r.setVertexAttribPointers(c,i,o));a&&a.bind(),u.currentNumAttributes=h}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function tN(r,n,a){if(!n.needsDEMTextureUpload)return;let o=r.context,s=o.gl;o.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||r.getTileTexture(a.stride);let l=a.getPixels();n.demTexture?n.demTexture.update(l,{premultiply:!1}):n.demTexture=new i.Texture(o,l,s.RGBA,{premultiply:!1}),n.needsDEMTextureUpload=!1}let tj=r=>({u_matrix:new i.UniformMatrix4f(r),u_image0:new i.Uniform1i(r),u_skirt_height:new i.Uniform1f(r)}),tG=(i,r)=>({u_matrix:i,u_image0:0,u_skirt_height:r}),tZ=(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(a),u_merc_matrix:n,u_zoom_transition:o,u_merc_center:s,u_image0:0,u_frustum_tl:l,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:c,u_globe_pos:d,u_globe_radius:p,u_viewport:f,u_grid_matrix:_?Float32Array.from(_):new Float32Array(9),u_skirt_height:m});function t$(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}let tq=new class{constructor(){this.operations={}}newMorphing(i,r,n,a,o){if(i in this.operations){let r=this.operations[i];r.to.tileID.key!==n.tileID.key&&(r.queued=n)}else this.operations[i]={startTime:a,phase:0,duration:o,from:r,to:n,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;let r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(let r in this.operations){let n=this.operations[r];for(n.phase=(i-n.startTime)/n.duration;n.phase>
57=1||!this._validOp(n);)if(!this._nextOp(n,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}},tW={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function tX(i){return 6*Math.pow(1.5,22-i)}let tH=i=>({u_matrix:i});function tY(r,n,a,o,s){if(s>0){let l=i.exported.now(),h=(l-r.timeAdded)/s,u=n?(l-n.timeAdded)/s:-1,c=a.getSource(),d=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!n||Math.abs(n.tileID.overscaledZ-d)>Math.abs(r.tileID.overscaledZ-d),f=p&&r.refreshedUponExpiration?1:i.clamp(p?h:1-u,0,1);return r.refreshedUponExpiration&&h>=1&&(r.refreshedUponExpiration=!1),n?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}class tK extends i.SourceCache{constructor(i){let r=eL("mock-dem",{type:"raster-dem",maxzoom:i.transform.maxZoom},new R(eU(),null),i.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class tJ extends i.SourceCache{constructor(i){let r=eL("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new R(eU(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,n,a){if(r.freezeTileCoverage)return;this.transform=r;let o=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((n,a)=>{if(n[a.key]="",!this._tiles[a.key]){let n=new i.Tile(a,this._source.tileSize*a.overscaleFactor(),r.tileZoom);n.state="loaded",this._tiles[a.key]=n}return n},{});for(let i in this._tiles)i in o||(this.freeFBO(i),this._tiles[i].unloadVectorData(),delete this._tiles[i])}freeFBO(i){let r=this.proxyCachedFBO[i];if(void 0!==r){let n=Object.values(r);this.renderCachePool.push(...n),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class tQ extends i.OverscaledTileID{constructor(i,r,n){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=n}}class t0 extends i.Elevation{constructor(r,n){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};let[a,o,s]=function(r){let n=new i.StructArrayLayout2i4,a=new i.StructArrayLayout3ui6;n.reserve(17161),a.reserve(33800);let o=i.EXTENT/128,s=i.EXTENT+o/2,l=s+o;for(let r=-o;r<l;r+=o)for(let a=-o;a<l;a+=o){let o=a<0||a>s||r<0||r>s?24575:0,l=i.clamp(Math.round(a),0,i.EXTENT),h=i.clamp(Math.round(r),0,i.EXTENT);n.emplaceBack(l+o,h)}let h=(i,r)=>{let n=131*r+i;a.emplaceBack(n+1,n,n+131),a.emplaceBack(n+131,n+131+1,n+1)};for(let i=1;i<129;i++)for(let r=1;r<129;r++)h(r,i);return[0,129].forEach(i=>{for(let r=0;r<130;r++)h(r,i),h(i,r)}),[n,a,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(a,i.posAttributes.members),this.gridIndexBuffer=l.createIndexBuffer(o),this.gridSegments=i.SegmentVector.simpleSegment(0,0,a.length,o.length),this.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,a.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new tJ(n.map),this.orthoMatrix=i.create(),i.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,i.EXTENT,0,i.EXTENT,0,1);let h=l.gl;this._overlapStencilMode=new i.StencilMode({func:h.GEQUAL,mask:255},0,255,h.KEEP,h.KEEP,h.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new tK(n.map)}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),i.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=i,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,n,a){if(r&&r.terrain){this._style!==r&&(this.style=r),this.enabled=!0;let o=r.terrain.properties;this.sourceCache=0===r.terrain.drapeRenderMode?this._mockSourceCache:r._getSourceCache(o.get("source")),this._exaggeration=o.get("exaggeration");let s=()=>{this.sourceCache.used&&i.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
58This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let r=this.getScaledDemTileSize();this.sourceCache.update(n,r,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,s(),this._initializing=!0),s(),n.updateElevation(!0,a),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){let r=this.renderCacheEfficiency(this._style);
58this._style.map._optimizeForTerrain||100!==r.efficiency&&i.warnOnce(`Terrain render cache efficiency is not optimal (${r.efficiency}%) and performance
59                may be affected negatively, consider placing all background, fill and line layers before layer
60                with id '${r.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(i){i.coord&&"source"===i.dataType?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(let i in this._style._sourceCaches)this._style._sourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(i=>i.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){let i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let n=this.proxySourceCache,a=this.painter.transform;this._initializing&&(this._initializing=0===a._centerAltitude&&-1===this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(a.center),-1),this._emptyDEMTextureDirty=!this._initializing);let o=this.proxyCoords=n.getIds().map(i=>{let r=n.getTileByID(i).tileID;return r.projMatrix=a.calculateProjMatrix(r.toUnwrapped()),r});(function(r,n){let a=n.transform.pointCoordinate(n.transform.getCameraPoint()),o=new i.pointGeometry(a.x,a.y);r.sort((r,n)=>{if(n.overscaledZ-r.overscaledZ)return n.overscaledZ-r.overscaledZ;let a=new i.pointGeometry(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=new i.pointGeometry(n.canonical.x+(1<<n.canonical.z)*n.wrap,n.canonical.y),l=o.mult(1<<r.canonical.z);return l.x-=.5,l.y-=.5,l.distSqr(a)-l.distSqr(s)})})(o,this.painter),this._previousZoom=a.zoom;let s=this.proxyToSource||{};this.proxyToSource={},o.forEach(i=>{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};let l=this._style._sourceCaches;for(let i in l){let n=l[i];if(!n.used||(n!==this.sourceCache&&this.resetTileLookupCache(n.id),this._setupProxiedCoordsForOrtho(n,r[i],s),n.usedForTerrain))continue;let a=r[i];n.getSource().reparseOverscaled&&this._assignTerrainTiles(a)}this.proxiedCoords[n.id]=o.map(i=>new tQ(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(o),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(s),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();let h={};for(let i of(this._visibleDemTiles=[],this.proxyCoords)){let r=this.terrainTileForTile[i.key];if(!r)continue;let n=r.tileID.key;n in h||(this._visibleDemTiles.push(r),h[n]=n)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;let r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){let i=this.painter.context,r=i.gl;for(let n in this.terrainTileForTile){let a=this.terrainTileForTile[n],o=a.dem;o&&(!a.demTexture||a.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),tN(this.painter,a,o))}}_prepareDemTileUniforms(i,r,n,a){if(!r||null==r.demTexture)return!1;let o=i.tileID.canonical,s=Math.pow(2,r.tileID.canonical.z-o.z),l=a||"";return n[`u_dem_tl${l}`]=[o.x*s%1,o.y*s%1],n[`u_dem_scale${l}`]=s,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){let r=this.painter.context,n=r.gl;if(!this._emptyDepthBufferTexture){let a=new i.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new i.Texture(r,a,n.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let i=0,r=this._visibleDemTiles.reduce((r,n)=>{if(!n.dem)return r;let a=n.dem.tree.minimums[0];return a>0&&i++,r+a},0);return i?r/i:0}_updateEmptyDEMTexture(){let r=this.painter.context,n=r.gl;r.activeTexture.set(n.TEXTURE2);let a=this._getLoadedAreaMinimum(),o=new i.RGBAImage({width:1,height:1},new Uint8Array(i.DEMData.pack(a,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(o,{premultiply:!1}):s=this._emptyDEMTexture=new i.Texture(r,o,n.RGBA,{premultiply:!1}),s}setupElevationDraw(r,n,a){var o;let s=this.painter.context,l=s.gl,h=(o=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(o),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});h.u_dem_size=this.sourceCache.getSource().tileSize,h.u_exaggeration=this.exaggeration();let u=null,c=null,d=1;if(a&&a.morphing&&this._useVertexMorphing){let i=a.morphing.srcDemTile,n=a.morphing.dstDemTile;
60d=a.morphing.phase,i&&n&&(this._prepareDemTileUniforms(r,i,h,"_prev")&&(c=i),this._prepareDemTileUniforms(r,n,h)&&(u=n))}if(c&&u?(s.activeTexture.set(l.TEXTURE2),u.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),s.activeTexture.set(l.TEXTURE4),c.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),h.u_dem_lerp=d):(u=this.terrainTileForTile[r.tileID.key],s.activeTexture.set(l.TEXTURE2),(this._prepareDemTileUniforms(r,u,h)?u.demTexture:this.emptyDEMTexture).bind(l.NEAREST,l.CLAMP_TO_EDGE)),s.activeTexture.set(l.TEXTURE3),a&&a.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),this._depthFBO&&(h.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),h.u_depth_size_inv=[1,1]),a&&a.useMeterToDem&&u){let r=(1<<u.tileID.canonical.z)*i.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;h.u_meter_to_dem=r}if(a&&a.labelPlaneMatrixInv&&(h.u_label_plane_matrix_inv=a.labelPlaneMatrixInv),n.setTerrainUniformValues(s,h),"globe"===this.painter.transform.projection.name){let i=this.globeUniformValues(this.painter.transform,r.tileID.canonical,a&&a.useDenormalizedUpVectorScale);n.setGlobeUniformValues(s,i)}}globeUniformValues(r,n,a){let o=r.projection;return{u_tile_tl_up:o.upVector(n,0,0),u_tile_tr_up:o.upVector(n,i.EXTENT,0),u_tile_br_up:o.upVector(n,i.EXTENT,i.EXTENT),u_tile_bl_up:o.upVector(n,0,i.EXTENT),u_tile_up_scale:a?i.globeMetersToEcef(1):o.upVectorScale(n,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){let n=this.painter,a=this.painter.context;0!==r.length&&(a.bindFramebuffer.set(null),a.viewport.set([0,0,n.width,n.height]),n.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(r,n,a,o,s){if("globe"===r.transform.projection.name)!function(r,n,a,o,s){let l,h;let u=r.context,c=u.gl,d=r.options.showTerrainWireframe?2:0,p=r.transform,f=i.globeUseCustomAntiAliasing(r,u,p),m=(i,n)=>{if(h===i)return;let a=[tW[i],"PROJECTION_GLOBE_VIEW"];f&&a.push("CUSTOM_ANTIALIASING"),n&&a.push(tW[d]),l=r.useProgram("globeRaster",null,a),h=i},_=r.colorModeForRenderPass(),g=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tq.update(s);let y=i.calculateGlobeMercatorMatrix(p),x=[i.mercatorXfromLng(p.center.lng),i.mercatorYfromLat(p.center.lat)],v=r.globeSharedBuffers,b=[p.width*i.exported.devicePixelRatio,p.height*i.exported.devicePixelRatio],w=Float32Array.from(p.globeMatrix),T={useDenormalizedUpVectorScale:!0};if((d?[!1,!0]:[!1]).forEach(d=>{let p=r.transform,f=tX(p.zoom)*n.exaggeration();h=-1;let E=d?c.LINES:c.TRIANGLES;for(let h of o){let o=a.getTile(h),S=i.StencilMode.disabled,M=n.prevTerrainTileForTile[h.key],A=n.terrainTileForTile[h.key];t$(M,A)&&tq.newMorphing(h.key,M,A,s,250),u.activeTexture.set(c.TEXTURE0),o.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let I=tq.getMorphValuesForProxy(h.key),C=I?1:0;I&&i.extend$1(T,{morphing:{srcDemTile:I.from,dstDemTile:I.to,phase:i.easeCubicInOut(I.phase)}});let z=i.tileCornersToBounds(h.canonical),k=i.getLatitudinalLod(z.getCenter().lat),D=i.getGridMatrix(h.canonical,z,k,p.worldSize/p._pixelsPerMercatorPixel),P=i.globeNormalizeECEF(i.globeTileBounds(h.canonical)),L=tZ(p.projMatrix,w,y,P,i.globeToMercatorTransition(p.zoom),x,p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.globeCenterInViewSpace,p.globeRadius,b,f,D);if(m(C,d),n.setupElevationDraw(o,l,T),r.prepareDrawProgram(u,l,h.toUnwrapped()),v){let[n,a,o]=d?v.getWirefameBuffers(r.context,k):v.getGridBuffers(k,0!==f);l.draw(u,E,g,S,_,i.CullFaceMode.backCCW,L,"globe_raster",n,a,o)}}}),v){let s=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let h of(f&&s.push("CUSTOM_ANTIALIASING"),l=r.useProgram("globeRaster",null,s),o)){let{x:o,y:s,z:d}=h.canonical,f=0===s,m=s===(1<<d)-1,[y,w,E,S]=v.getPoleBuffers(d);if(S&&(f||m)){let s=a.getTile(h);u.activeTexture.set(c.TEXTURE0),s.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let v=i.globePoleMatrixForTile(d,o,p),M=i.globeNormalizeECEF(i.globeTileBounds(h.canonical)),A=(r,n)=>r.draw(u,c.TRIANGLES,g,i.StencilMode.disabled,_,i.CullFaceMode.disabled,tZ(p.projMatrix,v,v,M,0,x,p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.globeCenterInViewSpace,p.globeRadius,b,0),"globe_pole_raster",n,E,S);n.setupElevationDraw(s,l,T),r.prepareDrawProgram(u,l,h.toUnwrapped()),f&&A(l,y),m&&(v=i.scale(i.create(),v,[1,-1,1]),A(l,w))}}}}(r,n,a,o,s);else{let l,h;let u=r.context,c=u.gl,d=r.options.showTerrainWireframe?2:0,p=(i,n)=>{if(h===i)return;let a=[tW[i]];n&&a.push(tW[d]),l=r.useProgram("terrainRaster",null,a),h=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tq.update(s);let _=r.transform,g=tX(_.zoom)*n.exaggeration();
60(d?[!1,!0]:[!1]).forEach(d=>{h=-1;let y=d?c.LINES:c.TRIANGLES,[x,v]=d?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments];for(let h of o){let o;let b=a.getTile(h),w=i.StencilMode.disabled,T=n.prevTerrainTileForTile[h.key],E=n.terrainTileForTile[h.key];t$(T,E)&&tq.newMorphing(h.key,T,E,s,250),u.activeTexture.set(c.TEXTURE0),b.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST);let S=tq.getMorphValuesForProxy(h.key),M=S?1:0;S&&(o={morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:i.easeCubicInOut(S.phase)}});let A=tG(h.projMatrix,!function(i,r){let n=1<<i.z;return!r&&(0===i.x||i.x===n-1)||0===i.y||i.y===n-1}(h.canonical,_.renderWorldCopies)?g:g/10);p(M,d),n.setupElevationDraw(b,l,o),r.prepareDrawProgram(u,l,h.toUnwrapped()),l.draw(u,y,m,w,f,i.CullFaceMode.backCCW,A,"terrain_raster",n.gridBuffer,x,v)}})}}(n,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(0===this._drapedRenderBatches.length)return r+1;this.renderingToTexture=!0;let n=this.painter,a=this.painter.context,o=this.proxySourceCache,s=this.proxiedCoords[o.id],l=this._drapedRenderBatches.shift(),h=[],u=n.style.order,c=0;for(let d of s){let s;let p=o.getTileByID(d.proxyTileKey),f=o.proxyCachedFBO[d.key]?o.proxyCachedFBO[d.key][r]:void 0,m=void 0!==f?o.renderCache[f]:this.pool[c++],_=void 0!==f;if(p.texture=m.tex,_&&!m.dirty){h.push(p.tileID);continue}a.bindFramebuffer.set(m.fb.framebuffer),this.renderedToTile=!1,m.dirty&&(a.clear({color:i.Color.transparent,stencil:0}),m.dirty=!1);for(let i=l.start;i<=l.end;++i){let r=n.style._layers[u[i]];if(r.isHidden(n.transform.zoom))continue;let o=n.style._getLayerSourceCache(r),l=o?this.proxyToSource[d.key][o.id]:[d];l&&(a.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),n.renderLayer(n,o,r,l))}this.renderedToTile?(m.dirty=!0,h.push(p.tileID)):_||--c,5===c&&(c=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,a.bindFramebuffer.set(null),a.viewport.set([0,0,n.width,n.height]),l.end+1}postRender(){}renderCacheEfficiency(i){let r=i.order.length;if(0===r)return{efficiency:100};let n,a=0,o=0,s=!1;for(let l=0;l<r;++l){let r=i._layers[i.order[l]];this._style.isLayerDraped(r)?(s&&++a,++o):s||(s=!0,n=r.id)}return 0===o?{efficiency:100}:{efficiency:100*(1-a/o),firstUndrapedLayer:n}}getMinElevationBelowMSL(){let i=0;return this._visibleDemTiles.filter(i=>i.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,n){if(!this._visibleDemTiles)return null;let a=this._visibleDemTiles.filter(i=>i.dem).map(a=>{let o=a.tileID,s=1<<o.overscaledZ,{x:l,y:h}=o.canonical,u=l/s,c=(l+1)/s,d=h/s,p=(h+1)/s;return{minx:u,miny:d,maxx:c,maxy:p,t:a.dem.tree.raycastRoot(u,d,c,p,i,r,n),tile:a}});for(let o of(a.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),a)){if(null==o.t)break;let a=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,i,r,n);if(null!=a)return a}return null}_createFBO(){let r=this.painter.context,n=r.gl,a=this.drapeBufferSize;r.activeTexture.set(n.TEXTURE0);let o=new i.Texture(r,{width:a[0],height:a[1],data:null},n.RGBA);o.bind(n.LINEAR,n.CLAMP_TO_EDGE);let s=r.createFramebuffer(a[0],a[1],!1);return s.colorAttachment.set(o.texture),s.depthAttachment=new eM(r,s.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,a[0],a[1]),this._stencilRef=0,s.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):s.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&!r.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:s,tex:o,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(let i in this._style._sourceCaches)if(this._style._sourceCaches[i].hasTransition())return!0;return this._style.order.some(i=>{let r=this._style._layers[i],n=r.isHidden(this.painter.transform.zoom);return"custom"===r.type?!n&&r.shouldRedrape():!n&&r.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(let i of this._style._getSources())if(i instanceof eC){r=!0;break}if(!r)return;let n={};for(let r=0;r<this._style.order.length;++r){let a=this._style._layers[this._style.order[r]],o=this._style._getLayerSourceCache(a);if(o&&!n[o.id]&&!a.isHidden(this.painter.transform.zoom)&&"line"===a.type&&a.widthExpression() instanceof i.ZoomDependentExpression)for(let i of(n[o.id]=!0,this.proxyCoords)){let r=this.proxyToSource[i.key][o.id];if(r)for(let i of r)this._clearRenderCacheForTile(o.id,i)}}}_clearRasterLayersFromRenderCache(){let i=!1;for(let r in this._style._sourceCaches)if(this._style._sourceCaches[r]._source instanceof ez){i=!0;break}if(!i)return;let r={};for(let i=0;i<this._style.order.length;++i){let n=this._style._layers[this._style.order[i]],a=this._style._getLayerSourceCache(n);if(!a||r[a.id]||n.isHidden(this.painter.transform.zoom)||"raster"!==n.type)continue;let o=n.paint.get("raster-fade-duration");for(let i of this.proxyCoords){let r=this.proxyToSource[i.key][a.id];if(r)for(let i of r){let r=tY(a.getTile(i),a.findLoadedParent(i,0),a,this.painter.transform,o);(1!==r.opacity||0!==r.mix)&&this._clearRenderCacheForTile(a.id,i)}}}}_setupDrapedRenderBatches(){let i=this._style.order,r=i.length;if(0===r)return;let n=[],a,o=0,s=this._style._layers[i[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<r;)s=this._style._layers[i[o]];for(;o<r;++o){let r=this._style._layers[i[o]];r.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(r)?void 0===a&&(a=o):void 0!==a&&(n.push({start:a,end:o-1}),a=void 0))}void 0!==a&&n.push({start:a,end:o-1}),this._drapedRenderBatches=n}_setupRenderCache(i){let r=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,r.renderCache.length>r.renderCachePool.length){let i=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let n=0;n<i.length;++n){let a=Object.values(i[n]);r.renderCachePool.push(...a)}}return}this._clearRasterLayersFromRenderCache();let n=this.proxyCoords,a=this._tilesDirty;for(let o=n.length-1;o>=0;o--){let s=n[o];if(r.getTileByID(s.key),void 0!==r.proxyCachedFBO[s.key]){let n=i[s.key],o=this.proxyToSource[s.key],l=0;for(let i in o){let r=o[i],s=n[i];if(!s||s.length!==r.length||r.some((r,n)=>r!==s[n]||a[i]&&a[i].hasOwnProperty(r.key))){l=-1;break}++l}for(let i in r.proxyCachedFBO[s.key])r.renderCache[r.proxyCachedFBO[s.key][i]].dirty=l<0||l!==Object.values(n).length}}let o=[...this._drapedRenderBatches];for(let i of(o.sort((i,r)=>r.end-r.start-(i.end-i.start)),o))for(let a of n){if(r.proxyCachedFBO[a.key])continue;let n=r.renderCachePool.pop();void 0===n&&r.renderCache.length<50&&(n=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==n&&(r.proxyCachedFBO[a.key]={},r.proxyCachedFBO[a.key][i.start]=n,r.renderCache[n].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,n,a){let o;if(!a||!this._sourceTilesOverlap[a.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let s=this.painter.context,l=s.gl;if(r.length<=1)return void(this._overlapStencilType=!1);
60if(n.isTileClipped())o=r.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,n.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(r,n){let a=this.painter,o=this.painter.context,s=o.gl;a._tileClippingMaskIDs={},o.setColorMode(i.ColorMode.disabled),o.setDepthMode(i.DepthMode.disabled);let l=a.useProgram("clippingMask");for(let h of r){let r=a._tileClippingMaskIDs[h.key]=--n;l.draw(o,s.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:s.ALWAYS,mask:0},r,255,s.KEEP,s.KEEP,s.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tH(h.projMatrix),"$clipping",a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}}pointCoordinate(r){let n=this.painter.transform;if(r.x<0||r.x>n.width||r.y<0||r.y>n.height)return null;let a=[r.x,r.y,1,1];i.transformMat4$1(a,a,n.pixelMatrixInverse),i.scale$1(a,a,1/a[3]),a[0]/=n.worldSize,a[1]/=n.worldSize;let o=n._camera.position,s=i.mercatorZfromAltitude(1,n.center.lat),l=[o[0],o[1],o[2]/s,0],h=i.subtract([],a.slice(0,3),l);i.normalize(h,h);let u=this.raycast(l,h,this._exaggeration);return null!==u&&u?(i.scaleAndAdd(l,l,h,u),l[3]=l[2],l[2]*=s,l):null}drawDepth(){let r=this.painter,n=r.context,a=this.proxySourceCache,o=Math.ceil(r.width),s=Math.ceil(r.height);if(this._depthFBO&&(this._depthFBO.width!==o||this._depthFBO.height!==s)&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){let r=n.gl,a=n.createFramebuffer(o,s,!0);n.activeTexture.set(r.TEXTURE0);let l=new i.Texture(n,{width:o,height:s,data:null},r.RGBA);l.bind(r.NEAREST,r.CLAMP_TO_EDGE),a.colorAttachment.set(l.texture);let h=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,o,s);a.depthAttachment.set(h),this._depthFBO=a,this._depthTexture=l}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,o,s]),function(r,n,a,o){if("globe"===r.transform.projection.name)return;let s=r.context,l=s.gl;s.clear({depth:1});let h=r.useProgram("terrainDepth"),u=new i.DepthMode(l.LESS,i.DepthMode.ReadWrite,r.depthRangeFor3D);for(let r of o){let o=a.getTile(r),c=tG(r.projMatrix,0);n.setupElevationDraw(o,h),h.draw(s,l.TRIANGLES,u,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,c,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(r,this,a,this.proxyCoords)}_setupProxiedCoordsForOrtho(i,r,n){if(i.getSource() instanceof eD)return this._setupProxiedCoordsForImageSource(i,r,n);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};let a=this.proxiedCoords[i.id]=[],o=this.proxyCoords;for(let r=0;r<o.length;r++){let s=o[r],l=this._findTileCoveringTileID(s,i);if(l){let r=this._createProxiedId(s,l,n[s.key]&&n[s.key][i.id]);a.push(r),this.proxyToSource[s.key][i.id]=[r]}}let s=!1;for(let o=0;o<r.length;o++){let l=i.getTile(r[o]);if(!l||!l.hasData())continue;let h=this._findTileCoveringTileID(l.tileID,this.proxySourceCache);if(h&&h.tileID.canonical.z!==l.tileID.canonical.z){let r=this.proxyToSource[h.tileID.key][i.id],o=this._createProxiedId(h.tileID,l,n[h.tileID.key]&&n[h.tileID.key][i.id]);r?r.splice(r.length-1,0,o):this.proxyToSource[h.tileID.key][i.id]=[o],a.push(o),s=!0}}this._sourceTilesOverlap[i.id]=s}_setupProxiedCoordsForImageSource(r,n,a){if(!r.getSource().loaded())return;let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords,l=r.getSource(),h=new i.pointGeometry(l.tileID.x,l.tileID.y)._div(1<<l.tileID.z),u=l.coordinates.map(i.MercatorCoordinate.fromLngLat).reduce((i,r)=>
60(i.min.x=Math.min(i.min.x,r.x-h.x),i.min.y=Math.min(i.min.y,r.y-h.y),i.max.x=Math.max(i.max.x,r.x-h.x),i.max.y=Math.max(i.max.y,r.y-h.y),i),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(r,n)=>{let a=r.wrap+r.canonical.x/(1<<r.canonical.z),o=r.canonical.y/(1<<r.canonical.z),s=i.EXTENT/(1<<r.canonical.z),l=n.wrap+n.canonical.x/(1<<n.canonical.z),h=n.canonical.y/(1<<n.canonical.z);return a+s<l+u.min.x||a>l+u.max.x||o+s<h+u.min.y||o>h+u.max.y};for(let i=0;i<s.length;i++){let l=s[i];for(let i=0;i<n.length;i++){let s=r.getTile(n[i]);if(!s||!s.hasData()||c(l,s.tileID))continue;let h=this._createProxiedId(l,s,a[l.key]&&a[l.key][r.id]),u=this.proxyToSource[l.key][r.id];u?u.push(h):this.proxyToSource[l.key][r.id]=[h],o.push(h)}}}_createProxiedId(r,n,a){let o=this.orthoMatrix;if(a){let i=a.find(i=>i.key===n.tileID.key);if(i)return i}if(n.tileID.key!==r.key){let a,s,l;let h=r.canonical.z-n.tileID.canonical.z;o=i.create();let u=n.tileID.wrap-r.wrap<<r.overscaledZ;h>0?(s=(a=i.EXTENT>>h)*((n.tileID.canonical.x<<h)-r.canonical.x+u),l=a*((n.tileID.canonical.y<<h)-r.canonical.y)):(a=i.EXTENT<<-h,s=i.EXTENT*(n.tileID.canonical.x-(r.canonical.x+u<<-h)),l=i.EXTENT*(n.tileID.canonical.y-(r.canonical.y<<-h))),i.ortho(o,0,a,0,a,0,1),i.translate(o,o,[s,l,0])}return new tQ(n.tileID,r.key,o)}_findTileCoveringTileID(r,n){let a=n.getTile(r);if(a&&a.hasData())return a;let o=this._findCoveringTileCache[n.id],s=o[r.key];if((a=s?n.getTileByID(s):null)&&a.hasData()||null===s)return a;let l=a?a.tileID:r,h=l.overscaledZ,u=n.getSource().minzoom,c=[];if(!s){let o=n.getSource().maxzoom;if(r.canonical.z>=o){let a=r.canonical.z-o;n.getSource().reparseOverscaled?(h=Math.max(r.canonical.z+2,n.transform.tileZoom),l=new i.OverscaledTileID(h,r.wrap,o,r.canonical.x>>a,r.canonical.y>>a)):0!==a&&(h=o,l=new i.OverscaledTileID(h,r.wrap,o,r.canonical.x>>a,r.canonical.y>>a))}l.key!==r.key&&(c.push(l.key),a=n.getTile(l))}let d=i=>{c.forEach(r=>{o[r]=i}),c.length=0};for(h-=1;h>=u&&(!a||!a.hasData());h--){a&&d(a.tileID.key);let i=l.calculateScaledKey(h);if((a=n.getTileByID(i))&&a.hasData())break;let r=o[i];if(null===r)break;void 0===r?c.push(i):a=n.getTileByID(r)}return d(a?a.tileID.key:null),a&&a.hasData()?a:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let n=this._tilesDirty[i];n||(n=this._tilesDirty[i]={}),n[r.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){let r=function(r){let n=0,a=new i.StructArrayLayout2ui4;for(let i=1;i<129;i++){for(let r=1;r<129;r++)n=131*i+r,a.emplaceBack(n,n+1),a.emplaceBack(n,n+131),a.emplaceBack(n+1,n+131),128===i&&a.emplaceBack(n+131,n+131+1);a.emplaceBack(n+1,n+1+131)}return a}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(r),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class t1{static cacheKey(i,r,n,a){let o=`${r}${a?a.cacheKey:""}`;for(let r of n)i.usedDefines.includes(r)&&(o+=`/${r}`);return o}constructor(r,n,a,o,s,l){let h=r.gl;this.program=h.createProgram();let u=function(i){let r=[];for(let n=0;n<i.length;n++){if(null===i[n])continue;let a=i[n].split(" ");r.push(a.pop())}return r}(a.staticAttributes),c=o?o.getBinderAttributes():[],d=u.concat(c),p=o?o.defines():[];p=p.concat(l.map(i=>`#define ${i}`));let f=r.isWebGL2?"#version 300 es\n":"",m=f+p.concat(r.extStandardDerivatives&&0===f.length?"#extension GL_OES_standard_derivatives : enable\n".concat(tB):tB,tB,tA,tR.fragmentSource,tP.fragmentSource,a.fragmentSource).join("\n"),_=f+p.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",tA,tR.vertexSource,tP.vertexSource,tD.vertexSource,a.vertexSource).join("\n"),g=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);h.shaderSource(g,m),h.compileShader(g),h.attachShader(this.program,g);let y=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())this.failedToCreate=!0;else{h.shaderSource(y,_),h.compileShader(y),h.attachShader(this.program,y),this.attributes={},this.numAttributes=d.length;for(let i=0;i<this.numAttributes;i++)d[i]&&(h.bindAttribLocation(this.program,i,d[i]),this.attributes[d[i]]=i);h.linkProgram(this.program),h.deleteShader(y),h.deleteShader(g),this.fixedUniforms=s(r),this.binderUniforms=o?o.getUniforms(r):[],l.includes("TERRAIN")&&(this.terrainUniforms={u_dem:new i.Uniform1i(r),u_dem_prev:new i.Uniform1i(r),u_dem_unpack:new i.Uniform4f(r),u_dem_tl:new i.Uniform2f(r),u_dem_scale:new i.Uniform1f(r),u_dem_tl_prev:new i.Uniform2f(r),u_dem_scale_prev:new i.Uniform1f(r),u_dem_size:new i.Uniform1f(r),u_dem_lerp:new i.Uniform1f(r),u_exaggeration:new i.Uniform1f(r),u_depth:new i.Uniform1i(r),u_depth_size_inv:new i.Uniform2f(r),u_meter_to_dem:new i.Uniform1f(r),u_label_plane_matrix_inv:new i.UniformMatrix4f(r)}),l.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new i.Uniform3f(r),u_tile_tr_up:new i.Uniform3f(r),u_tile_br_up:new i.Uniform3f(r),u_tile_bl_up:new i.Uniform3f(r),u_tile_up_scale:new i.Uniform1f(r)}),l.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new i.UniformMatrix4f(r),u_fog_range:new i.Uniform2f(r),u_fog_color:new i.Uniform4f(r),u_fog_horizon_blend:new i.Uniform1f(r),u_fog_temporal_offset:new i.Uniform1f(r),u_frustum_tl:new i.Uniform3f(r),u_frustum_tr:new i.Uniform3f(r),u_frustum_br:new i.Uniform3f(r),u_frustum_bl:new i.Uniform3f(r),u_globe_pos:new i.Uniform3f(r),u_globe_radius:new i.Uniform1f(r),u_globe_transition:new i.Uniform1f(r),u_is_globe:new i.Uniform1i(r),u_viewport:new i.Uniform2f(r)})}}setTerrainUniformValues(i,r){if(!this.terrainUniforms)return;let n=this.terrainUniforms;if(!this.failedToCreate)for(let a in i.program.set(this.program),r)n[a]&&n[a].set(this.program,a,r[a])}setGlobeUniformValues(i,r){if(!this.globeUniforms)return;let n=this.globeUniforms;if(!this.failedToCreate)for(let a in i.program.set(this.program),r)n[a]&&n[a].set(this.program,a,r[a])}setFogUniformValues(i,r){if(!this.fogUniforms)return;let n=this.fogUniforms;if(!this.failedToCreate)for(let a in i.program.set(this.program),r)n[a].set(this.program,a,r[a])}draw(i,r,n,a,o,s,l,h,u,c,d,p,f,m,_){let g=i.gl;if(this.failedToCreate)return;for(let r of(i.program.set(this.program),i.setDepthMode(n),i.setStencilMode(a),i.setColorMode(o),i.setCullFace(s),Object.keys(this.fixedUniforms)))this.fixedUniforms[r].set(this.program,r,l[r]);m&&m.setUniforms(this.program,i,this.binderUniforms,p,{zoom:f});let y={[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[r];for(let n of d.get()){let a=n.vaos||(n.vaos={});
60(a[h]||(a[h]=new tV)).bind(i,this,u,m?m.getPaintVertexBuffers():[],c,n.vertexOffset,_||[]),g.drawElements(r,n.primitiveLength*y,g.UNSIGNED_SHORT,n.primitiveOffset*y*2)}}}function t2(i,r){let n=Math.pow(2,r.tileID.overscaledZ),a=r.tileSize*Math.pow(2,i.transform.tileZoom)/n,o=a*(r.tileID.canonical.x+r.tileID.wrap*n),s=a*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_tile_units_to_pixels:1/B(r,1,i.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}let t3=i.create(),t5=(r,n,a,o,s,l,h,u,c,d,p)=>{let f=n.style.light,m=f.properties.get("position"),_=[m.x,m.y,m.z],g=i.create$1();"viewport"===f.properties.get("anchor")&&(i.fromRotation(g,-n.transform.angle),i.transformMat3(_,_,g));let y=f.properties.get("color"),x=n.transform,v={u_matrix:r,u_lightpos:_,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+a,u_opacity:o,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:t3,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:s,u_edge_radius:l};return"globe"===x.projection.name&&(v.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],v.u_zoom_transition=c,v.u_inv_rot_matrix=p,v.u_merc_center=d,v.u_up_dir=x.projection.upVector(new i.CanonicalTileID(0,0,0),d[0]*i.EXTENT,d[1]*i.EXTENT),v.u_height_lift=u),v},t4=(r,n,a,o,s,l,h,u,c,d,p,f)=>{let m=t5(r,n,a,o,s,l,h,c,d,p,f),_={u_height_factor:-Math.pow(2,h.overscaledZ)/u.tileSize/8};return i.extend(m,t2(n,u),_)},t6=i=>({u_matrix:i}),t8=(r,n,a)=>i.extend(t6(r),t2(n,a)),t9=(i,r)=>({u_matrix:i,u_world:r}),t7=(r,n,a,o)=>i.extend(t8(r,n,a),{u_world:o}),ie=i.create(),it=(r,n,a,o,s,l)=>{let h;let u=r.transform,c="globe"===u.projection.name;if("map"===l.paint.get("circle-pitch-alignment")){if(c){let r=i.globePixelsToTileUnits(u.zoom,n.canonical)*u._pixelsPerMercatorPixel;h=Float32Array.from([r,0,0,r])}else h=u.calculatePixelsToTileUnitsMatrix(a)}else h=new Float32Array([u.pixelsToGLUnits[0],0,0,u.pixelsToGLUnits[1]]);let d={u_camera_to_center_distance:u.cameraToCenterDistance,u_matrix:r.translatePosMatrix(n.projMatrix,a,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:h,u_inv_rot_matrix:ie,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){d.u_inv_rot_matrix=o,d.u_merc_center=s,d.u_tile_id=[n.canonical.x,n.canonical.y,1<<n.canonical.z],d.u_zoom_transition=i.globeToMercatorTransition(u.zoom);let r=s[0]*i.EXTENT,a=s[1]*i.EXTENT;d.u_up_dir=u.projection.upVector(new i.CanonicalTileID(0,0,0),r,a)}return d},ii=i=>{let r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r},ir=(r,n,a,o)=>{let s=i.EXTENT/a.tileSize;return{u_matrix:r,u_camera_to_center_distance:n.getCameraToCenterDistance(o),u_extrude_scale:[n.pixelsToGLUnits[0]/s,n.pixelsToGLUnits[1]/s]}},ia=(i,r,n=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:n}),io=i.create(),is=(r,n,a,o,s,l,h)=>{let u=r.transform,c="globe"===u.projection.name,d=c?i.globePixelsToTileUnits(u.zoom,n.canonical)*u._pixelsPerMercatorPixel:B(a,1,l),p={u_matrix:n.projMatrix,u_extrude_scale:d,u_intensity:h,u_inv_rot_matrix:io,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){p.u_inv_rot_matrix=o,p.u_merc_center=s,p.u_tile_id=[n.canonical.x,n.canonical.y,1<<n.canonical.z],p.u_zoom_transition=i.globeToMercatorTransition(u.zoom);let r=s[0]*i.EXTENT,a=s[1]*i.EXTENT;p.u_up_dir=u.projection.upVector(new i.CanonicalTileID(0,0,0),r,a)}return p},il=(i,r,n,a,o,s,l)=>{let h=i.transform,u=h.calculatePixelsToTileUnitsMatrix(r);return{u_matrix:ic(i,r,n,a),u_pixels_to_tile_units:u,u_device_pixel_ratio:s,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:id(n)?r.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:iu(r,i.transform),u_alpha_discard_threshold:0,u_trim_offset:l}},ih=(i,r,n,a,o)=>{let s=i.transform;return{u_matrix:ic(i,r,n,a),u_texsize:r.imageAtlasTexture.size,u_pixels_to_tile_units:s.calculatePixelsToTileUnitsMatrix(r),u_device_pixel_ratio:o,u_image:0,u_tile_units_to_pixels:iu(r,s),u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_alph
60a_discard_threshold:0}};function iu(i,r){return 1/B(i,1,r.tileZoom)}function ic(i,r,n,a){return i.translatePosMatrix(a||r.tileID.projMatrix,r,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}function id(i){let r=i.paint.get("line-dasharray").value;return r.value||"constant"!==r.kind}let ip=(i,r,n,a,o,s)=>{var l,h;return{u_matrix:i,u_tl_parent:r,u_scale_parent:n,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(h=o.paint.get("raster-saturation"))>0?1-1/(1.001-h):-h,u_contrast_factor:(l=o.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:function(i){let r=Math.sin(i*=Math.PI/180),n=Math.cos(i);return[(2*n+1)/3,(-Math.sqrt(3)*r-n+1)/3,(Math.sqrt(3)*r-n+1)/3]}(o.paint.get("raster-hue-rotate")),u_perspective_transform:s}},im=i.create(),i_=(r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y)=>{let x=s.transform,v={u_is_size_zoom_constant:+("constant"===r||"source"===r),u_is_size_feature_constant:+("constant"===r||"camera"===r),u_size_t:n?n.uSizeT:0,u_size:n?n.uSize:0,u_camera_to_center_distance:x.cameraToCenterDistance,u_rotate_symbol:+a,u_aspect_ratio:x.width/x.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:l,u_label_plane_matrix:h,u_coord_matrix:u,u_is_text:+c,u_pitch_with_map:+o,u_texsize:d,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:im,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:im,u_up_vector:[0,-1,0]};return"globe"===y.name&&(v.u_tile_id=[p.canonical.x,p.canonical.y,1<<p.canonical.z],v.u_zoom_transition=f,v.u_inv_rot_matrix=_,v.u_merc_center=m,v.u_camera_forward=x._camera.forward(),v.u_ecef_origin=i.globeECEFOrigin(x.globeMatrix,p.toUnwrapped()),v.u_tile_matrix=Float32Array.from(x.globeMatrix),v.u_up_vector=g),v},ig=(r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y,x)=>i.extend(i_(r,n,a,o,s,l,h,u,c,d,f,m,_,g,y,x),{u_gamma_scale:o?s.transform.cameraToCenterDistance*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+p}),iy=(r,n,a,o,s,l,h,u,c,d,p,f,m,_,g,y)=>i.extend(ig(r,n,a,o,s,l,h,u,!0,c,!0,p,f,m,_,g,y),{u_texsize_icon:d,u_texture_icon:1}),ix=(i,r,n)=>({u_matrix:i,u_opacity:r,u_color:n}),iv=(r,n,a,o,s)=>i.extend(function(i,r,n){let a=r.imageManager.getPattern(i.toString()),{width:o,height:s}=r.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,r.transform.tileZoom)/l,u=h*(n.tileID.canonical.x+n.tileID.wrap*l),c=h*n.tileID.canonical.y;return{u_image:0,u_pattern_tl:a.tl,u_pattern_br:a.br,u_texsize:[o,s],u_pattern_size:a.displaySize,u_tile_units_to_pixels:1/B(n,1,r.transform.tileZoom),u_pixel_coord_upper:[u>>16,c>>16],u_pixel_coord_lower:[65535&u,65535&c]}}(o,a,s),{u_matrix:r,u_opacity:n}),ib={fillExtrusion:r=>({u_matrix:new i.UniformMatrix4f(r),u_lightpos:new i.Uniform3f(r),u_lightintensity:new i.Uniform1f(r),u_lightcolor:new i.Uniform3f(r),u_vertical_gradient:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r),u_edge_radius:new i.Uniform1f(r),u_ao:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_up_dir:new i.Uniform3f(r),u_height_lift:new i.Uniform1f(r)}),fillExtrusionPattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_lightpos:new i.Uniform3f(r),u_lightintensity:new i.Uniform1f(r),u_lightcolor:new i.Uniform3f(r),u_vertical_gradient:new i.Uniform1f(r),u_height_factor:new i.Uniform1f(r),u_edge_radius:new i.Uniform1f(r),u_ao:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_up_dir:new i.Uniform3f(r),u_height_lift:new i.Uniform1f(r),u_image:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_tile_units_to_pixels:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r)}),fill:r=>({u_matrix:new i.UniformMatrix4f(r)}),fillPattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_image:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_tile_units_to_pixels:new i.Uniform1f(r)}),fillOutline:r=>({u_matrix:new i.UniformMatrix4f(r),u_world:new i.Uniform2f(r)}),fillOutlinePattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_world:new i.Uniform2f(r),u_image:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_tile_units_to_pixels:new i.Uniform1f(r)}),circle:r=>({u_camera_to_center_distance:new i.Uniform1f(r),u_extrude_scale:new i.UniformMatrix2f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_up_dir:new i.Uniform3f(r)}),collisionBox:r=>({u_matrix:new i.UniformMatrix4f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_extrude_scale:new i.Uniform2f(r)}),collisionCircle:r=>({u_matrix:new i.UniformMatrix4f(r),u_inv_matrix:new i.UniformMatrix4f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_viewport_size:new i.Uniform2f(r)}),debug:r=>
60({u_color:new i.UniformColor(r),u_matrix:new i.UniformMatrix4f(r),u_overlay:new i.Uniform1i(r),u_overlay_scale:new i.Uniform1f(r)}),clippingMask:r=>({u_matrix:new i.UniformMatrix4f(r)}),heatmap:r=>({u_extrude_scale:new i.Uniform1f(r),u_intensity:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_up_dir:new i.Uniform3f(r)}),heatmapTexture:r=>({u_image:new i.Uniform1i(r),u_color_ramp:new i.Uniform1i(r),u_opacity:new i.Uniform1f(r)}),hillshade:r=>({u_matrix:new i.UniformMatrix4f(r),u_image:new i.Uniform1i(r),u_latrange:new i.Uniform2f(r),u_light:new i.Uniform2f(r),u_shadow:new i.UniformColor(r),u_highlight:new i.UniformColor(r),u_accent:new i.UniformColor(r)}),hillshadePrepare:r=>({u_matrix:new i.UniformMatrix4f(r),u_image:new i.Uniform1i(r),u_dimension:new i.Uniform2f(r),u_zoom:new i.Uniform1f(r),u_unpack:new i.Uniform4f(r)}),line:r=>({u_matrix:new i.UniformMatrix4f(r),u_pixels_to_tile_units:new i.UniformMatrix2f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_units_to_pixels:new i.Uniform2f(r),u_dash_image:new i.Uniform1i(r),u_gradient_image:new i.Uniform1i(r),u_image_height:new i.Uniform1f(r),u_texsize:new i.Uniform2f(r),u_tile_units_to_pixels:new i.Uniform1f(r),u_alpha_discard_threshold:new i.Uniform1f(r),u_trim_offset:new i.Uniform2f(r)}),linePattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_texsize:new i.Uniform2f(r),u_pixels_to_tile_units:new i.UniformMatrix2f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_image:new i.Uniform1i(r),u_units_to_pixels:new i.Uniform2f(r),u_tile_units_to_pixels:new i.Uniform1f(r),u_alpha_discard_threshold:new i.Uniform1f(r)}),raster:r=>({u_matrix:new i.UniformMatrix4f(r),u_tl_parent:new i.Uniform2f(r),u_scale_parent:new i.Uniform1f(r),u_fade_t:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r),u_image0:new i.Uniform1i(r),u_image1:new i.Uniform1i(r),u_brightness_low:new i.Uniform1f(r),u_brightness_high:new i.Uniform1f(r),u_saturation_factor:new i.Uniform1f(r),u_contrast_factor:new i.Uniform1f(r),u_spin_weights:new i.Uniform3f(r),u_perspective_transform:new i.Uniform2f(r)}),symbolIcon:r=>({u_is_size_zoom_constant:new i.Uniform1i(r),u_is_size_feature_constant:new i.Uniform1i(r),u_size_t:new i.Uniform1f(r),u_size:new i.Uniform1f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_rotate_symbol:new i.Uniform1i(r),u_aspect_ratio:new i.Uniform1f(r),u_fade_change:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_label_plane_matrix:new i.UniformMatrix4f(r),u_coord_matrix:new i.UniformMatrix4f(r),u_is_text:new i.Uniform1i(r),u_pitch_with_map:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_camera_forward:new i.Uniform3f(r),u_tile_matrix:new i.UniformMatrix4f(r),u_up_vector:new i.Uniform3f(r),u_ecef_origin:new i.Uniform3f(r),u_texture:new i.Uniform1i(r)}),symbolSDF:r=>({u_is_size_zoom_constant:new i.Uniform1i(r),u_is_size_feature_constant:new i.Uniform1i(r),u_size_t:new i.Uniform1f(r),u_size:new i.Uniform1f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_rotate_symbol:new i.Uniform1i(r),u_aspect_ratio:new i.Uniform1f(r),u_fade_change:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_label_plane_matrix:new i.UniformMatrix4f(r),u_coord_matrix:new i.UniformMatrix4f(r),u_is_text:new i.Uniform1i(r),u_pitch_with_map:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_texture:new i.Uniform1i(r),u_gamma_scale:new i.Uniform1f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_camera_forward:new i.Uniform3f(r),u_tile_matrix:new i.UniformMatrix4f(r),u_up_vector:new i.Uniform3f(r),u_ecef_origin:new i.Uniform3f(r),u_is_halo:new i.Uniform1i(r)}),symbolTextAndIcon:r=>({u_is_size_zoom_constant:new i.Uniform1i(r),u_is_size_feature_constant:new i.Uniform1i(r),u_size_t:new i.Uniform1f(r),u_size:new i.Uniform1f(r),u_c
60amera_to_center_distance:new i.Uniform1f(r),u_rotate_symbol:new i.Uniform1i(r),u_aspect_ratio:new i.Uniform1f(r),u_fade_change:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_label_plane_matrix:new i.UniformMatrix4f(r),u_coord_matrix:new i.UniformMatrix4f(r),u_is_text:new i.Uniform1i(r),u_pitch_with_map:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_texsize_icon:new i.Uniform2f(r),u_texture:new i.Uniform1i(r),u_texture_icon:new i.Uniform1i(r),u_gamma_scale:new i.Uniform1f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_is_halo:new i.Uniform1i(r)}),background:r=>({u_matrix:new i.UniformMatrix4f(r),u_opacity:new i.Uniform1f(r),u_color:new i.UniformColor(r)}),backgroundPattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_opacity:new i.Uniform1f(r),u_image:new i.Uniform1i(r),u_pattern_tl:new i.Uniform2f(r),u_pattern_br:new i.Uniform2f(r),u_texsize:new i.Uniform2f(r),u_pattern_size:new i.Uniform2f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_tile_units_to_pixels:new i.Uniform1f(r)}),terrainRaster:tj,terrainDepth:tj,skybox:r=>({u_matrix:new i.UniformMatrix4f(r),u_sun_direction:new i.Uniform3f(r),u_cubemap:new i.Uniform1i(r),u_opacity:new i.Uniform1f(r),u_temporal_offset:new i.Uniform1f(r)}),skyboxGradient:r=>({u_matrix:new i.UniformMatrix4f(r),u_color_ramp:new i.Uniform1i(r),u_center_direction:new i.Uniform3f(r),u_radius:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r),u_temporal_offset:new i.Uniform1f(r)}),skyboxCapture:r=>({u_matrix_3f:new i.UniformMatrix3f(r),u_sun_direction:new i.Uniform3f(r),u_sun_intensity:new i.Uniform1f(r),u_color_tint_r:new i.Uniform4f(r),u_color_tint_m:new i.Uniform4f(r),u_luminance:new i.Uniform1f(r)}),globeRaster:r=>({u_proj_matrix:new i.UniformMatrix4f(r),u_globe_matrix:new i.UniformMatrix4f(r),u_normalize_matrix:new i.UniformMatrix4f(r),u_merc_matrix:new i.UniformMatrix4f(r),u_zoom_transition:new i.Uniform1f(r),u_merc_center:new i.Uniform2f(r),u_image0:new i.Uniform1i(r),u_grid_matrix:new i.UniformMatrix3f(r),u_skirt_height:new i.Uniform1f(r),u_frustum_tl:new i.Uniform3f(r),u_frustum_tr:new i.Uniform3f(r),u_frustum_br:new i.Uniform3f(r),u_frustum_bl:new i.Uniform3f(r),u_globe_pos:new i.Uniform3f(r),u_globe_radius:new i.Uniform1f(r),u_viewport:new i.Uniform2f(r)}),globeAtmosphere:r=>({u_frustum_tl:new i.Uniform3f(r),u_frustum_tr:new i.Uniform3f(r),u_frustum_br:new i.Uniform3f(r),u_frustum_bl:new i.Uniform3f(r),u_horizon:new i.Uniform1f(r),u_transition:new i.Uniform1f(r),u_fadeout_range:new i.Uniform1f(r),u_color:new i.Uniform4f(r),u_high_color:new i.Uniform4f(r),u_space_color:new i.Uniform4f(r),u_star_intensity:new i.Uniform1f(r),u_star_density:new i.Uniform1f(r),u_star_size:new i.Uniform1f(r),u_temporal_offset:new i.Uniform1f(r),u_horizon_angle:new i.Uniform1f(r),u_rotation_matrix:new i.UniformMatrix4f(r)})};function iw(r,n,a,s,l,h,u){let c=r.context,d=c.gl,p=r.transform,f=r.useProgram("collisionBox"),m=[],_=0,g=0;for(let o=0;o<s.length;o++){let y=s[o],x=n.getTile(y),v=x.getBucket(a);if(!v)continue;let b=function(i,r,n){if(r.projection.name===n.projection.name)return i.projMatrix;let a=n.clone();return a.setProjection(r.projection),te(a,r.getProjection(),i)}(y,v,p),w=b;0===l[0]&&0===l[1]||(w=r.translatePosMatrix(b,x,l,h));let T=u?v.textCollisionBox:v.iconCollisionBox,E=v.collisionCircleArray;if(E.length>0){let r=i.create(),n=w;i.mul(r,v.placementInvProjMatrix,p.glCoordMatrix),i.mul(r,r,v.placementViewportMatrix),m.push({circleArray:E,circleOffset:g,transform:n,invTransform:r,projection:v.getProjection()}),_+=E.length/4,g=_}T&&(r.terrain&&r.terrain.setupElevationDraw(x,f),f.draw(c,d.LINES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,ir(w,p,x,v.getProjection()),a.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,null,p.zoom,null,[T.collisionVertexBuffer,T.collisionVertexBufferExt]))}if(!u||!m.length)return;let y=r.useProgram("collisionCircle"),x=new i.StructArrayLayout2f1f2i16;x.resize(4*_),x._trim();let v=0;for(let i of m)for(let r=0;r<i.circleArray.length/4;r++){let n=4*r,a=i.circleArray[n+0],o=i.circleArray[n+1],s=i.circleArray[n+2],l=i.circleArray[n+3];x.emplace(v++,a,o,s,l,0),x.emplace(v++,a,o,s,l,1),x.emplace(v++,a,o,s,l,2),x.emplace(v++,a,o,s,l,3)}(!o||o.length<2*_)&&(o=function(r){let n=2*r,a=new i.StructArrayLayout3ui6;a.resize(n),a._trim();for(let i=0;i<n;i++){let r=6*i;a.uint16[r+0]=4*i+0,a.uint16[r+1]=4*i+1,a.uint16[r+2]=4*i+2,a.uint16[r+3]=4*i+2,a.uint16[r+4]=4*i+3,a.uint16[r+5]=4*i+0}return a}(_));let b=c.createIndexBuffer(o,!0),w=c.createVertexBuffer(x,i.collisionCircleLayout.members,!0);for(let n of m){let o={u_matrix:n.transform,u_inv_matrix:n.invTransform,u_camera_to_center_distance:p.getCameraToCenterDistance(n.projection),u_viewport_size:[p.width,p.height]};y.draw(c,d.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,o,a.id,w,b,i.SegmentVector.simpleSegment(0,2*n.circleOffset,n.circleArray.length,n.circleArray.length/2),null,p.zoom)}w.destroy(),b.destroy()}let iT=i.create();function iE(r,n,a,o,s,l,h,u,c,d,p,f){let m=r.context,_=m.gl,g=r.transform,y="map"===u,x="map"===c,v=y&&"point"!==a.layout.get("symbol-placement"),b=y&&!x&&!v,w=void 0!==a.layout.get("symbol-sort-key").constantOr(1),T=!1,E=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),S=[i.mercatorXfromLng(g.center.lng),i.mercatorYfromLat(g.center.lat)],M=a.layout.get("text-variable-anchor"),A="globe"===g.projection.name,I=[],C=[0,-1,0],z=C;for(let u of((A||g.mercatorFromTransition)&&!y&&(z=function(r){let n=r._camera.getWorldToCamera(r.worldSize,1),a=i.multiply([],n,r.globeMatrix);i.invert(a,a);let o=[0,0,0],s=[0,1,0,0];return i.transformMat4$1(s,s,a),o[0]=s[0],o[1]=s[1],o[2]=s[2],i.normalize(o,o),o}(g)),o)){let o;let c=n.getTile(u),p=c.getBucket(a);if(!p||"mercator"===p.projection.name&&A)continue;let f=s?p.text:p.icon;if(!f||p.fullyClipped||!f.segments.get().length)continue;let m=f.programConfigurations.get(a.id),E=s||p.sdfIcons,k=s?p.textSizeData:p.iconSizeData,D=x||0!==g.pitch,P=i.evaluateSizeForZoom(k,g.zoom),L,R,B,O,F=[0,0],U=null;if(s){if(R=c.glyphAtlasTexture,B=_.LINEAR,L=c.glyphAtlasTexture.size,p.iconsInText){F=c.imageAtlasTexture.size,U=c.imageAtlasTexture;let i="composite"===k.kind||"camera"===k.kind;O=D||r.options.rotating||r.options.zooming||i?_.LINEAR:_.NEAREST}}else{let i=1!==a.layout.get("icon-size").constantOr(0)||p.iconsNeedLinear;R=c.imageAtlasTexture,B=E||r.options.rotating||r.options.zooming||i||D?_.LINEAR:_.NEAREST,L=c.imageAtlasTexture.size}let V="globe"===p.projection.name,N=V?z:C,j=V?i.globeToMercatorTransition(g.zoom):0,G=tt(u,p.getProjection(),g),Z=g.calculatePixelsToTileUnitsMatrix(c),$=eY(G,c.tileID.canonical,x,y,g,p.getProjection(),Z),q=r.terrain&&x&&v?i.invert(i.create(),$):iT,W=eJ(G,c.tileID.canonical,x,y,g,p.getProjection(),Z),X=M&&p.hasTextData(),H="none"!==a.layout.get("icon-text-fit")&&X&&p.hasIconData();if(v){let n=g.elevation,a=n?n.getAtTileOffsetFunc(u,g.center.lat,g.worldSize,p.getProjection()):null,o=eK(G,c.tileID.canonical,x,y,g,p.getProjection(),Z);!function(r,n,a,o,s,l,h,u,c,d){let p=a.transform,f=o?r.textSizeData:r.iconSizeData,m=i.evaluateSizeForZoom(f,a.transform.zoom),_="globe"===p.projection.name,g=[256/a.width*2+1,256/a.height*2+1],y=o?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;y.clear();let x=null;_&&(x=o?r.text.globeExtVertexArray:r.icon.globeExtVertexArray);let v=r.lineVertexArray,b=o?r.text.placedSymbolArray:r.icon.placedSymbolArray,w=a.transform.width/a.transform.height,T,E=!1;for(let o=0;o<b.length;o++){let _=b.get(o),{numGlyphs:S,writingMode:M}=_;if(M!==i.WritingMode.vertical||E||T===i.WritingMode.horizontal||(E=!0),T=M,(_.hidden||M===i.WritingMode.vertical)&&!E){e8(S,y);continue}E=!1;let A=new i.pointGeometry(_.tileAnchorX,_.tileAnchorY),{x:I,y:C,z:z}=p.projection.projectTilePoint(A.x,A.y,d.canonical);if(c){let[i,r,n]=c(A);I+=i,C+=r,z+=n}let k=[I,C,z,1];if(i.transformMat4$1(k,k,n),!function(i,r){let n=i[0]/i[3],a=i[1]/i[3];return n>=-r[0]&&n<=r[0]&&a>=-r[1]&&a<=r[1]}(k,g)){e8(S,y);continue}let D=e0(a.transform.cameraToCenterDistance,k[3]),P=i.evaluateSizeForFeature
60(f,m,_),L=h?P/D:P*D,R=eQ(I,C,z,s);if(R[3]<=0){e8(S,y);continue}let B={},O=h?null:c,F=e3(_,L,!1,u,n,s,l,r.glyphOffsetArray,v,y,x,R,A,B,w,O,p.projection,d,h);E=F.useVertical,O&&F.needsFlipping&&(B={}),(F.notEnoughRoom||E||F.needsFlipping&&e3(_,L,!0,u,n,s,l,r.glyphOffsetArray,v,y,x,R,A,B,w,O,p.projection,d,h).notEnoughRoom)&&e8(S,y)}o?(r.text.dynamicLayoutVertexBuffer.updateData(y),x&&r.text.globeExtVertexBuffer.updateData(x)):(r.icon.dynamicLayoutVertexBuffer.updateData(y),x&&r.icon.globeExtVertexBuffer.updateData(x))}(p,G,r,s,o,W,x,d,a,u)}let Y=v||s&&M||H,K=r.translatePosMatrix(G,c,l,h),J=Y?iT:$,Q=r.translatePosMatrix(W,c,l,h,!0),ee=p.getProjection().createInversionMatrix(g,u.canonical),et=[];r.terrainRenderModeElevated()&&x&&et.push("PITCH_WITH_MAP_TERRAIN"),V&&et.push("PROJECTION_GLOBE_VIEW"),Y&&et.push("PROJECTED_POS_ON_VIEWPORT");let ei=E&&0!==a.paint.get(s?"text-halo-width":"icon-halo-width").constantOr(1);o=E?p.iconsInText?iy(k.kind,P,b,x,r,K,J,Q,L,F,u,j,S,ee,N,p.getProjection()):ig(k.kind,P,b,x,r,K,J,Q,s,L,!0,u,j,S,ee,N,p.getProjection()):i_(k.kind,P,b,x,r,K,J,Q,s,L,u,j,S,ee,N,p.getProjection());let er={program:r.useProgram(p.iconsInText&&s?"symbolTextAndIcon":E?"symbolSDF":"symbolIcon",m,et),buffers:f,uniformValues:o,atlasTexture:R,atlasTextureIcon:U,atlasInterpolation:B,atlasInterpolationIcon:O,isSDF:E,hasHalo:ei,tile:c,labelPlaneMatrixInv:q};if(w&&p.canOverlap)for(let r of(T=!0,f.segments.get()))I.push({segments:new i.SegmentVector([r]),sortKey:r.sortKey,state:er});else I.push({segments:f.segments,sortKey:0,state:er})}for(let i of(T&&I.sort((i,r)=>i.sortKey-r.sortKey),I)){let n=i.state;if(r.terrain&&r.terrain.setupElevationDraw(n.tile,n.program,{useDepthForOcclusion:!A,labelPlaneMatrixInv:n.labelPlaneMatrixInv}),m.activeTexture.set(_.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,_.CLAMP_TO_EDGE),n.atlasTextureIcon&&(m.activeTexture.set(_.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,_.CLAMP_TO_EDGE)),n.isSDF){let o=n.uniformValues;n.hasHalo&&(o.u_is_halo=1,iS(n.buffers,i.segments,a,r,n.program,E,p,f,o)),o.u_is_halo=0}iS(n.buffers,i.segments,a,r,n.program,E,p,f,n.uniformValues)}}function iS(r,n,a,o,s,l,h,u,c){let d=o.context,p=[r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer,r.globeExtVertexBuffer];s.draw(d,d.gl.TRIANGLES,l,h,u,i.CullFaceMode.disabled,c,a.id,r.layoutVertexBuffer,r.indexBuffer,n,a.paint,o.transform.zoom,r.programConfigurations.get(a.id),p)}function iM(r,n,a,o,s,l,h){let u,c,d,p,f;let m=r.context.gl,_=a.paint.get("fill-pattern"),g=_&&_.constantOr(1);for(let y of(h?(c=g&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=m.LINES):(c=g?"fillPattern":"fill",u=m.TRIANGLES),o)){let o=n.getTile(y);if(g&&!o.patternsLoaded())continue;let x=o.getBucket(a);if(!x)continue;r.prepareDrawTile();let v=x.programConfigurations.get(a.id),b=r.useProgram(c,v);g&&(r.context.activeTexture.set(m.TEXTURE0),o.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),v.updatePaintBuffers());let w=_.constantOr(null);if(w&&o.imageAtlas){let i=o.imageAtlas.patternPositions[w.toString()];i&&v.setConstantPatternPositions(i)}let T=r.translatePosMatrix(y.projMatrix,o,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));if(h){p=x.indexBuffer2,f=x.segments2;let i=r.terrain&&r.terrain.renderingToTexture?r.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];d="fillOutlinePattern"===c&&g?t7(T,r,o,i):t9(T,i)}else p=x.indexBuffer,f=x.segments,d=g?t8(T,r,o):t6(T);r.prepareDrawProgram(r.context,b,y.toUnwrapped()),b.draw(r.context,u,s,r.stencilModeForClipping(y),l,i.CullFaceMode.disabled,d,a.id,x.layoutVertexBuffer,p,f,a.paint,r.transform.zoom,v)}}function iA(r,n,a,o,s,l,h){let u=r.context,c=u.gl,d=r.transform,p=a.paint.get("fill-extrusion-pattern"),f=p.constantOr(1),m=a.paint.get("fill-extrusion-opacity"),_=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),a.paint.get("fill-extrusion-ambient-occlusion-radius")],g=a.layout.get("fill-extrusion-edge-radius"),y="globe"===d.projection.name?i.fillExtrusionHeightLift():0,x="globe"===d.projection.name,v=x?i.globeToMercatorTransition(d.zoom):0,b=[i.mercatorXfromLng(d.center.lng),i.mercatorYfromLat(
60d.center.lat)],w=[];for(let T of(x&&w.push("PROJECTION_GLOBE_VIEW"),_[0]>0&&w.push("FAUX_AO"),o)){let o=n.getTile(T),E=o.getBucket(a);if(!E||E.projection.name!==d.projection.name)continue;let S=E.programConfigurations.get(a.id),M=r.useProgram(f?"fillExtrusionPattern":"fillExtrusion",S,w);if(r.terrain){let s=r.terrain;if(r.style.terrainSetForDrapingOnly())s.setupElevationDraw(o,M,{useMeterToDem:!0});else{if(!E.enableTerrain)continue;if(s.setupElevationDraw(o,M,{useMeterToDem:!0}),function(r,n,a,o,s,l){let h,u,c;let d=[r=>{let n=r.canonical.x-1,a=r.wrap;return n<0&&(n=(1<<r.canonical.z)-1,a--),new i.OverscaledTileID(r.overscaledZ,a,r.canonical.z,n,r.canonical.y)},r=>{let n=r.canonical.x+1,a=r.wrap;return n===1<<r.canonical.z&&(n=0,a++),new i.OverscaledTileID(r.overscaledZ,a,r.canonical.z,n,r.canonical.y)},r=>new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(0===r.canonical.y?1<<r.canonical.z:r.canonical.y)-1),r=>new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)],p=i=>{let r=n.getSource().minzoom,a=i=>{let r=n.getTileByID(i);if(r&&r.hasData())return r.getBucket(s)};
60for(let n of[0,-1,1]){if(i.overscaledZ+n<r)continue;let o=a(i.calculateScaledKey(i.overscaledZ+n));if(o)return o}},f=[0,0,0],m=(r,n)=>(f[0]=Math.min(r.min.y,n.min.y),f[1]=Math.max(r.max.y,n.max.y),f[2]=i.EXTENT-n.min.x>r.max.x?n.min.x-i.EXTENT:r.max.x,f),_=(r,n)=>(f[0]=Math.min(r.min.x,n.min.x),f[1]=Math.max(r.max.x,n.max.x),f[2]=i.EXTENT-n.min.y>r.max.y?n.min.y-i.EXTENT:r.max.y,f),g=[(i,r)=>m(i,r),(i,r)=>m(r,i),(i,r)=>_(i,r),(i,r)=>_(r,i)],y=new i.pointGeometry(0,0),x=(r,n,o,s,d)=>{let p=[[s?o:r,s?r:o,0],[s?o:n,s?n:o,0]],f=d<0?i.EXTENT+d:d,m=[s?f:(r+n)/2,s?(r+n)/2:f,0];return 0===o&&d<0||0!==o&&d>0?l.getForTilePoints(c,[m],!0,u):p.push(m),l.getForTilePoints(a,p,!0,h),Math.max(p[0][2],p[1][2],m[2])/l.exaggeration()};for(let r=0;r<4;r++){let n=(r<2?1:5)-r,s=o.borders[r];if(0===s.length)continue;let f=c=d[r](a),m=p(f);if(!(m&&m instanceof i.FillExtrusionBucket&&m.enableTerrain)||o.borderDoneWithNeighborZ[r]===m.canonical.z&&m.borderDoneWithNeighborZ[n]===o.canonical.z||!(u=l.findDEMTileFor(f))||!u.dem)continue;if(!h){let i=l.findDEMTileFor(a);if(!i||!i.dem)return;h=i}let _=m.borders[n],v=0,b=m.borderDoneWithNeighborZ[n]!==o.canonical.z;if(o.canonical.z===m.canonical.z){for(let a=0;a<s.length;a++){let l;let h=o.featuresOnBorder[s[a]],u=h.borders[r];for(;v<_.length&&!((l=m.featuresOnBorder[_[v]]).borders[n][1]>u[0]+3);)b&&m.encodeCentroid(void 0,l,!1),v++;if(l&&v<_.length){let a=v,s=0;for(;!(l.borders[n][0]>u[1]-3)&&(s++,++v!==_.length);)l=m.featuresOnBorder[_[v]];if(l=m.featuresOnBorder[_[a]],h.intersectsCount()>1||l.intersectsCount()>1||1!==s){1!==s&&(v=a),o.encodeCentroid(void 0,h,!1),b&&m.encodeCentroid(void 0,l,!1);continue}let c=g[r](h,l),d=r%2?i.EXTENT-1:0;y.x=x(c[0],Math.min(i.EXTENT-1,c[1]),d,r<2,c[2]),y.y=0,o.encodeCentroid(y,h,!1),b&&m.encodeCentroid(y,l,!1)}else o.encodeCentroid(void 0,h,!1)}o.borderDoneWithNeighborZ[r]=m.canonical.z,o.needsCentroidUpdate=!0,b&&(m.borderDoneWithNeighborZ[n]=o.canonical.z,m.needsCentroidUpdate=!0)}else{for(let i of s)o.encodeCentroid(void 0,o.featuresOnBorder[i],!1);if(b){for(let i of _)m.encodeCentroid(void 0,m.featuresOnBorder[i],!1);m.borderDoneWithNeighborZ[n]=o.canonical.z,m.needsCentroidUpdate=!0}o.borderDoneWithNeighborZ[r]=m.canonical.z,o.needsCentroidUpdate=!0}}(o.needsCentroidUpdate||!o.centroidVertexBuffer&&0!==o.centroidVertexArray.length)&&o.uploadCentroid(r)}(u,n,T,E,a,s),!E.centroidVertexBuffer){let i=M.attributes.a_centroid_pos;void 0!==i&&c.vertexAttrib2f(i,0,0)}}}f&&(r.context.activeTexture.set(c.TEXTURE0),o.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers());let A=p.constantOr(null);if(A&&o.imageAtlas){let i=o.imageAtlas.patternPositions[A.toString()];i&&S.setConstantPatternPositions(i)}let I=r.translatePosMatrix(T.projMatrix,o,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),C=d.projection.createInversionMatrix(d,T.canonical),z=a.paint.get("fill-extrusion-vertical-gradient"),k=f?t4(I,r,z,m,_,g,T,o,y,v,b,C):t5(I,r,z,m,_,g,T,y,v,b,C);r.prepareDrawProgram(u,M,T.toUnwrapped());let D=[];r.terrain&&D.push(E.centroidVertexBuffer),x&&D.push(E.layoutVertexExtBuffer),M.draw(u,u.gl.TRIANGLES,s,l,h,i.CullFaceMode.backCCW,k,a.id,E.layoutVertexBuffer,E.indexBuffer,E.segments,a.paint,r.transform.zoom,S,D)}}let iI=new i.Color(1,0,0,1),iC=new i.Color(0,1,0,1),iz=new i.Color(0,0,1,1),ik=new i.Color(1,0,1,1),iD=new i.Color(0,1,1,1);function iP(i,r,n,a){iR(i,0,r+n/2,i.transform.width,n,a)}function iL(i,r,n,a){iR(i,r-n/2,0,n,i.transform.height,a)}function iR(r,n,a,o,s,l){let h=r.context,u=h.gl;u.enable(u.SCISSOR_TEST),u.scissor(n*i.exported.devicePixelRatio,a*i.exported.devicePixelRatio,o*i.exported.devicePixelRatio,s*i.exported.devicePixelRatio),h.clear({color:l}),u.disable(u.SCISSOR_TEST)}let{members:iB}=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]);function iO(i,r,n,a){i.emplaceBack(r,n,a)}class iF{constructor(r){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,iO(this.vertexArray,-1,-1,1),iO(this.vertexArray,1,-1,1),iO(this.vertexArray,-1,1,1),iO(this.vertexArray,1,1,1),iO(this.vertexArray,-1,-1,-1),iO(this.vertexArray,1,-1,-1),iO(this.vertexArray,-1,1,-1),iO(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=r.createVertexBuffer(this.vertexArray,iB),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function iU(r,n,a,o,s,l){let h=r.gl,u=n.paint.get("sky-atmosphere-color"),c=n.paint.get("sky-atmosphere-halo-color"),d=n.paint.get("sky-atmosphere-sun-intensity"),p={u_matrix_3f:i.fromMat4(i.create$1(),o),u_sun_direction:s,u_sun_intensity:d,u_color_tint_r:[u.r,u.g,u.b,u.a],u_color_tint_m:[c.r,c.g,c.b,c.a],u_luminance:5e-5};h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_CUBE_MAP_POSITIVE_X+l,n.skyboxTexture,0),a.draw(r,h.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,p,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}let iV=i.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class iN{constructor(r){let n=new i.StructArrayLayout5f20;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);let a=new i.StructArrayLayout3ui6;a.emplaceBack(0,1,2),a.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(n,iV.members),this.indexBuffer=r.createIndexBuffer(a),this.segments=i.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}
60let ij={symbol:function(r,n,a,o,s){if("translucent"!==r.renderPass)return;let l=i.StencilMode.disabled,h=r.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(r,n,a,o,s,l,h){let u=n.transform,c="map"===s,d="map"===l;for(let n of r){let r=o.getTile(n),s=r.getBucket(a);if(!s||!s.text||!s.text.segments.get().length)continue;let l=i.evaluateSizeForZoom(s.textSizeData,u.zoom),p=tt(n,s.getProjection(),u),f=u.calculatePixelsToTileUnitsMatrix(r),m=eY(p,r.tileID.canonical,d,c,u,s.getProjection(),f),_="none"!==a.layout.get("icon-text-fit")&&s.hasIconData();if(l){let a=Math.pow(2,u.zoom-r.tileID.overscaledZ);(function(r,n,a,o,s,l,h,u,c,d,p){let f=r.text.placedSymbolArray,m=r.text.dynamicLayoutVertexArray,_=r.icon.dynamicLayoutVertexArray,g={},y=r.getProjection(),x=tt(u,y,l),v=l.elevation,b=y.upVectorScale(u.canonical,l.center.lat,l.worldSize).metersToTile;m.clear();for(let _=0;_<f.length;_++){let w=f.get(_),{tileAnchorX:T,tileAnchorY:E,numGlyphs:S}=w,M=r.allowVerticalPlacement&&!w.placedOrientation,A=w.hidden||!w.crossTileID||M?null:o[w.crossTileID];if(A){let o=0,f=0,_=0;if(v){let i=v?v.getAtTileOffset(u,T,E):0,[r,n,a]=y.upVector(u.canonical,T,E);o=i*r*b,f=i*n*b,_=i*a*b}let[M,I,C,z]=eQ(w.projectedAnchorX+o,w.projectedAnchorY+f,w.projectedAnchorZ+_,a?x:h),k=e0(l.getCameraToCenterDistance(y),z),D=s.evaluateSizeForFeature(r.textSizeData,d,w)*k/i.ONE_EM;a&&(D*=r.tilePixelRatio/c);let P=function({width:r,height:n,anchor:a,textOffset:o,textScale:s},l){let{horizontalAlign:h,verticalAlign:u}=i.getAnchorAlignment(a),c=i.evaluateVariableOffset(a,o);return new i.pointGeometry((-(h-.5)*r/s+c[0])*l,(-(u-.5)*n/s+c[1])*l)}(A,D);a?({x:M,y:I,z:C}=y.projectTilePoint(T+P.x,E+P.y,u.canonical),[M,I,C]=eQ(M+o,I+f,C+_,h)):(n&&P._rotate(-l.angle),M+=P.x,I+=P.y,C=0);let L=r.allowVerticalPlacement&&w.placedOrientation===i.WritingMode.vertical?Math.PI/2:0;for(let r=0;r<S;r++)i.addDynamicAttributes(m,M,I,C,L);p&&w.associatedIconIndex>=0&&(g[w.associatedIconIndex]={x:M,y:I,z:C,angle:L})}else e8(S,m)}if(p){_.clear();let n=r.icon.placedSymbolArray;for(let r=0;r<n.length;r++){let a=n.get(r),{numGlyphs:o}=a,s=g[r];if(a.hidden||!s)e8(o,_);else{let{x:r,y:n,z:a,angle:l}=s;for(let s=0;s<o;s++)i.addDynamicAttributes(_,r,n,a,l)}}r.icon.dynamicLayoutVertexBuffer.updateData(_)}r.text.dynamicLayoutVertexBuffer.updateData(m)})(s,c,d,h,i.symbolSize,u,m,n,a,l,_)}}}(o,r,a,n,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),s),0!==a.paint.get("icon-opacity").constantOr(1)&&iE(r,n,a,o,!1,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),a.layout.get("icon-rotation-alignment"),a.layout.get("icon-pitch-alignment"),a.layout.get("icon-keep-upright"),l,h),0!==a.paint.get("text-opacity").constantOr(1)&&iE(r,n,a,o,!0,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),a.layout.get("text-keep-upright"),l,h),n.map.showCollisionBoxes&&(iw(r,n,a,o,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),iw(r,n,a,o,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(r,n,a,o){if("translucent"!==r.renderPass)return;let s=a.paint.get("circle-opacity"),l=a.paint.get("circle-stroke-width"),h=a.paint.get("circle-stroke-opacity"),u=void 0!==a.layout.get("circle-sort-key").constantOr(1);if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let c=r.context,d=c.gl,p=r.transform,f=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),m=i.StencilMode.disabled,_=r.colorModeForRenderPass(),g="globe"===p.projection.name,y=[i.mercatorXfromLng(p.center.lng),i.mercatorYfromLat(p.center.lat)],x=[];for(let s=0;s<o.length;s++){let l=o[s],h=n.getTile(l),c=h.getBucket(a);if(!c||c.projection.name!==p.projection.name)continue;let d=c.programConfigurations.get(a.id),f=ii(a);g&&f.push("PROJECTION_GLOBE_VIEW");let m=r.useProgram("circle",d,f),_=c.layoutVertexBuffer,v=c.globeExtVertexBuffer,b=c.indexBuffer,w=p.projection.createInversionMatrix(p,l.canonical),T={programConfiguration:d,program:m,layoutVertexBuffer:_,globeExtVertexBuffer:v,indexBuffer:b,uniformValues:it(r,l,h,w,y,a),tile:h};if(u)for(let r of c.segments.get())x.push({segments:new i.SegmentVector([r]),sortKey:r.sortKey,state:T});else x.push({segments:c.segments,sortKey:0,state:T})}u&&x.sort((i,r)=>i.sortKey-r.sortKey);let v={useDepthForOcclusion:!g};for(let n of x){let{programConfiguration:o,program:s,layoutVertexBuffer:l,globeExtVertexBuffer:h,indexBuffer:u,uniformValues:g,tile:y}=n.state,x=n.segments;r.terrain&&r.terrain.setupElevationDraw(y,s,v),r.prepareDrawProgram(c,s,y.tileID.toUnwrapped()),s.draw(c,d.TRIANGLES,f,m,_,i.CullFaceMode.disabled,g,a.id,l,u,x,a.paint,p.zoom,o,[h])}},heatmap:function(r,n,a,o){if(0!==a.paint.get("heatmap-opacity")){if("offscreen"===r.renderPass){let s=r.context,l=s.gl,h=i.StencilMode.disabled,u=new i.ColorMode([l.ONE,l.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(i,r,n,a){let o=i.gl,s=r.width*a,l=r.height*a;i.activeTexture.set(o.TEXTURE1),i.viewport.set([0,0,s,l]);let h=n.heatmapFbo;if(!h||h&&(h.width!==s||h.height!==l)){h&&h.destroy();let r=o.createTexture();o.bindTexture(o.TEXTURE_2D,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),h=n.heatmapFbo=i.createFramebuffer(s,l,!1),function(i,r,n,a,o,s){let l=i.gl;l.texImage2D(l.TEXTURE_2D,0,i.isWebGL2&&i.extRenderToTextureHalfFloat?l.RGBA16F:l.RGBA,o,s,0,l.RGBA,i.extRenderToTextureHalfFloat?i.isWebGL2?l.HALF_FLOAT:i.extTextureHalfFloat.HALF_FLOAT_OES:l.UNSIGNED_BYTE,null),a.colorAttachment.set(n)}(i,0,r,h,s,l)}else o.bindTexture(o.TEXTURE_2D,h.colorAttachment.get()),i.bindFramebuffer.set(h.framebuffer)})(s,r,a,"globe"===r.transform.projection.name?.5:.25),s.clear({color:i.Color.transparent});let c=r.transform,d="globe"===c.projection.name,p=d?["PROJECTION_GLOBE_VIEW"]:null,f=d?i.CullFaceMode.frontCCW:i.CullFaceMode.disabled,m=[i.mercatorXfromLng(c.center.lng),i.mercatorYfromLat(c.center.lat)];for(let _=0;_<o.length;_++){let g=o[_];if(n.hasRenderableParent(g))continue;let y=n.getTile(g),x=y.getBucket(a);if(!x||x.projection.name!==c.projection.name)continue;let v=x.programConfigurations.get(a.id),b=r.useProgram("heatmap",v,p),{zoom:w}=r.transform;r.terrain&&r.terrain.setupElevationDraw(y,b),r.prepareDrawProgram(s,b,g.toUnwrapped());let T=c.projection.createInversionMatrix(c,g.canonical);b.draw(s,l.TRIANGLES,i.DepthMode.disabled,h,u,f,is(r,g,y,T,m,w,a.paint.get("heatmap-intensity")),a.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,a.paint,r.transform.zoom,v,d?[x.globeExtVertexBuffer]:null)}s.viewport.set([0,0,r.width,r.height])}else"translucent"===r.renderPass&&(r.context.setColorMode(r.colorModeForRenderPass()),function(r,n){let a=r.context,o=a.gl,s=n.heatmapFbo;if(!s)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,s.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1);let l=n.colorRampTexture;l||(l=n.colorRampTexture=new i.Texture(a,n.colorRamp,o.RGBA)),l.bind(o.LINEAR,o.CLAMP_TO_EDGE),r.useProgram("heatmapTexture").draw(a,o.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,{u_image:0,u_color_ramp:1,u_opacity:n.paint.get("heatmap-opacity")},n.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,n.paint,r.transform.zoom)}(r,a))}},line:function(r,n,a,o){if("translucent"!==r.renderPass)return;let s=a.paint.get("line-opacity"),l=a.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;let h=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),u=r.colorModeForRenderPass(),c=r.terrain&&r.terrain.renderingToTexture?1:i.exported.devicePixelRatio,d=a.paint.get("line-dasharray"),p=d.constantOr(1),f=a.layout.get("line-cap"),m=a.paint.get("line-pattern"),_=m.constantOr(1),g=a.paint.get("line-gradient"),y=_?"linePattern":"line",x=r.context,v=x.gl,b=(i=>{let r=[];id(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");let n=i.paint.get("line-trim-offset");0===n[0]&&0===n[1]||r.push("RENDER_LINE_TRIM_OFFSET");let a=i.paint.get("line-pattern").constantOr(1),o=1!==i.paint.get("line-opacity").constantOr(1);return!a&&o&&r.push("RENDER_LINE_ALPHA_DISCARD"),r})(a),w=b.includes("RENDER_LINE_ALPHA_DISCARD");for(let s of(r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(w=!1),o)){let o=n.getTile(s);if(_&&!o.patternsLoaded())continue;let l=o.getBucket(a);if(!l)continue;r.prepareDrawTile();let T=l.programConfigurations.get(a.id),E=r.useProgram(y,T,b),S=m.constantOr(null);if(S&&o.imageAtlas){let i=o.imageAtlas.patternPositions[S.toString()];i&&T.setConstantPatternPositions(i)}let M=d.constantOr(null),A=f.constantOr(null);if(!_&&M&&A&&o.lineAtlas){let i=o.lineAtlas.getDash(M,A);i&&T.setConstantPatternPositions(i)}let[I,C]=a.paint.get("line-trim-offset");("round"===A||"square"===A)&&I!==C&&(0===I&&(I-=1),1===C&&(C+=1));let z=r.terrain?s.projMatrix:null,k=_?ih(r,o,a,z,c):il(r,o,a,z,l.lineClipsArray.length,c,[I,C]);if(g){let o=l.gradients[a.id],h=o.texture;if(a.gradientVersion!==o.version){let u=256;
60if(a.stepInterpolant){let a=n.getSource().maxzoom,o=s.canonical.z===a?Math.ceil(1<<r.transform.maxZoom-s.canonical.z):1;u=i.clamp(i.nextPowerOfTwo(l.maxLineLength/i.EXTENT*1024*o),256,x.maxTextureSize)}o.gradient=i.renderColorRamp({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:u,image:o.gradient||void 0,clips:l.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new i.Texture(x,o.gradient,v.RGBA),o.version=a.gradientVersion,h=o.texture}x.activeTexture.set(v.TEXTURE1),h.bind(a.stepInterpolant?v.NEAREST:v.LINEAR,v.CLAMP_TO_EDGE)}p&&(x.activeTexture.set(v.TEXTURE0),o.lineAtlasTexture.bind(v.LINEAR,v.REPEAT),T.updatePaintBuffers()),_&&(x.activeTexture.set(v.TEXTURE0),o.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),T.updatePaintBuffers()),r.prepareDrawProgram(x,E,s.toUnwrapped());let D=n=>{E.draw(x,v.TRIANGLES,h,n,u,i.CullFaceMode.disabled,k,a.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,a.paint,r.transform.zoom,T,[l.layoutVertexBuffer2])};if(w){let n=r.stencilModeForClipping(s).ref;0===n&&r.terrain&&x.clear({stencil:0});let a={func:v.EQUAL,mask:255};k.u_alpha_discard_threshold=.8,D(new i.StencilMode(a,n,255,v.KEEP,v.KEEP,v.INVERT)),k.u_alph
60a_discard_threshold=0,D(new i.StencilMode(a,n,255,v.KEEP,v.KEEP,v.KEEP))}else D(r.stencilModeForClipping(s))}w&&(r.resetStencilClippingMasks(),r.terrain&&x.clear({stencil:0}))},fill:function(r,n,a,o){let s=a.paint.get("fill-color"),l=a.paint.get("fill-opacity");if(0===l.constantOr(1))return;let h=r.colorModeForRenderPass(),u=a.paint.get("fill-pattern"),c=r.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===s.constantOr(i.Color.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(r.renderPass===c){let s=r.depthModeForSublayer(1,"opaque"===r.renderPass?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);iM(r,n,a,o,s,h,!1)}if("translucent"===r.renderPass&&a.paint.get("fill-antialias")){let s=r.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);iM(r,n,a,o,s,h,!0)}},"fill-extrusion":function(r,n,a,o){let s=a.paint.get("fill-extrusion-opacity");if(0!==s&&"translucent"===r.renderPass){let l=new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);if(1!==s||a.paint.get("fill-extrusion-pattern").constantOr(1))iA(r,n,a,o,l,i.StencilMode.disabled,i.ColorMode.disabled),iA(r,n,a,o,l,r.stencilModeFor3D(),r.colorModeForRenderPass()),r.resetStencilClippingMasks();else{let s=r.colorModeForRenderPass();iA(r,n,a,o,l,i.StencilMode.disabled,s)}}},hillshade:function(r,n,a,o){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass)return;let s=r.context,l=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),h=r.colorModeForRenderPass(),u=r.terrain&&r.terrain.renderingToTexture,[c,d]="translucent"!==r.renderPass||u?[{},o]:r.stencilConfigForOverlap(o);for(let o of d){let s=n.getTile(o);if(s.needsHillshadePrepare&&"offscreen"===r.renderPass)!function(r,n,a,o,s,l){let h=r.context,u=h.gl;if(!n.dem)return;let c=n.dem;if(h.activeTexture.set(u.TEXTURE1),tN(r,n,c),!n.demTexture)return;n.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);let d=c.dim;h.activeTexture.set(u.TEXTURE0);let p=n.fbo;if(!p){let r=new i.Texture(h,{width:d,height:d,data:null},u.RGBA);r.bind(u.LINEAR,u.CLAMP_TO_EDGE),(p=n.fbo=h.createFramebuffer(d,d,!0)).colorAttachment.set(r.texture)}h.bindFramebuffer.set(p.framebuffer),h.viewport.set([0,0,d,d]);let{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=r.getMercatorTileBoundsBuffers();r.useProgram("hillshadePrepare").draw(h,u.TRIANGLES,o,s,l,i.CullFaceMode.disabled,((r,n)=>{let a=n.stride,o=i.create();return i.ortho(o,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(o,o,[0,-i.EXTENT,0]),{u_matrix:o,u_image:1,u_dimension:[a,a],u_zoom:r.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,c),a.id,f,m,_),n.needsHillshadePrepare=!1}(r,s,a,l,i.StencilMode.disabled,h);else if("translucent"===r.renderPass){let n=u&&r.terrain?r.terrain.stencilModeForRTTOverlap(o):c[o.overscaledZ];!function(r,n,a,o,s,l,h){let u=r.context,c=u.gl,d=a.fbo;if(!d)return;r.prepareDrawTile();let p=r.useProgram("hillshade");u.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,d.colorAttachment.get());let f=((r,n,a,o)=>{let s=a.paint.get("hillshade-shadow-color"),l=a.paint.get("hillshade-highlight-color"),h=a.paint.get("hillshade-accent-color"),u=a.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===a.paint.get("hillshade-illumination-anchor")&&(u-=r.transform.angle);let c=!r.options.moving;return{u_matrix:o||r.transform.calculateProjMatrix(n.tileID.toUnwrapped(),c),u_image:0,u_latrange:function(r,n){let a=Math.pow(2,n.canonical.z),o=n.canonical.y;return[new i.MercatorCoordinate(0,o/a).toLngLat().lat,new i.MercatorCoordinate(0,(o+1)/a).toLngLat().lat]}(0,n.tileID),u_light:[a.paint.get("hillshade-exaggeration"),u],u_shadow:s,u_highlight:l,u_accent:h}})(r,a,o,r.terrain?n.projMatrix:null);r.prepareDrawProgram(u,p,n.toUnwrapped());let{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=r.getTileBoundsBuffers(a);p.draw(u,c.TRIANGLES,s,l,h,i.CullFaceMode.disabled,f,o.id,m,_,g)}(r,o,s,a,l,n,h)}}s.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,n,a,o,s,l){if("translucent"!==r.renderPass||0===a.paint.get("raster-opacity")||!o.length)return;let h=r.context,u=h.gl,c=n.getSource(),d=r.useProgram("raster"),p=r.colorModeForRenderPass(),f=r.terrain&&r.terrain.renderingToTexture,[m,_]=c 
60instanceof eD||f?[{},o]:r.stencilConfigForOverlap(o),g=_[_.length-1].overscaledZ,y=!r.options.moving;for(let o of _){let s,_;let x=f?i.DepthMode.disabled:r.depthModeForSublayer(o.overscaledZ-g,1===a.paint.get("raster-opacity")?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,u.LESS),v=o.toUnwrapped(),b=n.getTile(o);if(f&&(!b||!b.hasData()))continue;let w=f?o.projMatrix:r.transform.calculateProjMatrix(v,y),T=r.terrain&&f?r.terrain.stencilModeForRTTOverlap(o):m[o.overscaledZ],E=l?0:a.paint.get("raster-fade-duration");b.registerFadeDuration(E);let S=n.findLoadedParent(o,0),M=tY(b,S,n,r.transform,E);r.terrain&&r.terrain.prepareDrawTile();let A="nearest"===a.paint.get("raster-resampling")?u.NEAREST:u.LINEAR;h.activeTexture.set(u.TEXTURE0),b.texture.bind(A,u.CLAMP_TO_EDGE),h.activeTexture.set(u.TEXTURE1),S?(S.texture.bind(A,u.CLAMP_TO_EDGE),s=Math.pow(2,S.tileID.overscaledZ-b.tileID.overscaledZ),_=[b.tileID.canonical.x*s%1,b.tileID.canonical.y*s%1]):b.texture.bind(A,u.CLAMP_TO_EDGE);let I=ip(w,_||[0,0],s||1,M,a,c instanceof eD?c.perspectiveTransform:[0,0]);if(r.prepareDrawProgram(h,d,v),c instanceof eD)c.boundsBuffer&&c.boundsSegments&&d.draw(h,u.TRIANGLES,x,i.StencilMode.disabled,p,i.CullFaceMode.disabled,I,a.id,c.boundsBuffer,r.quadTriangleIndexBuffer,c.boundsSegments);else{let{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:s}=r.getTileBoundsBuffers(b);d.draw(h,u.TRIANGLES,x,T,p,i.CullFaceMode.disabled,I,a.id,n,o,s)}}r.resetStencilClippingMasks()},background:function(r,n,a,o){let s=a.paint.get("background-color"),l=a.paint.get("background-opacity");if(0===l)return;let h=r.context,u=h.gl,c=r.transform,d=c.tileSize,p=a.paint.get("background-pattern");if(r.isPatternMissing(p))return;let f=!p&&1===s.a&&1===l&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==f)return;let m=i.StencilMode.disabled,_=r.depthModeForSublayer(0,"opaque"===f?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),g=r.colorModeForRenderPass(),y=r.useProgram(p?"backgroundPattern":"background"),x,v=o;for(let f of(v||(v=Object.values(x=r.getBackgroundTiles()).map(i=>i.tileID)),p&&(h.activeTexture.set(u.TEXTURE0),r.imageManager.bind(r.context)),v)){let v=f.toUnwrapped(),b=o?f.projMatrix:r.transform.calculateProjMatrix(v);r.prepareDrawTile();let w=n?n.getTile(f):x?x[f.key]:new i.Tile(f,d,c.zoom,r),T=p?iv(b,l,r,p,{tileID:f,tileSize:d}):ix(b,l,s);r.prepareDrawProgram(h,y,v);let{tileBoundsBuffer:E,tileBoundsIndexBuffer:S,tileBoundsSegments:M}=r.getTileBoundsBuffers(w);y.draw(h,u.TRIANGLES,_,m,g,i.CullFaceMode.disabled,T,a.id,E,S,M)}},sky:function(r,n,a){let o=r.transform,s="mercator"===o.projection.name||"globe"===o.projection.name?1:i.smoothstep(7,8,o.zoom),l=a.paint.get("sky-opacity")*s;if(0===l)return;let h=r.context,u=a.paint.get("sky-type"),c=new i.DepthMode(h.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),d=r.frameCounter/1e3%1;"atmosphere"===u?"offscreen"===r.renderPass?a.needsSkyboxCapture(r)&&(function(r,n,a,o){let s=r.context,l=s.gl,h=n.skyboxFbo;if(!h){h=n.skyboxFbo=s.createFramebuffer(32,32,!1),n.skyboxGeometry=new iF(s),n.skyboxTexture=s.gl.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,n.skyboxTexture),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);for(let i=0;i<6;++i)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,l.RGBA,32,32,0,l.RGBA,l.UNSIGNED_BYTE,null)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,32,32]);let u=n.getCenter(r,!0),c=r.useProgram("skyboxCapture"),d=new Float64Array(16);i.identity(d),i.rotateY(d,d,-(.5*Math.PI)),iU(s,n,c,d,u,0),i.identity(d),i.rotateY(d,d,.5*Math.PI),iU(s,n,c,d,u,1),i.identity(d),i.rotateX(d,d,-(.5*Math.PI)),iU(s,n,c,d,u,2),i.identity(d),i.rotateX(d,d,.5*Math.PI),iU(s,n,c,d,u,3),i.identity(d),iU(s,n,c,d,u,4),i.identity(d),i.rotateY(d,d,Math.PI),iU(s,n,c,d,u,5),s.viewport.set([0,0,r.width,r.height])}(r,a),a.markSkyboxValid(r)):"sky"===r.renderPass&&function(r,n,a,o,s){let l=r.context,h=l.gl,u=r.transform,c=r.useProgram("skybox");l.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_CUBE_MAP,n.skyboxTexture);let d={u_matrix:u.skyboxMatrix,u_sun_direction:n.getCenter(r,!1),u_cubemap:0,u_opacity:o,u_temporal_offset:s};r.prepareDrawProgram(l,c),c.draw(l,h.TRIANGLES,a,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,d,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,a,c,l,d):"gradient"===u&&"sky"===r.renderPass&&function(r,n,a,o,s){let l,h,u;let c=r.context,d=c.gl,p=r.transform,f=r.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new iF(c)),c.activeTexture.set(d.TEXTURE0);let m=n.colorRampTexture;m||(m=n.colorRampTexture=new i.Texture(c,n.colorRamp,d.RGBA)),m.bind(d.LINEAR,d.CLAMP_TO_EDGE);let _=(l=p.skyboxMatrix,h=n.getCenter(r,!1),u=n.paint.get("sky-gradient-radius"),{u_matrix:l,u_color_ramp:0,u_center_direction:h,u_radius:i.degToRad(u),u_opacity:o,u_temporal_offset:s});r.prepareDrawProgram(c,f),f.draw(c,d.TRIANGLES,a,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,_,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,a,c,l,d)},debug:function(r,n,a){for(let o=0;o<a.length;o++)!function(r,n,a){let o=r.context,s=r.transform,l=o.gl,h="globe"===s.projection.name,u=a.projMatrix;if(h&&i.globeToMercatorTransition(s.zoom)>0){let r=i.transitionTileAABBinECEF(a.canonical,s),n=i.globeDenormalizeECEF(r);u=i.multiply(new Float32Array(16),s.globeMatrix,n),i.multiply(u,s.projMatrix,u)}let c=r.useProgram("debug",null,h?["PROJECTION_GLOBE_VIEW"]:null),d=n.getTileByID(a.key);r.terrain&&r.terrain.setupElevationDraw(d,c);let p=i.DepthMode.disabled,f=i.StencilMode.disabled,m=r.colorModeForRenderPass(),_="$debug";o.activeTexture.set(l.TEXTURE0),r.emptyTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h?d._makeGlobeTileDebugBuffers(r.context,s):d._makeDebugTileBoundsBuffers(r.context,s.projection);let g=d._tileDebugBuffer||r.debugBuffer,y=d._tileDebugIndexBuffer||r.debugIndexBuffer,x=d._tileDebugSegments||r.debugSegments;c.draw(o,l.LINE_STRIP,p,f,m,i.CullFaceMode.disabled,ia(u,i.Color.red),_,g,y,x,null,
60null,null,[d._globeTileDebugBorderBuffer]);let v=d.latestRawTileData,b=Math.floor((v&&v.byteLength||0)/1024),w=512/Math.min(n.getTile(a).tileSize,512)*(a.overscaledZ/s.zoom)*.5,T=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(T+=` => ${a.overscaledZ}`),function(i,r){i.initDebugOverlayCanvas();let n=i.debugOverlayCanvas,a=i.context.gl,o=i.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,n.width,n.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(r,5,5),o.strokeText(r,5,5),i.debugOverlayTexture.update(n),i.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(r,T+=` ${b}kb`);let E=d._tileDebugTextBuffer||r.debugBuffer,S=d._tileDebugTextIndexBuffer||r.quadTriangleIndexBuffer,M=d._tileDebugTextSegments||r.debugSegments;c.draw(o,l.TRIANGLES,p,f,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,ia(u,i.Color.transparent,w),_,E,S,M,null,null,null,[d._globeTileDebugTextBuffer])}(r,n,a[o])},custom:function(r,n,a,o){let s=r.context,l=a.implementation;if(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes("custom")||r.terrain&&(r.terrain.renderingToTexture||"offscreen"===r.renderPass)&&a.isLayerDraped()){if("offscreen"===r.renderPass){let n=l.prerender;if(n){if(r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),"globe"===r.transform.projection.name){let a=r.transform.pointMerc;n.call(l,s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.globeToMercatorTransition(r.transform.zoom),[a.x,a.y],r.transform.pixelsPerMeterRatio)}else n.call(l,s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState()}}else if("translucent"===r.renderPass){if(r.terrain&&r.terrain.renderingToTexture){let n=l.renderToTile;if(n){let a=o[0].canonical,h=new i.MercatorCoordinate(a.x+o[0].wrap*(1<<a.z),a.y,a.z);s.setDepthMode(i.DepthMode.disabled),s.setStencilMode(i.StencilMode.disabled),s.setColorMode(r.colorModeForRenderPass()),r.setCustomLayerDefaults(),n.call(l,s.gl,h),s.setDirty(),r.setBaseState()}return}r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),s.setStencilMode(i.StencilMode.disabled);let n="3d"===l.renderingMode?new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,i.DepthMode.ReadOnly);if(s.setDepthMode(n),"globe"===r.transform.projection.name){let n=r.transform.pointMerc;l.render(s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.globeToMercatorTransition(r.transform.zoom),[n.x,n.y],r.transform.pixelsPerMeterRatio)}else l.render(s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState(),s.bindFramebuffer.set(null)}}else i.warnOnce("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}};class iG{constructor(r,n,a=!1){this.context=new eI(r,a),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=i.SourceCache.maxUnderzooming+i.SourceCache.maxOverzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new tv,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(i,r){let n=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(n||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new t0(this,i));let a=this._terrain;this.transform.elevation=n?a:null,a.update(i,this.transform,r)}_updateFog(i){let r=i.fog;if(!r||"globe"===this.transform.projection.name||1>r.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[n,a]=r.getFovAdjustedRange(this.transform._fov);if(n>a)return void(this.transform.fogCullDistSq=null);let o=n+.78*(a-n);this.transform.fogCullDistSq=o*o}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(r,n){if(this.width=r*i.exported.devicePixelRatio,this.height=n*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style.order)this.style._layers[i].resize()}setup(){let r=this.context,n=new i.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(i.EXTENT,0),n.emplaceBack(0,i.EXTENT),n.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=r.createVertexBuffer(n,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);let a=new i.StructArrayLayout2i4;a.emplaceBack(0,0),a.emplaceBack(i.EXTENT,0),a.emplaceBack(0,i.EXTENT),a.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=r.createVertexBuffer(a,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);let o=new i.StructArrayLayout2i4;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(o,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);let s=new i.StructArrayLayout4i8;s.emplaceBack(0,0,0,0),s.emplaceBack(i.EXTENT,0,i.EXTENT,0),s.emplaceBack(0,i.EXTENT,0,i.EXTENT),s.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=r.createVertexBuffer(s,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);let l=new i.StructArrayLayout3ui6;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);let h=new i.StructArrayLayout1ui2;for(let i of[0,1,3,2,0])h.emplaceBack(i);this.debugIndexBuffer=r.createIndexBuffer(h),this.emptyTexture=new i.Texture(r,
60new i.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA),this.identityMat=i.create();let u=this.context.gl;this.stencilClearMode=new i.StencilMode({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(i.window.performance.now()),this.atmosphereBuffer=new iN(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let r=this.context,n=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(r,n.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,tH(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,n,a){if(!n||this.currentStencilSource===n.id||!r.isTileClipped()||!a||0===a.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let i=!1;for(let r of a)if(void 0===this._tileClippingMaskIDs[r.key]){i=!0;break}if(!i)return}this.currentStencilSource=n.id;let o=this.context,s=o.gl;this.nextStencilID+a.length>256&&this.clearStencil(),o.setColorMode(i.ColorMode.disabled),o.setDepthMode(i.DepthMode.disabled);let l=this.useProgram("clippingMask");for(let r of(this._tileClippingMaskIDs={},a)){let a=n.getTile(r),h=this._tileClippingMaskIDs[r.key]=this.nextStencilID++,{tileBoundsBuffer:u,tileBoundsIndexBuffer:c,tileBoundsSegments:d}=this.getTileBoundsBuffers(a);l.draw(o,s.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:s.ALWAYS,mask:0},h,255,s.KEEP,s.KEEP,s.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tH(r.projMatrix),"$clipping",u,c,d)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let r=this.nextStencilID++,n=this.context.gl;return new i.StencilMode({func:n.NOTEQUAL,mask:255},r,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);let n=this.context.gl;return new i.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(r){let n=this.context.gl,a=r.sort((i,r)=>r.overscaledZ-i.overscaledZ),o=a[a.length-1].overscaledZ,s=a[0].overscaledZ-o+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();let r={};for(let a=0;a<s;a++)r[a+o]=new i.StencilMode({func:n.GEQUAL,mask:255},a+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=s,[r,a]}return[{[o]:i.StencilMode.disabled},a]}colorModeForRenderPass(){let r=this.context.gl;if(this._showOverdrawInspector){let n=1/8;return new i.ColorMode([r.CONSTANT_COLOR,r.ONE],new i.Color(n,n,n,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?i.ColorMode.unblended:i.ColorMode.alphaBlended}depthModeForSublayer(r,n,a){if(!this.opaquePassEnabledForLayer())return i.DepthMode.disabled;let o=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new i.DepthMode(a||this.context.gl.LEQUAL,n,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(r,n){this.style=r,this.options=n,this.imageManager=r.imageManager,this.glyphManager=r.glyphManager,this.symbolFadeChange=r.placement.symbolFadeChange(i.exported.now()),this.imageManager.beginFrame();let a=this.style.order,o=this.style._sourceCaches;for(let i in o){let r=o[i];r.used&&r.prepare(this.context)}let s={},l={},h={};for(let i in o){let r=o[i];s[i]=r.getVisibleCoordinates(),l[i]=s[i].slice().reverse(),h[i]=r.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let i=0;i<a.length;i++)if(this.style._layers[a[i]].is3D()){this.opaquePassCutoff=i;break}if(this.terrain&&(this.terrain.updateTileBinding(h),this.opaquePassCutoff=0),"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new i.GlobeSharedBuffers(this.context)),i.isMapAuthenticated(this.context.gl)){for(let i of(this.renderPass="offscreen",a)){let n=this.style._layers[i],a=r._getLayerSourceCache(n);if(!n.hasOffscreenPass()||n.isHidden(this.transform.zoom))continue;let o=a?l[a.id]:void 0;("custom"===n.type||n.isSky()||o&&o.length)&&this.renderLayer(this,a,n,o)}if(this.depthRangeFor3D=[0,1-(r.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:n.showOverdrawInspector?i.
60Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){let i=this.style._layers[a[this.currentLayer]],n=r._getLayerSourceCache(i);if(i.isSky())continue;let o=n?l[n.id]:void 0;this._renderTileClippingMasks(i,n,o),this.renderLayer(this,n,i,o)}if(this.style.fog&&this.transform.projection.supportsFog&&function(r,n){let a,o,s,l,h,u;let c=r.context,d=c.gl,p=r.transform,f=new i.DepthMode(d.LEQUAL,i.DepthMode.ReadOnly,[0,1]),m=r.useProgram("globeAtmosphere",null,"globe"===p.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),_=i.globeToMercatorTransition(p.zoom),g=n.properties.get("color").toArray01(),y=n.properties.get("high-color").toArray01(),x=n.properties.get("space-color").toArray01PremultipliedAlpha(),v=i.identity$1([]);i.rotateY$1(v,v,-i.degToRad(p._center.lng)),i.rotateX$1(v,v,i.degToRad(p._center.lat)),i.rotateZ$1(v,v,p.angle),i.rotateX$1(v,v,-p._pitch);let b=i.fromQuat(new Float32Array(16),v),w=i.mapValue(n.properties.get("star-intensity"),0,1,0,.25),T=i.mapValue(n.properties.get("horizon-blend"),0,1,5e-4,.25),E=i.globeUseCustomAntiAliasing(r,c,p)&&5e-4===T?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,S=r.frameCounter/1e3%1,M=i.length(p.globeCenterInViewSpace),A=Math.sqrt(Math.pow(M,2)-Math.pow(E,2)),I=(a=p.frustumCorners.TL,o=p.frustumCorners.TR,s=p.frustumCorners.BR,l=p.frustumCorners.BL,h=p.frustumCorners.horizon,u=Math.acos(A/M),{u_frustum_tl:a,u_frustum_tr:o,u_frustum_br:s,u_frustum_bl:l,u_horizon:h,u_transition:_,u_fadeout_range:T,u_color:g,u_high_color:y,u_space_color:x,u_star_intensity:w,u_star_size:5*i.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:S,u_horizon_angle:u,u_rotation_matrix:b});r.prepareDrawProgram(c,m);let C=r.atmosphereBuffer;C&&m.draw(c,d.TRIANGLES,f,i.StencilMode.disabled,i.ColorMode.alphaBlended,i.CullFaceMode.backCW,I,"skybox",C.vertexBuffer,C.indexBuffer,C.segments)}(this,this.style.fog),this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){let i=this.style._layers[a[this.currentLayer]],n=r._getLayerSourceCache(i);i.isSky()&&this.renderLayer(this,n,i,n?l[n.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;){let i=this.style._layers[a[this.currentLayer]],n=r._getLayerSourceCache(i);if(i.isSky()){++this.currentLayer;continue}if(this.terrain&&this.style.isLayerDraped(i)){if(i.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer);continue}let o=n?("symbol"===i.type?h:l)[n.id]:void 0;this._renderTileClippingMasks(i,n,n?s[n.id]:void 0),this.renderLayer(this,n,i,o),++this.currentLayer}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let n=null;i.values(this.style._layers).forEach(i=>{let a=r._getLayerSourceCache(i);a&&!i.isHidden(this.transform.zoom)&&(!n||n.getSource().maxzoom<a.getSource().maxzoom)&&(n=a)}),n&&this.options.showTileBoundaries&&ij.debug(this,n,n.getVisibleCoordinates())}this.options.showPadding&&function(i){var r,n;let a=i.transform.padding;iP(i,i.transform.height-(a.top||0),3,iI),iP(i,a.bottom||0,3,iC),iL(i,a.left||0,3,iz),iL(i,i.transform.width-(a.right||0),3,ik);let o=i.transform.centerPoint;r=o.x,n=i.transform.height-o.y,iR(i,r-1,n-10,2,20,iD),iR(i,r-10,n-1,20,2,iD)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(i.window.performance.now()),this.saveC
60anvasCopy())}}renderLayer(i,r,n,a){n.isHidden(this.transform.zoom)||("background"===n.type||"sky"===n.type||"custom"===n.type||a&&a.length)&&(this.id=n.id,this.gpuTimingStart(n),i.transform.projection.unsupportedLayers&&i.transform.projection.unsupportedLayers.includes(n.type)&&(!i.terrain||"custom"!==n.type)||ij[n.type](i,r,n,a,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;let r=this.context.extTimerQuery,n=this.gpuTimers[i.id];n||(n=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:r.createQueryEXT()}),n.calls++,r.beginQueryEXT(r.TIME_ELAPSED_EXT,n.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let i=this.context.extTimerQuery,r=i.createQueryEXT();this.deferredRenderGpuTimeQueries.push(r),i.beginQueryEXT(i.TIME_ELAPSED_EXT,r)}}gpuTimingDeferredRenderEnd(){if(!this.options.gpuTimingDeferredRender)return;let i=this.context.extTimerQuery;i.endQueryEXT(i.TIME_ELAPSED_EXT)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let i=this.context.extTimerQuery;i.endQueryEXT(i.TIME_ELAPSED_EXT)}collectGpuTimers(){let i=this.gpuTimers;return this.gpuTimers={},i}collectDeferredRenderGpuQueries(){let i=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],i}queryGpuTimers(i){let r={};for(let n in i){let a=i[n],o=this.context.extTimerQuery,s=o.getQueryObjectEXT(a.query,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(a.query),r[n]=s}return r}queryGpuTimeDeferredRender(i){if(!this.options.gpuTimingDeferredRender)return 0;let r=this.context.extTimerQuery,n=0;for(let a of i)n+=r.getQueryObjectEXT(a,r.QUERY_RESULT_EXT)/1e6,r.deleteQueryEXT(a);return n}translatePosMatrix(r,n,a,o,s){if(!a[0]&&!a[1])return r;let l=s?"map"===o?this.transform.angle:0:"viewport"===o?-this.transform.angle:0;if(l){let i=Math.sin(l),r=Math.cos(l);a=[a[0]*r-a[1]*i,a[0]*i+a[1]*r]}let h=[s?a[0]:B(n,a[0],this.transform.zoom),s?a[1]:B(n,a[1],this.transform.zoom),0],u=new Float32Array(16);return i.translate(u,r,h),u}saveTileTexture(i){let r=this._tileTextures[i.size[0]];r?r.push(i):this._tileTextures[i.size[0]]=[i]}getTileTexture(i){let r=this._tileTextures[i];return r&&r.length>0?r.pop():null}isPatternMissing(i){return null===i||void 0!==i&&!this.imageManager.getPattern(i.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){let i=this.terrain&&this.terrain.renderingToTexture,r=this.terrain&&0===this.terrain.exaggeration(),n=this.style&&this.style.fog,a=[];return this.terrainRenderModeElevated()&&a.push("TERRAIN"),"globe"===this.transform.projection.name&&a.push("GLOBE"),r&&a.push("ZERO_EXAGGERATION"),n&&!i&&0!==n.getOpacity(this.transform.pitch)&&a.push("FOG"),i&&a.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&a.push("OVERDRAW_INSPECTOR"),a}useProgram(i,r,n){this.cache=this.cache||{};let a=this.currentGlobalDefines().concat(n||[]),o=t1.cacheKey(tO[i],i,a,r);return this.cache[o]||(this.cache[o]=new t1(this.context,i,tO[i],r,ib[i],a)),this.cache[o]}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(){let i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.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(r,n,a){if(this.terrain&&this.terrain.renderingToTexture)return;let o=this.style.fog;if(o){let s=o.getOpacity(this.transform.pitch),l=((r,n,a,o,s,l,h,u,c,d,p)=>{let f=r.transform,m=n.properties.get("color").toArray01();m[3]=o;let _=r.frameCounter/1e3%1;return{u_fog_matrix:a?f.calculateFogTileMatrix(a):r.identityMat,u_fog_range:n.getFovAdjustedRange(f._fov),u_fog_color:m,u_fog_horizon_blend:n.properties.get("horizon-blend"),u_fog_temporal_offset:_,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:d,u_viewport:p,u_globe_transition:i.globeToMercatorTransition(f.zoom),u_is_globe:+("globe"===f.projection.name)}})(this,o,a,s,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*i.exported.devicePixelRatio,this.transform.height*i.exported.devicePixelRatio]);n.setFogUniformValues(r,l)}}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){let i=this.canvasCopy();i&&(this.frameCopies.push(i),this.tileLoaded=!1)}canvasCopy(){let i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}
60getBackgroundTiles(){let r=this._backgroundTiles,n=this._backgroundTiles={};for(let a of this.transform.coveringTiles({tileSize:512}))n[a.key]=r[a.key]||new i.Tile(a,512,this.transform.tileZoom,this);return n}clearBackgroundTiles(){this._backgroundTiles={}}}class iZ{constructor(i=0,r=0,n=0,a=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=n,this.right=a}interpolate(r,n,a){return null!=n.top&&null!=r.top&&(this.top=i.number(r.top,n.top,a)),null!=n.bottom&&null!=r.bottom&&(this.bottom=i.number(r.bottom,n.bottom,a)),null!=n.left&&null!=r.left&&(this.left=i.number(r.left,n.left,a)),null!=n.right&&null!=r.right&&(this.right=i.number(r.right,n.right,a)),this}getCenter(r,n){let a=i.clamp((this.left+r-this.right)/2,0,r),o=i.clamp((this.top+n-this.bottom)/2,0,n);return new i.pointGeometry(a,o)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new iZ(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function i$(r,n){let a=i.getColumn(r,3);i.fromQuat(r,n),i.setColumn(r,3,a)}function iq(r,n){let a=i.identity$1([]);return i.rotateZ$1(a,a,-n),i.rotateX$1(a,a,-r),a}function iW(r,n){let a=[r[0],r[1],0],o=[n[0],n[1],0];if(i.length(a)>=1e-15){let r=i.normalize([],a);i.scale$2(o,r,i.dot(o,r)),n[0]=o[0],n[1]=o[1]}let s=i.cross([],n,r);if(1e-15>i.len(s))return null;let l=Math.atan2(-s[1],s[0]);return iq(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),l)}class iX{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){if(r){let n=r instanceof i.MercatorCoordinate?r:new i.MercatorCoordinate(r[0],r[1],r[2]);
60this._renderWorldCopies&&(n.x=i.wrap(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(r,n){if(this.orientation=null,!this.position)return;let a=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(r)):0,o=this.position,s=i.MercatorCoordinate.fromLngLat(r,a),l=[s.x-o.x,s.y-o.y,s.z-o.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=iW(l,n)}setPitchBearing(r,n){this.orientation=iq(i.degToRad(r),i.degToRad(-n))}}class iH{constructor(r,n){this._transform=i.identity([]),this.orientation=n,this.position=r}get mercatorPosition(){let r=this.position;return new i.MercatorCoordinate(r[0],r[1],r[2])}get position(){let r=i.getColumn(this._transform,3);return[r[0],r[1],r[2]]}set position(r){r&&i.setColumn(this._transform,3,[r[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||i.identity$1([]),r&&i$(this._transform,this._orientation)}getPitchBearing(){let i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=iq(i,r),i$(this._transform,this._orientation)}forward(){let r=i.getColumn(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){let r=i.getColumn(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){let r=i.getColumn(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,n){let a=new Float64Array(16);return i.invert(a,this.getWorldToCamera(r,n)),a}getWorldToCameraPosition(r,n,a){let o=this.position;i.scale$2(o,o,-r);let s=new Float64Array(16);return i.fromScaling(s,[a,a,a]),i.translate(s,s,o),s[10]*=n,s}getWorldToCamera(r,n){let a=new Float64Array(16),o=new Float64Array(4),s=this.position;return i.conjugate(o,this._orientation),i.scale$2(s,s,-r),i.fromQuat(a,o),i.translate(a,a,s),a[1]*=-1,a[5]*=-1,a[9]*=-1,a[13]*=-1,a[8]*=n,a[9]*=n,a[10]*=n,a[11]*=n,a}getCameraToClipPerspective(r,n,a,o){let s=new Float64Array(16);return i.perspective(s,r,n,a,o),s}getDistanceToElevation(r,n=!1){let a=0===r?0:i.mercatorZfromAltitude(r,n?i.latFromMercatorY(this.position[1]):this.position[1]),o=this.forward();return(a-this.position[2])/o[2]}clone(){return new iH([...this.position],[...this.orientation])}}function iY(r,n){let a=iJ(r.projection,r.zoom,r.width,r.height),o=function(r,n,a,o,s){let l=new i.LngLat(a.lng-180*iQ,a.lat),h=new i.LngLat(a.lng+180*iQ,a.lat),u=r.project(l.lng,l.lat),c=r.project(h.lng,h.lat),d=-Math.atan2(c.y-u.y,c.x-u.x),p=i.MercatorCoordinate.fromLngLat(a);p.y=i.clamp(p.y,-.999975,.999975);let f=p.toLngLat(),m=r.project(f.lng,f.lat),_=i.MercatorCoordinate.fromLngLat(f);_.x+=iQ;let g=_.toLngLat(),y=r.project(g.lng,g.lat),x=i1(y.x-m.x,y.y-m.y,d),v=i.MercatorCoordinate.fromLngLat(f);v.y+=iQ;let b=v.toLngLat(),w=r.project(b.lng,b.lat),T=i1(w.x-m.x,w.y-m.y,d),E=Math.abs(x.x)/Math.abs(T.y),S=i.identity([]);i.rotateZ(S,S,-d*(1-(s?0:o)));let M=i.identity([]);return i.scale(M,M,[1,1-(1-E)*o,1]),M[4]=-T.x/T.y*o,i.rotateZ(M,M,d),i.multiply(M,S,M),M}(r.projection,0,r.center,a,n),s=iK(r);return i.scale(o,o,[s,s,1]),o}function iK(r){let n=r.projection,a=iJ(r.projection,r.zoom,r.width,r.height);return Math.pow(2,i0(n,r.center)*a+(1-a)*i0(n,i.LngLat.convert(n.center)))}function iJ(r,n,a,o,s=1/0){let l=r.range;if(!l)return 0;let h=Math.log(Math.min(s,Math.max(a,o))/1024)/Math.LN2;return i.smoothstep(l[0]+h,l[1]+h,n)}let iQ=1/4e4;function i0(r,n){let a=i.clamp(n.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),o=new i.LngLat(n.lng-180*iQ,a),s=new i.LngLat(n.lng+180*iQ,a),l=r.project(o.lng,a),h=r.project(s.lng,a),u=i.MercatorCoordinate.fromLngLat(o),c=i.MercatorCoordinate.fromLngLat(s),d=h.x-l.x,p=h.y-l.y,f=c.x-u.x,m=c.y-u.y;return Math.log(Math.sqrt((f*f+m*m)/(d*d+p*p)))/Math.LN2}function i1(i,r,n){let a=Math.cos(n),o=Math.sin(n);return{x:i*a-r*o,y:i*o+r*a}}class i2{constructor(r,n,a,o,s,l,h){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=r||0,this._maxZoom=n||22,this._minPitch=null==a?0:a,this._maxPitch=null==o?60:o,this.setProjection(l),this.setMaxBounds(h),this.width=0,this.height=0,this._center=new i.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 iZ,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new iH,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){let i=new i2(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForE
60xaggeration=this._centerAltitudeValidForExaggeration,i.tileSize=this.tileSize,i.mercatorFromTransition=this.mercatorFromTransition,i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._seaLevelZoom=this._seaLevelZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._averageElevation=this._averageElevation,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i.frustumCorners=this.frustumCorners,i}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(i,r=!1){let n=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||n)&&this._updateCameraOnTerrain(),(i||n)&&this._constrainCamera(r),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};let n=this.projection?this.getProjection():void 0;this.projection=i.getProjection(this.projectionOptions);let a=!s(n,this.getProjection());return a&&this._calcMatrices(),this.mercatorFromTransition=!1,a}setMercatorFromTransition(){let r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.getProjection({name:"mercator"});let n=r!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get cameraWorldSize(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return i.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(r){var n,a,o,s,l,h,u,c,d,p;let f=-r*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(n=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),a=this.rotationMatrix,o=this.rotationMatrix,s=this.angle,l=o[0],h=o[1],u=o[2],c=o[3],d=Math.sin(s),p=Math.cos(s),a[0]=l*p+u*d,a[1]=h*p+c*d,a[2]=-(l*d)+u*p,a[3]=-(h*d)+c*p)}get pitch(){return this._pitch/Math.PI*180}set pitch(r){let n=i.clamp(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get aspect(){return this.width/this.height}get fovX(){return this._fov}get fovY(){let i=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/i)}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=i.degToRad(r),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(i){let r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForE
60xaggeration=void 0);let i=this._elevation;this._centerAltitude=i.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=i.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;let r=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],a=this.horizonLineFromTop(),o=0,s=0;for(let l=0;l<n.length;l++){let h=new i.pointGeometry(n[l][0]*this.width,a+n[l][1]*(this.height-a)),u=r.pointCoordinate(h);if(!u)continue;let c=1/Math.hypot(u[0]-this._camera.position[0],u[1]-this._camera.position[1]);o+=u[3]*c,s+=c}return 0===s?NaN:o/s}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let i=this._seaLevelZoom,r=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),n=this.pixelsPerMeter/this.worldSize*r,a=this._mercatorZfromZoom(i),o=this._mercatorZfromZoom(this._maxZoom);this._setZoom(this._zoomFromMercatorZ(Math.max(a-n,o)))}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}computeZoomRelativeTo(r){let n;let a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));n=r.z<this._camera.position[2]?[a.x,a.y,a.z]:[r.x,r.y,r.z];let o=i.length(i.sub([],this._camera.position,n));return i.clamp(this._zoomFromMercatorZ(o),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let n=!1;if(r.orientation&&!i.exactEquals(r.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(r.orientation)),r.position){let a=[r.position.x,r.position.y,r.position.z];i.exactEquals$1(a,this._camera.position)||(this._setCameraPosition(a),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let r=this._camera.position,n=new iX;return n.position=new i.MercatorCoordinate(r[0],r[1],r[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(r){if(!i.length$1(r))return!1;i.normalize$1(r,r);let n=i.transformQuat([],[0,0,-1],r),a=i.transformQuat([],[0,-1,0],r);if(a[2]<0)return!1;let o=iW(n,a);return!!o&&(this._camera.orientation=o,!0)}_setCameraPosition(r){let n=this.zoomScale(this.minZoom)*this.tileSize,a=this.zoomScale(this.maxZoom)*this.tileSize,o=this.cameraToCenterDistance;r[2]=i.clamp(r[2],o/a,o/n),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,r,n){this._unmodified=!1,this._edgeInsets.interpolate(i,r,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize)))}getVisibleUnwrappedCoordinates(r){let n=[new i.UnwrappedTileID(0,r)];if(this.renderWorldCopies){let a=this.pointCoordinate(new i.pointGeometry(0,0)),o=this.pointCoordinate(new i.pointGeometry(this.width,0)),s=this.pointCoordinate(new i.pointGeometry(this.width,this.height)),l=this.pointCoordinate(new i.pointGeometry(0,this.height)),h=Math.floor(Math.min(a.x,o.x,s.x,l.x)),u=Math.floor(Math.max(a.x,o.x,s.x,l.x));for(let a=h-1;a<=u+1;a++)0!==a&&n.push(new i.UnwrappedTileID(a,r))}return n}coveringTiles(r){let n=this.coveringZoomLevel(r),a=n,o=this.elevation&&!r.isTerrainDEM,s="mercator"===this.projection.name;if(void 0!==r.minzoom&&n<r.minzoom)return[];void 0!==r.maxzoom&&n>r.maxzoom&&(n=r.maxzoom);let l=this.locationCoordinate(this.center),h=this.center.lat,u=1<<n,c=[u*l.x,u*l.y,0],d="globe"===this.projection.name,p=!d,f=i.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,p),m=d?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),_=u*i.mercatorZfromAltitude(1,this.center.lat),g=this._camera.position[2]/i.mercatorZfromAltitude(1,this.center.lat),y=[u*m.x,u*m.y,g*(p?1:_)],x=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),v=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?n:0,b=r.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,w=r.isTerrainDEM?-b:this._elevation?this._elevation.getMinElevationBelowMSL():0,T=this.projection.isReprojectedInTileSpace?iK(this):1,E=r=>{let n=1/4e4,a=new i.MercatorCoordinate(r.x+n,r.y,r.z),o=new i.MercatorCoordinate(r.x,r.y+n,r.z),s=r.toLngLat(),l=a.toLngLat(),h=o.toLngLat(),u=this.locationCoordinate(s),c=this.locationCoordinate(l),d=this.locationCoordinate(h);return Math.sqrt(Math.hypot(c.x-u.x,c.y-u.y)*Math.hypot(d.x-u.x,d.y-u.y))*T/n},S=r=>({aabb:i.tileAABB(this,u,0,0,0,r,w,b,this.projection),zoom:0,x:0,y:0,minZ:w,maxZ:b,wrap:r,fullyVisible:!1}),M=[],A=[],I=n,C=r.reparseOverscaled?a:n,z=i=>i*i,k=z((g-this._centerAltitude)*_),D=i=>{if(!this._elevation||!i.tileID||!s)return;let r=this._elevation.getMinMaxForTile(i.tileID),n=i.aabb;r?(n.min[2]=r.min,n.max[2]=r.max,n.center[2]=(n.min[2]+n.max[2])/2):(i.shouldSplit=P(i),i.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},P=r=>{if(r.zoom<v)return!0;
60if(r.zoom===I)return!1;if(null!=r.shouldSplit)return r.shouldSplit;let n=r.aabb.distanceX(y),s=r.aabb.distanceY(y),l=k,u=1;if(d){l=z(r.aabb.distanceZ(y));let n=Math.pow(2,r.zoom),a=Math.min(Math.max(h,i.latFromMercatorY((r.y+1)/n)),i.latFromMercatorY(r.y/n)),o=i.circumferenceAtLatitude(a)/i.circumferenceAtLatitude(h);if(u=a===h?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,o/this._mercatorScaleRatio),this.zoom<=i.GLOBE_ZOOM_THRESHOLD_MIN&&r.zoom===I-1&&o>=.9)return!0}else if(o&&(l=z(r.aabb.distanceZ(y)*_)),this.projection.isReprojectedInTileSpace&&a<=5){let n=Math.pow(2,r.zoom),a=E(new i.MercatorCoordinate((r.x+.5)/n,(r.y+.5)/n));u=a>.85?1:a}let c=n*n+s*s+l,p=z((1<<I-r.zoom)*x*u*((i,r)=>{if(r*z(.707)<i)return 1;let n=Math.sqrt(r/i);return n/(1.4144271570014144+(Math.pow(1.1,n-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(l,k),c));return c<p};if(this.renderWorldCopies)for(let i=1;i<=3;i++)M.push(S(-i)),M.push(S(i));for(M.push(S(0));M.length>0;){let a=M.pop(),l=a.x,h=a.y,p=a.fullyVisible;if(!p){let i=a.aabb.intersects(f);if(0===i)continue;p=2===i}if(a.zoom!==I&&P(a))for(let r=0;r<4;r++){let n=(l<<1)+r%2,c=(h<<1)+(r>>1),f={aabb:s?a.aabb.quadrant(r):i.tileAABB(this,u,a.zoom+1,n,c,a.wrap,a.minZ,a.maxZ,this.projection),zoom:a.zoom+1,x:n,y:c,wrap:a.wrap,fullyVisible:p,tileID:void 0,shouldSplit:void 0,minZ:a.minZ,maxZ:a.maxZ};o&&!d&&(f.tileID=new i.OverscaledTileID(a.zoom+1===I?C:a.zoom+1,a.wrap,a.zoom+1,n,c),D(f)),M.push(f)}else{let o=a.zoom===I?C:a.zoom;if(r.minzoom&&r.minzoom>o)continue;let s=c[0]-(.5+l+(a.wrap<<a.zoom))*(1<<n-a.zoom),u=c[1]-.5-h,d=a.tileID?a.tileID:new i.OverscaledTileID(o,a.wrap,a.zoom,l,h);A.push({tileID:d,distanceSq:s*s+u*u})}}if(this.fogCullDistSq){let n=this.fogCullDistSq,a=this.horizonLineFromTop();A=A.filter(o=>{let s=[0,0,0,1],l=[i.EXTENT,i.EXTENT,0,1],h=this.calculateFogTileMatrix(o.tileID.toUnwrapped());i.transformMat4$1(s,s,h),i.transformMat4$1(l,l,h);let u=i.getAABBPointSquareDist(s,l);if(0===u)return!0;let c=!1,d=this._elevation;if(d&&u>n&&0!==a){let n;let s=this.calculateProjMatrix(o.tileID.toUnwrapped());r.isTerrainDEM||(n=d.getMinMaxForTile(o.tileID)),n||(n={min:w,max:b});let l=i.furthestTileCorner(this.rotation),h=[l[0]*i.EXTENT,l[1]*i.EXTENT,n.max];i.transformMat4(h,h,s),c=(1-h[1])*this.height*.5<a}return u<n||c})}return A.sort((i,r)=>i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(r){let n=i.clamp(r.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),a=this.projection.project(r.lng,n);return new i.pointGeometry(a.x*this.worldSize,a.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/i.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,n){let a,o;let s=this.centerPoint;if("globe"===this.projection.name){let i=this.worldSize;a=(n.x-s.x)/i,o=(n.y-s.y)/i}else{let i=this.pointCoordinate(n),r=this.pointCoordinate(s);a=i.x-r.x,o=i.y-r.y}let l=this.locationCoordinate(r);this.setLocation(new i.MercatorCoordinate(l.x-a,l.y-o))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i){return this.projection.locationPoint(this,i)}locationPoint3D(i){return this.projection.locationPoint(this,i,!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i){return this.coordinateLocation(this.pointCoordinate3D(i))}locationCoordinate(r,n){let a=n?i.mercatorZfromAltitude(n,r.lat):void 0,o=this.projection.project(r.lng,r.lat);return new i.MercatorCoordinate(o.x,o.y,a)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,n){let a=null!=n?n:this._centerAltitude,o=[r.x,r.y,0,1],s=[r.x,r.y,1,1];i.transformMat4$1(o,o,this.pixelMatrixInverse),i.transformMat4$1(s,s,this.pixelMatrixInverse);let l=s[3];i.scale$1(o,o,1/o[3]),i.scale$1(s,s,1/l);let h=o[2],u=s[2];return{p0:o,p1:s,t:h===u?0:(a-h)/(u-h)}}screenPointToMercatorRay(r){let n=[r.x,r.y,0,1],a=[r.x,r.y,1,1];return i.transformMat4$1(n,n,this.pixelMatrixInverse),i.transformMat4$1(a,a,this.pixelMatrixInverse),i.scale$1(n,n,1/n[3]),i.scale$1(a,a,1/a[3]),n[2]=i.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,a[2]=i.mercatorZfromAltitude(a[2],this._center.lat)*this.worldSize,i.scale$1(n,n,1/this.worldSize),i.scale$1(a,a,1/this.worldSize),new i.Ray([n[0],n[1],n[2]],i.normalize([],i.sub([],a,n)))}rayIntersectionCoordinate(r){let{p0:n,p1:a,t:o}=r,s=i.mercatorZfromAltitude(n[2],this._center.lat),l=i.mercatorZfromAltitude(a[2],this._center.lat);return new i.MercatorCoordinate(i.number(n[0],a[0],o)/this.worldSize,i.number(n[1],a[1],o)/this.worldSize,i.number(s,l,o))}pointCoordinate(i,r=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,r)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);let n=this.projection.pointCoordinate3D(this,r.x,r.y);if(n)return new i.MercatorCoordinate(n[0],n[1],n[2]);let a=0,o=this.horizonLineFromTop();if(r.y>o)return this.pointCoordinate(r);let s=.02*o,l=r.clone();for(let r=0;r<10&&o-a>s;r++){l.y=i.number(a,o,.66);let r=this.projection.pointCoordinate3D(this,l.x,l.y);r?(o=l.y,n=r):a=l.y}return n?new i.MercatorCoordinate(n[0],n[1],n[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}_coordinatePoint(r,n){let a=n&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,o=[r.x*this.worldSize,r.y*this.worldSize,a+r.toAltitude(),1];return i.transformMat4$1(o,o,this.pixelMatrix),o[3]>0?new i.pointGeometry(o[0]/o[3],o[1]/o[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:r,left:n}=this._edgeInsets,a=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,s=this.pointLocation3D(new i.pointGeometry(n,r)),l=this.pointLocation3D(new i.pointGeometry(o,r)),h=this.pointLocation3D(new i.pointGeometry(o,a)),u=this.pointLocation3D(new i.pointGeometry(n,a)),c=Math.min(s.lng,l.lng,h.lng,u.lng),d=Math.max(s.lng,l.lng,h.lng,u.lng),p=Math.min(s.lat,l.lat,h.lat,u.lat),f=Math.max(s.lat,l.lat,h.lat,u.lat),m=Math.pow(2,-this.zoom)/16*270,_="globe"===this.projection.name?1:4,g=(r,n,a,o,s)=>{let l=(r+a)/2,h=(n+o)/2,u=new i.pointGeometry(l,h),{lng:y,lat:x}=this.pointLocation3D(u),v=Math.max(0,c-y,p-x,y-d,x-f);c=Math.min(c,y),d=Math.max(d,y),p=Math.min(p,x),f=Math.max(f,x),(s<_||v>m)&&(g(r,n,l,h,s+1),g(l,h,a,o,s+1))};if(g(n,r,o,r,1),g(o,r,o,a,1),g(o,a,n,a,1),g(n,a,n,r,1),"globe"===this.projection.name){let[r,n]=i.polesInViewport(this);r?(f=90,d=180,c=-180):n&&(p=-90,d=180,c=-180)}return new i.LngLatBounds(new i.LngLat(c,p),new i.LngLat(d,f))}_getBoundsRectangular(r,n){let a,o,s,l;let{top:h,left:u}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=new i.pointGeometry(u,h),f=new i.pointGeometry(d,h),m=new i.pointGeometry(d,c),_=new i.pointGeometry(u,c),g=this.pointCoordinate(p,r),y=this.pointCoordinate(f,r),x=this.pointCoordinate(m,n),v=this.pointCoordinate(_,n);return g.y>1&&y.y>=0?g=new i.MercatorCoordinate((1-v.y)/(((a=g).y-v.y)/(a.x-v.x))+v.x,1):g.y<0&&y.y<=1&&(g=new i.MercatorCoordinate(-v.y/(((o=g).y-v.y)/(o.x-v.x))+v.x,0)),y.y>1&&g.y>=0?y=new i.MercatorCoordinate((1-x.y)/(((s=y).y-x.y)/(s.x-x.x))+x.x,1):y.y<0&&g.y<=1&&(y=new i.MercatorCoordinate(-x.y/(((l=y).y-x.y)/(l.x-x.x))+x.x,0)),(new i.LngLatBounds).extend(this.coordinateLocation(g)).extend(this.coordinateLocation(y)).extend(this.coordinateLocation(v)).extend(this.coordinateLocation(x))}_getBoundsRectangularTerrain(){let i=this.elevation;if(!i.visibleDemTiles.length||i.isUsingMockSource())return this._getBoundsRectangular(0,0);let r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){let n=r.dem.tree;i.min=Math.min(i.min,n.minimums[0]),i.max=Math.max(i.max,n.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(i=!0){let r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=i.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=i.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=i.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,r){return this.projection.createTileMatrix(this,r,i)}calculateDistanceTileData(r){let n=r.key,a=this._distanceTileDataCache;if(a[n])return a[n];let o=r.canonical,s=1/this.height,l=this.cameraWorldSize,h=l/this.zoomScale(o.z),u=(o.x+Math.pow(2,o.z)*r.wrap)*h,c=o.y*h,d=this.point;d.x*=l/this.worldSize,d.y*=l/this.worldSize;let p=this.angle,f=Math.sin(-p),m=-Math.cos(-p);return a[n]={bearing:[f,m],center:[(d.x-u)*s,(d.y-c)*s],scale:h/i.EXTENT*s},a[n]}calculateFogTileMatrix(r){let n=r.key,a=this._fogTileMatrixCache;if(a[n])return a[n];let o=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return i.multiply(o,this.worldToFogMatrix,o),a[n]=new Float32Array(o),a[n]}calculateProjMatrix(r,n=!1){let a=r.key,o=n?this._alignedProjMatrixCache:this._projMatrixCache;if(o[a])return o[a];let s=this.calculatePosMatrix(r,this.worldSize);return i.multiply(s,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:n?this.alignedProjMatrix:this.projMatrix,s),o[a]=new Float32Array(s),o[a]}calculatePixelsToTileUnitsMatrix(r){let n=r.tileID.key,a=this._pixelsToTileUnitsCache;if(a[n])return a[n];let o=function(r,n){var a,o,s,l,h,u,c,d;let{scale:p}=r.tileTransform,f=p*i.EXTENT/(r.tileSize*Math.pow(2,n.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return a=new Float32Array(4),l=(o=n.inverseAdjustmentMatrix)[1],h=o[2],u=o[3],d=(s=[f,f])[1],a[0]=o[0]*(c=s[0]),a[1]=l*c,a[2]=h*d,a[3]=u*d,a}(r,this);return a[n]=o,a[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let r=1/this.worldSize,n=i.fromScaling([],[r,r,r]);return i.multiply(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let r=this._elevation;this._updateCameraState();let n=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(n),o=this._camera.forward(),s=i.mercatorZfromAltitude(1,this._center.lat);a[2]/=s,o[2]/=s,i.normalize(o,o);let l=r.raycast(a,o,r.exaggeration());if(l){let r=i.scaleAndAdd([],a,o,l),n=new i.MercatorCoordinate(r[0],r[1],i.mercatorZfromAltitude(r[2],i.latFromMercatorY(r[1]))),h=(n.z+i.length([n.x-a[0],n.y-a[1],n.z-a[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(h),this._centerAltitude=n.toAltitude(),this._center=this.coordinateLocation(n),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;let n=this._elevation,a=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,o=this._computeCameraPosition(a),s=n.getAtPointOrZero(new i.MercatorCoordinate(...o)),l=this.pixelsPerMeter/this.worldSize*s,h=this._minimumHeightOverTerrain(),u=o[2]-l;if(u<=h){if(u<0||r){let r=this.locationCoordinate(this._center,this._centerAltitude),n=[o[0],o[1],r.z-o[2]],a=i.length(n);n[2]-=(h-u)/this._pixelsPerMercatorPixel;let s=i.length(n);if(0===s)return;i.scale$2(n,n,a/s*this._pixelsPerMercatorPixel),this._camera.position=[o[0],o[1],r.z*this._pixelsPerMercatorPixel-n[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let r="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){let n=this.center;return n.lat=i.clamp(n.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||r)||(n.lng=i.clamp(n.lng,this.minLng,this.maxLng)),this.center=n,void(this._constraining=!1)}let n=this._unmodified,{x:a,y:o}=this.point,s=0,l=a,h=o,u=this.width/2,c=this.height/2,d=this.worldMinY*this.scale,p=this.worldMaxY*this.scale;if(o-c<d&&(h=d+c),o+c>p&&(h=p-c),p-d<this.height&&(s=Math.max(s,this.height/(p-d)),h=(p+d)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let i=this.worldMinX*this.scale,r=this.worldMaxX*this.scale,n=this.worldSize/2-(i+r)/2;(l=(a+n+this.worldSize)%this.worldSize-n)-u<i&&(l=i+u),l+u>r&&(l=r-u),r-i<this.width&&(s=Math.max(s,this.width/(r-i)),l=(r+i)/2)}l===a&&h===o||(this.center=this.unproject(new i.pointGeometry(l,h))),s&&(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=n,this._constraining=!1}_minZoomForBounds(){let i=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(i=Math.max(i,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),i}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
60_calcMatrices(){if(!this.height)return;let r=this.centerOffset,n=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=i.mercatorZfromAltitude(1,this.center.lat)/i.mercatorZfromAltitude(1,i.GLOBE_SCALE_MATCH_LATITUDE));let a=iJ(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,a),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;let o="meters"===this.projection.zAxisUnit?n:1,s=this._camera.getWorldToCamera(this.worldSize,o),l=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);l[8]=-(2*r.x)/this.width,l[9]=2*r.y/this.height;let h=i.mul([],l,s);if(this.projection.isReprojectedInTileSpace){let r=this.locationCoordinate(this.center),n=i.identity([]);i.translate(n,n,[r.x*this.worldSize,r.y*this.worldSize,0]),i.multiply(n,n,iY(this)),i.translate(n,n,[-r.x*this.worldSize,-r.y*this.worldSize,0]),i.multiply(h,h,n),this.inverseAdjustmentMatrix=function(i){let r=iY(i,!0);return w([],[r[0],r[1],r[4],r[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=i.scale([],h,[this.worldSize,this.worldSize,this.worldSize/o,1]),this.projMatrix=h,this.invProjMatrix=i.invert(new Float64Array(16),this.projMatrix);let u=i.invert([],l);this.frustumCorners=i.FrustumCorners.fromInvProjectionMatrix(u,this.horizonLineFromTop(),this.height);let c=new Float32Array(16);i.identity(c),i.scale(c,c,[1,-1,1]),i.rotateX(c,c,this._pitch),i.rotateZ(c,c,this.angle);let d=i.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),p=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;d[8]=-(2*r.x)/this.width,d[9]=2*(r.y+p)/this.height,this.skyboxMatrix=i.multiply(c,d,c);let f=this.point,m=f.x,_=f.y,g=this.width%2/2,y=this.height%2/2,x=Math.cos(this.angle),v=Math.sin(this.angle),b=m-Math.round(m)+x*g+v*y,T=_-Math.round(_)+x*y+v*g,E=new Float64Array(h);if(i.translate(E,E,[b>.5?b-1:b,T>.5?T-1:T,0]),this.alignedProjMatrix=E,h=i.create(),i.scale(h,h,[this.width/2,-this.height/2,1]),i.translate(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=i.create(),i.scale(h,h,[1,-1,1]),i.translate(h,h,[-1,-1,0]),i.scale(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(h=i.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");if(this.pixelMatrixInverse=h,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=i.calculateGlobeMatrix(this);let r=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.transformMat4(r,r,s),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=h;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let r=this.cameraWorldSizeForFog,n=this.cameraPixelsPerMeter,a=this._camera.position,o=1/this.height/this._pixelsPerMercatorPixel,s=[r,r,n];i.scale$2(s,s,o),i.scale$2(a,a,-1),i.multiply$2(a,a,s);let l=i.create();i.translate(l,l,a),i.scale(l,l,s),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,n,o)}_computeCameraPosition(i){let r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),a=this.point,o=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[a.x/this.worldSize-n[0]*o,a.y/this.worldSize-n[1]*o,i/this.worldSize*this._centerAltitude-n[2]*o]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){let n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),a=this._camera.position[2],o=r[2],s=1;this.projection.wrap&&(this.center=this.center.wrap()),o>0&&(s=Math.min((n-a)/o,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){let r=this._camera.position,n=this._camera.forward(),{pitch:a,bearing:o}=this._camera.getPitchBearing(),s=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),h=Math.max((r[2]-s)/Math.cos(a),l),u=this._zoomFromMercatorZ(h);i.scaleAndAdd(r,r,n,h),this._pitch=i.clamp(a,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(o,-Math.PI,Math.PI),this._setZoom(i.clamp(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.MercatorCoordinate(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){let i=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(i*this.tileSize))}zoomFromMercatorZAdjusted(r){let n=0,a=i.GLOBE_ZOOM_THRESHOLD_MAX,o=0,s=1/0;for(;a-n>1e-6&&a>n;){let i=n+.5*(a-n),l=this.tileSize*Math.pow(2,i),h=this.getCameraToCenterDistance(this.projection,i,l),u=this.scaleZoom(h/(r*this.tileSize)),c=Math.abs(i-u);c<s&&(s=c,o=i),i<u?n=i:a=i}return o}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,n){let a=Math.min(r.x,n.x),o=Math.max(r.x,n.x),s=Math.min(r.y,n.y),l=Math.max(r.y,n.y);if(s<this.horizonLineFromTop(!1))return!0;
60if("mercator"!==this.projection.name)return!1;let h=[new i.pointGeometry(a,s),new i.pointGeometry(o,l),new i.pointGeometry(a,l),new i.pointGeometry(o,s)],u=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(let i of h){let r=this.pointRayIntersection(i);if(r.t<0)return!0;let n=this.rayIntersectionCoordinate(r);if(n.x<u||n.y<0||n.x>c||n.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(r,n){let a=i.length(i.sub([],this._camera.position,r)),o=this._zoomFromMercatorZ(a)+n;return a-this._mercatorZfromZoom(o)}getCameraPoint(){if("globe"===this.projection.name){let r=function([r,n,a],o){let s=[r,n,a,1];i.transformMat4$1(s,s,o);let l=s[3]=Math.max(s[3],1e-6);return s[0]/=l,s[1]/=l,s[2]/=l,s}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.pointGeometry(r[0],r[1])}{let r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,r))}}getCameraToCenterDistance(i,r=this.zoom,n=this.worldSize){let a=iJ(i,r,this.width,this.height,1024),o=i.pixelSpaceConversion(this.center.lat,n,a);return .5/Math.tan(.5*this._fov)*this.height*o}getWorldToCameraMatrix(){let r=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&i.multiply(r,r,this.globeMatrix),r}}function i3(i,r){let n=!1,a=null,o=()=>{a=null,n&&(i(),a=setTimeout(o,r),n=!1)};return()=>(n=!0,a||o(),a)}class i5{constructor(r){this._hashName=r&&encodeURIComponent(r),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=i3(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,i.window.addEventListener("hashchange",this._onHashChange,!1),r.on("moveend",this._updateHash),this}remove(){return this._map&&(this._map.off("moveend",this._updateHash),i.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0),this}getHashString(){let r=this._map;if(!r)return"";let n=i4(r);if(this._hashName){let r=this._hashName,a=!1,o=i.window.location.hash.slice(1).split("&").map(i=>{let o=i.split("=")[0];return o===r?(a=!0,`${o}=${n}`):i}).filter(i=>i);return a||o.push(`${r}=${n}`),`#${o.join("&")}`}return`#${n}`}_getCurrentHash(){let r=i.window.location.hash.replace("#","");if(this._hashName){let i;return r.split("&").map(i=>i.split("=")).forEach(r=>{r[0]===this._hashName&&(i=r)}),(i&&i[1]||"").split("/")}return r.split("/")}_onHashChange(){let i=this._map;if(!i)return!1;let r=this._getCurrentHash();if(r.length>=3&&!r.some(i=>isNaN(i))){let n=i.dragRotate.isEnabled()&&i.touchZoomRotate.isEnabled()?+(r[3]||0):i.getBearing();return i.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:n,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){let r=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,r)}}function i4(i,r){let n=i.getCenter(),a=Math.round(100*i.getZoom())/100,o=Math.pow(10,Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10)),s=Math.round(n.lng*o)/o,l=Math.round(n.lat*o)/o,h=i.getBearing(),u=i.getPitch(),c=r?`/${s}/${l}/${a}`:`${a}/${l}/${s}`;return(h||u)&&(c+="/"+Math.round(10*h)/10),u&&(c+=`/${Math.round(u)}`),c}let i6={linearity:.3,easing:i.bezier(0,0,.3,1)},i8=i.extend({deceleration:2500,maxSpeed:1400},i6),i9=i.extend({deceleration:20,maxSpeed:1400},i6),i7=i.extend({deceleration:1e3,maxSpeed:360},i6),re=i.extend({deceleration:1e3,maxSpeed:90},i6);class rt{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:r})}_drainInertiaBuffer(){let r=this._inertiaBuffer,n=i.exported.now();for(;r.length>0&&n-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:i}of this._inertiaBuffer)n.zoom+=i.zoomDelta||0,n.bearing+=i.bearingDelta||0,n.pitch+=i.pitchDelta||0,i.panDelta&&n.pan._add(i.panDelta),i.around&&(n.around=i.around),i.pinchAround&&(n.pinchAround=i.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(n.pan.mag()){let s=rr(n.pan.mag(),a,i.extend({},i8,r||{}));o.offset=n.pan.mult(s.amount/n.pan.mag()),o.center=this._map.transform.center,ri(o,s)}if(n.zoom){let i=rr(n.zoom,a,i9);o.zoom=this._map.transform.zoom+i.amount,ri(o,i)}if(n.bearing){let r=rr(n.bearing,a,i7);
60o.bearing=this._map.transform.bearing+i.clamp(r.amount,-179,179),ri(o,r)}if(n.pitch){let i=rr(n.pitch,a,re);o.pitch=this._map.transform.pitch+i.amount,ri(o,i)}if(o.zoom||o.bearing){let i=void 0===n.pinchAround?n.around:n.pinchAround;o.around=i?this._map.unproject(i):this._map.getCenter()}return this.clear(),o.noMoveStart=!0,o}}function ri(i,r){(!i.duration||i.duration<r.duration)&&(i.duration=r.duration,i.easing=r.easing)}function rr(r,n,a){let{maxSpeed:o,linearity:s,deceleration:l}=a,h=i.clamp(r*s/(n/1e3),-o,o),u=Math.abs(h)/(l*s);return{easing:a.easing,duration:1e3*u,amount:u/2*h}}class rn extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,n,a,o={}){let s=y(n.getCanvasContainer(),a);super(r,i.extend({point:s,lngLat:n.unproject(s),originalEvent:a},o)),this._defaultPrevented=!1,this.target=n}}class ra extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,n,a){let o="touchend"===r?a.changedTouches:a.touches,s=x(n.getCanvasContainer(),o),l=s.map(i=>n.unproject(i)),h=s.reduce((i,r,n,a)=>i.add(r.div(a.length)),new i.pointGeometry(0,0));super(r,{points:s,point:h,lngLats:l,lngLat:n.unproject(h),originalEvent:a}),this._defaultPrevented=!1}}class ro extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,n){super(i,{originalEvent:n}),this._defaultPrevented=!1}}class rs{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new ro(i.type,this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new rn(i.type,this._map,i))}mouseup(i){this._map.fire(new rn(i.type,this._map,i))}preclick(r){let n=i.extend({},r);n.type="preclick",this._map.fire(new rn(n.type,this._map,n))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new rn(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new rn(i.type,this._map,i))}mouseover(i){this._map.fire(new rn(i.type,this._map,i))}mouseout(i){this._map.fire(new rn(i.type,this._map,i))}touchstart(i){return this._firePreventable(new ra(i.type,this._map,i))}touchmove(i){this._map.fire(new ra(i.type,this._map,i))}touchend(i){this._map.fire(new ra(i.type,this._map,i))}touchcancel(i){this._map.fire(new ra(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rl{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new rn(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new rn(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rh{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(f(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active)return;let n=this._startPos,a=this._lastPos;if(!n||!a||a.equals(r)||!this._box&&r.dist(n)<this._clickTolerance)return;this._lastPos=r,this._box||(this._box=u("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));let o=Math.min(n.x,r.x),s=Math.max(n.x,r.x),l=Math.min(n.y,r.y),h=Math.max(n.y,r.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${o}px,${l}px)`,this._box.style.width=s-o+"px",this._box.style.height=h-l+"px")})}mouseupWindow(r,n){if(!this._active)return;let a=this._startPos;if(a&&0===r.button){if(this.reset(),g(),a.x!==n.x||a.y!==n.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(a,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),m(),delete this._startPos,delete this._lastPos}_fireEvent(r,n){return this._map.fire(new i.Event(r,{originalEvent:n}))}}function ru(i,r){let n={};for(let a=0;a<i.length;a++)n[i[a].identifier]=r[a];return n}class rc{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=r.timeStamp),a.length===this.numTouches&&(this.centroid=function(r){let n=new i.pointGeometry(0,0);for(let i of r)n._add(i);return n.div(r.length)}(n),this.touches=ru(a,n)))}touchmove(i,r,n){if(this.aborted||!this.centroid)return;let a=ru(n,r);for(let i in this.touches){let r=this.touches[i],n=a[i];(!n||n.dist(r)>30)&&(this.aborted=!0)}}touchend(i,r,n){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}}class rd{constructor(i){this.singleTap=new rc(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(i,r,n){this.singleTap.touchstart(i,r,n)}touchmove(i,r,n){this.singleTap.touchmove(i,r,n)}touchend(i,r,n){let a=this.singleTap.touchend(i,r,n);if(a){let r=i.timeStamp-this.lastTime<500,n=!this.lastTap||30>this.lastTap.dist(a);if(r&&n||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class rp{constructor(){this._zoomIn=new rd({numTouches:1,numTaps:2}),this._zoomOut=new rd({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,n){this._zoomIn.touchstart(i,r,n),this._zoomOut.touchstart(i,r,n)}touchmove(i,r,n){this._zoomIn.touchmove(i,r,n),this._zoomOut.touchmove(i,r,n)}touchend(i,r,n){let a=this._zoomIn.touchend(i,r,n),o=this._zoomOut.touchend(i,r,n);return a?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(a)},{originalEvent:i})}):o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(o)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let rf={0:1,2:2};class rm{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;let n=v(i);this._correctButton(i,n)&&(this._lastPoint=r,this._eventButton=n)}mousemoveWindow(i,r){let n=this._lastPoint;if(n){if(i.preventDefault(),null!=this._eventButton&&function(i,r){let n=rf[r];return void 0===i.buttons||(i.buttons&n)!==n}(i,this._eventButton))this.reset();else if(this._moved||!(r.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(n,r)}}mouseupWindow(i){this._lastPoint&&v(i)===this._eventButton&&(this._moved&&g(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class r_ extends rm{mousedown(i,r){super.mousedown(i,r),this._lastPoint&&(this._active=!0)}_correctButton(i,r){return 0===r&&!i.ctrlKey}_move(i,r){return{around:r,panDelta:r.sub(i)}}}class rg extends rm{_correctButton(i,r){return 0===r&&i.ctrlKey||2===r}_move(i,r){let n=.8*(r.x-i.x);if(n)return this._active=!0,{bearingDelta:n}}contextmenu(i){i.preventDefault()}}class ry extends rm{_correctButton(i,r){return 0===r&&i.ctrlKey||2===r}_move(i,r){let n=-.5*(r.y-i.y);if(n)return this._active=!0,{pitchDelta:n}}contextmenu(i){i.preventDefault()}}class rx{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),i.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new i.pointGeometry(0,0)}touchstart(i,r,n){return this._calculateTransform(i,r,n)}touchmove(r,n,a){if(this._active&&!(a.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===a.length&&!i.isFullscreen())return void this._showTouchPanBlockerAlert();
60"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,n,a)}}touchend(i,r,n){this._calculateTransform(i,r,n),this._active&&n.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,n,a){a.length>0&&(this._active=!0);let o=ru(a,n),s=new i.pointGeometry(0,0),l=new i.pointGeometry(0,0),h=0;for(let i in o){let r=o[i],n=this._touches[i];n&&(s._add(r),l._add(r.sub(n)),h++,o[i]=r)}if(this._touches=o,h<this._minTouches||!l.mag())return;let u=l.div(h);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(h),panDelta:u}}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=u("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="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")},500)}}class rv{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(i){}_move(i,r,n){return{}}touchstart(i,r,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([r[0],r[1]]))}touchmove(i,r,n){let a=this._firstTwoTouches;if(!a)return;i.preventDefault();let[o,s]=a,l=rb(n,r,o),h=rb(n,r,s);if(!l||!h)return;let u=this._aroundCenter?null:l.add(h).div(2);return this._move([l,h],u,i)}touchend(i,r,n){if(!this._firstTwoTouches)return;let[a,o]=this._firstTwoTouches,s=rb(n,r,a),l=rb(n,r,o);s&&l||(this._active&&g(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function rb(i,r,n){for(let a=0;a<i.length;a++)if(i[a].identifier===n)return r[a]}function rw(i,r){return Math.log(i/r)/Math.LN2}class rT extends rv{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,r){let n=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(.1>Math.abs(rw(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:rw(this._distance,n),pinchAround:r}}}function rE(i,r){return 180*i.angleWith(r)/Math.PI}class rS extends rv{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){let n=this._vector;if(this._vector=i[0].sub(i[1]),n&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:rE(this._vector,n),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let r=25/(Math.PI*this._minDiameter)*360,n=this._startVector;return!!n&&Math.abs(rE(i,n))<r}}function rM(i){return Math.abs(i.y)>Math.abs(i.x)}class rA extends rv{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(i){this._lastPoints=i,rM(i[0].sub(i[1]))&&(this._valid=!1)}_move(r,n,a){let o=this._lastPoints;if(!o)return;let s=r[0].sub(o[0]),l=r[1].sub(o[1]);return this._map._cooperativeGestures&&!i.isFullscreen()&&a.touches.length<3||(this._val
60id=this.gestureBeginsVertically(s,l,a.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:-((s.y+l.y)/2*.5)})}gestureBeginsVertically(i,r,n){if(void 0!==this._valid)return this._valid;let a=i.mag()>=2,o=r.mag()>=2;if(!a&&!o)return;if(!a||!o)return null==this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;let s=i.y>0==r.y>0;return rM(i)&&rM(r)&&s}}class rI{constructor(){this._panStep=100,this._bearingStep=15,this._pitchStep=10,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,n=0,a=0,o=0,s=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?n=-1:(i.preventDefault(),o=-1);break;case 39:i.shiftKey?n=1:(i.preventDefault(),o=1);break;case 38:i.shiftKey?a=1:(i.preventDefault(),s=-1);break;case 40:i.shiftKey?a=-1:(i.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(n=0,a=0),{cameraAnimation:l=>{let h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:rC,zoom:r?Math.round(h)+r*(i.shiftKey?2:1):h,bearing:l.getBearing()+n*this._bearingStep,pitch:l.getPitch()+a*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:l.getCenter()},{originalEvent:i})}}}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 rC(i){return i*(2-i)}class rz{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||i.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=r.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY,a=i.exported.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&4>Math.abs(n)?this._type="trackpad":o>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(o*n)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),r.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=r,this._delta-=n,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=y(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,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;let r=this._map.transform;"wheel"===this._type&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let n=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==a&&(a=1/a);let o=n(),s=Math.pow(2,o),l="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(l*a))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._delta=0}let a="number"==typeof this._targetZoom?this._targetZoom:n(),o=this._startZoom,s=this._easing,l,h=!1;if("wheel"===this._type&&o&&s){let r=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),n=s(r);l=i.number(o,a,n),r<1?this._frameId||(this._frameId=!0):h=!0}else l=a,h=!0;return this._active=!0,h&&(this._active=!1,this._finishTimeout=setTimeout(()=>
60{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!h,zoomDelta:l-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let n=i.ease;if(this._prevEase){let r=this._prevEase,a=(i.exported.now()-r.start)/r.duration,o=r.easing(a+.01)-r.easing(a),s=.27/Math.sqrt(o*o+1e-4)*.01;n=i.bezier(s,Math.sqrt(.0729-s*s),.25,1)}return this._prevEase={start:i.exported.now(),duration:r,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=u("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.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`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")},200)}}class rk{constructor(i,r){this._clickZoom=i,this._tapZoom=r}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 rD{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(i.shiftKey?-1:1),around:n.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rP{constructor(){this._tap=new rd({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(i,r,n){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=r[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(i,r,n))}touchmove(i,r,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let a=r[0],o=a.y-this._swipePoint.y;return this._swipePoint=a,i.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(i,r,n)}touchend(i,r,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(i,r,n)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rL{constructor(i,r,n){this._el=i,this._mousePan=r,this._touchPan=n}enable(i){this._inertiaOptions=i||{},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 rR{constructor(i,r,n){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=n}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 rB{constructor(i,r,n,a){this._el=i,this._touchZoom=r,this._touchRotate=n,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),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()}}let rO=i=>i.zoom||i.drag||i.pitch||i.rotate;class rF extends i.Event{}class rU{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,n){let a=i.sub([],n,r);this.radius=i.length(a[2]<0?i.div([],a,this.constants):[a[0],a[1],0])}projectRay(r){i.div(r,r,this.constants),i.normalize(r,r),i.mul$1(r,r,this.constants);let n=i.scale$2([],r,this.radius);if(n[2]>0){let r=i.scale$2([],[0,0,1],i.dot(n,[0,0,1])),a=i.scale$2([],i.normalize([],[n[0],n[1],0]),this.radius),o=i.add([],n,i.scale$2([],i.sub([],i.add([],a,r),n),2));n[0]=o[0],n[1]=o[1]}return n}}function rV(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class rN{constructor(r,n){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new rt(r),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new rU,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),i.bindAll(["handleEvent","handleWindowEvent"],this);let a=this._el;for(let[r,n,o]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[i.window,"blur",void 0]],this._listeners))r.addEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,o)}destroy(){for(let[r,n,a]of this._listeners)r.removeEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(i){let r=this._map,n=r.getCanvasContainer();this._add("mapEvent",new rs(r,i));let a=r.boxZoom=new rh(r,i);this._add("boxZoom",a);let o=new rp,s=new rD;r.doubleClickZoom=new rk(s,o),this._add("tapZoom",o),this._add("clickZoom",s);let l=new rP;this._add("tapDragZoom",l);let h=r.touchPitch=new rA(r);this._add("touchPitch",h);let u=new rg(i),c=new ry(i);r.dragRotate=new rR(i,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);let d=new r_(i),p=new rx(r,i);r.dragPan=new rL(n,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]);let f=new rS,m=new rT;r.touchZoomRotate=new rB(n,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new rl(r));let _=r.scrollZoom=new rz(r,this);this._add("scrollZoom",_,["mousePan"]);let g=r.keyboard=new rI;for(let n of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))i.interactive&&i[n]&&r[n].enable(i[n])}_add(i,r,n){this._handlers.push({handlerName:i,handler:r,allowed:n}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(let{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(let{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!rO(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(i,r,n){for(let a in i)if(a!==n&&(!r||0>r.indexOf(a)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){let r=[];for(let n of i)this._el.contains(n.target)&&r.push(n);return r}handleEvent(i,r){this._updatingCamera=!0;let n="renderFrame"===i.type,a=n?void 0:i,o={needsRenderFrame:!1},s={},l={},h=i.touches?this._getMapTouches(i.touches):void 0,u=h?x(this._el,h):n?void 0:y(this._el,i);for(let{handlerName:n,handler:c,allowed:d}of this._handlers){let p;c.isEnabled()&&(this._blockedByActive(l,d,n)?c.reset():c[r||i.type]&&(p=c[r||i.type](i,u,h),this.mergeHandlerResult(o,s,p,n,a),p&&p.needsRenderFrame&&this._triggerRe
60nderFrame()),(p||c.isActive())&&(l[n]=c))}let c={};for(let i in this._previousActiveHandlers)l[i]||(c[i]=a);this._previousActiveHandlers=l,(Object.keys(c).length||rV(o))&&(this._changes.push([o,s,c]),this._triggerRenderFrame()),(Object.keys(l).length||rV(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:d}=o;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(r,n,a,o,s){if(!a)return;i.extend(r,a);let l={handlerName:o,originalEvent:a.originalEvent||s};void 0!==a.zoomDelta&&(n.zoom=l),void 0!==a.panDelta&&(n.drag=l),void 0!==a.pitchDelta&&(n.pitch=l),void 0!==a.bearingDelta&&(n.rotate=l)}_applyChanges(){let r={},n={},a={};for(let[o,s,l]of this._changes)o.panDelta&&(r.panDelta=(r.panDelta||new i.pointGeometry(0,0))._add(o.panDelta)),o.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+o.pitchDelta),void 0!==o.around&&(r.around=o.around),void 0!==o.aroundCoord&&(r.aroundCoord=o.aroundCoord),void 0!==o.pinchAround&&(r.pinchAround=o.pinchAround),o.noInertia&&(r.noInertia=o.noInertia),i.extend(n,s),i.extend(a,l);this._updateMapTransform(r,n,a),this._changes=[]}_updateMapTransform(r,n,a){let o=this._map,s=o.transform,l=i=>[i.x,i.y,i.z];if((i=>{let r=this._eventsInProgress.drag;return r&&!this._handlersById[r.handlerName].isActive()})()&&!rV(r)){let i=s.zoom;s.cameraElevationReference="sea",s.recenterOnTerrain(),s.cameraElevationReference="ground",i!==s.zoom&&this._map._update(!0)}if(s._isCameraConstrained&&o._stop(!0),!rV(r))return void this._fireEvents(n,a,!0);let{panDelta:h,zoomDelta:u,bearingDelta:c,pitchDelta:d,around:p,aroundCoord:f,pinchAround:m}=r;s._isCameraConstrained&&(u>0&&(u=0),s._isCameraConstrained=!1),void 0!==m&&(p=m),(u||n.drag&&!this._eventsInProgress.drag)&&p&&(this._dragOrigin=l(s.pointCoordinate3D(p)),this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",o._stop(!0),p=p||o.transform.centerPoint,c&&(s.bearing+=c),d&&(s.pitch+=d),s._updateCameraState();let _=[0,0,0];if(h){if("mercator"===s.projection.name){let i=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p).dir),r=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p.sub(h)).dir);_[0]=r[0]-i[0],_[1]=r[1]-i[1]}else{let r=s.pointCoordinate(p);if("globe"===s.projection.name){h=h.rotate(-s.angle);let n=s._pixelsPerMercatorPixel/s.worldSize;_[0]=-h.x*i.mercatorScale(i.latFromMercatorY(r.y))*n,_[1]=-h.y*i.mercatorScale(s.center.lat)*n}else{let i=s.pointCoordinate(p.sub(h));r&&i&&(_[0]=i.x-r.x,_[1]=i.y-r.y)}}}let g=s.zoom,y=[0,0,0];if(u){let r=l(f||s.pointCoordinate3D(p)),n={dir:i.normalize([],i.sub([],r,s._camera.position))};if(n.dir[2]<0){let a=s.zoomDeltaToMovement(r,u);i.scale$2(y,n.dir,a)}}let x=i.add(_,_,y);s._translateCameraConstrained(x),u&&Math.abs(s.zoom-g)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(n,a,!0)}_fireEvents(r,n,a){let o;let s=rO(this._eventsInProgress),l=rO(r),h={};for(let i in r){let{originalEvent:n}=r[i];this._eventsInProgress[i]||(h[`${i}start`]=n),this._eventsInProgress[i]=r[i]}for(let i in!s&&l&&this._fireEvent("movestart",l.originalEvent),h)this._fireEvent(i,h[i]);for(let i in l&&this._fireEvent("move",l.originalEvent),r){let{originalEvent:n}=r[i];this._fireEvent(i,n)}let u={};for(let i in this._eventsInProgress){let{handlerName:r,originalEvent:a}=this._eventsInProgress[i];this._handlersById[r].isActive()||(delete this._eventsInProgress[i],o=n[r]||a,u[`${i}end`]=o)}for(let i in u)this._fireEvent(i,u[i]);let c=rO(this._eventsInProgress);if(a&&(s||l)&&!c){let r,n;this._updatingCamera=!0;let a=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);a?(0!==(r=a.bearing||this._map.getBearing())&&-this._bearingSnap<r&&r<this._bearingSnap&&(a.bearing=0),this._map.easeTo(a,{originalEvent:o})):(this._map.fire(new i.Event("moveend",{originalEvent:o})),0!==(n=this._map.getBearing())&&-this._bearingSnap<n&&n<this._bearingSnap&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,n){this._map.fire(new i.Event(r,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new rF("renderFrame",{timeStamp:i})),this._applyChanges()})}
60_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let rj="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class rG extends i.Evented{constructor(r,n){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,n,a){return r=i.pointGeometry.convert(r).mult(-1),this.panTo(this.transform.center,i.extend({offset:r},n),a)}panTo(r,n,a){return this.easeTo(i.extend({center:r},n),a)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(r,n,a){return this.easeTo(i.extend({zoom:r},n),a)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(r,n,a){return this.easeTo(i.extend({bearing:r},n),a)}resetNorth(r,n){return this.rotateTo(0,i.extend({duration:1e3},r),n),this}resetNorthPitch(r,n){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},r),n),this}snapToNorth(i,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,r):this}getPitch(){return this.transform.pitch}setPitch(i,r){return this.jumpTo({pitch:i},r),this}cameraForBounds(r,n){r=i.LngLatBounds.convert(r);let a=n&&n.bearing||0,o=n&&n.pitch||0,s=r.getNorthWest(),l=r.getSouthEast();return this._cameraForBounds(this.transform,s,l,a,o,n)}_extendCameraOptions(r){let n={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=i.extend({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){let i=r.padding;r.padding={top:i,bottom:i,right:i,left:i}}return r.padding=i.extend(n,r.padding),r}_minimumAABBFrustumDistance(i,r){let n=r.max[0]-r.min[0],a=r.max[1]-r.min[1];return n/a>i.aspect?n/(2*Math.tan(.5*i.fovX)*i.aspect):a/(2*Math.tan(.5*i.fovY)*i.aspect)}_cameraForBoundsOnGlobe(r,n,a,o,s,l){let h=r.clone(),u=this._extendCameraOptions(l);h.bearing=o,h.pitch=s;let c=i.LngLat.convert(n),d=i.LngLat.convert(a),p=.5*(c.lat+d.lat),f=.5*(c.lng+d.lng),m=i.latLngToECEF(p,f),_=i.normalize([],m),g=i.normalize([],i.cross([],_,[0,1,0])),y=i.cross([],g,_),x=[g[0],g[1],g[2],0,y[0],y[1],y[2],0,_[0],_[1],_[2],0,0,0,0,1],v=[m,i.latLngToECEF(c.lat,c.lng),i.latLngToECEF(d.lat,c.lng),i.latLngToECEF(d.lat,d.lng),i.latLngToECEF(c.lat,d.lng),i.latLngToECEF(p,c.lng),i.latLngToECEF(p,d.lng),i.latLngToECEF(c.lat,f),i.latLngToECEF(d.lat,f)],b=i.Aabb.fromPoints(v.map(r=>[i.dot(g,r),i.dot(y,r),i.dot(_,r)])),w=i.transformMat4([],b.center,x);0===i.squaredLength(w)&&i.set(w,0,0,1),i.normalize(w,w),i.scale$2(w,w,i.GLOBE_RADIUS),h.center=i.ecefToLatLng(w);let T=h.getWorldToCameraMatrix(),E=i.invert(new Float64Array(16),T);b=i.Aabb.applyTransform(b,i.multiply([],T,x)),i.transformMat4(w,w,T);let S=.5*(b.max[2]-b.min[2]),M=this._minimumAABBFrustumDistance(h,b),A=i.scale$2([],[0,0,1],S),I=i.add(A,w,A),C=M+(0===h.pitch?0:i.distance(w,I)),z=h.globeCenterInViewSpace,k=i.sub([],w,[z[0],z[1],z[2]]);i.normalize(k,k),i.scale$2(k,k,C);let D=i.add([],w,k);i.transformMat4(D,D,E);let P=i.earthRadius/i.GLOBE_RADIUS,L=i.length(D),R=i.mercatorZfromAltitude(Math.max(L*P-i.earthRadius,Number.EPSILON),0),B=Math.min(h.zoomFromMercatorZAdjusted(R),u.maxZoom);return B>.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(h.setProjection({name:"mercator"}),h.zoom=B,this._cameraForBounds(h,n,a,o,s,l)):{center:h.center,zoom:B,bearing:o,pitch:s}}queryTerrainElevation(r,n){let a=this.transform.elevation;return a?(n=i.extend({},{exaggerated:!0},n),a.getAtPoint(i.MercatorCoordinate.fromLngLat(r),null,n.exaggerated)):null}_cameraForBounds(r,n,a,o,s,l){if("globe"===r.projection.name)return this._cameraForBoundsOnGlobe(r,n,a,o,s,l);let h=r.clone(),u=this._extendCameraOptions(l),c=h.padding;h.bearing=o,h.pitch=s;let d=i.LngLat.convert(n),p=i.LngLat.convert(a),f=new i.LngLat(d.lng,p.lat),m=new i.LngLat(p.lng,d.lat),_=h.project(d),g=h.project(p),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(p),v=this.queryTerrainElevation(f),b=this.queryTerrainElevation(m),w=[[_.x,_.y,Math.min(y||0,x||0,v||0,b||0)],[g.x,g.y,Math.max(y||0,x||0,v||0,b||0)]],T=i.Aabb.fromPoints(w),E=h.getWorldToCameraMatrix(),S=i.invert(new Float64Array(16),E);T=i.Aabb.applyTransform(T,E);let M=i.sub([],T.max,T.min),A=c.left||0,I=c.right||0,C=c.bottom||0,z=c.top||0,{left:k,right:D,top:P,bottom:L}=u.padding,R=.5*(A+I),B=.5*(z+C),O=Math.min(h.scaleZoom(h.scale*Math.min((h.width-(A+I+k+D))/M[0],(h.height-(C+z+L+P))/M[1])),u.maxZoom),F=h.scale/h.zoomScale(O);T=new i.Aabb([T.min[0]-(k+R)*F,T.min[1]-(L+B)*F,T.min[2]],[T.max[0]+(D+R)*F,T.max[1]+(P+B)*F,T.max[2]]);let U=.5*M[2],V=this._minimumAABBFrustumDistance(h,T),N=[0,0,1,0];i.transformMat4$1(N,N,E),i.normalize$2(N,N);let j=i.scale$2([],N,V+U),G=i.add([],T.center,j),Z=("number"==typeof u.offset.x&&"number"==typeof u.offset.y?new i.pointGeometry(u.offset.x,u.offset.y):i.pointGeometry.convert(u.offset)).rotate(-i.degToRad(o));T.center[0]-=Z.x*F,T.center[1]+=Z.y*F,i.transformMat4(T.center,T.center,S),i.transformMat4(G,G,S);let $=[T.center[0],T.center[1],G[2]*h.pixelsPerMeter];i.scale$2($,$,1/h.worldSize);let q=i.lngFromMercatorX($[0]),W=i.latFromMercatorY($[1]),X=Math.min(h._zoomFromMercatorZ($[2]),u.maxZoom),H=new i.LngLat(q,W);return h.mercatorFromTransition&&X<.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(h.setProjection({name:"globe"}),h.zoom=X,this._cameraForBounds(h,n,a,o,s,l)):{center:H,zoom:X,bearing:o,pitch:s}}fitBounds(i,r,n){let a=this.cameraForBounds(i,r);return this._fitInternal(a,r,n)}fitScreenCoordinates(r,n,a,o,s){let l=i.pointGeometry.convert(r),h=i.pointGeometry.convert(n),u=new i.pointGeometry(Math.min(l.x,h.x),Math.min(l.y,h.y)),c=new i.pointGeometry(Math.max(l.x,h.x),Math.max(l.y,h.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(l,h))return this;let d=this.transform.pointLocation3D(u),p=this.transform.pointLocation3D(c),f=this.transform.pointLocation3D(new i.pointGeometry(u.x,c.y)),m=this.transform.pointLocation3D(new i.pointGeometry(c.x,u.y)),_=[Math.min(d.lng,p.lng,f.lng,m.lng),Math.min(d.lat,p.lat,f.lat,m.lat)],g=[Math.max(d.lng,p.lng,f.lng,m.lng),Math.max(d.lat,p.lat,f.lat,m.lat)],y=o&&o.pitch?o.pitch:this.getPitch(),x=this._cameraForBounds(this.transform,_,g,a,y,o);return this._fitInternal(x,o,s)}_fitInternal(r,n,a){return r?(delete(n=i.extend(r,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(r,n){this.stop();let a=r.preloadOnly?this.transform.clone():this.transform,o=!1,s=!1,l=!1;return"zoom"in r&&a.zoom!==+r.zoom&&(o=!0,a.zoom=+r.zoom),void 0!==r.center&&(a.center=i.LngLat.convert(r.center)),"bearing"in r&&a.bearing!==+r.bearing&&(s=!0,a.bearing=+r.bearing),"pitch"in r&&a.pitch!==+r.pitch&&(l=!0,a.pitch=+r.pitch),null==r.padding||a.isPaddingEqual(r.padding)||(a.padding=r.padding),r.preloadOnly?(this._preloadTiles(a),this):(this.fire(new i.Event("movestart",n)).fire(new i.Event("move",n)),o&&this.fire(new i.Event("zoomstart",n)).fire(new i.Event("zoom",n)).fire(new i.Event("zoomend",n)),s&&this.fire(new i.Event("rotatestart",n)).fire(new i.Event("rotate",n)).fire(new i.Event("rotateend",n)),l&&this.fire(new i.Event("pitchstart",n)).fire(new i.Event("pitch",n)).fire(new i.Event("pitchend",n)),this.fire(new i.Event("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.warnOnce(rj),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,n){let a=this.transform;if(!a.projection.supportsFreeCamera)return i.warnOnce(rj),this;this.stop();let o=a.zoom,s=a.pitch,l=a.bearing;a.setFreeCameraOptions(r);let h=o!==a.zoom,u=s!==a.pitch,c=l!==a.bearing;return this.fire(new i.Event("movestart",n)).fire(new i.Event("move",n)),h&&this.fire(new i.Event("zoomstart",n)).fire(new i.Event("zoom",n)).fire(new i.Event("zoomend",n)),c&&this.fire(new i.Event("rotatestart",n)).fire(new i.Event("rotate",n)).fire(new i.Event("rotateend",n)),u&&this.fire(new i.Event("pitchstart",n)).fire(new i.Event("pitch",n)).fire(new i.Event("pitchend",n)),this.fire(new i.Event("moveend",n)),this}easeTo(r,n){let a,o,s,l,h;this._stop(!1,r.easeId),(!1===(r=i.extend({offset:[0,0],duration:500,easing:i.ease},r)).animate||!r.essential&&i.exported.prefersReducedMotion)&&(r.duration=0);let u=this.transform,c=this.getZoom(),d=this.getBearing(),p=this.getPitch(),f=this.getPadding(),m="zoom"in r?+r.zoom:c,_="bearing"in r?this._normalizeBearing(r.bearing,d):d,g="pitch"in r?+r.pitch:p,y="padding"in r?r.padding:u.padding,x=i.pointGeometry.convert(r.offset);if("globe"===u.projection.name){let n=i.MercatorCoordinate.fromLngLat(u.center),l=x.rotate(-u.angle);n.x+=l.x/u.worldSize,n.y+=l.y/u.worldSize;let h=n.toLngLat(),c=i.LngLat.convert(r.center||h);this._normalizeCenter(c),a=u.centerPoint.add(l),o=new i.pointGeometry(n.x,n.y).mult(u.worldSize),s=new i.pointGeometry(i.mercatorXfromLng(c.lng),i.mercatorYfromLat(c.lat)).mult(u.worldSize).sub(o)}else{a=u.centerPoint.add(x);let n=u.pointLocation(a),l=i.LngLat.convert(r.center||n);this._normalizeCenter(l),o=u.project(n),s=u.project(l).sub(o)}let v=u.zoomScale(m-c);r.around&&(l=i.LngLat.convert(r.around),h=u.locationPoint(l));let b=this._zooming||m!==c,w=this._rotating||d!==_,T=this._pitching||g!==p,E=!u.isPaddingEqual(y),S=u=>S=>{if(b&&(u.zoom=i.number(c,m,S)),w&&(u.bearing=i.number(d,_,S)),T&&(u.pitch=i.number(p,g,S)),E&&(u.interpolatePadding(f,y,S),a=u.centerPoint.add(x)),l)u.setLocationAtPoint(l,h);else{let i=u.zoomScale(u.zoom-c),r=Math.pow(m>c?Math.min(2,v):Math.max(.5,v),1-S),n=u.unproject(o.add(s.mult(S*r)).mult(i));u.setLocationAtPoint(u.renderWorldCopies?n.wrap():n,a)}return r.preloadOnly||this._fireMoveEvents(n),u};if(r.preloadOnly){let i=this._emulate(S,r.duration,u);return this._preloadTiles(i),this}let M={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=w,this._pitching=T,this._padding=E,this._easeId=r.easeId,this._prepareEase(n,r.noMoveStart,M),this._ease(S(u),i=>{u.recenterOnTerrain(),this._afterEase(n,i)},r),this}_prepareEase(r,n,a={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||a.moving||this.fire(new i.Event("movestart",r)),this._zooming&&!a.zooming&&this.fire(new i.Event("zoomstart",r)),this._rotating&&!a.rotating&&this.fire(new i.Event("rotatestart",r)),this._pitching&&!a.pitching&&this.fire(new i.Event("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.Event("move",r)),this._zooming&&this.fire(new i.Event("zoom",r)),this._rotating&&this.fire(new i.Event("rotate",r)),this._pitching&&this.fire(new i.Event("pitch",r))}_afterEase(r,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let a=this._zooming,o=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new i.Event("zoomend",r)),o&&this.fire(new i.Event("rotateend",r)),s&&this.fire(new i.Event("pitchend",r)),this.fire(new i.Event("moveend",r))}flyTo(r,n){if(!r.essential&&i.exported.prefersReducedMotion){let a=i.pick(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(a,n)}this.stop(),r=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},r);let a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.clamp(+r.zoom,a.minZoom,a.maxZoom):o,c="bearing"in r?this._normalizeBearing(r.bearing,s):s,d="pitch"in r?+r.pitch:l,p="padding"in r?r.padding:a.padding,f
60=a.zoomScale(u-o),m=i.pointGeometry.convert(r.offset),_=a.centerPoint.add(m),g=a.pointLocation(_),y=i.LngLat.convert(r.center||g);this._normalizeCenter(y);let x=a.project(g),v=a.project(y).sub(x),b=r.curve,w=Math.max(a.width,a.height),T=w/f,E=v.mag();if("minZoom"in r){let n=i.clamp(Math.min(r.minZoom,o,u),a.minZoom,a.maxZoom);b=Math.sqrt(w/a.zoomScale(n-o)/E*2)}let S=b*b;function M(i){let r=(T*T-w*w+(i?-1:1)*S*S*E*E)/(2*(i?T:w)*S*E);return Math.log(Math.sqrt(r*r+1)-r)}function A(i){return(Math.exp(i)-Math.exp(-i))/2}function I(i){return(Math.exp(i)+Math.exp(-i))/2}let C=M(0),z=function(i){return I(C)/I(C+b*i)},k=function(i){var r;return(I(C)*(A(r=C+b*i)/I(r))-A(C))/S*w/E},D=(M(1)-C)/b;if(1e-6>Math.abs(E)||!isFinite(D)){if(1e-6>Math.abs(w-T))return this.easeTo(r,n);let i=T<w?-1:1;D=Math.abs(Math.log(T/w))/b,k=function(){return 0},z=function(r){return Math.exp(i*b*r)}}r.duration="duration"in r?+r.duration:1e3*D/("screenSpeed"in r?+r.screenSpeed/b:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);let P=s!==c,L=d!==l,R=!a.isPaddingEqual(p),B=a=>f=>{let g=f*D,b=1/z(g);a.zoom=1===f?u:o+a.scaleZoom(b),P&&(a.bearing=i.number(s,c,f)),L&&(a.pitch=i.number(l,d,f)),R&&(a.interpolatePadding(h,p,f),_=a.centerPoint.add(m));let w=1===f?y:a.unproject(x.add(v.mult(k(g))).mult(b));return a.setLocationAtPoint(a.renderWorldCopies?w.wrap():w,_),a._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(n),a};if(r.preloadOnly){let i=this._emulate(B,r.duration,a);return this._preloadTiles(i),this}return this._zooming=!0,this._rotating=P,this._pitching=L,this._padding=R,this._prepareEase(n,!1),this._ease(B(a),()=>this._afterEase(n),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let i=this._onEaseEnd;this._onEaseEnd=void 0,i.call(this,r)}if(!i){let i=this.handlers;i&&i.stop(!1)}return this}_ease(r,n,a){!1===a.animate||0===a.duration?(r(1),n()):(this._easeStart=i.exported.now(),this._easeOptions=a,this._onEaseFrame=r,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let r=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,n){let a=Math.abs((r=i.wrap(r,-180,180))-n);return Math.abs(r-360-n)<a&&(r-=360),Math.abs(r+360-n)<a&&(r+=360),r}_normalizeCenter(i){let r=this.transform;if(!r.renderWorldCopies||r.maxBounds)return;let n=i.lng-r.center.lng;i.lng+=n>180?-360:n<-180?360:0}_emulate(i,r,n){let a=Math.ceil(15*r/1e3),o=[],s=i(n.clone());for(let i=0;i<=a;i++){let r=s(i/a);o.push(r.clone())}return o}}class rZ{constructor(r={}){this.options=r,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){let r=this.options&&this.options.compact;return this._map=i,this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=u("button","mapboxgl-ctrl-attrib-button",this._container),u("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=u("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),r&&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),void 0===r&&(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(i,r){let n=this._map._getUIString(`AttributionControl.${r}`);i.setAttribute("aria-label",n),i.removeAttribute("title"),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
60se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));let n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(r){let a=n.reduce((i,r,a)=>(r.value&&(i+=`${r.key}=${r.value}${a<n.length-1?"&":""}`),i),"?");r.href=`${i.config.FEEDBACK_URL}/${a}#${i4(this._map,!0)}`,r.rel="noopener nofollow",this._setElementTitle(r,"MapFeedback")}}_updateData(i){i&&("metadata"===i.sourceDataType||"visibility"===i.sourceDataType||"style"===i.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let i=[];if(this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let r=this._map.style._sourceCaches;for(let n in r){let a=r[n];if(a.used){let r=a.getSource();r.attribution&&0>i.indexOf(r.attribution)&&i.push(r.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,n)=>{for(let a=n+1;a<i.length;a++)if(i[a].indexOf(r)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));let n=i.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,i.length?(this._innerContainer.innerHTML=n,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 r${constructor(){i.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=u("div","mapboxgl-ctrl");let r=u("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),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(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(let r in i){let n=i[r].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){let i=this._container.children;if(i.length){let r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class rq{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){let r=this._currentlyRunning;for(let n of r?this._queue.concat(r):this._queue)if(n.id===i)return void(n.cancelled=!0)}run(i=0){let r=this._currentlyRunning=this._queue;for(let n of(this._queue=[],r))if(!n.cancelled&&(n.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function rW(r,n,a){if(r=new i.LngLat(r.lng,r.lat),n){let o=new i.LngLat(r.lng-360,r.lat),s=new i.LngLat(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-a.center.lng)/360),h=a.locationPoint(r).distSqr(n),u=n.x<0||n.y<0||n.x>a.width||n.y>a.height;a.locationPoint(o).distSqr(n)<h&&(u||Math.abs(o.lng-a.center.lng)<l)?r=o:a.locationPoint(s).distSqr(n)<h&&(u||Math.abs(s.lng-a.center.lng)<l)&&(r=s)}for(;Math.abs(r.lng-a.center.lng)>180;){let i=a.locationPoint(r);if(i.x>=0&&i.y>=0&&i.x<=a.width&&i.y<=a.height)break;r.lng>a.center.lng?r.lng-=360:r.lng+=360}return r}
60let rX={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 rH extends i.Evented{constructor(r,n){if(super(),(r instanceof i.window.HTMLElement||n)&&(r=i.extend({element:r},n)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=r&&r.occludedOpacity||.2,r&&r.element)this._element=r.element,this._offset=i.pointGeometry.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=u("div");let n=c("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),a=c("radialGradient",{id:"shadowGradient"},c("defs",{},n));c("stop",{offset:"10%","stop-opacity":.4},a),c("stop",{offset:"100%","stop-opacity":.05},a),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n),c("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"},n),c("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"},n),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),this._offset=i.pointGeometry.convert(r&&r.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",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});let a=this._element.classList;for(let i in rX)a.remove(`mapboxgl-marker-anchor-${i}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),i.on("click",this._onMapClick)),this}remove(){let i=this._map;return i&&(i.off("click",this._onMapClick),i.off("move",this._updateMoving),i.off("moveend",this._update),i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler),i.off("mouseup",this._onUp),i.off("touchend",this._onUp),i.off("mousemove",this._onMove),i.off("touchmove",this._onMove),i.off("remove",this._clearFadeTimer),i._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(i){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")),i){if(!("offset"in i.options)){let r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,i._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","fal
60se")}return this}_onKeyPress(i){let r=i.code,n=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==n&&13!==n||this.togglePopup()}_onMapClick(i){let r=i.originalEvent.target,n=this._element;this._popup&&(r===n||n.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let i=this._map,r=this._pos;if(!i||!r)return!1;let n=i.unproject(r),a=i.getFreeCameraOptions();if(!a.position)return!1;let o=a.position.toLngLat();return o.distanceTo(n)<.9*o.distanceTo(this._lngLat)}_evaluateOpacity(){let r;let n=this._map;if(!n)return;let a=this._pos;if(!a||a.x<0||a.x>n.transform.width||a.y<0||a.y>n.transform.height)return void this._clearFadeTimer();let o=n.unproject(a);n._showingGlobe()&&i.isLngLatBehindGlobe(n.transform,this._lngLat)?r=0:(r=1-n._queryFogOpacity(o),n.transform._terrainEnabled()&&n.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let i=this._pos;if(!i||!this._map)return;let r=this._offset.mult(this._scale);this._element.style.transform=`
61            translate(${i.x}px,${i.y}px)
62            ${rX[this._anchor]}
63            ${this._calculateXYTransform()} ${this._calculateZTransform()}
64            translate(${r.x}px,${r.y}px)
65        `}_calculateXYTransform(){let r=this._pos,n=this._map,a=this.getPitchAlignment();if(!n||!r||"map"!==a)return"";if(!n._showingGlobe()){let i=n.getPitch();return i?`rotateX(${i}deg)`:""}let o=i.radToDeg(i.globeTiltAtLngLat(n.transform,this._lngLat)),s=r.sub(i.globeCenterToScreenPoint(n.transform)),l=Math.abs(s.x)+Math.abs(s.y);if(0===l)return"";let h=o/l;return`rotateX(${-s.y*h}deg) rotateY(${s.x*h}deg)`}_calculateZTransform(){let r=this._pos,n=this._map;if(!n||!r)return"";let a=0,o=this.getRotationAlignment();if("map"===o){if(n._showingGlobe()){let r=n.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),o=n.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(r);a=i.radToDeg(Math.atan2(o.y,o.x))-90}else a=-n.getBearing()}else if("horizon"===o){let o=i.smoothstep(4,6,n.getZoom()),s=i.globeCenterToScreenPoint(n.transform);s.y+=o*n.transform.height;let l=r.sub(s),h=i.radToDeg(Math.atan2(l.y,l.x));a=(h>90?h-270:h+90)*(1-o)}return(a+=this._rotation)?`rotateZ(${a}deg)`:""}_update(r){i.window.cancelAnimationFrame(this._updateFrameId);let n=this._map;
65n&&(n.transform.renderWorldCopies&&(this._lngLat=rW(this._lngLat,this._pos,n.transform)),this._pos=n.project(this._lngLat),!0===r?this._updateFrameId=i.window.requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),n._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=i.pointGeometry.convert(r),this._update(),this}_onMove(r){let n=this._map;if(!n)return;let a=this._pointerdownPos,o=this._positionDelta;if(a&&o){if(!this._isDragging){let i=this._clickTolerance||n._clickTolerance;if(r.point.dist(a)<i)return;this._isDragging=!0}this._pos=r.point.sub(o),this._lngLat=n.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new i.Event("dragend")),this._state="inactive"}_addDragHandler(i){let r=this._map,n=this._pos;r&&n&&this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(n),this._pointerdownPos=i.point,this._state="pending",r.on("mousemove",this._onMove),r.on("touchmove",this._onMove),r.once("mouseup",this._onUp),r.once("touchend",this._onUp))}setDraggable(i){this._draggable=!!i;let r=this._map;return r&&(i?(r.on("mousedown",this._addDragHandler),r.on("touchstart",this._addDragHandler)):(r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(i){return this._occludedOpacity=i||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let rY={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"};function rK(r=new i.pointGeometry(0,0),n="bottom"){if("number"==typeof r){let a=Math.round(Math.sqrt(.5*Math.pow(r,2)));switch(n){case"top":return new i.pointGeometry(0,r);case"top-left":return new i.pointGeometry(a,a);case"top-right":return new i.pointGeometry(-a,a);case"bottom":return new i.pointGeometry(0,-r);case"bottom-left":return new i.pointGeometry(a,-a);case"bottom-right":return new i.pointGeometry(-a,-a);case"left":return new i.pointGeometry(r,0);case"right":return new i.pointGeometry(-r,0)}return new i.pointGeometry(0,0)}return r instanceof i.pointGeometry||Array.isArray(r)?i.pointGeometry.convert(r):i.pointGeometry.convert(r[n]||[0,0])}class rJ{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;let n=i.easeCubicInOut((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,n){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+n}}let rQ={"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 ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},r0={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,performanceMetricsCollection:!0,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
65acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},r1={showCompass:!0,showZoom:!0,visualizePitch:!1};class r2{constructor(r,n,a=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new rg({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,a&&(this.mousePitch=new ry({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),f()}move(i,r){let n=this.map,a=this.mouseRotate.mousemoveWindow(i,r),o=a&&a.bearingDelta;if(o&&n.setBearing(n.getBearing()+o),this.mousePitch){let a=this.mousePitch.mousemoveWindow(i,r),o=a&&a.pitchDelta;o&&n.setPitch(n.getPitch()+o)}}off(){let i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart,{passive:!1}),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){m(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(i.extend({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),y(this.element,r)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,y(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=x(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=x(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&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()}}let r3={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},r5={maxWidth:100,unit:"metric"};function r4(i,r,n){let a=r6(r),o=a/r,s={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[n];this._map._requestDomTask(()=>{this._container.style.width=i*o+"px",this._container.innerHTML=`${a}&nbsp;${s}`})}function r6(i){let r=Math.pow(10,`${Math.floor(i)}`.length-1),n=i/r;return r*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(i){let r=Math.pow(10,Math.ceil(-Math.log(i)/Math.LN10));return Math.round(i*r)/r}(n))}let r8={version:i.version,supported:l,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends rG{constructor(r){if(i.LivePerformanceUtils.mark(i.PerformanceMarkers.create),null!=(r=i.extend({},r0,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(r.antialias&&i.isSafariWithAntialiasingBug(i.window)&&(r.antialias=!1,i.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new i2(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),r),this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileC
65acheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._useWebGL2=r.useWebGL2,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._collectResourceTiming=r.collectResourceTiming,this._optimizeForTerrain=r.optimizeForTerrain,this._language=this._parseLanguage(r.language),this._worldview=r.worldview,this._renderTaskQueue=new rq,this._domRenderTaskQueue=new rq,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.uniqueId(),this._locale=i.extend({},rQ,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._performanceMetricsCollection=r.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new rJ(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new i.RequestManager(r.transformRequest,r.accessToken,r.testMode),this._silenceAuthErrors=!!r.testMode,"string"==typeof r.container){if(this._container=i.window.document.getElementById(r.container),!this._container)throw Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof i.window.HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.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."),r.maxBounds&&this.setMaxBounds(r.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==i.window&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new rN(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,r.style&&this.setStyle(r.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),r.projection&&this.setProjection(r.projection),this._hash=r.hash&&new i5("string"==typeof r.hash&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,i.extend({},r.fitBoundsOptions,{duration:0})))),this.resize(),r.attributionControl&&this.addControl(new rZ({customAttribution:r.customAttribution})),this._logoControl=new r$,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.Event(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.Event(`${r.dataType}dataloading`,r))})}_getMapId(){return this._mapId}addControl(r,n){if(void 0===n&&(n=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=r.onAdd(this);this._controls.push(r);let o=this._controlPositions[n];return -1!==n.indexOf("bottom")?o.insertBefore(a,o.firstChild):o.appendChild(a),this}
65removeControl(r){if(!r||!r.onRemove)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let n=this._controls.indexOf(r);return n>-1&&this._controls.splice(n,1),r.onRemove(this),this}hasControl(i){return this._controls.indexOf(i)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){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));let n=!this._moving;return n&&this.fire(new i.Event("movestart",r)).fire(new i.Event("move",r)),this.fire(new i.Event("resize",r)),n&&this.fire(new i.Event("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.LngLatBounds.convert(r)),this._update()}setMinZoom(r){if((r=null==r?-2:r)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()<r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(r){if((r=null==r?22:r)>=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=null==r?0:r)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()<r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(r){if((r=null==r?85:r)>85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(r){return"auto"===r?i.window.navigator.language:Array.isArray(r)?0===r.length?void 0:r.map(r=>"auto"===r?i.window.navigator.language:r):r}setLanguage(i){let r=this._parseLanguage(i);if(!this.style||r===this._language)return this;for(let i of(this._language=r,this.style._reloadSources(),this._controls))i._setLanguage&&i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(i){return this.style&&i!==this._worldview&&(this._worldview=i,this.style._reloadSources()),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(i){return this._lazyInitEmptyStyle(),i?"string"==typeof i&&(i={name:i}):i=null,this._useExplicitProjection=!!i,this._prioritizeAndUpdateProjection(i,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){let r;if("globe"!==this.getProjection().name)return;let n=this.transform,a=n.projection.name;"globe"===a&&n.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?(n.setMercatorFromTransition(),r=!0):"mercator"===a&&n.zoom<i.GLOBE_ZOOM_THRESHOLD_MAX&&(n.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
65Update())}_prioritizeAndUpdateProjection(i,r){return this._updateProjection(i||r||{name:"mercator"})}_updateProjection(r){let n;if(n="globe"===r.name&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(r),this.style.applyProjectionUpdate(),n){for(let i in this.painter.clearBackgroundTiles(),this.style._sourceCaches)this.style._sourceCaches[i].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(r){return this.transform.locationPoint3D(i.LngLat.convert(r))}unproject(r){return this.transform.pointLocation3D(i.pointGeometry.convert(r))}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}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(i,r,n){if("mouseenter"===i||"mouseover"===i){let a=!1;return{layers:new Set(r),listener:n,delegates:{mousemove:o=>{let s=r.filter(i=>this.getLayer(i)),l=s.length?this.queryRenderedFeatures(o.point,{layers:s}):[];l.length?a||(a=!0,n.call(this,new rn(i,this,o.originalEvent,{features:l}))):a=!1},mouseout:()=>{a=!1}}}}if("mouseleave"===i||"mouseout"===i){let a=!1;return{layers:new Set(r),listener:n,delegates:{mousemove:o=>{let s=r.filter(i=>this.getLayer(i));(s.length?this.queryRenderedFeatures(o.point,{layers:s}):[]).length?a=!0:a&&(a=!1,n.call(this,new rn(i,this,o.originalEvent)))},mouseout:r=>{a&&(a=!1,n.call(this,new rn(i,this,r.originalEvent)))}}}}return{layers:new Set(r),listener:n,delegates:{[i]:i=>{let a=r.filter(i=>this.getLayer(i)),o=a.length?this.queryRenderedFeatures(i.point,{layers:a}):[];o.length&&(i.features=o,n.call(this,i),delete i.features)}}}}on(i,r,n){if(void 0===n)return super.on(i,r);Array.isArray(r)||(r=[r]);let a=this._createDelegatedListener(i,r,n);for(let r in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(a),a.delegates)this.on(r,a.delegates[r]);return this}once(i,r,n){if(void 0===n)return super.once(i,r);Array.isArray(r)||(r=[r]);let a=this._createDelegatedListener(i,r,n);for(let i in a.delegates)this.once(i,a.delegates[i]);return this}off(i,r,n){if(void 0===n)return super.off(i,r);r=new Set(Array.isArray(r)?r:[r]);let a=(i,r)=>{if(i.size!==r.size)return!1;for(let n of i)if(!r.has(n))return!1;return!0},o=this._delegatedListeners?this._delegatedListeners[i]:void 0;return o&&(i=>{for(let o=0;o<i.length;o++){let s=i[o];if(s.listener===n&&a(s.layers,r)){for(let i in s.delegates)this.off(i,s.delegates[i]);return i.splice(o,1),this}}})(o),this}queryRenderedFeatures(r,n){return this.style?(void 0!==n||void 0===r||r instanceof i.pointGeometry||Array.isArray(r)||(n=r,r=void 0),this.style.queryRenderedFeatures(r=r||[[0,0],[this.transform.width,this.transform.height]],n=n||{},this.transform)):[]}querySourceFeatures(i,r){return this.style.querySourceFeatures(i,r)}setStyle(r,n){return!1!==(n=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},n)).diff&&n.localIdeographFontFamily===this._localIdeographFontFamily&&n.localFontFamily===this._localFontFamily&&this.style&&r?(this._diffStyle(r,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._localFontFamily=n.localFontFamily,this._updateStyle(r,n))}_getUIString(i){let r=this._locale[i];if(null==r)throw Error(`Missing UI string '${i}'`);return r}_updateStyle(i,r){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i&&(this.style=new tM(this,r||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof i?this.style.loadURL(i):this.style.loadJSON(i)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new tM(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(r,n){if("string"==typeof r){let a=this._requestManager.normalizeStyleURL(r),o=this._requestManager.transformRequest(a,i.ResourceType.Style);i.getJSON(o,(r,a)=>{r?this.fire(new i.ErrorEvent(r)):a&&this._updateDiff(a,n)})}else"object"==typeof r&&this._updateDiff(r,n)}_updateDiff(r,n){try{this.style.setState(r)&&this._update(!0)}catch(a){i.warnOnce(`Unable to perform style diff: ${a.message||a.error||a}.  Rebuilding the style from scratch.`),this._updateStyle(r,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(i.warnOnce("There is no style added to the map."),!1)}addSource(i,r){return this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)}isSourceLoaded(i){return!!this.style&&this.style._isSourceCacheLoaded(i)}areTilesLoaded(){let i=this.style&&this.style._sourceCaches;for(let r in i){let n=i[r]._tiles;for(let i in n){let r=n[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}}return!0}addSourceType(i,r,n){this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,n)}removeSource(i){return this.style.removeSource(i),this._updateTerrain(),this._update(!0)}getSource(i){return this.style.getSource(i)}addImage(r,n,{pixelRatio:a=1,sdf:o=!1,stretchX:s,stretchY:l,content:h}={}){if(this._lazyInitEmptyStyle(),n instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&n instanceof i.window.ImageBitmap){let{width:u,height:c,data:d}=i.exported.getImageData(n);this.style.addImage(r,{data:new i.RGBAImage({width:u,height:c},d),pixelRatio:a,stretchX:s,stretchY:l,content:h,sdf:o,version:0})}else if(void 0===n.width||void 0===n.height)this.fire(new i.ErrorEvent(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{let{width:u,height:c}=n;this.style.addImage(r,{data:new i.RGBAImage({width:u,height:c},new Uint8Array(n.data)),pixelRatio:a,stretchX:s,stretchY:l,content:h,sdf:o,version:0,userImage:n}),n.onAdd&&n.onAdd(this,r)}}updateImage(r,n){let a=this.style.getImage(r);if(!a)return void this.fire(new i.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=n instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&n instanceof i.window.ImageBitmap?i.exported.getImageData(n):n,{width:s,height:l}=o;void 0!==s&&void 0!==l?s===a.data.width&&l===a.data.height?(a.data.replace(o.data,!(n instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&n instanceof i.window.ImageBitmap)),this.style.updateImage(r,a)):this.fire(new i.ErrorEvent(Error(`The width and height of the updated image (${s}, ${l})
66                must be that same as the previous version of the image
67                (${a.data.width}, ${a.data.height})`))):this.fire(new i.ErrorEvent(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(r){return r?!!this.style.getImage(r):(this.fire(new i.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(i){this.style.removeImage(i)}loadImage(r,n){i.getImage(this._requestManager.transformRequest(r,i.ResourceType.Image),(r,a)=>{n(r,a instanceof i.window.HTMLImageElement?i.exported.getImageData(a):a)})}listImages(){return this.style.listImages()}addLayer(i,r){return this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)}moveLayer(i,r){return this.style.moveLayer(i,r),this._update(!0)}removeLayer(i){return this.style.removeLayer(i),this._update(!0)}getLayer(i){return this.style.getLayer(i)}setLayerZoomRange(i,r,n){return this.style.setLayerZoomRange(i,r,n),this._update(!0)}setFilter(i,r,n={}){return this.style.setFilter(i,r,n),this._update(!0)}getFilter(i){return this.style.getFilter(i)}setPaintProperty(i,r,n,a={}){return this.style.setPaintProperty(i,r,n,a),this._update(!0)}getPaintProperty(i,r){return this.style.getPaintProperty(i,r)}setLayoutProperty(i,r,n,a={}){return this.style.setLayoutProperty(i,r,n,a),this._update(!0)}getLayoutProperty(i,r){return this.style.getLayoutProperty(i,r)}setLight(i,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(i,r),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(r),this.transform):0}setFeatureState(i,r){return this.style.setFeatureState(i,r),this._update()}removeFeatureState(i,r){return this.style.removeFeatureState(i,r),this._update()}getFeatureState(i){return this.style.getFeatureState(i)}_updateContainerDimensions(){if(!this._container)return;let r=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300,a,o,s,l=this._container;for(;l&&(!o||!s);){let r=i.window.getComputedStyle(l).transform;
67r&&"none"!==r&&((a=r.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==a[0]&&"1"!==a[0]&&(o=a[0]),a[3]&&"0"!==a[3]&&"1"!==a[3]&&(s=a[3])),l=l.parentElement}this._containerWidth=o?Math.abs(r/o):r,this._containerHeight=s?Math.abs(n/s):n}_detectMissingCSS(){"rgb(250, 128, 114)"!==i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.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 in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){let i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=u("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();let r=this._canvasContainer=u("div","mapboxgl-canvas-container",i);this._interactive&&r.classList.add("mapboxgl-interactive"),this._canvas=u("canvas","mapboxgl-canvas",r),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);let n=this._controlContainer=u("div","mapboxgl-control-container",i),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(i=>{a[i]=u("div",`mapboxgl-ctrl-${i}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,n){let a=i.exported.devicePixelRatio||1;this._canvas.width=a*Math.ceil(r),this._canvas.height=a*Math.ceil(n),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${n}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){let r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_addPopup(i){this._popups.push(i)}_removePopup(i){let r=this._popups.indexOf(i);-1!==r&&this._popups.splice(r,1)}_setupPainter(){let r=i.extend({},l.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._useWebGL2&&this._canvas.getContext("webgl2",r),a=n||this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);a?(this._useWebGL2&&!n&&i.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),i.storeAuthState(a,!0),this.painter=new iG(a,this.transform,!!n),this.on("data",i=>{"source"===i.dataType&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(a)):this.fire(new i.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.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(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let n;let a=this.painter.context.extTimerQuery,o=i.exported.now();if(this.listens("gpu-timing-frame")&&(n=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,n)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],i.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],i.window.performance.now())),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjectionTransition();let s=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let r=this.transform.zoom,n=this.transform.pitch,a=i.exported.now(),o=new i.EvaluationParameters(r,{now:a,fadeDuration:s,pitch:n,transition:this.style.getTransition()});this.style.update(o)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedU
67pdate=!0,this._sourcesDirty=!0);let l=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),l=this._updateAverageElevation(o),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):l=this._updateAverageElevation(o),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,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 i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){let r=i.exported.now()-o;a.endQueryEXT(a.TIME_ELAPSED_EXT,n),setTimeout(()=>{let s=a.getQueryObjectEXT(n,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(n),this.fire(new i.Event("gpu-timing-frame",{cpuTime:r,gpuTime:s})),i.window.performance.mark("frame-gpu",{startTime:o,detail:{gpuTime:s}})},50)}if(this.listens("gpu-timing-layer")){let r=this.painter.collectGpuTimers();setTimeout(()=>{let n=this.painter.queryGpuTimers(r);this.fire(new i.Event("gpu-timing-layer",{layerTimes:n}))},50)}if(this.listens("gpu-timing-deferred-render")){let r=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let n=this.painter.queryGpuTimeDeferredRender(r);this.fire(new i.Event("gpu-timing-deferred-render",{gpuTime:n}))},50)}let h=this._sourcesDirty||this._styleDirty||this._placementDirty||l;if(h||this._repaint)this.triggerRepaint();else{let r=!this.isMoving()&&this.loaded();if(r&&(l=this._updateAverageElevation(o,!0)),l)this.triggerRepaint();else if(this._triggerFrame(!1),r&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let r=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:r})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,i.LivePerformanceUtils.mark(i.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&i.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(i){for(let r of this._markers)i&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(let r of this._popups)!i||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(i,r=!1){let n=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){let r=this.transform.averageElevation,a=this.transform.sampleAverageElevation(),o=!1;this.transform.elevation&&(o=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(a)?a=0:this._averageElevationLastSampledAt=i;let s=Math.abs(r-a);if(s>1){if(this._isInitialLoad||o)return this._averageElevation.jumpTo(a),n(a);this._averageElevation.easeTo(a,i,300)}else if(s>1e-4)return this._averageElevation.jumpTo(a),n(a)}return!!this._averageElevation.isEasing(i)&&n(this._averageElevation.getValue(i))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{if(r&&(r.message===i.AUTH_ERR_MSG||401===r.status)){let r=this.painter.context.gl;i.storeAuthState(r,!1),this._logoControl instanceof r$&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(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/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){let i=this._isDragging();this.painter.updateTerrain(this.style,i)}_calculateSpeedIndex(){let i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());let n=this.painter.context.gl,a=n.createFramebuffer();function o(i){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,i,0);let r=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,r),r}return n.bindFramebuffer(n.FRAMEBUFFER,a),this._canvasPixelComparison(o(i),r.canvasCopies.map(o),r.timeStamps)}_canvasPixelComparison(i,r,n){let a=n[1]-n[0],o=i.length/4;for(let s=0;s<r.length;s++){let l=r[s],h=0;for(let r=0;r<l.length;r+=4)l[r]===i[r]&&l[r+1]===i[r+1]&&l[r+2]===i[r+2]&&l[r+3]===i[r+3]&&(h+=1);a+=(n[s+2]-n[s+1])*(1-h/o)}return a}remove(){for(let i of(this._hash&&this._hash.remove(),this._controls))i.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),void 0!==i.window&&(i.window.removeEventListener("resize",this._onWindowResize,!1),i.window.removeEventListener("orientationchange",this._onWindowResize,!1),i.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.removeEventListener("online",this._onWindowOnline,!1),i.window.removeEventListener("visibilitychange",this._onVisibilityChange,!1));let r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),i.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new i.Event("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(r){this._renderNextFrame=this._renderNextFrame||r,this.style&&!this._frame&&(this._frame=i.exported.frame(i=>{let r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){let n=this.style?Object.values(this.style._sourceCaches):[];return i.asyncAll(n,(i,n)=>i._preloadTiles(r,n),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}_onVisibilityChange(){"hidden"===i.window.document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,i?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(i){this._showTileAABBs!==i&&(this._showTileAABBs=i,i&&this._update())}_setCacheLimits(r,n){i.setCacheLimits(r,n)}get version(){return i.version}},NavigationControl:class{constructor(r){this.options=i.extend({},r1,r),this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),u("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>{this._map&&this._map.zoomOut({},{originalEvent:i})}),u("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{let r=this._map;r&&(this.options.visualizePitch?r.resetNorthPitch({},{originalEvent:i}):r.resetNorth({},{originalEvent:i}))}),this._compassIcon=u("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let i=this._map;if(!i)return;let r=i.getZoom(),n=r===i.getMaxZoom(),a=r===i.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())}_rotateCompassArrow(){let i=this._map;if(!i)return;let r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(i.transform.pitch*(Math.PI/180)
67),.5)}) rotateX(${i.transform.pitch}deg) rotateZ(${i.transform.angle*(180/Math.PI)}deg)`:`rotate(${i.transform.angle*(180/Math.PI)}deg)`;i._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(i){return this._map=i,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),i.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&i.on("pitch",this._rotateCompassArrow),i.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new r2(i,this._compass,this.options.visualizePitch)),this._container}onRemove(){let i=this._map;i&&(this._container.remove(),this.options.showZoom&&i.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&i.off("pitch",this._rotateCompassArrow),i.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(i,r){let n=u("button",i,this._container);return n.type="button",n.addEventListener("click",r),n}_setButtonTitle(i,r){if(!this._map)return;let n=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",n),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends i.Evented{constructor(r){super(),this.options=i.extend({geolocation:i.window.navigator.geolocation},r3,r),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=i3(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(i){return this._map=i,this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(r){let n=(i=!!this.options.geolocation)=>{this._supportsGeolocation=i,r(i)};void 0!==this._supportsGeolocation?r(this._supportsGeolocation):void 0!==i.window.navigator.permissions?i.window.navigator.permissions.query({name:"geolocation"}).then(i=>n("denied"!==i.state)).catch(()=>n()):n()}_isOutOfMapMaxBounds(i){let r=this._map.getMaxBounds(),n=i.coords;return!!r&&(n.longitude<r.getWest()||n.longitude>r.getEast()||n.latitude<r.getSouth()||n.latitude>r.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(r){if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":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&&"OFF"!==this._watchState&&this._updateMarker(r),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",r)),this._finish()}}
67_updateCamera(r){let n=new i.LngLat(r.coords.longitude,r.coords.latitude),a=r.coords.accuracy,o=this._map.getBearing(),s=i.extend({bearing:o},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(a),s,{geolocateSource:!0})}_updateMarker(r){if(r){let n=new i.LngLat(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let r=this._map.transform,n=i.mercatorZfromAltitude(1,r._center.lat)*r.worldSize,a=Math.ceil(2*this._accuracy*n);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(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(r){if(this._map){if(this.options.trackUserLocation){if(1===r.code){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;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&this._noTimeout)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",r)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(r){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=u("button","mapboxgl-ctrl-geolocate",this._container),u("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===r){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u("div","mapboxgl-user-location"),this._dotElement.appendChild(u("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(u("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new rH({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=u("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rH({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",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.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 i.Event("trackuserlocationstart"));break;
67case"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 i.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 i.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("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let i;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(i={maximumAge:6e5,timeout:0},this._noTimeout=!0):(i=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,i),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(){let r=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};void 0!==i.window.DeviceMotionEvent&&"function"==typeof i.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&r()}).catch(console.error):r()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientation),i.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:rZ,ScaleControl:class{constructor(r){this.options=i.extend({},r5,r),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(i){return!1}}()||(this._setScale=r4.bind(this)),i.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let i=this.options.maxWidth||100,r=this._map,n=r._containerHeight/2,a=r._containerWidth/2-i/2,o=r.unproject([a,n]),s=r.unproject([a+i,n]),l=o.distanceTo(s);if("imperial"===this.options.unit){let r=3.2808*l;r>5280?this._setScale(i,r/5280,"mile"):this._setScale(i,r,"foot")}else"nautical"===this.options.unit?this._setScale(i,l/1852,"nautical-mile"):l>=1e3?this._setScale(i,l/1e3,"kilometer"):this._setScale(i,l,"meter")}_setScale(i,r,n){let a=r6(r),o=a/r;this._map._requestDomTask(()=>{this._container.style.width=i*o+"px",this._container.innerHTML="nautical-mile"!==n?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"narrow",unit:n}).format(a):`${a}&nbsp;nm`})}onAdd(i){return this._map=i,this._language=i.getLanguage(),this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.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(i){this._language=i,this._update()}setUnit(i){this.options.unit=i,this._update()}},FullscreenControl:class{constructor(r){this._fullscreen=!1,r&&r.container&&(r.container instanceof i.window.HTMLElement?this._container=r.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=u("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){let r=this._fullscreenButton=u("button","mapboxgl-ctrl-fullscreen",this._controlContainer);u("span","mapboxgl-ctrl-icon",r).setAttribute("aria-hidden","true"),r.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.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()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(r){super(),this.options=i.extend(Object.create(rY),r),i.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(r&&r.className?r.className.trim().split(/\s+/):[])}addTo(r){return this._map&&this.remove(),this._map=r,this.options.closeOnClick&&r.on("preclick",this._onClose),this.options.closeOnMove&&r.on("move",this._onClose),r.on("remove",this.remove),this._update(),r._addPopup(this),this._focusFirstElement(),this._trackPointer?(r.on("mousemove",this._onMouseEvent),r.on("mouseup",this._onMouseEvent),r._canvasContainer.classList.add("mapboxgl-track-pointer")):r.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let r=this._map;return r&&(r.off("move",this._update),r.off("move",this._onClose),r.off("preclick",this._onClose),r.off("click",this._onClose),r.off("remove",this.remove),r.off("mousemove",this._onMouseEvent),r.off("mouseup",this._onMouseEvent),r.off("drag",this._onMouseEvent),r._canvasContainer&&r._canvasContainer.classList.remove("mapboxgl-track-pointer"),r._removePopup(this),this._map=void 0),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(r){this._lngLat=i.LngLat.convert(r),this._pos=null,this._trackPointer=!1,this._update();let n=this._map;return n&&(n.on("move",this._update),n.off("mousemove",this._onMouseEvent),n._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let i=this._map;return i&&(i.off("move",this._update),i.on("mousemove",this._onMouseEvent),i.on("drag",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(r){return this.setDOMContent(i.window.document.createTextNode(r))}setHTML(r){let n;let a=i.window.document.createDocumentFragment(),o=i.window.document.createElement("body");for(o.innerHTML=r;n=o.firstChild;)a.appendChild(n);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=u("div","mapboxgl-popup-content",this._container||void 0);
67if(r.appendChild(i),this.options.closeButton){let i=this._closeButton=u("button","mapboxgl-popup-close-button",r);i.type="button",i.setAttribute("aria-label","Close popup"),i.setAttribute("aria-hidden","true"),i.innerHTML="&#215;",i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._updateClassList(),r}_onMouseEvent(i){this._update(i.point)}_getAnchor(i){if(this.options.anchor)return this.options.anchor;let r=this._map,n=this._container,a=this._pos;if(!r||!n||!a)return"bottom";let o=n.offsetWidth,s=n.offsetHeight,l=a.x<o/2,h=a.x>r.transform.width-o/2;if(a.y+i<s)return l?"top-left":h?"top-right":"top";if(a.y>r.transform.height-s){if(l)return"bottom-left";if(h)return"bottom-right"}return l?"left":h?"right":"bottom"}_updateClassList(){let i=this._container;if(!i)return;let r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),i.className=r.join(" ")}_update(r){let n=this._map,a=this._content;if(!n||!this._lngLat&&!this._trackPointer||!a)return;let o=this._container;if(o||(o=this._container=u("div","mapboxgl-popup",n.getContainer()),this._tip=u("div","mapboxgl-popup-tip",o),o.appendChild(a)),this.options.maxWidth&&o.style.maxWidth!==this.options.maxWidth&&(o.style.maxWidth=this.options.maxWidth),n.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rW(this._lngLat,this._pos,n.transform)),!this._trackPointer||r){let i=this._pos=this._trackPointer&&r?r:n.project(this._lngLat),a=rK(this.options.offset),o=this._anchor=this._getAnchor(a.y),s=rK(this.options.offset,o),l=i.add(s).round();n._requestDomTask(()=>{this._container&&o&&(this._container.style.transform=`${rX[o]} translate(${l.x}px,${l.y}px)`)})}if(!this._marker&&n._showingGlobe()){let r=i.isLngLatBehindGlobe(n.transform,this._lngLat)?0:1;this._setOpacity(r)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let i=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._container&&(this._container.style.opacity=`${i}`),this._content&&(this._content.style.pointerEvents=i?"auto":"none")}},Marker:rH,Style:tM,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:iX,Evented:i.Evented,config:i.config,prewarm:function(){eU().acquire(eO)},clearPrewarmedResources:function(){let i=a;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(eO),a=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 i.config.ACCESS_TOKEN},set accessToken(t){i.config.ACCESS_TOKEN=t},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(t){i.config.API_URL=t},get workerCount(){return eF.workerCount},set workerCount(e){eF.workerCount=e},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.clearTileCache(r)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return r8}),n},i.exports=a()}}]);

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.