=s.x&&s.x>=c&&i!==s.x&&f(ln.x||s.x===n.x&&h(n,s)))&&(n=s,d=o)),s=s.next}while(s!==u);return n}(e,t);if(!n)return t;var i=T(n,e);return s(i,i.next),s(n,n.next)}function h(e,t){return I(e.prev,e,t.prev)<0&&I(t.next,e,e.next)<0}function p(e,t,n,s,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,n=e;do{(t.x=(e-a)*(l-r)&&(e-a)*(s-r)>=(n-a)*(t-r)&&(n-a)*(l-r)>=(i-a)*(s-r)}function m(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&v(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(g(e,t)&&g(t,e)&&function(e,t){var n=e,s=!1,i=(e.x+t.x)/2,l=(e.y+t.y)/2;do{n.y>l!==n.next.y>l&&n.next.y!==n.y&&i<(n.next.x-n.x)*(l-n.y)/(n.next.y-n.y)+n.x&&(s=!s),n=n.next}while(n!==e);return s}(e,t)&&(I(e.prev,e,t.prev)||I(e,t.prev,t))||y(e,t)&&I(e.prev,e,e.next)>0&&I(t.prev,t,t.next)>0)}function I(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function y(e,t){return e.x===t.x&&e.y===t.y}function v(e,t,n,s){var i=w(I(e,t,n)),l=w(I(e,t,s)),a=w(I(n,s,e)),r=w(I(n,s,t));return i!==l&&a!==r||(!(0!==i||!E(e,n,t))||(!(0!==l||!E(e,s,t))||(!(0!==a||!E(n,e,s))||!(0!==r||!E(n,t,s)))))}function E(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function w(e){return e>0?1:e<0?-1:0}function g(e,t){return I(e.prev,e,e.next)<0?I(e,t,e.next)>=0&&I(e,e.prev,t)>=0:I(e,t,e.prev)<0||I(e,e.next,t)<0}function T(e,t){var n=new S(e.i,e.x,e.y),s=new S(t.i,t.x,t.y),i=e.next,l=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,s.next=n,n.prev=s,l.next=s,s.prev=l,s}function b(e,t,n,s){var i=new S(e,t,n);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function R(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function S(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function D(e,t,n,s){for(var i=0,l=t,a=n-s;l0&&(s+=e[i-1].length,n.holes.push(s))}return n}},912:function(e){e.exports=function(){"use strict";var e,t,n;function s(s,i){if(e)if(t){var l="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 = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",a={};e(a),n=i(a),"undefined"!==typeof window&&window&&window.URL&&window.URL.createObjectURL&&(n.workerUrl=window.URL.createObjectURL(new Blob([l],{type:"text/javascript"})))}else t=i;else e=i}return s(["exports"],(function(e){var t="undefined"!=typeof self?self:{},n="2.15.0";let s;const i={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==s){const e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{s=null!={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.API_URL_REGEX?new RegExp({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.API_URL_REGEX):e}catch(t){s=e}}return s},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(){if(!i.API_URL)return null;try{const e=new URL(i.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return 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},l={supported:!1,testSupport:function(e){!o&&r&&(u?c(e):a=e)}};let a,r,o=!1,u=!1;function c(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.isContextLost())return;l.supported=!0}catch(e){}e.deleteTexture(t),o=!0}t.document&&(r=t.document.createElement("img"),r.onload=function(){a&&c(a),a=null,u=!0},r.onerror=function(){o=!0,a=null},r.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const h="01";function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d=f;function f(e,t,n,s){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=s}f.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,s=0;s<8;s++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)i?a=n:r=n,n=.5*(r-a)+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var m=p(d),I=y;function y(e,t){this.x=e,this.y=t}y.prototype={clone:function(){return new y(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),s=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=s,this},_rotateAround:function(e,t){var n=Math.cos(e),s=Math.sin(e),i=t.y+s*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-s*(this.y-t.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},y.convert=function(e){return e instanceof y?e:Array.isArray(e)?new y(e[0],e[1]):e};var v=p(I);const E=Math.PI/180,w=180/Math.PI;function g(e){return e*E}function T(e){return e*w}const b=[[0,0],[1,0],[1,1],[0,1]];function R(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function S(e,t,n,s){const i=new m(e,t,n,s);return function(e){return i.solve(e)}}const D=S(.25,.1,.25,1);function A(e,t,n){return Math.min(n,Math.max(t,e))}function C(e,t,n){return(n=A((n-e)/(t-e),0,1))*n*(3-2*n)}function x(e,t,n){const s=n-t,i=((e-t)%s+s)%s+t;return i===t?n:i}function _(e,t,n){if(!e.length)return n(null,[]);let s=e.length;const i=new Array(e.length);let l=null;e.forEach(((e,a)=>{t(e,((e,t)=>{e&&(l=e),i[a]=t,0==--s&&n(l,i)}))}))}function O(e){const t=[];for(const n in e)t.push(e[n]);return t}function N(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function F(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function B(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function H(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function U(e,t){return-1!==e.indexOf(t,e.length-t.length)}function G(e,t,n){const s={};for(const i in e)s[i]=t.call(n||this,e[i],i,e);return s}function k(e,t,n){const s={};for(const i in e)t.call(n||this,e[i],i,e)&&(s[i]=e[i]);return s}function z(e){return Array.isArray(e)?e.map(z):"object"==typeof e&&e?G(e,z):e}const V={};function j(e){V[e]||("undefined"!=typeof console&&console.warn(e),V[e]=!0)}function W(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function Y(e){let t=0;for(let n,s,i=0,l=e.length,a=l-1;i@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,n,s,i)=>{const l=s||i;return t[n]=!l||l.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let Z=null;function K(e){if(null==Z){const t=e.navigator?e.navigator.userAgent:null;Z=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Z}function Q(e){try{const n=t[e];return n.setItem("_mapbox_test_",1),n.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function J(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}const $="mapbox-tiles";let ee,te,ne=500,se=50;function ie(){try{return t.caches}catch(e){}}function le(){ie()&&!ee&&(ee=t.caches.open($))}function ae(e){const t=e.indexOf("?");if(t<0)return e;const n=function(e){const t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}(e),s=n.filter((e=>{const t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return s.length?"".concat(e.slice(0,t),"?").concat(s.join("&")):e.slice(0,t)}let re=1/0;const oe={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(oe);class ue extends Error{constructor(e,t,n){401===t&&we(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=n}toString(){return"".concat(this.name,": ").concat(this.message," (").concat(this.status,"): ").concat(this.url)}}const ce=q()?()=>self.worker&&self.worker.referrer:()=>("blob:"===t.location.protocol?t.parent:t).location.href,he=function(e,n){if(!(/^file:/.test(s=e.url)||/^file:/.test(ce())&&!/^\w+:/.test(s))){if(t.fetch&&t.Request&&t.AbortController&&t.Request.prototype.hasOwnProperty("signal"))return function(e,n){const s=new t.AbortController,i=new t.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:ce(),referrerPolicy:e.referrerPolicy,signal:s.signal});let l=!1,a=!1;const r=(o=i.url).indexOf("sku=")>0&&we(o);var o;"json"===e.type&&i.headers.set("Accept","application/json");const u=(s,l,o)=>{if(a)return;if(s&&"SecurityError"!==s.message&&j(s.toString()),l&&o)return c(l);const u=Date.now();t.fetch(i).then((t=>{if(t.ok){const e=r?t.clone():null;return c(t,e,u)}return n(new ue(t.statusText,t.status,e.url))})).catch((t=>{"AbortError"!==t.name&&n(new Error("".concat(t.message," ").concat(e.url)))}))},c=(s,r,o)=>{("arrayBuffer"===e.type?s.arrayBuffer():"json"===e.type?s.json():s.text()).then((e=>{a||(r&&o&&function(e,n,s){if(le(),!ee)return;const i={status:n.status,statusText:n.statusText,headers:new t.Headers};n.headers.forEach(((e,t)=>i.headers.set(t,e)));const l=X(n.headers.get("Cache-Control")||"");if(l["no-store"])return;l["max-age"]&&i.headers.set("Expires",new Date(s+1e3*l["max-age"]).toUTCString());const a=i.headers.get("Expires");a&&(new Date(a).getTime()-s<42e4||function(e,t){if(void 0===te)try{new Response(new ReadableStream),te=!0}catch(e){te=!1}te?t(e.body):e.blob().then(t)}(n,(n=>{const s=new t.Response(n,i);le(),ee&&ee.then((t=>t.put(ae(e.url),s))).catch((e=>j(e.message)))})))}(i,r,o),l=!0,n(null,e,s.headers.get("Cache-Control"),s.headers.get("Expires")))})).catch((e=>{a||n(new Error(e.message))}))};return r?function(e,t){if(le(),!ee)return t(null);const n=ae(e.url);ee.then((e=>{e.match(n).then((s=>{const i=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),n=X(e.headers.get("Cache-Control")||"");return t>Date.now()&&!n["no-cache"]}(s);e.delete(n),i&&e.put(n,s.clone()),t(null,s,i)})).catch(t)})).catch(t)}(i,u):u(null,null),{cancel:()=>{a=!0,l||s.abort()}}}(e,n);if(q()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,n,void 0,!0)}var s;return function(e,n){const s=new t.XMLHttpRequest;s.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(s.responseType="arraybuffer");for(const t in e.headers)s.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(s.responseType="text",s.setRequestHeader("Accept","application/json")),s.withCredentials="include"===e.credentials,s.onerror=()=>{n(new Error(s.statusText))},s.onload=()=>{if((s.status>=200&&s.status<300||0===s.status)&&null!==s.response){let t=s.response;if("json"===e.type)try{t=JSON.parse(s.response)}catch(e){return n(e)}n(null,t,s.getResponseHeader("Cache-Control"),s.getResponseHeader("Expires"))}else n(new ue(s.statusText,s.status,e.url))},s.send(e.body),{cancel:()=>s.abort()}}(e,n)},pe=function(e,t){return he(N(e,{type:"arrayBuffer"}),t)};function de(e){const n=t.document.createElement("a");return n.href=e,n.protocol===t.document.location.protocol&&n.host===t.document.location.host}const fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let me,Ie;me=[],Ie=0;const ye=function(e,n){if(l.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),Ie>=i.MAX_PARALLEL_IMAGE_REQUESTS){const t={requestParameters:e,callback:n,cancelled:!1,cancel(){this.cancelled=!0}};return me.push(t),t}Ie++;let s=!1;const a=()=>{if(!s)for(s=!0,Ie--;me.length&&Ie{a(),e?n(e):s&&(t.createImageBitmap?function(e,n){const s=new t.Blob([new Uint8Array(e)],{type:"image/png"});t.createImageBitmap(s).then((e=>{n(null,e)})).catch((e=>{n(new Error("Could not load image because of ".concat(e.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")))}))}(s,((e,t)=>n(e,t,i,l))):function(e,n){const s=new t.Image,i=t.URL;s.onload=()=>{n(null,s),i.revokeObjectURL(s.src),s.onload=null,t.requestAnimationFrame((()=>{s.src=fe}))},s.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new t.Blob([new Uint8Array(e)],{type:"image/png"});s.src=e.byteLength?i.createObjectURL(l):fe}(s,((e,t)=>n(e,t,i,l))))}));return{cancel:()=>{r.cancel(),a()}}},ve="NO_ACCESS_TOKEN";function Ee(e){return 0===e.indexOf("mapbox:")}function we(e){return i.API_URL_REGEX.test(e)}function ge(e){return i.API_CDN_URL_REGEX.test(e)}function Te(e){return i.API_STYLE_REGEX.test(e)&&!be(e)}function be(e){return i.API_SPRITE_REGEX.test(e)}const Re=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Se(e){const t=e.match(Re);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function De(e){const t=e.params.length?"?".concat(e.params.join("&")):"";return"".concat(e.protocol,"://").concat(e.authority).concat(e.path).concat(t)}const Ae="mapbox.eventData";function Ce(e){if(!e)return null;const n=e.split(".");if(!n||3!==n.length)return null;try{return JSON.parse(decodeURIComponent(t.atob(n[1]).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(e){return null}}class xe{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const n=Ce(i.ACCESS_TOKEN);let s="";return s=n&&n.u?t.btoa(encodeURIComponent(n.u).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t))))):i.ACCESS_TOKEN||"",e?"".concat(Ae,".").concat(e,":").concat(s):"".concat(Ae,":").concat(s)}fetchEventData(){const e=Q("localStorage"),n=this.getStorageKey(),s=this.getStorageKey("uuid");if(e)try{const e=t.localStorage.getItem(n);e&&(this.eventData=JSON.parse(e));const i=t.localStorage.getItem(s);i&&(this.anonId=i)}catch(e){j("Unable to read from LocalStorage")}}saveEventData(){const e=Q("localStorage"),n=this.getStorageKey(),s=this.getStorageKey("uuid");if(e)try{t.localStorage.setItem(s,this.anonId),Object.keys(this.eventData).length>=1&&t.localStorage.setItem(n,JSON.stringify(this.eventData))}catch(e){j("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,t,n,s){if(!i.EVENTS_URL)return;const l=Se(i.EVENTS_URL);l.params.push("access_token=".concat(s||i.ACCESS_TOKEN||""));const a={event:this.type,created:new Date(e).toISOString()},r=t?N(a,t):a,o={url:De(l),headers:{"Content-Type":"text/plain"},body:JSON.stringify([r])};this.pendingRequest=function(e,t){return he(N(e,{method:"POST"}),t)}(o,(e=>{this.pendingRequest=null,n(e),this.saveEventData(),this.processRequests(s)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const _e=new class extends xe{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){i.EVENTS_URL&&i.ACCESS_TOKEN&&Array.isArray(e)&&e.some((e=>Ee(e)||we(e)))&&this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Ce(i.ACCESS_TOKEN),s=t?t.u:i.ACCESS_TOKEN;let l=s!==this.eventData.tokenU;B(this.anonId)||(this.anonId=M(),l=!0);const a=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(a),n=(a-this.eventData.lastSuccess)/864e5;l=l||n>=1||n<-1||e.getDate()!==t.getDate()}else l=!0;l?this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:h,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=a,this.eventData.tokenU=s)}),e):this.processRequests()}},Oe=_e.postTurnstileEvent.bind(_e),Ne=new class extends xe{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,n,s){this.skuToken=t,this.errorCb=s,i.EVENTS_URL&&(n||i.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},n):this.errorCb(new Error(ve)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:s}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),B(this.anonId)||(this.anonId=M()),this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:h,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e))}},Le=Ne.postMapLoadEvent.bind(Ne),Pe=new class extends xe{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){i.EVENTS_URL&&(e||i.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:s,performanceData:i}=this.queue.shift(),l=function(e){const s=t.performance.getEntriesByType("resource"),i=t.performance.getEntriesByType("mark"),l=function(e){const t={};if(e)for(const n in e)if("other"!==n)for(const s of e[n]){const e="".concat(n,"ResolveRangeMin"),i="".concat(n,"ResolveRangeMax"),l="".concat(n,"RequestCount"),a="".concat(n,"RequestCachedCount");t[e]=Math.min(t[e]||1/0,s.startTime),t[i]=Math.max(t[i]||-1/0,s.responseEnd);const r=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==s.transferSize&&0===s.transferSize&&r(a),r(l)}return t}(function(e,t){const n={};if(e)for(const s of e){const e=t(s);void 0===n[e]&&(n[e]=[]),n[e].push(s)}return n}(s,ke)),a=t.devicePixelRatio,r=t.navigator.connection||t.navigator.mozConnection||t.navigator.webkitConnection,o={counters:[],metadata:[],attributes:[]},u=(e,t,n)=>{null!=n&&e.push({name:t,value:n.toString()})};for(const t in l)u(o.counters,t,l[t]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(u(o.counters,"interactionRangeMin",e.interactionRange[0]),u(o.counters,"interactionRangeMax",e.interactionRange[1])),i)for(const t of Object.keys(Ue)){const e=Ue[t],n=i.find((t=>t.name===e));n&&u(o.counters,e,n.startTime)}return u(o.counters,"visibilityHidden",e.visibilityHidden),u(o.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(Te(e)){const t=e.split("/").slice(-2);if(2===t.length)return"mapbox://styles/".concat(t[0],"/").concat(t[1])}}}(s)),u(o.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),u(o.attributes,"fogEnabled",e.fogEnabled?"true":"false"),u(o.attributes,"projection",e.projection),u(o.attributes,"zoom",e.zoom),u(o.metadata,"devicePixelRatio",a),u(o.metadata,"connectionEffectiveType",r?r.effectiveType:void 0),u(o.metadata,"navigatorUserAgent",t.navigator.userAgent),u(o.metadata,"screenWidth",t.screen.width),u(o.metadata,"screenHeight",t.screen.height),u(o.metadata,"windowWidth",t.innerWidth),u(o.metadata,"windowHeight",t.innerHeight),u(o.metadata,"mapWidth",e.width/a),u(o.metadata,"mapHeight",e.height/a),u(o.metadata,"webglRenderer",e.renderer),u(o.metadata,"webglVendor",e.vendor),u(o.metadata,"sdkVersion",n),u(o.metadata,"sdkIdentifier","mapbox-gl-js"),o}(i);for(const t of l.metadata);for(const t of l.counters);for(const t of l.attributes);this.postEvent(s,l,(()=>{}),e)}},Me=Pe.postPerformanceEvent.bind(Pe),Fe=new class extends xe{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,n,s){if(!i.API_URL||!i.SESSION_PATH)return;const l=Se(i.API_URL+i.SESSION_PATH);l.params.push("sku=".concat(t||"")),l.params.push("access_token=".concat(s||i.ACCESS_TOKEN||""));const a={url:De(l),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(e,t){return he(N(e,{method:"GET"}),t)}(a,(e=>{this.pendingRequest=null,n(e),this.saveEventData(),this.processRequests(s)}))}getSessionAPI(e,t,n,s){this.skuToken=t,this.errorCb=s,i.SESSION_PATH&&i.API_URL&&(n||i.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},n):this.errorCb(new Error(ve)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}},Be=Fe.getSessionAPI.bind(Fe),He=new Set,Ue={create:"create",load:"load",fullLoad:"fullLoad"},Ge={mark(e){t.performance.mark(e)},measure(e,n,s){t.performance.measure(e,n,s)}};function ke(e){const t=e.name.split("?")[0];return ge(t)&&t.includes("mapbox-gl.js")?"javascript":ge(t)&&t.includes("mapbox-gl.css")?"css":function(e){return i.API_FONTS_REGEX.test(e)}(t)?"fontRange":be(t)?"sprite":Te(t)?"style":function(e){return i.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}const ze=t.performance;function Ve(e){const t=e?e.url.toString():void 0;return ze.getEntriesByName(t)}let je,We,Ye,qe;const Xe={now:()=>void 0!==Ye?Ye:t.performance.now(),setNow(e){Ye=e},restoreNow(){Ye=void 0},frame(e){const n=t.requestAnimationFrame(e);return{cancel:()=>t.cancelAnimationFrame(n)}},getImageData(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const{width:s,height:i}=e;qe||(qe=t.document.createElement("canvas"));const l=qe.getContext("2d",{willReadFrequently:!0});if(!l)throw new Error("failed to create canvas 2d context");return(s>qe.width||i>qe.height)&&(qe.width=s,qe.height=i),l.clearRect(-n,-n,s+2*n,i+2*n),l.drawImage(e,0,0,s,i),l.getImageData(-n,-n,s+2*n,i+2*n)},resolveURL:e=>(je||(je=t.document.createElement("a")),je.href=e,je.href),get devicePixelRatio(){return t.devicePixelRatio},get prefersReducedMotion(){return!!t.matchMedia&&(null==We&&(We=t.matchMedia("(prefers-reduced-motion: reduce)")),We.matches)}};function Ze(e,t,n){n[e]&&-1!==n[e].indexOf(t)||(n[e]=n[e]||[],n[e].push(t))}function Ke(e,t,n){if(n&&n[e]){const s=n[e].indexOf(t);-1!==s&&n[e].splice(s,1)}}class Qe{constructor(e){N(this,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),this.type=e}}class Je extends Qe{constructor(e){super("error",N({error:e},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}}class $e{on(e,t){return this._listeners=this._listeners||{},Ze(e,t,this._listeners),this}off(e,t){return Ke(e,t,this._listeners),Ke(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Ze(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new Qe(e,t||{}));const n=e.type;if(this.listens(n)){e.target=this;const t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of t)n.call(this,e);const s=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const l of s)Ke(n,l,this._oneTimeListeners),l.call(this,e);const i=this._eventedParent;i&&(N(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof Je&&console.error(e.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var et=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":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":false,"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"]},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"requires":["fill-extrusion-edge-radius"],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":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 tt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:[];this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new at(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}var rt=at;const ot={kind:"null"},ut={kind:"number"},ct={kind:"string"},ht={kind:"boolean"},pt={kind:"color"},dt={kind:"object"},ft={kind:"value"},mt={kind:"collator"},It={kind:"formatted"},yt={kind:"resolvedImage"};function vt(e,t){return{kind:"array",itemType:e,N:t}}function Et(e){if("array"===e.kind){const t=Et(e.itemType);return"number"==typeof e.N?"array<".concat(t,", ").concat(e.N,">"):"value"===e.itemType.kind?"array":"array<".concat(t,">")}return e.kind}const wt=[ot,ut,ct,ht,pt,It,dt,vt(ft),yt];function gt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!gt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of wt)if(!gt(e,t))return null}return"Expected ".concat(Et(e)," but found ").concat(Et(t)," instead.")}function Tt(e,t){return t.some((t=>t.kind===e.kind))}function bt(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}var Rt,St={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 Dt(e){return(e=Math.round(e))<0?0:e>255?255:e}function At(e){return Dt("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function Ct(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function xt(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{Rt={}.parseCSSColor=function(e){var t,n=e.replace(/ /g,"").toLowerCase();if(n in St)return St[n].slice();if("#"===n[0])return 4===n.length?(t=parseInt(n.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===n.length&&(t=parseInt(n.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var s=n.indexOf("("),i=n.indexOf(")");if(-1!==s&&i+1===n.length){var l=n.substr(0,s),a=n.substr(s+1,i-(s+1)).split(","),r=1;switch(l){case"rgba":if(4!==a.length)return null;r=Ct(a.pop());case"rgb":return 3!==a.length?null:[At(a[0]),At(a[1]),At(a[2]),r];case"hsla":if(4!==a.length)return null;r=Ct(a.pop());case"hsl":if(3!==a.length)return null;var o=(parseFloat(a[0])%360+360)%360/360,u=Ct(a[1]),c=Ct(a[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return[Dt(255*xt(p,h,o+1/3)),Dt(255*xt(p,h,o)),Dt(255*xt(p,h,o-1/3)),r];default:return null}}return null}}catch(e){}class _t{constructor(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.r=e,this.g=t,this.b=n,this.a=s}static parse(e){if(!e)return;if(e instanceof _t)return e;if("string"!=typeof e)return;const t=Rt(e);return t?new _t(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,n,s]=this.toArray();return"rgba(".concat(Math.round(e),",").concat(Math.round(t),",").concat(Math.round(n),",").concat(s,")")}toArray(){const{r:e,g:t,b:n,a:s}=this;return 0===s?[0,0,0,0]:[255*e/s,255*t/s,255*n/s,s]}toArray01(){const{r:e,g:t,b:n,a:s}=this;return 0===s?[0,0,0,0]:[e/s,t/s,n/s,s]}toArray01PremultipliedAlpha(){const{r:e,g:t,b:n,a:s}=this;return[e,t,n,s]}}_t.black=new _t(0,0,0,1),_t.white=new _t(1,1,1,1),_t.transparent=new _t(0,0,0,0),_t.red=new _t(1,0,0,1),_t.blue=new _t(0,0,1,1);var Ot=_t;class Nt{constructor(e,t,n){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Lt{constructor(e,t,n,s,i){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=n,this.fontStack=s,this.textColor=i}}class Pt{constructor(e){this.sections=e}static fromString(e){return new Pt([new Lt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof Pt?e:Pt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){e.push(["image",t.image.name]);continue}e.push(t.text);const n={};t.fontStack&&(n["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(n["font-scale"]=t.scale),t.textColor&&(n["text-color"]=["rgba"].concat(t.textColor.toArray())),e.push(n)}return e}}class Mt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Mt({name:e,available:!1}):null}serialize(){return["image",this.name]}}function Ft(e,t,n,s){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===s||"number"==typeof s&&s>=0&&s<=1?null:"Invalid rgba value [".concat([e,t,n,s].join(", "),"]: 'a' must be between 0 and 1."):"Invalid rgba value [".concat(("number"==typeof s?[e,t,n,s]:[e,t,n]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}function Bt(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Ot)return!0;if(e instanceof Nt)return!0;if(e instanceof Pt)return!0;if(e instanceof Mt)return!0;if(Array.isArray(e)){for(const t of e)if(!Bt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Bt(e[t]))return!1;return!0}return!1}function Ht(e){if(null===e)return ot;if("string"==typeof e)return ct;if("boolean"==typeof e)return ht;if("number"==typeof e)return ut;if(e instanceof Ot)return pt;if(e instanceof Nt)return mt;if(e instanceof Pt)return It;if(e instanceof Mt)return yt;if(Array.isArray(e)){const t=e.length;let n;for(const s of e){const e=Ht(s);if(n){if(n===e)continue;n=ft;break}n=e}return vt(n||ft,t)}return dt}function Ut(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Ot||e instanceof Pt||e instanceof Mt?e.toString():JSON.stringify(e)}class Gt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error("'literal' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(!Bt(e[1]))return t.error("invalid value");const n=e[1];let s=Ht(n);const i=t.expectedType;return"array"!==s.kind||0!==s.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(s=i),new Gt(s,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 Ot?["rgba"].concat(this.value.toArray()):this.value instanceof Pt?this.value.serialize():this.value}}var kt=Gt,zt=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};const Vt={string:ct,number:ut,boolean:ht,object:dt};class jt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n,s=1;const i=e[0];if("array"===i){let i,l;if(e.length>2){const n=e[1];if("string"!=typeof n||!(n in Vt)||"object"===n)return t.error('The item type argument of "array" must be one of string, number, boolean',1);i=Vt[n],s++}else i=ft;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],s++}n=vt(i,l)}else n=Vt[i];const l=[];for(;se.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const n=e.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){t.push(n.kind);const s=e.N;("number"==typeof s||this.args.length>1)&&t.push(s)}}return t.concat(this.args.map((e=>e.serialize())))}}var Wt=jt;class Yt{constructor(e){this.type=It,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&"object"==typeof n)return t.error("First argument must be an image or text section.");const s=[];let i=!1;for(let l=1;l<=e.length-1;++l){const n=e[l];if(i&&"object"==typeof n&&!Array.isArray(n)){i=!1;let e=null;if(n["font-scale"]&&(e=t.parse(n["font-scale"],1,ut),!e))return null;let l=null;if(n["text-font"]&&(l=t.parse(n["text-font"],1,vt(ct)),!l))return null;let a=null;if(n["text-color"]&&(a=t.parse(n["text-color"],1,pt),!a))return null;const r=s[s.length-1];r.scale=e,r.font=l,r.textColor=a}else{const n=t.parse(e[l],1,ft);if(!n)return null;const a=n.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,s.push({content:n,scale:null,font:null,textColor:null})}}return new Yt(s)}evaluate(e){return new Pt(this.sections.map((t=>{const n=t.content.evaluate(e);return Ht(n)===yt?new Lt("",n,null,null,null):new Lt(Ut(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const n={};t.scale&&(n["font-scale"]=t.scale.serialize()),t.font&&(n["text-font"]=t.font.serialize()),t.textColor&&(n["text-color"]=t.textColor.serialize()),e.push(n)}return e}}class qt{constructor(e){this.type=yt,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ct);return n?new qt(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=Mt.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Xt={"to-boolean":ht,"to-color":pt,"to-number":ut,"to-string":ct};class Zt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(("to-boolean"===n||"to-string"===n)&&2!==e.length)return t.error("Expected one argument.");const s=Xt[n],i=[];for(let l=1;l4?"Invalid rbga value ".concat(JSON.stringify(t),": expected an array containing either three or four numeric values."):Ft(t[0],t[1],t[2],t[3]),!n))return new Ot(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new zt(n||"Could not parse color from value '".concat("string"==typeof t?t:String(JSON.stringify(t)),"'"))}if("number"===this.type.kind){let t=null;for(const n of this.args){if(t=n.evaluate(e),null===t)return 0;const s=Number(t);if(!isNaN(s))return s}throw new zt("Could not convert ".concat(JSON.stringify(t)," to number."))}return"formatted"===this.type.kind?Pt.fromString(Ut(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Mt.fromString(Ut(this.args[0].evaluate(e))):Ut(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Yt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new qt(this.args[0]).serialize();const e=["to-".concat(this.type.kind)];return this.eachChild((t=>{e.push(t.serialize())})),e}}var Kt=Zt;const Qt=["Unknown","Point","LineString","Polygon"];var Jt=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?Qt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:n,y:s}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*t-e[0])+this.featureDistanceData.bearing[1]*(s*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Ot.parse(e)),t}};class $t{constructor(e,t,n,s){this.name=e,this.type=t,this._evaluate=n,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const n=e[0],s=$t.definitions[n];if(!s)return t.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0);const i=Array.isArray(s)?s[0]:s.type,l=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=l.filter((t=>{let[n]=t;return!Array.isArray(n)||n.length===e.length-1}));let r=null;for(const[o,u]of a){r=new An(t.registry,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t{let[t]=e;return n=t,Array.isArray(n)?"(".concat(n.map(Et).join(", "),")"):"(".concat(Et(n.type),"...)");var n})).join(" | "),s=[];for(let i=1;i=t[2]||e[1]<=t[1]||e[3]>=t[3])}function an(e,t){const n=(180+e[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=Math.pow(2,t.z);return[Math.round(n*i*nn),Math.round(s*i*nn)]}function rn(e,t,n){const s=e[0]-t[0],i=e[1]-t[1],l=e[0]-n[0],a=e[1]-n[1];return s*a-l*i==0&&s*l<=0&&i*a<=0}function on(e,t){let n=!1;for(let a=0,r=t.length;a(s=e)[1]!=(l=r[t+1])[1]>s[1]&&s[0]<(l[0]-i[0])*(s[1]-i[1])/(l[1]-i[1])+i[0]&&(n=!n)}}var s,i,l;return n}function un(e,t){for(let n=0;n0&&r<0||a<0&&r>0}function hn(e,t,n){for(const u of n)for(let n=0;nn[2]){const t=.5*s;let i=e[0]-n[0]>t?-s:n[0]-e[0]>t?s:0;0===i&&(i=e[0]-n[2]>t?-s:n[2]-e[0]>t?s:0),e[0]+=i}sn(t,e)}function yn(e,t,n,s){const i=Math.pow(2,s.z)*nn,l=[s.x*nn,s.y*nn],a=[];if(!e)return a;for(const r of e)for(const e of r){const s=[e.x+l[0],e.y+l[1]];In(s,t,n,i),a.push(s)}return a}function vn(e,t,n,s){const i=Math.pow(2,s.z)*nn,l=[s.x*nn,s.y*nn],a=[];if(!e)return a;for(const o of e){const e=[];for(const n of o){const s=[n.x+l[0],n.y+l[1]];sn(t,s),e.push(s)}a.push(e)}if(t[2]-t[0]<=i/2){(r=t)[0]=r[1]=1/0,r[2]=r[3]=-1/0;for(const e of a)for(const s of e)In(s,t,n,i)}var r;return a}class En{constructor(e,t){this.type=ht,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error("'within' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(Bt(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e{t&&!gn(e)&&(t=!1)})),t}function Tn(e){if(e instanceof en&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Tn(e)&&(t=!1)})),t}function bn(e,t){if(e instanceof en&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild((e=>{n&&!bn(e,t)&&(n=!1)})),n}class Rn{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new Rn(n,t.scope.get(n)):t.error('Unknown variable "'.concat(n,'". Make sure "').concat(n,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var Sn=Rn;class Dn{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new rt,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];this.registry=e,this.path=t,this.key=t.map((e=>"[".concat(e,"]"))).join(""),this.scope=s,this.errors=i,this.expectedType=n}parse(e,t,n,s){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return t?this.concat(t,n,s)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return"assert"===n?new Wt(t,[e]):"coerce"===n?new Kt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if("string"!=typeof s)return this.error("Expression name must be a string, but found ".concat(typeof s,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;const i=this.registry[s];if(i){let s=i.parse(e,this);if(!s)return null;if(this.expectedType){const e=this.expectedType,i=s.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==i.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(e,i))return null}else s=n(s,e,t.typeAnnotation||"coerce");else s=n(s,e,t.typeAnnotation||"assert")}if(!(s instanceof kt)&&"resolvedImage"!==s.type.kind&&Cn(s)){const t=new Jt;try{s=new kt(s.type,s.evaluate(t))}catch(e){return this.error(e.message),null}}return s}return this.error('Unknown expression "'.concat(s,'". If you wanted a literal array, use ["literal", [...]].'),0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found ".concat(typeof e," instead."))}concat(e,t,n){const s="number"==typeof e?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new Dn(this.registry,s,t||null,i,this.errors)}error(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s"[".concat(e,"]"))).join(""));this.errors.push(new lt(i,e))}checkSubtype(e,t){const n=gt(e,t);return n&&this.error(n),n}}var An=Dn;function Cn(e){if(e instanceof Sn)return Cn(e.boundExpression);if(e instanceof en&&"error"===e.name)return!1;if(e instanceof tn)return!1;if(e instanceof wn)return!1;const t=e instanceof Kt||e instanceof Wt;let n=!0;return e.eachChild((e=>{n=t?n&&Cn(e):n&&e instanceof kt})),!!n&&gn(e)&&bn(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function xn(e,t){const n=e.length-1;let s,i,l=0,a=n,r=0;for(;l<=a;)if(r=Math.floor((l+a)/2),s=e[r],i=e[r+1],s<=t){if(r===n||tt))throw new zt("Input is not a number.");a=r-1}return 0}class _n{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,i]of n)this.labels.push(s),this.outputs.push(i)}static parse(e,t){if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,ut);if(!n)return null;const s=[];let i=null;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);for(let l=1;l=n)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',r);const u=t.parse(a,o,i);if(!u)return null;i=i||u.type,s.push([n,u])}return new _n(i,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const i=t.length;return s>=t[i-1]?n[i-1].evaluate(e):n[xn(t,s)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}var On=_n;function Nn(e,t,n){return e*(1-n)+t*n}var Ln=Object.freeze({__proto__:null,array:function(e,t,n){return e.map(((e,s)=>Nn(e,t[s],n)))},color:function(e,t,n){return new Ot(Nn(e.r,t.r,n),Nn(e.g,t.g,n),Nn(e.b,t.b,n),Nn(e.a,t.a,n))},number:Nn});const Pn=.95047,Mn=1.08883,Fn=4/29,Bn=6/29,Hn=3*Bn*Bn,Un=Bn*Bn*Bn,Gn=Math.PI/180,kn=180/Math.PI;function zn(e){return e>Un?Math.pow(e,1/3):e/Hn+Fn}function Vn(e){return e>Bn?e*e*e:Hn*(e-Fn)}function jn(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Wn(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Yn(e){const t=Wn(e.r),n=Wn(e.g),s=Wn(e.b),i=zn((.4124564*t+.3575761*n+.1804375*s)/Pn),l=zn((.2126729*t+.7151522*n+.072175*s)/1);return{l:116*l-16,a:500*(i-l),b:200*(l-zn((.0193339*t+.119192*n+.9503041*s)/Mn)),alpha:e.a}}function qn(e){let t=(e.l+16)/116,n=isNaN(e.a)?t:t+e.a/500,s=isNaN(e.b)?t:t-e.b/200;return t=1*Vn(t),n=Pn*Vn(n),s=Mn*Vn(s),new Ot(jn(3.2404542*n-1.5371385*t-.4985314*s),jn(-.969266*n+1.8760108*t+.041556*s),jn(.0556434*n-.2040259*t+1.0572252*s),e.alpha)}function Xn(e,t,n){const s=t-e;return e+n*(s>180||s<-180?s-360*Math.round(s/360):s)}const Zn={forward:Yn,reverse:qn,interpolate:function(e,t,n){return{l:Nn(e.l,t.l,n),a:Nn(e.a,t.a,n),b:Nn(e.b,t.b,n),alpha:Nn(e.alpha,t.alpha,n)}}},Kn={forward:function(e){const{l:t,a:n,b:s}=Yn(e),i=Math.atan2(s,n)*kn;return{h:i<0?i+360:i,c:Math.sqrt(n*n+s*s),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Gn,n=e.c;return qn({l:e.l,a:Math.cos(t)*n,b:Math.sin(t)*n,alpha:e.alpha})},interpolate:function(e,t,n){return{h:Xn(e.h,t.h,n),c:Nn(e.c,t.c,n),l:Nn(e.l,t.l,n),alpha:Nn(e.alpha,t.alpha,n)}}};var Qn=Object.freeze({__proto__:null,hcl:Kn,lab:Zn});class Jn{constructor(e,t,n,s,i){this.type=e,this.operator=t,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[l,a]of i)this.labels.push(l),this.outputs.push(a)}static interpolationFactor(e,t,n,s){let i=0;if("exponential"===e.name)i=$n(t,e.base,n,s);else if("linear"===e.name)i=$n(t,1,n,s);else if("cubic-bezier"===e.name){const l=e.controlPoints;i=new m(l[0],l[1],l[2],l[3]).solve($n(t,1,n,s))}return i}static parse(e,t){let[n,s,i,...l]=e;if(!Array.isArray(s)||0===s.length)return t.error("Expected an interpolation type expression.",1);if("linear"===s[0])s={name:"linear"};else if("exponential"===s[0]){const e=s[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:e}}else{if("cubic-bezier"!==s[0])return t.error("Unknown interpolation type ".concat(String(s[0])),1,0);{const e=s.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(i=t.parse(i,2,ut),!i)return null;const a=[];let r=null;"interpolate-hcl"===n||"interpolate-lab"===n?r=pt:t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(let o=0;o=e)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',s);const u=t.parse(n,i,r);if(!u)return null;r=r||u.type,a.push([e,u])}return"number"===r.kind||"color"===r.kind||"array"===r.kind&&"number"===r.itemType.kind&&"number"==typeof r.N?new Jn(r,n,s,i,a):t.error("Type ".concat(Et(r)," is not interpolatable."))}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const i=t.length;if(s>=t[i-1])return n[i-1].evaluate(e);const l=xn(t,s),a=Jn.interpolationFactor(this.interpolation,s,t[l],t[l+1]),r=n[l].evaluate(e),o=n[l+1].evaluate(e);return"interpolate"===this.operator?Ln[this.type.kind.toLowerCase()](r,o,a):"interpolate-hcl"===this.operator?Kn.reverse(Kn.interpolate(Kn.forward(r),Kn.forward(o),a)):Zn.reverse(Zn.interpolate(Zn.forward(r),Zn.forward(o),a))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const t=[this.operator,e,this.input.serialize()];for(let n=0;ngt(s,e.type)));return new ts(l?ft:n,i)}evaluate(e){let t,n=null,s=0;for(const i of this.args){if(s++,n=i.evaluate(e),n&&n instanceof Mt&&!n.available&&(t||(t=n),n=null,s===this.args.length))return t;if(null!==n)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var ns=ts;class ss{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found ".concat(e.length-1," instead."));const n=[];for(let i=1;i=n.length)throw new zt("Array index out of bounds: ".concat(t," > ").concat(n.length-1,"."));if(t!==Math.floor(t))throw new zt("Array index must be an integer, but found ".concat(t," instead."));return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var as=ls;class rs{constructor(e,t){this.type=ht,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));const n=t.parse(e[1],1,ft),s=t.parse(e[2],2,ft);return n&&s?Tt(n.type,[ht,ct,ut,ot,ft])?new rs(n,s):t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Et(n.type)," instead")):null}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(null==n)return!1;if(!bt(t,["boolean","string","number","null"]))throw new zt("Expected first argument to be of type boolean, string, number or null, but found ".concat(Et(Ht(t))," instead."));if(!bt(n,["string","array"]))throw new zt("Expected second argument to be of type array or string, but found ".concat(Et(Ht(n))," instead."));return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var os=rs;class us{constructor(e,t,n){this.type=ut,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));const n=t.parse(e[1],1,ft),s=t.parse(e[2],2,ft);if(!n||!s)return null;if(!Tt(n.type,[ht,ct,ut,ot,ft]))return t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Et(n.type)," instead"));if(4===e.length){const i=t.parse(e[3],3,ut);return i?new us(n,s,i):null}return new us(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!bt(t,["boolean","string","number","null"]))throw new zt("Expected first argument to be of type boolean, string, number or null, but found ".concat(Et(Ht(t))," instead."));if(!bt(n,["string","array"]))throw new zt("Expected second argument to be of type array or string, but found ".concat(Et(Ht(n))," instead."));if(this.fromIndex){const s=this.fromIndex.evaluate(e);return n.indexOf(t,s)}return n.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var cs=us;class hs{constructor(e,t,n,s,i,l){this.inputType=e,this.type=t,this.input=n,this.cases=s,this.outputs=i,this.otherwise=l}static parse(e,t){if(e.length<5)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!=1)return t.error("Expected an even number of arguments.");let n,s;t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);const i={},l=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(n){if(u.checkSubtype(n,Ht(e)))return null}else n=Ht(e);if(void 0!==i[String(e)])return u.error("Branch labels must be unique.");i[String(e)]=l.length}const c=t.parse(r,o,s);if(!c)return null;s=s||c.type,l.push(c)}const a=t.parse(e[1],1,ft);if(!a)return null;const r=t.parse(e[e.length-1],e.length-1,s);return r?"value"!==a.type.kind&&t.concat(1).checkSubtype(n,a.type)?null:new hs(n,s,a,i,l,r):null}evaluate(e){const t=this.input.evaluate(e);return(Ht(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),n=[],s={};for(const l of t){const e=s[this.cases[l]];void 0===e?(s[this.cases[l]]=n.length,n.push([this.cases[l],[l]])):n[e][1].push(l)}const i=e=>"number"===this.inputType.kind?Number(e):e;for(const[l,a]of n)e.push(1===a.length?i(a[0]):a.map(i)),e.push(this.outputs[l].serialize());return e.push(this.otherwise.serialize()),e}}var ps=hs;class ds{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const s=[];for(let l=1;l{let[t,n]=e;return n.outputDefined()}))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var fs=ds;class ms{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));const n=t.parse(e[1],1,ft),s=t.parse(e[2],2,ut);if(!n||!s)return null;if(!Tt(n.type,[vt(ft),ct,ft]))return t.error("Expected first argument to be of type array or string, but found ".concat(Et(n.type)," instead"));if(4===e.length){const i=t.parse(e[3],3,ut);return i?new ms(n.type,n,s,i):null}return new ms(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!bt(t,["string","array"]))throw new zt("Expected first argument to be of type array or string, but found ".concat(Et(Ht(t))," instead."));if(this.endIndex){const s=this.endIndex.evaluate(e);return t.slice(n,s)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var Is=ms;function ys(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function vs(e,t,n,s){return 0===s.compare(t,n)}function Es(e,t,n){const s="=="!==e&&"!="!==e;return class i{constructor(e,t,n){this.type=ht,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const n=e[0];let l=t.parse(e[1],1,ft);if(!l)return null;if(!ys(n,l.type))return t.concat(1).error('"'.concat(n,"\" comparisons are not supported for type '").concat(Et(l.type),"'."));let a=t.parse(e[2],2,ft);if(!a)return null;if(!ys(n,a.type))return t.concat(2).error('"'.concat(n,"\" comparisons are not supported for type '").concat(Et(a.type),"'."));if(l.type.kind!==a.type.kind&&"value"!==l.type.kind&&"value"!==a.type.kind)return t.error("Cannot compare types '".concat(Et(l.type),"' and '").concat(Et(a.type),"'."));s&&("value"===l.type.kind&&"value"!==a.type.kind?l=new Wt(a.type,[l]):"value"!==l.type.kind&&"value"===a.type.kind&&(a=new Wt(l.type,[a])));let r=null;if(4===e.length){if("string"!==l.type.kind&&"string"!==a.type.kind&&"value"!==l.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(r=t.parse(e[3],3,mt),!r)return null}return new i(l,a,r)}evaluate(i){const l=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(s&&this.hasUntypedArgument){const t=Ht(l),n=Ht(a);if(t.kind!==n.kind||"string"!==t.kind&&"number"!==t.kind)throw new zt('Expected arguments for "'.concat(e,'" to be (string, string) or (number, number), but found (').concat(t.kind,", ").concat(n.kind,") instead."))}if(this.collator&&!s&&this.hasUntypedArgument){const e=Ht(l),n=Ht(a);if("string"!==e.kind||"string"!==n.kind)return t(i,l,a)}return this.collator?n(i,l,a,this.collator.evaluate(i)):t(i,l,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const ws=Es("==",(function(e,t,n){return t===n}),vs),gs=Es("!=",(function(e,t,n){return t!==n}),(function(e,t,n,s){return!vs(0,t,n,s)})),Ts=Es("<",(function(e,t,n){return t",(function(e,t,n){return t>n}),(function(e,t,n,s){return s.compare(t,n)>0})),Rs=Es("<=",(function(e,t,n){return t<=n}),(function(e,t,n,s){return s.compare(t,n)<=0})),Ss=Es(">=",(function(e,t,n){return t>=n}),(function(e,t,n,s){return s.compare(t,n)>=0}));class Ds{constructor(e,t,n,s,i,l){this.type=ct,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=i,this.maxFractionDigits=l}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ut);if(!n)return null;const s=e[2];if("object"!=typeof s||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let i=null;if(s.locale&&(i=t.parse(s.locale,1,ct),!i))return null;let l=null;if(s.currency&&(l=t.parse(s.currency,1,ct),!l))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,ct),!a))return null;let r=null;if(s["min-fraction-digits"]&&(r=t.parse(s["min-fraction-digits"],1,ut),!r))return null;let o=null;return s["max-fraction-digits"]&&(o=t.parse(s["max-fraction-digits"],1,ut),!o)?null:new Ds(n,i,l,a,r,o)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class As{constructor(e){this.type=ut,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected 1 argument, but found ".concat(e.length-1," instead."));const n=t.parse(e[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?t.error("Expected argument of type string or array, but found ".concat(Et(n.type)," instead.")):new As(n):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new zt("Expected value to be of type string or array, but found ".concat(Et(Ht(t))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}const Cs={"==":ws,"!=":gs,">":bs,"<":Ts,">=":Ss,"<=":Rs,array:Wt,at:as,boolean:Wt,case:fs,coalesce:ns,collator:tn,format:Yt,image:qt,in:os,"index-of":cs,interpolate:es,"interpolate-hcl":es,"interpolate-lab":es,length:As,let:is,literal:kt,match:ps,number:Wt,"number-format":Ds,object:Wt,slice:Is,step:On,string:Wt,"to-boolean":Kt,"to-color":Kt,"to-number":Kt,"to-string":Kt,var:Sn,within:wn};function xs(e,t){let[n,s,i,l]=t;n=n.evaluate(e),s=s.evaluate(e),i=i.evaluate(e);const a=l?l.evaluate(e):1,r=Ft(n,s,i,a);if(r)throw new zt(r);return new Ot(n/255*a,s/255*a,i/255*a,a)}function _s(e,t){return e in t}function Os(e,t){const n=t[e];return void 0===n?null:n}function Ns(e){return{type:e}}en.register(Cs,{error:[{kind:"error"},[ct],(e,t)=>{let[n]=t;throw new zt(n.evaluate(e))}],typeof:[ct,[ft],(e,t)=>{let[n]=t;return Et(Ht(n.evaluate(e)))}],"to-rgba":[vt(ut,4),[pt],(e,t)=>{let[n]=t;return n.evaluate(e).toArray()}],rgb:[pt,[ut,ut,ut],xs],rgba:[pt,[ut,ut,ut,ut],xs],has:{type:ht,overloads:[[[ct],(e,t)=>{let[n]=t;return _s(n.evaluate(e),e.properties())}],[[ct,dt],(e,t)=>{let[n,s]=t;return _s(n.evaluate(e),s.evaluate(e))}]]},get:{type:ft,overloads:[[[ct],(e,t)=>{let[n]=t;return Os(n.evaluate(e),e.properties())}],[[ct,dt],(e,t)=>{let[n,s]=t;return Os(n.evaluate(e),s.evaluate(e))}]]},"feature-state":[ft,[ct],(e,t)=>{let[n]=t;return Os(n.evaluate(e),e.featureState||{})}],properties:[dt,[],e=>e.properties()],"geometry-type":[ct,[],e=>e.geometryType()],id:[ft,[],e=>e.id()],zoom:[ut,[],e=>e.globals.zoom],pitch:[ut,[],e=>e.globals.pitch||0],"distance-from-center":[ut,[],e=>e.distanceFromCenter()],"heatmap-density":[ut,[],e=>e.globals.heatmapDensity||0],"line-progress":[ut,[],e=>e.globals.lineProgress||0],"sky-radial-progress":[ut,[],e=>e.globals.skyRadialProgress||0],accumulated:[ft,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ut,Ns(ut),(e,t)=>{let n=0;for(const s of t)n+=s.evaluate(e);return n}],"*":[ut,Ns(ut),(e,t)=>{let n=1;for(const s of t)n*=s.evaluate(e);return n}],"-":{type:ut,overloads:[[[ut,ut],(e,t)=>{let[n,s]=t;return n.evaluate(e)-s.evaluate(e)}],[[ut],(e,t)=>{let[n]=t;return-n.evaluate(e)}]]},"/":[ut,[ut,ut],(e,t)=>{let[n,s]=t;return n.evaluate(e)/s.evaluate(e)}],"%":[ut,[ut,ut],(e,t)=>{let[n,s]=t;return n.evaluate(e)%s.evaluate(e)}],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(e,t)=>{let[n,s]=t;return Math.pow(n.evaluate(e),s.evaluate(e))}],sqrt:[ut,[ut],(e,t)=>{let[n]=t;return Math.sqrt(n.evaluate(e))}],log10:[ut,[ut],(e,t)=>{let[n]=t;return Math.log(n.evaluate(e))/Math.LN10}],ln:[ut,[ut],(e,t)=>{let[n]=t;return Math.log(n.evaluate(e))}],log2:[ut,[ut],(e,t)=>{let[n]=t;return Math.log(n.evaluate(e))/Math.LN2}],sin:[ut,[ut],(e,t)=>{let[n]=t;return Math.sin(n.evaluate(e))}],cos:[ut,[ut],(e,t)=>{let[n]=t;return Math.cos(n.evaluate(e))}],tan:[ut,[ut],(e,t)=>{let[n]=t;return Math.tan(n.evaluate(e))}],asin:[ut,[ut],(e,t)=>{let[n]=t;return Math.asin(n.evaluate(e))}],acos:[ut,[ut],(e,t)=>{let[n]=t;return Math.acos(n.evaluate(e))}],atan:[ut,[ut],(e,t)=>{let[n]=t;return Math.atan(n.evaluate(e))}],min:[ut,Ns(ut),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[ut,Ns(ut),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[ut,[ut],(e,t)=>{let[n]=t;return Math.abs(n.evaluate(e))}],round:[ut,[ut],(e,t)=>{let[n]=t;const s=n.evaluate(e);return s<0?-Math.round(-s):Math.round(s)}],floor:[ut,[ut],(e,t)=>{let[n]=t;return Math.floor(n.evaluate(e))}],ceil:[ut,[ut],(e,t)=>{let[n]=t;return Math.ceil(n.evaluate(e))}],"filter-==":[ht,[ct,ft],(e,t)=>{let[n,s]=t;return e.properties()[n.value]===s.value}],"filter-id-==":[ht,[ft],(e,t)=>{let[n]=t;return e.id()===n.value}],"filter-type-==":[ht,[ct],(e,t)=>{let[n]=t;return e.geometryType()===n.value}],"filter-<":[ht,[ct,ft],(e,t)=>{let[n,s]=t;const i=e.properties()[n.value],l=s.value;return typeof i==typeof l&&i{let[n]=t;const s=e.id(),i=n.value;return typeof s==typeof i&&s":[ht,[ct,ft],(e,t)=>{let[n,s]=t;const i=e.properties()[n.value],l=s.value;return typeof i==typeof l&&i>l}],"filter-id->":[ht,[ft],(e,t)=>{let[n]=t;const s=e.id(),i=n.value;return typeof s==typeof i&&s>i}],"filter-<=":[ht,[ct,ft],(e,t)=>{let[n,s]=t;const i=e.properties()[n.value],l=s.value;return typeof i==typeof l&&i<=l}],"filter-id-<=":[ht,[ft],(e,t)=>{let[n]=t;const s=e.id(),i=n.value;return typeof s==typeof i&&s<=i}],"filter->=":[ht,[ct,ft],(e,t)=>{let[n,s]=t;const i=e.properties()[n.value],l=s.value;return typeof i==typeof l&&i>=l}],"filter-id->=":[ht,[ft],(e,t)=>{let[n]=t;const s=e.id(),i=n.value;return typeof s==typeof i&&s>=i}],"filter-has":[ht,[ft],(e,t)=>{let[n]=t;return n.value in e.properties()}],"filter-has-id":[ht,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ht,[vt(ct)],(e,t)=>{let[n]=t;return n.value.indexOf(e.geometryType())>=0}],"filter-id-in":[ht,[vt(ft)],(e,t)=>{let[n]=t;return n.value.indexOf(e.id())>=0}],"filter-in-small":[ht,[ct,vt(ft)],(e,t)=>{let[n,s]=t;return s.value.indexOf(e.properties()[n.value])>=0}],"filter-in-large":[ht,[ct,vt(ft)],(e,t)=>{let[n,s]=t;return function(e,t,n,s){for(;n<=s;){const i=n+s>>1;if(t[i]===e)return!0;t[i]>e?s=i-1:n=i+1}return!1}(e.properties()[n.value],s.value,0,s.value.length-1)}],all:{type:ht,overloads:[[[ht,ht],(e,t)=>{let[n,s]=t;return n.evaluate(e)&&s.evaluate(e)}],[Ns(ht),(e,t)=>{for(const n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:ht,overloads:[[[ht,ht],(e,t)=>{let[n,s]=t;return n.evaluate(e)||s.evaluate(e)}],[Ns(ht),(e,t)=>{for(const n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[ht,[ht],(e,t)=>{let[n]=t;return!n.evaluate(e)}],"is-supported-script":[ht,[ct],(e,t)=>{let[n]=t;const s=e.globals&&e.globals.isSupportedScript;return!s||s(n.evaluate(e))}],upcase:[ct,[ct],(e,t)=>{let[n]=t;return n.evaluate(e).toUpperCase()}],downcase:[ct,[ct],(e,t)=>{let[n]=t;return n.evaluate(e).toLowerCase()}],concat:[ct,Ns(ft),(e,t)=>t.map((t=>Ut(t.evaluate(e)))).join("")],"resolved-locale":[ct,[mt],(e,t)=>{let[n]=t;return n.evaluate(e).resolvedLocale()}]});var Ls=Cs;function Ps(e){return{result:"success",value:e}}function Ms(e){return{result:"error",value:e}}function Fs(e){return"data-driven"===e["property-type"]}function Bs(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Hs(e){return!!e.expression&&e.expression.interpolated}function Us(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Gs(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ks(e){return e}function zs(e,t){const n="color"===t.type,s=e.stops&&"object"==typeof e.stops[0][0],i=s||!(s||void 0!==e.property),l=e.type||(Hs(t)?"exponential":"interval");if(n&&((e=tt({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],Ot.parse(e[1])]))),e.default=Ot.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Qn[e.colorSpace])throw new Error("Unknown color space: ".concat(e.colorSpace));let a,r,o;if("exponential"===l)a=Ys;else if("interval"===l)a=Ws;else if("categorical"===l){a=js,r=Object.create(null);for(const t of e.stops)r[t[0]]=t[1];o=typeof e.stops[0][0]}else{if("identity"!==l)throw new Error('Unknown function type "'.concat(l,'"'));a=qs}if(s){const n={},s=[];for(let t=0;te[0])),evaluate:(n,s)=>{let{zoom:l}=n;return Ys({stops:i,base:e.base},t,l).evaluate(l,s)}}}if(i){const n="exponential"===l?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:n,interpolationFactor:es.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:n=>{let{zoom:s}=n;return a(e,t,s,r,o)}}}return{kind:"source",evaluate(n,s){const i=s&&s.properties?s.properties[e.property]:void 0;return void 0===i?Vs(e.default,t.default):a(e,t,i,r,o)}}}function Vs(e,t,n){return void 0!==e?e:void 0!==t?t:void 0!==n?n:void 0}function js(e,t,n,s,i){return Vs(typeof n===i?s[n]:void 0,e.default,t.default)}function Ws(e,t,n){if("number"!==Us(n))return Vs(e.default,t.default);const s=e.stops.length;if(1===s)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[s-1][0])return e.stops[s-1][1];const i=xn(e.stops.map((e=>e[0])),n);return e.stops[i][1]}function Ys(e,t,n){const s=void 0!==e.base?e.base:1;if("number"!==Us(n))return Vs(e.default,t.default);const i=e.stops.length;if(1===i)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];const l=xn(e.stops.map((e=>e[0])),n),a=function(e,t,n,s){const i=s-n,l=e-n;return 0===i?0:1===t?l/i:(Math.pow(t,l)-1)/(Math.pow(t,i)-1)}(n,s,e.stops[l][0],e.stops[l+1][0]),r=e.stops[l][1],o=e.stops[l+1][1];let u=Ln[t.type]||ks;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Qn[e.colorSpace];u=(e,n)=>t.reverse(t.interpolate(t.forward(e),t.forward(n),a))}return"function"==typeof r.evaluate?{evaluate(){for(var e=arguments.length,t=new Array(e),n=0;nJSON.stringify(e))).join(", "),", but found ").concat(JSON.stringify(e)," instead."));return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Zs(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Ls}function Ks(e,t){const n=new An(Ls,[],t?function(e){const t={color:pt,string:ct,number:ut,enum:ct,boolean:ht,formatted:It,resolvedImage:yt};return"array"===e.type?vt(t[e.value]||ft,e.length):t[e.type]}(t):void 0),s=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return s?Ps(new Xs(s,t)):Ms(n.errors)}class Qs{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Tn(t.expression)}evaluateWithoutErrorHandling(e,t,n,s,i,l){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,i,l)}evaluate(e,t,n,s,i,l){return this._styleExpression.evaluate(e,t,n,s,i,l)}}class Js{constructor(e,t,n,s){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Tn(t.expression),this.interpolationType=s}evaluateWithoutErrorHandling(e,t,n,s,i,l){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,i,l)}evaluate(e,t,n,s,i,l){return this._styleExpression.evaluate(e,t,n,s,i,l)}interpolationFactor(e,t,n){return this.interpolationType?es.interpolationFactor(this.interpolationType,e,t,n):0}}function $s(e,t){if("error"===(e=Ks(e,t)).result)return e;const n=e.value.expression,s=gn(n);if(!s&&!Fs(t))return Ms([new lt("","data expressions not supported")]);const i=bn(n,["zoom","pitch","distance-from-center"]);if(!i&&!Bs(t))return Ms([new lt("","zoom expressions not supported")]);const l=ti(n);return l||i?l instanceof lt?Ms([l]):l instanceof es&&!Hs(t)?Ms([new lt("",'"interpolate" expressions cannot be used with this property')]):Ps(l?new Js(s?"camera":"composite",e.value,l.labels,l instanceof es?l.interpolation:void 0):new Qs(s?"constant":"source",e.value)):Ms([new lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ei{constructor(e,t){this._parameters=e,this._specification=t,tt(this,zs(this._parameters,this._specification))}static deserialize(e){return new ei(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ti(e){let t=null;if(e instanceof is)t=ti(e.result);else if(e instanceof ns){for(const n of e.args)if(t=ti(n),t)break}else(e instanceof On||e instanceof es)&&e.input instanceof en&&"zoom"===e.input.name&&(t=e);return t instanceof lt||e.eachChild((e=>{const n=ti(e);n instanceof lt?t=n:!t&&n?t=new lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&n&&t!==n&&(t=new lt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}class ni{constructor(e,t,n,s){this.message=(e?"".concat(e,": "):"")+n,s&&(this.identifier=s),null!=t&&t.__line__&&(this.line=t.__line__)}}function si(e){const t=e.key,n=e.value,s=e.valueSpec||{},i=e.objectElementValidators||{},l=e.style,a=e.styleSpec;let r=[];const o=Us(n);if("object"!==o)return[new ni(t,n,"object expected, ".concat(o," found"))];for(const u in n){const e=u.split(".")[0];let o;i[e]?o=i[e]:s[e]?o=Bi:i["*"]?o=i["*"]:s["*"]&&(o=Bi),o?r=r.concat(o({key:(t?"".concat(t,"."):t)+u,value:n[u],valueSpec:s[e]||s["*"],style:l,styleSpec:a,object:n,objectKey:u},n)):r.push(new ni(t,n[u],'unknown property "'.concat(u,'"')))}for(const u in s)i[u]||s[u].required&&void 0===s[u].default&&void 0===n[u]&&r.push(new ni(t,n,'missing required property "'.concat(u,'"')));return r}function ii(e){const t=e.value,n=e.valueSpec,s=e.style,i=e.styleSpec,l=e.key,a=e.arrayElementValidator||Bi;if("array"!==Us(t))return[new ni(l,t,"array expected, ".concat(Us(t)," found"))];if(n.length&&t.length!==n.length)return[new ni(l,t,"array length ".concat(n.length," expected, length ").concat(t.length," found"))];if(n["min-length"]&&t.lengthi)return[new ni(t,n,"".concat(n," is greater than the maximum value ").concat(i))]}return[]}function ai(e){const t=e.valueSpec,n=nt(e.value.type);let s,i,l,a={};const r="categorical"!==n&&void 0===e.value.property,o=!r,u="array"===Us(e.value.stops)&&"array"===Us(e.value.stops[0])&&"object"===Us(e.value.stops[0][0]),c=si({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===n)return[new ni(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const s=e.value;return t=t.concat(ii({key:e.key,value:s,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Us(s)&&0===s.length&&t.push(new ni(e.key,s,"array must have at least one stop")),t},default:function(e){return Bi({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&r&&c.push(new ni(e.key,e.value,'missing required property "property"')),"identity"===n||e.value.stops||c.push(new ni(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!Hs(e.valueSpec)&&c.push(new ni(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(o&&!Fs(e.valueSpec)?c.push(new ni(e.key,e.value,"property functions not supported")):r&&!Bs(e.valueSpec)&&c.push(new ni(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!u||void 0!==e.value.property||c.push(new ni(e.key,e.value,'"property" property is required')),c;function h(e){let n=[];const s=e.value,r=e.key;if("array"!==Us(s))return[new ni(r,s,"array expected, ".concat(Us(s)," found"))];if(2!==s.length)return[new ni(r,s,"array length 2 expected, length ".concat(s.length," found"))];if(u){if("object"!==Us(s[0]))return[new ni(r,s,"object expected, ".concat(Us(s[0])," found"))];if(void 0===s[0].zoom)return[new ni(r,s,"object stop key must have zoom")];if(void 0===s[0].value)return[new ni(r,s,"object stop key must have value")];const t=nt(s[0].zoom);if("number"!=typeof t)return[new ni(r,s[0].zoom,"stop zoom values must be numbers")];if(l&&l>t)return[new ni(r,s[0].zoom,"stop zoom values must appear in ascending order")];t!==l&&(l=t,i=void 0,a={}),n=n.concat(si({key:"".concat(r,"[0]"),value:s[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:li,value:p}}))}else n=n.concat(p({key:"".concat(r,"[0]"),value:s[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},s));return Zs(st(s[1]))?n.concat([new ni("".concat(r,"[1]"),s[1],"expressions are not allowed in function stops.")]):n.concat(Bi({key:"".concat(r,"[1]"),value:s[1],valueSpec:t,style:e.style,styleSpec:e.styleSpec}))}function p(e,l){const r=Us(e.value),o=nt(e.value),u=null!==e.value?e.value:l;if(s){if(r!==s)return[new ni(e.key,u,"".concat(r," stop domain type must match previous stop domain type ").concat(s))]}else s=r;if("number"!==r&&"string"!==r&&"boolean"!==r&&"number"!=typeof o&&"string"!=typeof o&&"boolean"!=typeof o)return[new ni(e.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==r&&"categorical"!==n){let s="number expected, ".concat(r," found");return Fs(t)&&void 0===n&&(s+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ni(e.key,u,s)]}return"categorical"!==n||"number"!==r||"number"==typeof o&&isFinite(o)&&Math.floor(o)===o?"categorical"!==n&&"number"===r&&"number"==typeof o&&"number"==typeof i&&void 0!==i&&onew ni("".concat(e.key).concat(t.key),e.value,t.message)));const n=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!n.outputDefined())return[new ni(e.key,e.value,'Invalid data expression for "'.concat(e.propertyKey,'". Output values must be contained as literals within the expression.'))];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Tn(n))return[new ni(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return oi(n,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!bn(n,["zoom","feature-state"]))return[new ni(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!gn(n))return[new ni(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function oi(e,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const i of t.valueSpec.expression.parameters)n.delete(i);if(0===n.size)return[];const s=[];return e instanceof en&&n.has(e.name)?[new ni(t.key,t.value,'["'.concat(e.name,'"] expression is not supported in a filter for a ').concat(t.object.type," layer with id: ").concat(t.object.id))]:(e.eachChild((e=>{s.push(...oi(e,t))})),s)}function ui(e){const t=e.key,n=e.value,s=e.valueSpec,i=[];return Array.isArray(s.values)?-1===s.values.indexOf(nt(n))&&i.push(new ni(t,n,"expected one of [".concat(s.values.join(", "),"], ").concat(JSON.stringify(n)," found"))):-1===Object.keys(s.values).indexOf(nt(n))&&i.push(new ni(t,n,"expected one of [".concat(Object.keys(s.values).join(", "),"], ").concat(JSON.stringify(n)," found"))),i}function ci(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!ci(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function hi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fill";if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};ci(e)||(e=vi(e));const n=e;let s=!0;try{s=function(e){if(!fi(e))return e;let t=st(e);return di(t),t=pi(t),t}(n)}catch(e){console.warn("Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n".concat(JSON.stringify(n,null,2),"\n "))}const i=et["filter_".concat(t)],l=Ks(s,i);let a=null;if("error"===l.result)throw new Error(l.value.map((e=>"".concat(e.key,": ").concat(e.message))).join(", "));a=(e,t,n)=>l.value.evaluate(e,t,{},n);let r=null,o=null;if(s!==n){const e=Ks(n,i);if("error"===e.result)throw new Error(e.value.map((e=>"".concat(e.key,": ").concat(e.message))).join(", "));r=(t,n,s,i,l)=>e.value.evaluate(t,n,{},s,void 0,void 0,i,l),o=!gn(e.value.expression)}return{filter:a,dynamicFilter:r||void 0,needGeometry:yi(s),needFeature:!!o}}function pi(e){if(!Array.isArray(e))return e;const t=function(e){if(mi.has(e[0]))for(let t=1;tpi(e)))}function di(e){let t=!1;const n=[];if("case"===e[0]){for(let s=1;s",">=","<","<=","to-boolean"]);function Ii(e,t){return et?1:0}function yi(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?Ei(e[1],e[2],t):"any"===t?(n=e.slice(1),["any"].concat(n.map(vi))):"all"===t?["all"].concat(e.slice(1).map(vi)):"none"===t?["all"].concat(e.slice(1).map(vi).map(Ti)):"in"===t?wi(e[1],e.slice(2)):"!in"===t?Ti(wi(e[1],e.slice(2))):"has"===t?gi(e[1]):"!has"===t?Ti(gi(e[1])):"within"!==t||e;var n}function Ei(e,t,n){switch(e){case"$type":return["filter-type-".concat(n),t];case"$id":return["filter-id-".concat(n),t];default:return["filter-".concat(n),e,t]}}function wi(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(Ii)]]:["filter-in-small",e,["literal",t]]}}function gi(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Ti(e){return["!",e]}function bi(e){return ci(st(e.value))?ri(tt({},e,{expressionContext:"filter",valueSpec:e.styleSpec["filter_".concat(e.layerType||"fill")]})):Ri(e)}function Ri(e){const t=e.value,n=e.key;if("array"!==Us(t))return[new ni(n,t,"array expected, ".concat(Us(t)," found"))];const s=e.styleSpec;let i,l=[];if(t.length<1)return[new ni(n,t,"filter array must have at least 1 element")];switch(l=l.concat(ui({key:"".concat(n,"[0]"),value:t[0],valueSpec:s.filter_operator,style:e.style,styleSpec:e.styleSpec})),nt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===nt(t[1])&&l.push(new ni(n,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":3!==t.length&&l.push(new ni(n,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&(i=Us(t[1]),"string"!==i&&l.push(new ni("".concat(n,"[1]"),t[1],"string expected, ".concat(i," found"))));for(let a=2;a{e in n&&t.push(new ni(s,n[e],'"'.concat(e,'" is prohibited for ref layers')))})),i.layers.forEach((t=>{nt(t.id)===r&&(e=t)})),e?e.ref?t.push(new ni(s,n.ref,"ref cannot reference another ref layer")):a=nt(e.type):"string"==typeof r&&t.push(new ni(s,n.ref,'ref layer "'.concat(r,'" not found')))}else if("background"!==a&&"sky"!==a)if(n.source){const e=i.sources&&i.sources[n.source],l=e&&nt(e.type);e?"vector"===l&&"raster"===a?t.push(new ni(s,n.source,'layer "'.concat(n.id,'" requires a raster source'))):"raster"===l&&"raster"!==a?t.push(new ni(s,n.source,'layer "'.concat(n.id,'" requires a vector source'))):"vector"!==l||n["source-layer"]?"raster-dem"===l&&"hillshade"!==a?t.push(new ni(s,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!n.paint||!n.paint["line-gradient"]&&!n.paint["line-trim-offset"]||"geojson"===l&&e.lineMetrics||t.push(new ni(s,n,'layer "'.concat(n.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new ni(s,n,'layer "'.concat(n.id,'" must specify a "source-layer"'))):t.push(new ni(s,n.source,'source "'.concat(n.source,'" not found')))}else t.push(new ni(s,n,'missing required property "source"'));return t=t.concat(si({key:s,value:n,valueSpec:l.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Bi({key:"".concat(s,".type"),value:n.type,valueSpec:l.layer.type,style:e.style,styleSpec:e.styleSpec,object:n,objectKey:"type"}),filter:e=>bi(tt({layerType:a},e)),layout:e=>si({layer:n,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Ai(tt({layerType:a},e))}}),paint:e=>si({layer:n,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Di(tt({layerType:a},e))}})}})),t}function xi(e){const t=e.value,n=e.key,s=Us(t);return"string"!==s?[new ni(n,t,"string expected, ".concat(s," found"))]:[]}const _i={promoteId:function(e){let{key:t,value:n}=e;if("string"===Us(n))return xi({key:t,value:n});{const e=[];for(const s in n)e.push(...xi({key:"".concat(t,".").concat(s),value:n[s]}));return e}}};function Oi(e){const t=e.value,n=e.key,s=e.styleSpec,i=e.style;if(!t.type)return[new ni(n,t,'"type" is required')];const l=nt(t.type);let a;switch(l){case"vector":case"raster":case"raster-dem":return a=si({key:n,value:t,valueSpec:s["source_".concat(l.replace("-","_"))],style:e.style,styleSpec:s,objectElementValidators:_i}),a;case"geojson":if(a=si({key:n,value:t,valueSpec:s.source_geojson,style:i,styleSpec:s,objectElementValidators:_i}),t.cluster)for(const e in t.clusterProperties){const[s,i]=t.clusterProperties[e],l="string"==typeof s?[s,["accumulated"],["get",e]]:s;a.push(...ri({key:"".concat(n,".").concat(e,".map"),value:i,expressionContext:"cluster-map"})),a.push(...ri({key:"".concat(n,".").concat(e,".reduce"),value:l,expressionContext:"cluster-reduce"}))}return a;case"video":return si({key:n,value:t,valueSpec:s.source_video,style:i,styleSpec:s});case"image":return si({key:n,value:t,valueSpec:s.source_image,style:i,styleSpec:s});case"canvas":return[new ni(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ui({key:"".concat(n,".type"),value:t.type,valueSpec:{values:Ni(s)},style:i,styleSpec:s})}}function Ni(e){return e.source.reduce(((t,n)=>{const s=e[n];return"enum"===s.type.type&&(t=t.concat(Object.keys(s.type.values))),t}),[])}function Li(e){const t=e.value,n=e.styleSpec,s=n.light,i=e.style;let l=[];const a=Us(t);if(void 0===t)return l;if("object"!==a)return l=l.concat([new ni("light",t,"object expected, ".concat(a," found"))]),l;for(const r in t){const e=r.match(/^(.*)-transition$/);l=l.concat(e&&s[e[1]]&&s[e[1]].transition?Bi({key:r,value:t[r],valueSpec:n.transition,style:i,styleSpec:n}):s[r]?Bi({key:r,value:t[r],valueSpec:s[r],style:i,styleSpec:n}):[new ni(r,t[r],'unknown property "'.concat(r,'"'))])}return l}function Pi(e){const t=e.value,n=e.key,s=e.style,i=e.styleSpec,l=i.terrain;let a=[];const r=Us(t);if(void 0===t)return a;if("object"!==r)return a=a.concat([new ni("terrain",t,"object expected, ".concat(r," found"))]),a;for(const o in t){const e=o.match(/^(.*)-transition$/);a=a.concat(e&&l[e[1]]&&l[e[1]].transition?Bi({key:o,value:t[o],valueSpec:i.transition,style:s,styleSpec:i}):l[o]?Bi({key:o,value:t[o],valueSpec:l[o],style:s,styleSpec:i}):[new ni(o,t[o],'unknown property "'.concat(o,'"'))])}if(t.source){const e=s.sources&&s.sources[t.source],i=e&&nt(e.type);e?"raster-dem"!==i&&a.push(new ni(n,t.source,"terrain cannot be used with a source of type ".concat(String(i),', it only be used with a "raster-dem" source type'))):a.push(new ni(n,t.source,'source "'.concat(t.source,'" not found')))}else a.push(new ni(n,t,'terrain is missing required property "source"'));return a}function Mi(e){const t=e.value,n=e.style,s=e.styleSpec,i=s.fog;let l=[];const a=Us(t);if(void 0===t)return l;if("object"!==a)return l=l.concat([new ni("fog",t,"object expected, ".concat(a," found"))]),l;for(const r in t){const e=r.match(/^(.*)-transition$/);l=l.concat(e&&i[e[1]]&&i[e[1]].transition?Bi({key:r,value:t[r],valueSpec:s.transition,style:n,styleSpec:s}):i[r]?Bi({key:r,value:t[r],valueSpec:i[r],style:n,styleSpec:s}):[new ni(r,t[r],'unknown property "'.concat(r,'"'))])}return l}const Fi={"*":()=>[],array:ii,boolean:function(e){const t=e.value,n=e.key,s=Us(t);return"boolean"!==s?[new ni(n,t,"boolean expected, ".concat(s," found"))]:[]},number:li,color:function(e){const t=e.key,n=e.value,s=Us(n);return"string"!==s?[new ni(t,n,"color expected, ".concat(s," found"))]:null===Rt(n)?[new ni(t,n,'color expected, "'.concat(n,'" found'))]:[]},enum:ui,filter:bi,function:ai,layer:Ci,object:si,source:Oi,light:Li,terrain:Pi,fog:Mi,string:xi,formatted:function(e){return 0===xi(e).length?[]:ri(e)},resolvedImage:function(e){return 0===xi(e).length?[]:ri(e)},projection:function(e){const t=e.value,n=e.styleSpec,s=n.projection,i=e.style;let l=[];const a=Us(t);if("object"===a)for(const r in t)l=l.concat(Bi({key:r,value:t[r],valueSpec:s[r],style:i,styleSpec:n}));else"string"!==a&&(l=l.concat([new ni("projection",t,"object or string expected, ".concat(a," found"))]));return l}};function Bi(e){const t=e.value,n=e.valueSpec,s=e.styleSpec;return n.expression&&Gs(nt(t))?ai(e):n.expression&&Zs(st(t))?ri(e):n.type&&Fi[n.type]?Fi[n.type](e):si(tt({},e,{valueSpec:n.type?s[n.type]:n}))}function Hi(e){const t=e.value,n=e.key,s=xi(e);return s.length||(-1===t.indexOf("{fontstack}")&&s.push(new ni(n,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&s.push(new ni(n,t,'"glyphs" url must include a "{range}" token'))),s}function Ui(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:et;return zi(Bi({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Hi,"*":()=>[]}}))}const Gi=e=>zi(Di(e)),ki=e=>zi(Ai(e));function zi(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function Vi(e,t){let n=!1;if(t&&t.length)for(const s of t)e.fire(new Je(new Error(s.message))),n=!0;return n}var ji=Yi,Wi=3;function Yi(e,t,n){var s=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(var l=0;l=c[d+0]&&s>=c[d+1])?(a[p]=!0,l.push(u[p])):a[p]=!1}}},Yi.prototype._forEachCell=function(e,t,n,s,i,l,a,r){for(var o=this._convertToCellCoord(e),u=this._convertToCellCoord(t),c=this._convertToCellCoord(n),h=this._convertToCellCoord(s),p=o;p<=c;p++)for(var d=u;d<=h;d++){var f=this.d*d+p;if((!r||r(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&i.call(this,e,t,n,s,f,l,a,r))return}},Yi.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},Yi.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},Yi.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=Wi+this.cells.length+1+1,n=0,s=0;s2&&void 0!==arguments[2]?arguments[2]:{};Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Xi[t]={klass:e,omit:n.omit||[]}}Zi(Object,"Object"),qi.serialize=function(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}},qi.deserialize=function(e){return new qi(e.buffer)},Object.defineProperty(qi,"name",{value:"Grid"}),Zi(qi,"Grid"),Zi(Ot,"Color"),Zi(Error,"Error"),Zi(ue,"AJAXError"),Zi(Mt,"ResolvedImage"),Zi(ei,"StylePropertyFunction"),Zi(Xs,"StyleExpression",{omit:["_evaluator"]}),Zi(Js,"ZoomDependentExpression"),Zi(Qs,"ZoomConstantExpression"),Zi(en,"CompoundExpression",{omit:["_evaluate"]});for(const bm in Ls)Xi[Ls[bm]._classRegistryKey]||Zi(Ls[bm],"Expression".concat(bm));function Ki(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Qi(e){return t.ImageBitmap&&e instanceof t.ImageBitmap}function Ji(e,n){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(Ki(e)||Qi(e))return n&&n.push(e),e;if(ArrayBuffer.isView(e)){const t=e;return n&&n.push(t.buffer),t}if(e instanceof t.ImageData)return n&&n.push(e.data.buffer),e;if(Array.isArray(e)){const t=[];for(const s of e)t.push(Ji(s,n));return t}if("object"==typeof e){const t=e.constructor,s=t._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class ".concat(s));const i=t.serialize?t.serialize(e,n):{};if(!t.serialize){for(const t in e)e.hasOwnProperty(t)&&(Xi[s].omit.indexOf(t)>=0||(i[t]=Ji(e[t],n)));e instanceof Error&&(i.message=e.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(i.$name=s),i}throw new Error("can't serialize object of type "+typeof e)}function $i(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Ki(e)||Qi(e)||ArrayBuffer.isView(e)||e instanceof t.ImageData)return e;if(Array.isArray(e))return e.map($i);if("object"==typeof e){const t=e.$name||"Object",{klass:n}=Xi[t];if(!n)throw new Error("can't deserialize unregistered class ".concat(t));if(n.deserialize)return n.deserialize(e);const s=Object.create(n.prototype);for(const i of Object.keys(e))"$name"!==i&&(s[i]=$i(e[i]));return s}throw new Error("can't deserialize object of type "+typeof e)}const el={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function tl(e){for(const t of e)if(il(t.charCodeAt(0)))return!0;return!1}function nl(e){for(const t of e)if(!sl(t.charCodeAt(0)))return!1;return!0}function sl(e){return!(el.Arabic(e)||el["Arabic Supplement"](e)||el["Arabic Extended-A"](e)||el["Arabic Presentation Forms-A"](e)||el["Arabic Presentation Forms-B"](e))}function il(e){return!(746!==e&&747!==e&&(e<4352||!(el["Bopomofo Extended"](e)||el.Bopomofo(e)||el["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||el["CJK Compatibility Ideographs"](e)||el["CJK Compatibility"](e)||el["CJK Radicals Supplement"](e)||el["CJK Strokes"](e)||!(!el["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||el["CJK Unified Ideographs Extension A"](e)||el["CJK Unified Ideographs"](e)||el["Enclosed CJK Letters and Months"](e)||el["Hangul Compatibility Jamo"](e)||el["Hangul Jamo Extended-A"](e)||el["Hangul Jamo Extended-B"](e)||el["Hangul Jamo"](e)||el["Hangul Syllables"](e)||el.Hiragana(e)||el["Ideographic Description Characters"](e)||el.Kanbun(e)||el["Kangxi Radicals"](e)||el["Katakana Phonetic Extensions"](e)||el.Katakana(e)&&12540!==e||!(!el["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!el["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||el["Unified Canadian Aboriginal Syllabics"](e)||el["Unified Canadian Aboriginal Syllabics Extended"](e)||el["Vertical Forms"](e)||el["Yijing Hexagram Symbols"](e)||el["Yi Syllables"](e)||el["Yi Radicals"](e))))}function ll(e){return!(il(e)||function(e){return!!(el["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||el["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||el["Letterlike Symbols"](e)||el["Number Forms"](e)||el["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||el["Control Pictures"](e)&&9251!==e||el["Optical Character Recognition"](e)||el["Enclosed Alphanumerics"](e)||el["Geometric Shapes"](e)||el["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||el["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||el["CJK Symbols and Punctuation"](e)||el.Katakana(e)||el["Private Use Area"](e)||el["CJK Compatibility Forms"](e)||el["Small Form Variants"](e)||el["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function al(e){return e>=1424&&e<=2303||el["Arabic Presentation Forms-A"](e)||el["Arabic Presentation Forms-B"](e)}function rl(e,t){return!(!t&&al(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||el.Khmer(e))}function ol(e){for(const t of e)if(al(t.charCodeAt(0)))return!0;return!1}const ul="deferred",cl="loading",hl="loaded";let pl=null,dl="unavailable",fl=null;const ml=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(dl="error"),pl&&pl(e)};function Il(){yl.fire(new Qe("pluginStateChange",{pluginStatus:dl,pluginURL:fl}))}const yl=new $e,vl=function(){return dl},El=function(){if(dl!==ul||!fl)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");dl=cl,Il(),fl&&pe({url:fl},(e=>{e?ml(e):(dl=hl,Il())}))},wl={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>dl===hl||null!=wl.applyArabicShaping,isLoading:()=>dl===cl,setState(e){dl=e.pluginStatus,fl=e.pluginURL},isParsed:()=>null!=wl.applyArabicShaping&&null!=wl.processBidirectionalText&&null!=wl.processStyledBidirectionalText,getPluginURL:()=>fl};class gl{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(e){return function(e,t){for(const n of e)if(!rl(n.charCodeAt(0),t))return!1;return!0}(e,wl.isLoaded())}}class Tl{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(Gs(e))return new ei(e,t);if(Zs(e)){const n=$s(e,t);if("error"===n.result)throw new Error(n.value.map((e=>"".concat(e.key,": ").concat(e.message))).join(", "));return n.value}{let n=e;return"string"==typeof e&&"color"===t.type&&(n=Ot.parse(e)),{kind:"constant",evaluate:()=>n}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class bl{constructor(e){this.property=e,this.value=new Tl(e,void 0)}transitioned(e,t){return new Sl(this.property,this.value,t,N({},e.transition,this.transition),e.now)}untransitioned(){return new Sl(this.property,this.value,null,{},0)}}class Rl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return z(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new bl(this._values[e].property)),this._values[e].value=new Tl(this._values[e].property,null===t?void 0:z(t))}getTransition(e){return z(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new bl(this._values[e].property)),this._values[e].transition=z(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);void 0!==n&&(e[t]=n);const s=this.getTransition(t);void 0!==s&&(e["".concat(t,"-transition")]=s)}return e}transitioned(e,t){const n=new Dl(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].transitioned(e,t._values[s]);return n}untransitioned(){const e=new Dl(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Sl{constructor(e,t,n,s,i){const l=s.delay||0,a=s.duration||0;i=i||0,this.property=e,this.value=t,this.begin=i+l,this.end=this.begin+a,e.specification.transition&&(s.delay||s.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const s=e.now||0,i=this.value.possiblyEvaluate(e,t,n),l=this.prior;if(l){if(s>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(sthis.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Hl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=0,s=0;return{members:e.map((e=>{const i=Ml[e.type].BYTES_PER_ELEMENT,l=n=Ul(n,Math.max(t,i)),a=e.components||1;return s=Math.max(s,i),n+=i*a,{name:e.name,type:e.type,components:a,offset:l}})),size:Ul(n,Math.max(s,t)),alignment:t}}function Ul(e,t){return Math.ceil(e/t)*t}class Gl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.int16[s+0]=t,this.int16[s+1]=n,e}}Gl.prototype.bytesPerElement=4,Zi(Gl,"StructArrayLayout2i4");class kl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=s,e}}kl.prototype.bytesPerElement=6,Zi(kl,"StructArrayLayout3i6");class zl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,s)}emplace(e,t,n,s,i){const l=4*e;return this.int16[l+0]=t,this.int16[l+1]=n,this.int16[l+2]=s,this.int16[l+3]=i,e}}zl.prototype.bytesPerElement=8,Zi(zl,"StructArrayLayout4i8");class Vl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,s,i,l,a)}emplace(e,t,n,s,i,l,a,r){const o=6*e,u=12*e,c=3*e;return this.int16[o+0]=t,this.int16[o+1]=n,this.uint8[u+4]=s,this.uint8[u+5]=i,this.uint8[u+6]=l,this.uint8[u+7]=a,this.float32[c+2]=r,e}}Vl.prototype.bytesPerElement=12,Zi(Vl,"StructArrayLayout2i4ub1f12");class jl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,s)}emplace(e,t,n,s,i){const l=4*e;return this.float32[l+0]=t,this.float32[l+1]=n,this.float32[l+2]=s,this.float32[l+3]=i,e}}jl.prototype.bytesPerElement=16,Zi(jl,"StructArrayLayout4f16");class Wl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s,i)}emplace(e,t,n,s,i,l){const a=6*e,r=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=n,this.uint16[a+2]=s,this.uint16[a+3]=i,this.float32[r+2]=l,e}}Wl.prototype.bytesPerElement=12,Zi(Wl,"StructArrayLayout4ui1f12");class Yl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,s)}emplace(e,t,n,s,i){const l=4*e;return this.uint16[l+0]=t,this.uint16[l+1]=n,this.uint16[l+2]=s,this.uint16[l+3]=i,e}}Yl.prototype.bytesPerElement=8,Zi(Yl,"StructArrayLayout4ui8");class ql extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,s,i,l)}emplace(e,t,n,s,i,l,a){const r=6*e;return this.int16[r+0]=t,this.int16[r+1]=n,this.int16[r+2]=s,this.int16[r+3]=i,this.int16[r+4]=l,this.int16[r+5]=a,e}}ql.prototype.bytesPerElement=12,Zi(ql,"StructArrayLayout6i12");class Xl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l,a,r,o,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,i,l,a,r,o,u,c,h)}emplace(e,t,n,s,i,l,a,r,o,u,c,h,p){const d=12*e;return this.int16[d+0]=t,this.int16[d+1]=n,this.int16[d+2]=s,this.int16[d+3]=i,this.uint16[d+4]=l,this.uint16[d+5]=a,this.uint16[d+6]=r,this.uint16[d+7]=o,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,e}}Xl.prototype.bytesPerElement=24,Zi(Xl,"StructArrayLayout4i4ui4i24");class Zl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,s,i,l)}emplace(e,t,n,s,i,l,a){const r=10*e,o=5*e;return this.int16[r+0]=t,this.int16[r+1]=n,this.int16[r+2]=s,this.float32[o+2]=i,this.float32[o+3]=l,this.float32[o+4]=a,e}}Zl.prototype.bytesPerElement=20,Zi(Zl,"StructArrayLayout3i3f20");class Kl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Kl.prototype.bytesPerElement=4,Zi(Kl,"StructArrayLayout1ul4");class Ql extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l,a,r,o,u,c,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,n,s,i,l,a,r,o,u,c,h,p)}emplace(e,t,n,s,i,l,a,r,o,u,c,h,p,d){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=n,this.int16[f+2]=s,this.int16[f+3]=i,this.int16[f+4]=l,this.float32[m+3]=a,this.float32[m+4]=r,this.float32[m+5]=o,this.float32[m+6]=u,this.int16[f+14]=c,this.uint32[m+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,e}}Ql.prototype.bytesPerElement=40,Zi(Ql,"StructArrayLayout5i4f1i1ul2ui40");class Jl extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,s,i,l,a)}emplace(e,t,n,s,i,l,a,r){const o=8*e;return this.int16[o+0]=t,this.int16[o+1]=n,this.int16[o+2]=s,this.int16[o+4]=i,this.int16[o+5]=l,this.int16[o+6]=a,this.int16[o+7]=r,e}}Jl.prototype.bytesPerElement=16,Zi(Jl,"StructArrayLayout3i2i2i16");class $l extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s,i)}emplace(e,t,n,s,i,l){const a=4*e,r=8*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=s,this.int16[r+6]=i,this.int16[r+7]=l,e}}$l.prototype.bytesPerElement=16,Zi($l,"StructArrayLayout2f1f2i16");class ea extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,s)}emplace(e,t,n,s,i){const l=12*e,a=3*e;return this.uint8[l+0]=t,this.uint8[l+1]=n,this.float32[a+1]=s,this.float32[a+2]=i,e}}ea.prototype.bytesPerElement=12,Zi(ea,"StructArrayLayout2ub2f12");class ta extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=s,e}}ta.prototype.bytesPerElement=12,Zi(ta,"StructArrayLayout3f12");class na extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=s,e}}na.prototype.bytesPerElement=6,Zi(na,"StructArrayLayout3ui6");class sa extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I,y,v,E,w){const g=this.length;return this.resize(g+1),this.emplace(g,e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I,y,v,E,w)}emplace(e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I,y,v,E,w,g){const T=30*e,b=15*e,R=60*e;return this.int16[T+0]=t,this.int16[T+1]=n,this.int16[T+2]=s,this.float32[b+2]=i,this.float32[b+3]=l,this.uint16[T+8]=a,this.uint16[T+9]=r,this.uint32[b+5]=o,this.uint32[b+6]=u,this.uint32[b+7]=c,this.uint16[T+16]=h,this.uint16[T+17]=p,this.uint16[T+18]=d,this.float32[b+10]=f,this.float32[b+11]=m,this.uint8[R+48]=I,this.uint8[R+49]=y,this.uint8[R+50]=v,this.uint32[b+13]=E,this.int16[T+28]=w,this.uint8[R+58]=g,e}}sa.prototype.bytesPerElement=60,Zi(sa,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class ia extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I,y,v,E,w,g,T,b,R,S,D,A,C,x){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I,y,v,E,w,g,T,b,R,S,D,A,C,x)}emplace(e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I,y,v,E,w,g,T,b,R,S,D,A,C,x,_){const O=38*e,N=19*e;return this.int16[O+0]=t,this.int16[O+1]=n,this.int16[O+2]=s,this.float32[N+2]=i,this.float32[N+3]=l,this.int16[O+8]=a,this.int16[O+9]=r,this.int16[O+10]=o,this.int16[O+11]=u,this.int16[O+12]=c,this.int16[O+13]=h,this.uint16[O+14]=p,this.uint16[O+15]=d,this.uint16[O+16]=f,this.uint16[O+17]=m,this.uint16[O+18]=I,this.uint16[O+19]=y,this.uint16[O+20]=v,this.uint16[O+21]=E,this.uint16[O+22]=w,this.uint16[O+23]=g,this.uint16[O+24]=T,this.uint16[O+25]=b,this.uint16[O+26]=R,this.uint16[O+27]=S,this.uint16[O+28]=D,this.uint32[N+15]=A,this.float32[N+16]=C,this.float32[N+17]=x,this.float32[N+18]=_,e}}ia.prototype.bytesPerElement=76,Zi(ia,"StructArrayLayout3i2f6i15ui1ul3f76");class la extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}la.prototype.bytesPerElement=4,Zi(la,"StructArrayLayout1f4");class aa extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,i){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s,i)}emplace(e,t,n,s,i,l){const a=5*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=s,this.float32[a+3]=i,this.float32[a+4]=l,e}}aa.prototype.bytesPerElement=20,Zi(aa,"StructArrayLayout5f20");class ra extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,s)}emplace(e,t,n,s,i){const l=6*e;return this.uint32[3*e+0]=t,this.uint16[l+2]=n,this.uint16[l+3]=s,this.uint16[l+4]=i,e}}ra.prototype.bytesPerElement=12,Zi(ra,"StructArrayLayout1ul3ui12");class oa extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.uint16[s+0]=t,this.uint16[s+1]=n,e}}oa.prototype.bytesPerElement=4,Zi(oa,"StructArrayLayout2ui4");class ua extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ua.prototype.bytesPerElement=2,Zi(ua,"StructArrayLayout1ui2");class ca extends Bl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.float32[s+0]=t,this.float32[s+1]=n,e}}ca.prototype.bytesPerElement=8,Zi(ca,"StructArrayLayout2f8");class ha extends Fl{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]}}ha.prototype.size=40;class pa extends Ql{get(e){return new ha(this,e)}}Zi(pa,"CollisionBoxArray");class da extends Fl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}da.prototype.size=60;class fa extends sa{get(e){return new da(this,e)}}Zi(fa,"PlacedSymbolArray");class ma extends Fl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(e){this._structArray.uint32[this._pos4+15]=e}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}ma.prototype.size=76;class Ia extends ia{get(e){return new ma(this,e)}}Zi(Ia,"SymbolInstanceArray");class ya extends la{getoffsetX(e){return this.float32[1*e+0]}}Zi(ya,"GlyphOffsetArray");class va extends Gl{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Zi(va,"SymbolLineVertexArray");class Ea extends Fl{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]}}Ea.prototype.size=12;class wa extends ra{get(e){return new Ea(this,e)}}Zi(wa,"FeatureIndexArray");class ga extends oa{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Zi(ga,"FillExtrusionCentroidArray");const Ta=Hl([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),ba=Hl([{name:"a_dash",components:4,type:"Uint16"}]);var Ra={exports:{}},Sa={exports:{}};Sa.exports=function(e,t){var n,s,i,l,a,r,o,u;for(s=e.length-(n=3&e.length),i=t,a=3432918353,r=461845907,u=0;u>>16)*a&65535)<<16)&4294967295)<<15|o>>>17))*r+(((o>>>16)*r&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(l>>>16)&65535)<<16);switch(o=0,n){case 3:o^=(255&e.charCodeAt(u+2))<<16;case 2:o^=(255&e.charCodeAt(u+1))<<8;case 1:i^=o=(65535&(o=(o=(65535&(o^=255&e.charCodeAt(u)))*a+(((o>>>16)*a&65535)<<16)&4294967295)<<15|o>>>17))*r+(((o>>>16)*r&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var Da=Sa.exports,Aa={exports:{}};Aa.exports=function(e,t){for(var n,s=e.length,i=t^s,l=0;s>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),s-=4,++l;switch(s){case 3:i^=(255&e.charCodeAt(l+2))<<16;case 2:i^=(255&e.charCodeAt(l+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(l)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var Ca=Da,xa=Aa.exports;Ra.exports=Ca,Ra.exports.murmur3=Ca,Ra.exports.murmur2=xa;var _a=p(Ra.exports);class Oa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,s){this.ids.push(Na(e)),this.positions.push(t,n,s)}getPositions(e){const t=Na(e);let n=0,s=this.ids.length-1;for(;n>1;this.ids[e]>=t?s=e:n=e+1}const i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){const n=new Float64Array(e.ids),s=new Uint32Array(e.positions);return La(n,s,0,n.length-1),t&&t.push(n.buffer,s.buffer),{ids:n,positions:s}}static deserialize(e){const t=new Oa;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function Na(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:_a(String(e))}function La(e,t,n,s){for(;n>1];let l=n-1,a=s+1;for(;;){do{l++}while(e[l]i);if(l>=a)break;Pa(e,l,a),Pa(t,3*l,3*a),Pa(t,3*l+1,3*a+1),Pa(t,3*l+2,3*a+2)}a-n"u_".concat(e))),this.type=n}setUniform(e,t,n,s,i){t.set(e,i,s.constantOr(this.value))}getBinding(e,t){return"color"===this.type?new Ha(e):new Fa(e)}}class ja{constructor(e,t){this.uniformNames=t.map((e=>"u_".concat(e))),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,t,n,s,i){const l="u_pattern"===i||"u_dash"===i?this.pattern:"u_pixel_ratio"===i?this.pixelRatio:null;l&&t.set(e,i,l)}getBinding(e,t){return"u_pattern"===t||"u_dash"===t?new Ba(e):new Fa(e)}}class Wa{constructor(e,t,n,s){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:"a_".concat(e),type:"Float32",components:"color"===n?2:1,offset:0}))),this.paintVertexArray=new s}populatePaintArray(e,t,n,s,i,l){const a=this.paintVertexArray.length,r=this.expression.evaluate(new gl(0),t,{},i,s,l);this.paintVertexArray.resize(e),this._setPaintValue(a,e,r)}updatePaintArray(e,t,n,s,i){const l=this.expression.evaluate({zoom:0},n,s,void 0,i);this._setPaintValue(e,t,l)}_setPaintValue(e,t,n){if("color"===this.type){const s=za(n);for(let n=e;n"u_".concat(e,"_t"))),this.type=n,this.useIntegerZoom=s,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:"a_".concat(e),type:"Float32",components:"color"===n?4:2,offset:0}))),this.paintVertexArray=new l}populatePaintArray(e,t,n,s,i,l){const a=this.expression.evaluate(new gl(this.zoom),t,{},i,s,l),r=this.expression.evaluate(new gl(this.zoom+1),t,{},i,s,l),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,a,r)}updatePaintArray(e,t,n,s,i){const l=this.expression.evaluate({zoom:this.zoom},n,s,void 0,i),a=this.expression.evaluate({zoom:this.zoom+1},n,s,void 0,i);this._setPaintValue(e,t,l,a)}_setPaintValue(e,t,n,s){if("color"===this.type){const i=za(n),l=za(s);for(let n=e;n2&&void 0!==arguments[2]?arguments[2]:()=>!0;this.binders={},this._buffers=[];const s=[];for(const i in e.paint._values){if(!n(i))continue;const l=e.paint.get(i);if(!(l instanceof Cl&&Fs(l.property.specification)))continue;const a=Qa(i,e.type),r=l.value,o=l.property.specification.type,u=!!l.property.useIntegerZoom,c="line-dasharray"===i||i.endsWith("pattern"),h="line-dasharray"===i&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==r.kind||h)if("source"===r.kind||h||c){const t=er(i,o,"source");this.binders[i]=c?new qa(r,a,o,t,e.id):new Wa(r,a,o,t),s.push("/a_".concat(i))}else{const e=er(i,o,"composite");this.binders[i]=new Ya(r,a,o,u,t,e),s.push("/z_".concat(i))}else this.binders[i]=c?new ja(r.value,a):new Va(r.value,a,o),s.push("/u_".concat(i))}this.cacheKey=s.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Wa||t instanceof Ya?t.maxValue:0}populatePaintArrays(e,t,n,s,i,l){for(const a in this.binders){const r=this.binders[a];(r instanceof Wa||r instanceof Ya||r instanceof qa)&&r.populatePaintArray(e,t,n,s,i,l)}}setConstantPatternPositions(e){for(const t in this.binders){const n=this.binders[t];n instanceof ja&&n.setConstantPatternPositions(e)}}updatePaintArrays(e,t,n,s,i,l){let a=!1;for(const r in e){const o=t.getPositions(r);for(const t of o){const o=n.feature(t.index);for(const n in this.binders){const u=this.binders[n];if((u instanceof Wa||u instanceof Ya||u instanceof qa)&&!0===u.expression.isStateDependent){const c=s.paint.get(n);u.expression=c.value,u.updatePaintArray(t.start,t.end,o,e[r],i,l),a=!0}}}}return a}defines(){const e=[];for(const t in this.binders){const n=this.binders[t];(n instanceof Va||n instanceof ja)&&e.push(...n.uniformNames.map((e=>"#define HAS_UNIFORM_".concat(e))))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const n=this.binders[t];if(n instanceof Wa||n instanceof Ya||n instanceof qa)for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:()=>!0;this.programConfigurations={};for(const s of e)this.programConfigurations[s.id]=new Xa(s,t,n);this.needsUpload=!1,this._featureMap=new Oa,this._bufferOffset=0}populatePaintArrays(e,t,n,s,i,l,a){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,s,i,l,a);void 0!==t.id&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,s,i){for(const l of n)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,t,l,s,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Ka={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Qa(e,t){return Ka[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}const Ja={"line-pattern":{source:Wl,composite:Wl},"fill-pattern":{source:Wl,composite:Wl},"fill-extrusion-pattern":{source:Wl,composite:Wl},"line-dasharray":{source:Yl,composite:Yl}},$a={color:{source:ca,composite:jl},number:{source:la,composite:ca}};function er(e,t,n){const s=Ja[e];return s&&s[n]||$a[t][n]}Zi(Va,"ConstantBinder"),Zi(ja,"PatternConstantBinder"),Zi(Wa,"SourceExpressionBinder"),Zi(qa,"PatternCompositeBinder"),Zi(Ya,"CompositeExpressionBinder"),Zi(Xa,"ProgramConfiguration",{omit:["_buffers"]}),Zi(Za,"ProgramConfigurationSet");const tr="-transition";class nr extends $e{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Al(t.layout)),t.paint)){this._transitionablePaint=new Rl(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new xl(t.paint)}}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!=t&&this._validate(ki,"layers.".concat(this.id,".layout.").concat(e),e,t,n)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return U(e,tr)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!=t&&this._validate(Gi,"layers.".concat(this.id,".paint.").concat(e),e,t,n))return!1;if(U(e,tr))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const n=this._transitionablePaint._values[e],s=n.value.isDataDriven(),i=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const l=this._transitionablePaint._values[e].value,a=l.isDataDriven(),r=U(e,"pattern")||"line-dasharray"===e;return a||s||r||this._handleOverridablePaintPropertyUpdate(e,i,l)}}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getProgramConfiguration(e){return null}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),k(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,n,s){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return(!i||!1!==i.validate)&&Vi(this,e.call(Ui,{key:t,layerType:this.type,objectKey:n,value:s,styleSpec:et,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Cl&&Fs(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=hi(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const sr=Hl([{name:"a_pos",components:2,type:"Int16"}],4),ir=Hl([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class lr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.segments=e}prepareSegment(e,t,n,s){let i=this.segments[this.segments.length-1];return e>lr.MAX_VERTEX_ARRAY_LENGTH&&j("Max vertices per segment is ".concat(lr.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e)),(!i||i.vertexLength+e>lr.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==s)&&(i={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==s&&(i.sortKey=s),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,s){return new lr([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:s,vaos:{},sortKey:0}])}}lr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Zi(lr,"SegmentVector");var ar=8192;class rr{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof zo?new zo(e.lng,e.lat):zo.convert(e),this}setSouthWest(e){return this._sw=e instanceof zo?new zo(e.lng,e.lat):zo.convert(e),this}extend(e){const t=this._sw,n=this._ne;let s,i;if(e instanceof zo)s=e,i=e;else{if(!(e instanceof rr))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(rr.convert(e)):this.extend(zo.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(zo.convert(e)):this;if(s=e._sw,i=e._ne,!s||!i)return this}return t||n?(t.lng=Math.min(s.lng,t.lng),t.lat=Math.min(s.lat,t.lat),n.lng=Math.max(i.lng,n.lng),n.lat=Math.max(i.lat,n.lat)):(this._sw=new zo(s.lng,s.lat),this._ne=new zo(i.lng,i.lat)),this}getCenter(){return new zo((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 zo(this.getWest(),this.getNorth())}getSouthEast(){return new zo(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(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:n}=zo.convert(e);let s=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&s}static convert(e){return!e||e instanceof rr?e:new rr(e)}}var or=1e-6,ur="undefined"!=typeof Float32Array?Float32Array:Array;function cr(){var e=new ur(9);return ur!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function hr(e,t,n){var s=t[0],i=t[1],l=t[2],a=t[3],r=t[4],o=t[5],u=t[6],c=t[7],h=t[8],p=n[0],d=n[1],f=n[2],m=n[3],I=n[4],y=n[5],v=n[6],E=n[7],w=n[8];return e[0]=p*s+d*a+f*u,e[1]=p*i+d*r+f*c,e[2]=p*l+d*o+f*h,e[3]=m*s+I*a+y*u,e[4]=m*i+I*r+y*c,e[5]=m*l+I*o+y*h,e[6]=v*s+E*a+w*u,e[7]=v*i+E*r+w*c,e[8]=v*l+E*o+w*h,e}function pr(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function dr(e,t){var n=t[0],s=t[1],i=t[2],l=t[3],a=t[4],r=t[5],o=t[6],u=t[7],c=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],I=t[14],y=t[15],v=n*r-s*a,E=n*o-i*a,w=n*u-l*a,g=s*o-i*r,T=s*u-l*r,b=i*u-l*o,R=c*m-h*f,S=c*I-p*f,D=c*y-d*f,A=h*I-p*m,C=h*y-d*m,x=p*y-d*I,_=v*x-E*C+w*A+g*D-T*S+b*R;return _?(e[0]=(r*x-o*C+u*A)*(_=1/_),e[1]=(i*C-s*x-l*A)*_,e[2]=(m*b-I*T+y*g)*_,e[3]=(p*T-h*b-d*g)*_,e[4]=(o*D-a*x-u*S)*_,e[5]=(n*x-i*D+l*S)*_,e[6]=(I*w-f*b-y*E)*_,e[7]=(c*b-p*w+d*E)*_,e[8]=(a*C-r*D+u*R)*_,e[9]=(s*D-n*C-l*R)*_,e[10]=(f*T-m*w+y*v)*_,e[11]=(h*w-c*T-d*v)*_,e[12]=(r*S-a*A-o*R)*_,e[13]=(n*A-s*S+i*R)*_,e[14]=(m*E-f*g-I*v)*_,e[15]=(c*g-h*E+p*v)*_,e):null}function fr(e,t,n){var s=t[0],i=t[1],l=t[2],a=t[3],r=t[4],o=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],m=t[12],I=t[13],y=t[14],v=t[15],E=n[0],w=n[1],g=n[2],T=n[3];return e[0]=E*s+w*r+g*h+T*m,e[1]=E*i+w*o+g*p+T*I,e[2]=E*l+w*u+g*d+T*y,e[3]=E*a+w*c+g*f+T*v,e[4]=(E=n[4])*s+(w=n[5])*r+(g=n[6])*h+(T=n[7])*m,e[5]=E*i+w*o+g*p+T*I,e[6]=E*l+w*u+g*d+T*y,e[7]=E*a+w*c+g*f+T*v,e[8]=(E=n[8])*s+(w=n[9])*r+(g=n[10])*h+(T=n[11])*m,e[9]=E*i+w*o+g*p+T*I,e[10]=E*l+w*u+g*d+T*y,e[11]=E*a+w*c+g*f+T*v,e[12]=(E=n[12])*s+(w=n[13])*r+(g=n[14])*h+(T=n[15])*m,e[13]=E*i+w*o+g*p+T*I,e[14]=E*l+w*u+g*d+T*y,e[15]=E*a+w*c+g*f+T*v,e}function mr(e,t,n){var s,i,l,a,r,o,u,c,h,p,d,f,m=n[0],I=n[1],y=n[2];return t===e?(e[12]=t[0]*m+t[4]*I+t[8]*y+t[12],e[13]=t[1]*m+t[5]*I+t[9]*y+t[13],e[14]=t[2]*m+t[6]*I+t[10]*y+t[14],e[15]=t[3]*m+t[7]*I+t[11]*y+t[15]):(i=t[1],l=t[2],a=t[3],r=t[4],o=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],e[0]=s=t[0],e[1]=i,e[2]=l,e[3]=a,e[4]=r,e[5]=o,e[6]=u,e[7]=c,e[8]=h,e[9]=p,e[10]=d,e[11]=f,e[12]=s*m+r*I+h*y+t[12],e[13]=i*m+o*I+p*y+t[13],e[14]=l*m+u*I+d*y+t[14],e[15]=a*m+c*I+f*y+t[15]),e}function Ir(e,t,n){var s=n[0],i=n[1],l=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*l,e[9]=t[9]*l,e[10]=t[10]*l,e[11]=t[11]*l,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function yr(e,t,n){var s=Math.sin(n),i=Math.cos(n),l=t[4],a=t[5],r=t[6],o=t[7],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=l*i+u*s,e[5]=a*i+c*s,e[6]=r*i+h*s,e[7]=o*i+p*s,e[8]=u*i-l*s,e[9]=c*i-a*s,e[10]=h*i-r*s,e[11]=p*i-o*s,e}function vr(e,t,n){var s=Math.sin(n),i=Math.cos(n),l=t[0],a=t[1],r=t[2],o=t[3],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=l*i-u*s,e[1]=a*i-c*s,e[2]=r*i-h*s,e[3]=o*i-p*s,e[8]=l*s+u*i,e[9]=a*s+c*i,e[10]=r*s+h*i,e[11]=o*s+p*i,e}function Er(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function wr(e,t,n){var s,i,l,a=n[0],r=n[1],o=n[2],u=Math.hypot(a,r,o);return u0&&(l=1/Math.sqrt(l)),e[0]=t[0]*l,e[1]=t[1]*l,e[2]=t[2]*l,e}function Pr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Mr(e,t,n){var s=t[0],i=t[1],l=t[2],a=n[0],r=n[1],o=n[2];return e[0]=i*o-l*r,e[1]=l*a-s*o,e[2]=s*r-i*a,e}function Fr(e,t,n){var s=t[0],i=t[1],l=t[2],a=n[3]*s+n[7]*i+n[11]*l+n[15];return e[0]=(n[0]*s+n[4]*i+n[8]*l+n[12])/(a=a||1),e[1]=(n[1]*s+n[5]*i+n[9]*l+n[13])/a,e[2]=(n[2]*s+n[6]*i+n[10]*l+n[14])/a,e}function Br(e,t,n){var s=n[0],i=n[1],l=n[2],a=t[0],r=t[1],o=t[2],u=i*o-l*r,c=l*a-s*o,h=s*r-i*a,p=i*h-l*c,d=l*u-s*h,f=s*c-i*u,m=2*n[3];return c*=m,h*=m,d*=2,f*=2,e[0]=a+(u*=m)+(p*=2),e[1]=r+c+d,e[2]=o+h+f,e}var Hr,Ur=Ar,Gr=Cr,kr=Rr;function zr(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Vr(e,t){var n=t[0],s=t[1],i=t[2],l=t[3],a=n*n+s*s+i*i+l*l;return a>0&&(a=1/Math.sqrt(a)),e[0]=n*a,e[1]=s*a,e[2]=i*a,e[3]=l*a,e}function jr(e,t,n){var s=t[0],i=t[1],l=t[2],a=t[3];return e[0]=n[0]*s+n[4]*i+n[8]*l+n[12]*a,e[1]=n[1]*s+n[5]*i+n[9]*l+n[13]*a,e[2]=n[2]*s+n[6]*i+n[10]*l+n[14]*a,e[3]=n[3]*s+n[7]*i+n[11]*l+n[15]*a,e}function Wr(){var e=new ur(4);return ur!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Yr(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function qr(e,t,n){n*=.5;var s=t[0],i=t[1],l=t[2],a=t[3],r=Math.sin(n),o=Math.cos(n);return e[0]=s*o+a*r,e[1]=i*o+l*r,e[2]=l*o-i*r,e[3]=a*o-s*r,e}function Xr(e,t,n){n*=.5;var s=t[0],i=t[1],l=t[2],a=t[3],r=Math.sin(n),o=Math.cos(n);return e[0]=s*o-l*r,e[1]=i*o+a*r,e[2]=l*o+s*r,e[3]=a*o-i*r,e}Tr(),Hr=new ur(4),ur!=Float32Array&&(Hr[0]=0,Hr[1]=0,Hr[2]=0,Hr[3]=0);var Zr=Vr;Tr(),Sr(1,0,0),Sr(0,1,0),Wr(),Wr(),cr();const Kr=Hl([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Qr}=Kr,Jr=Hl([{name:"a_pos_3",components:3,type:"Int16"}]);var $r=Hl([{name:"a_pos",type:"Int16",components:2}]);class eo{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,n){const s=Pr(t,this.dir);if(Math.abs(s)<1e-6)return!1;const i=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/s;return n[0]=this.pos[0]+this.dir[0]*i,n[1]=this.pos[1]+this.dir[1]*i,n[2]=this.pos[2]+this.dir[2]*i,!0}closestPointOnSphere(e,t,n){if(function(e,t){var n=e[0],s=e[1],i=e[2],l=t[0],a=t[1],r=t[2];return Math.abs(n-l)<=or*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-a)<=or*Math.max(1,Math.abs(s),Math.abs(a))&&Math.abs(i-r)<=or*Math.max(1,Math.abs(i),Math.abs(r))}(this.pos,e)||0===t)return n[0]=n[1]=n[2]=0,!1;const[s,i,l]=this.dir,a=this.pos[0]-e[0],r=this.pos[1]-e[1],o=this.pos[2]-e[2],u=s*s+i*i+l*l,c=2*(a*s+r*i+o*l),h=c*c-4*u*(a*a+r*r+o*o-t*t);if(h<0){const e=Math.max(-c/2,0),u=a+s*e,h=r+i*e,p=o+l*e,d=Math.hypot(u,h,p);return n[0]=u*t/d,n[1]=h*t/d,n[2]=p*t/d,!1}{const e=(-c-Math.sqrt(h))/(2*u);if(e<0){const e=Math.hypot(a,r,o);return n[0]=a*t/e,n[1]=r*t/e,n[2]=o*t/e,!1}return n[0]=a+s*e,n[1]=r+i*e,n[2]=o+l*e,!0}}}class to{constructor(e,t,n,s,i){this.TL=e,this.TR=t,this.BR=n,this.BL=s,this.horizon=i}static fromInvProjectionMatrix(e,t,n){const s=[-1,1,1],i=[1,1,1],l=[1,-1,1],a=[-1,-1,1],r=Fr(s,s,e),o=Fr(i,i,e),u=Fr(l,l,e),c=Fr(a,a,e);return new to(r,o,u,c,t/n)}}class no{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(e,t,n,s){const i=Math.pow(2,n),l=[[-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=>{const l=jr([],n,e),a=1/l[3]/t*i;return function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}(l,l,[a,a,s?1/l[3]:a,a])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=Lr([],Mr([],Ur([],l[e[0]],l[e[1]]),Ur([],l[e[2]],l[e[1]]))),n=-Pr(t,l[e[1]]);return t.concat(n)}));return new no(l,a)}}class so{static fromPoints(e){const t=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const s of e)xr(t,t,s),_r(n,n,s);return new so(t,n)}static applyTransform(e,t){const n=e.getCorners();for(let s=0;s=0;if(0===l)return 0;l!==t.length&&(n=!1)}if(n)return 2;for(let s=0;s<3;s++){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let i=0;ithis.max[s]-this.min[s])return 0}return 1}}const io=5,lo=6,ao=ar/Math.PI/2,ro=16383,oo=64,uo=[oo,32,16],co=-ao,ho=ao,po=[new so([co,co,co],[ho,ho,ho]),new so([co,co,co],[0,0,ho]),new so([0,co,co],[ho,0,ho]),new so([co,0,co],[0,ho,ho]),new so([0,0,co],[ho,ho,ho])];function fo(e){return e*ao/Uo}function mo(e,t,n){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const i=Or([],e._camera.position,e.worldSize),l=[t,n,1,1];jr(l,l,e.pixelMatrixInverse),zr(l,l,1/l[3]);const a=Lr([],Ur([],l,i)),r=e.globeMatrix,o=[r[12],r[13],r[14]],u=Ur([],o,i),c=Rr(u),h=Lr([],u),p=e.worldSize/(2*Math.PI),d=Pr(h,a),f=Math.asin(p/c);if(f1?null:function(e,t,n,s){const i=Math.sin(n);return e*(Math.sin((1-s)*n)/i)+t*(Math.sin(s*n)/i)}(e.a[t],e.b[t],e.angle,A(n,0,1))+e.center[t]}function vo(e){if(e.z<=1)return po[e.z+2*e.y+e.x];const t=Ro(bo(e));return so.fromPoints(t)}function Eo(e,t,n){return Or(e,e,1-n),Nr(e,e,t,n)}function wo(e,t){const n=Lo(t.zoom);if(0===n)return vo(e);const s=bo(e),i=Ro(s),l=jo(s.getWest())*t.worldSize,a=jo(s.getEast())*t.worldSize,r=Wo(s.getNorth())*t.worldSize,o=Wo(s.getSouth())*t.worldSize,u=[l,r,0],c=[a,r,0],h=[l,o,0],p=[a,o,0],d=dr([],t.globeMatrix);return Fr(u,u,d),Fr(c,c,d),Fr(h,h,d),Fr(p,p,d),i[0]=Eo(i[0],h,n),i[1]=Eo(i[1],p,n),i[2]=Eo(i[2],c,n),i[3]=Eo(i[3],u,n),so.fromPoints(i)}function go(e,t,n){for(const s of e)Fr(s,s,t),Or(s,s,n)}function To(e,t,n){const s=t/e.worldSize,i=e.globeMatrix;if(n.z<=1){const e=vo(n).getCorners();return go(e,i,s),so.fromPoints(e)}const l=bo(n),a=Ro(l);go(a,i,s);const r=Number.MAX_VALUE,o=[-r,-r,-r],u=[r,r,r];if(l.contains(e.center)){for(const e of a)xr(u,u,e),_r(o,o,e);o[2]=0;const t=e.point,n=[t.x*s,t.y*s,0];return xr(u,u,n),_r(o,o,n),new so(u,o)}const c=[i[12]*s,i[13]*s,i[14]*s],h=l.getCenter(),p=A(e.center.lat,-Ko,Ko),d=A(h.lat,-Ko,Ko),f=jo(e.center.lng),m=Wo(p);let I=f-jo(h.lng);const y=m-Wo(d);I>.5?I-=1:I<-.5&&(I+=1);let v=0;Math.abs(I)>Math.abs(y)?v=I>=0?1:3:(v=y>=0?0:2,Nr(c,c,[i[4]*s,i[5]*s,i[6]*s],-Math.sin(g(y>=0?l.getSouth():l.getNorth()))*ao));const E=a[v],w=a[(v+1)%4],T=new Io(E,w,c),b=[yo(T,0)||E[0],yo(T,1)||E[1],yo(T,2)||E[2]],R=Lo(e.zoom);if(R>0){const s=function(e,t,n,s,i){let{x:l,y:a,z:r}=e;const o=1/(1<.5?d=-1:f<-.5&&(d=1),u=((u+d)*t-(s*=t))*n+s,c=((c+d)*t-s)*n+s,h=(h*t-(i*=t))*n+i,p=(p*t-i)*n+i,[[u,p,0],[c,p,0],[c,h,0],[u,h,0]]}(n,t,e._pixelsPerMercatorPixel,f,m);for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:ao;return n=g(n),[e*Math.sin(n)*s,-t*s,e*Math.cos(n)*s]}function Do(e,t,n){return So(Math.cos(g(e)),Math.sin(g(e)),t,n)}function Ao(e,t,n,s){const i=1<Math.PI/2*1.01}const Fo=g(85),Bo=Math.cos(Fo),Ho=Math.sin(Fo),Uo=6371008.8,Go=2*Math.PI*Uo;class ko{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(t,")"));if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ko(x(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){const t=Math.PI/180,n=this.lat*t,s=e.lat*t,i=Math.sin(n)*Math.sin(s)+Math.cos(n)*Math.cos(s)*Math.cos((e.lng-this.lng)*t);return Uo*Math.acos(Math.min(i,1))}toBounds(){const e=360*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)/40075017,t=e/Math.cos(Math.PI/180*this.lat);return new rr(new ko(this.lng-t,this.lat-e),new ko(this.lng+t,this.lat+e))}toEcef(e){const t=fo(e);return Do(this.lat,this.lng,ao+t)}static convert(e){if(e instanceof ko)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new ko(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new ko(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}var zo=ko;function Vo(e){return Go*Math.cos(e*Math.PI/180)}function jo(e){return(180+e)/360}function Wo(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Yo(e,t){return e/Vo(t)}function qo(e){return 360*e-180}function Xo(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Zo(e,t){return e*Vo(Xo(t))}const Ko=85.051129;function Qo(e){return 1/Math.cos(e*Math.PI/180)}class Jo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=zo.convert(e);return new Jo(jo(n.lng),Wo(n.lat),Yo(t,n.lat))}toLngLat(){return new zo(qo(this.x),Xo(this.y))}toAltitude(){return Zo(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Go*Qo(Xo(this.y))}}function $o(e,t,n,s,i,l,a,r,o){const u=(t+s)/2,c=(n+i)/2,h=new v(u,c);r(h),function(e,t,n,s,i,l){const a=n-i,r=s-l;return Math.abs((s-t)*a-(n-e)*r)/Math.hypot(a,r)}(h.x,h.y,l.x,l.y,a.x,a.y)>=o?($o(e,t,n,u,c,l,h,r,o),$o(e,u,c,s,i,h,a,r,o)):e.push(a)}function eu(e,t,n){let s=e[0],i=s.x,l=s.y;t(s);const a=[s];for(let r=1;re.x+1||se.y+1)&&j("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function au(e,t,n){const s=e.loadGeometry(),i=e.extent,l=ar/i;if(t&&n&&n.projection.isReprojectedInTileSpace){const l=1<{const n=qo((t.x+e.x/i)/l),s=Xo((t.y+e.y/i)/l),c=u.project(n,s);e.x=(c.x*a-r)*i,e.y=(c.y*a-o)*i};for(let t=0;t=i||n.y<0||n.y>=i||(c(n),e.push(n));s[t]=e}}for(const a of s)for(const e of a)lu(e,l);return s}function ru(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?au(e):[]}}function ou(e,t,n,s,i){e.emplaceBack(2*t+(s+1)/2,2*n+(i+1)/2)}function uu(e,t,n){const s=16384;e.emplaceBack(t.x,t.y,t.z,n[0]*s,n[1]*s,n[2]*s)}class cu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Gl,this.indexArray=new na,this.segments=new lr,this.programConfigurations=new Za(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n,s){const i=this.layers[0],l=[];let a=null;"circle"===i.type&&(a=i.layout.get("circle-sort-key"));for(const{feature:o,id:u,index:c,sourceLayerIndex:h}of e){const e=this.layers[0]._featureFilter.needGeometry,t=ru(o,e);if(!this.layers[0]._featureFilter.filter(new gl(this.zoom),t,n))continue;const i=a?a.evaluate(t,{},n):void 0,r={id:u,properties:o.properties,type:o.type,sourceLayerIndex:h,index:c,geometry:e?t.geometry:au(o,n,s),patterns:{},sortKey:i};l.push(r)}a&&l.sort(((e,t)=>e.sortKey-t.sortKey));let r=null;"globe"===s.projection.name&&(this.globeExtVertexArray=new ql,r=s.projection);for(const o of l){const{geometry:s,index:i,sourceLayerIndex:l}=o,a=e[i].feature;this.addFeature(o,s,i,t.availableImages,n,r),t.featureIndex.insert(a,s,i,l,this.index)}}update(e,t,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,sr.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ir.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,t,n,s,i,l){for(const a of t)for(const t of a){const n=t.x,s=t.y;if(n<0||n>=ar||s<0||s>=ar)continue;if(l){const e=l.projectTilePoint(n,s,i),t=l.upVector(i,n,s),a=this.globeExtVertexArray;uu(a,e,t),uu(a,e,t),uu(a,e,t),uu(a,e,t)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),r=a.vertexLength;ou(this.layoutVertexArray,n,s,-1,-1),ou(this.layoutVertexArray,n,s,1,-1),ou(this.layoutVertexArray,n,s,1,1),ou(this.layoutVertexArray,n,s,-1,1),this.indexArray.emplaceBack(r,r+1,r+2),this.indexArray.emplaceBack(r,r+2,r+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},s,i)}}function hu(e,t){for(let n=0;n1){if(mu(e,t))return!0;for(let s=0;s1?n:n.sub(t)._mult(i)._add(t))}function Eu(e,t){let n,s,i,l=!1;for(let a=0;at.y!=i.y>t.y&&t.x<(i.x-s.x)*(t.y-s.y)/(i.y-s.y)+s.x&&(l=!l)}return l}function wu(e,t){let n=!1;for(let s=0,i=e.length-1;st.y!=a.y>t.y&&t.x<(a.x-l.x)*(t.y-l.y)/(a.y-l.y)+l.x&&(n=!n)}return n}function gu(e,t,n,s,i){for(const a of e)if(t<=a.x&&n<=a.y&&s>=a.x&&i>=a.y)return!0;const l=[new v(t,n),new v(t,i),new v(s,i),new v(s,n)];if(e.length>2)for(const a of l)if(wu(e,a))return!0;for(let a=0;ai.x&&t.x>i.x||e.yi.y&&t.y>i.y)return!1;const l=W(e,t,n[0]);return l!==W(e,t,n[1])||l!==W(e,t,n[2])||l!==W(e,t,n[3])}function bu(e,t,n){const s=t.paint.get(e).value;return"constant"===s.kind?s.value:n.programConfigurations.get(t.id).getMaxValue(e)}function Ru(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Su(e,t,n,s,i){if(!t[0]&&!t[1])return e;const l=v.convert(t)._mult(i);"viewport"===n&&l._rotate(-s);const a=[];for(let r=0;r0){const e=n.projection.upVector(u,h.x,h.y);d.x+=e[0]*c*p,d.y+=e[1]*c*p,d.z+=e[2]*c*p}const f=l?h:_u(d.x,d.y,d.z,s),m=l?e.tilespaceRays.map((e=>Lu(e,p))):e.queryGeometry.screenGeometry,I=jr([],[d.x,d.y,d.z,1],s);if(!a&&l?o*=I[3]/n.cameraToCenterDistance:a&&!l&&(o*=n.cameraToCenterDistance/I[3]),l){const e=Xo((t.y/ar+u.y)/(1<e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||s.x>t.width-i.width||s.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=e.data,r=t.data;for(let o=0;o{t[e.evaluationKey]=l;const a=e.expression.evaluate(t);i.data[n+s+0]=Math.floor(255*a.r/a.a),i.data[n+s+1]=Math.floor(255*a.g/a.a),i.data[n+s+2]=Math.floor(255*a.b/a.a),i.data[n+s+3]=Math.floor(255*a.a)};if(e.clips)for(let a=0,r=0;a80*n){s=l=e[0],i=a=e[1];for(var f=n;fl&&(l=r),o>a&&(a=o);u=0!==(u=Math.max(l-s,a-i))?32767/u:0}return Zu(p,d,n,s,i,u,0),d}function qu(e,t,n,s,i){var l,a;if(i===yc(e,t,n,s)>0)for(l=t;l=t;l-=s)a=fc(l,e[l],e[l+1],a);return a&&oc(a,a.next)&&(mc(a),a=a.next),a}function Xu(e,t){if(!e)return e;t||(t=e);var n,s=e;do{if(n=!1,s.steiner||!oc(s,s.next)&&0!==rc(s.prev,s,s.next))s=s.next;else{if(mc(s),(s=t=s.prev)===s.next)break;n=!0}}while(n||s!==t);return t}function Zu(e,t,n,s,i,l,a){if(e){!a&&l&&function(e,t,n,s){var i=e;do{0===i.z&&(i.z=sc(i.x,i.y,t,n,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,s,i,l,a,r,o,u=1;do{for(n=e,e=null,l=null,a=0;n;){for(a++,s=n,r=0,t=0;t0||o>0&&s;)0!==r&&(0===o||!s||n.z<=s.z)?(i=n,n=n.nextZ,r--):(i=s,s=s.nextZ,o--),l?l.nextZ=i:e=i,i.prevZ=l,l=i;n=s}l.nextZ=null,u*=2}while(a>1)}(i)}(e,s,i,l);for(var r,o,u=e;e.prev!==e.next;)if(r=e.prev,o=e.next,l?Qu(e,s,i,l):Ku(e))t.push(r.i/n|0),t.push(e.i/n|0),t.push(o.i/n|0),mc(e),e=o.next,u=o.next;else if((e=o)===u){a?1===a?Zu(e=Ju(Xu(e),t,n),t,n,s,i,l,2):2===a&&$u(e,t,n,s,i,l):Zu(Xu(e),t,n,s,i,l,1);break}}}function Ku(e){var t=e.prev,n=e,s=e.next;if(rc(t,n,s)>=0)return!1;for(var i=t.x,l=n.x,a=s.x,r=t.y,o=n.y,u=s.y,c=il?i>a?i:a:l>a?l:a,d=r>o?r>u?r:u:o>u?o:u,f=s.next;f!==t;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&lc(i,r,l,o,a,u,f.x,f.y)&&rc(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Qu(e,t,n,s){var i=e.prev,l=e,a=e.next;if(rc(i,l,a)>=0)return!1;for(var r=i.x,o=l.x,u=a.x,c=i.y,h=l.y,p=a.y,d=ro?r>u?r:u:o>u?o:u,I=c>h?c>p?c:p:h>p?h:p,y=sc(d,f,t,n,s),v=sc(m,I,t,n,s),E=e.prevZ,w=e.nextZ;E&&E.z>=y&&w&&w.z<=v;){if(E.x>=d&&E.x<=m&&E.y>=f&&E.y<=I&&E!==i&&E!==a&&lc(r,c,o,h,u,p,E.x,E.y)&&rc(E.prev,E,E.next)>=0)return!1;if(E=E.prevZ,w.x>=d&&w.x<=m&&w.y>=f&&w.y<=I&&w!==i&&w!==a&&lc(r,c,o,h,u,p,w.x,w.y)&&rc(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;E&&E.z>=y;){if(E.x>=d&&E.x<=m&&E.y>=f&&E.y<=I&&E!==i&&E!==a&&lc(r,c,o,h,u,p,E.x,E.y)&&rc(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;w&&w.z<=v;){if(w.x>=d&&w.x<=m&&w.y>=f&&w.y<=I&&w!==i&&w!==a&&lc(r,c,o,h,u,p,w.x,w.y)&&rc(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Ju(e,t,n){var s=e;do{var i=s.prev,l=s.next.next;!oc(i,l)&&uc(i,s,s.next,l)&&pc(i,l)&&pc(l,i)&&(t.push(i.i/n|0),t.push(s.i/n|0),t.push(l.i/n|0),mc(s),mc(s.next),s=e=l),s=s.next}while(s!==e);return Xu(s)}function $u(e,t,n,s,i,l){var a=e;do{for(var r=a.next.next;r!==a.prev;){if(a.i!==r.i&&ac(a,r)){var o=dc(a,r);return a=Xu(a,a.next),o=Xu(o,o.next),Zu(a,t,n,s,i,l,0),void Zu(o,t,n,s,i,l,0)}r=r.next}a=a.next}while(a!==e)}function ec(e,t){return e.x-t.x}function tc(e,t){var n=function(e,t){var n,s=t,i=e.x,l=e.y,a=-1/0;do{if(l<=s.y&&l>=s.next.y&&s.next.y!==s.y){var r=s.x+(l-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(r<=i&&r>a&&(a=r,n=s.x=s.x&&s.x>=c&&i!==s.x&&lc(ln.x||s.x===n.x&&nc(n,s)))&&(n=s,p=o)),s=s.next}while(s!==u);return n}(e,t);if(!n)return t;var s=dc(n,e);return Xu(s,s.next),Xu(n,n.next)}function nc(e,t){return rc(e.prev,e,t.prev)<0&&rc(t.next,e,e.next)<0}function sc(e,t,n,s,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ic(e){var t=e,n=e;do{(t.x=(e-a)*(l-r)&&(e-a)*(s-r)>=(n-a)*(t-r)&&(n-a)*(l-r)>=(i-a)*(s-r)}function ac(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&uc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(pc(e,t)&&pc(t,e)&&function(e,t){var n=e,s=!1,i=(e.x+t.x)/2,l=(e.y+t.y)/2;do{n.y>l!=n.next.y>l&&n.next.y!==n.y&&i<(n.next.x-n.x)*(l-n.y)/(n.next.y-n.y)+n.x&&(s=!s),n=n.next}while(n!==e);return s}(e,t)&&(rc(e.prev,e,t.prev)||rc(e,t.prev,t))||oc(e,t)&&rc(e.prev,e,e.next)>0&&rc(t.prev,t,t.next)>0)}function rc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function oc(e,t){return e.x===t.x&&e.y===t.y}function uc(e,t,n,s){var i=hc(rc(e,t,n)),l=hc(rc(e,t,s)),a=hc(rc(n,s,e)),r=hc(rc(n,s,t));return i!==l&&a!==r||!(0!==i||!cc(e,n,t))||!(0!==l||!cc(e,s,t))||!(0!==a||!cc(n,e,s))||!(0!==r||!cc(n,t,s))}function cc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function hc(e){return e>0?1:e<0?-1:0}function pc(e,t){return rc(e.prev,e,e.next)<0?rc(e,t,e.next)>=0&&rc(e,e.prev,t)>=0:rc(e,t,e.prev)<0||rc(e,e.next,t)<0}function dc(e,t){var n=new Ic(e.i,e.x,e.y),s=new Ic(t.i,t.x,t.y),i=e.next,l=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,s.next=n,n.prev=s,l.next=s,s.prev=l,s}function fc(e,t,n,s){var i=new Ic(e,t,n);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function mc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ic(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function yc(e,t,n,s){for(var i=0,l=t,a=n-s;l0&&n.holes.push(s+=e[i-1].length)}return n};var vc=p(Wu.exports);function Ec(e,t,n,s,i){wc(e,t,n||0,s||e.length-1,i||Tc)}function wc(e,t,n,s,i){for(;s>n;){if(s-n>600){var l=s-n+1,a=t-n+1,r=Math.log(l),o=.5*Math.exp(2*r/3),u=.5*Math.sqrt(r*o*(l-o)/l)*(a-l/2<0?-1:1);wc(e,t,Math.max(n,Math.floor(t-a*o/l+u)),Math.min(s,Math.floor(t+(l-a)*o/l+u)),i)}var c=e[t],h=n,p=s;for(gc(e,n,t),i(e[s],c)>0&&gc(e,n,s);h0;)p--}0===i(e[n],c)?gc(e,n,p):gc(e,++p,s),p<=t&&(n=p+1),t<=p&&(s=p-1)}}function gc(e,t,n){var s=e[t];e[t]=e[n],e[n]=s}function Tc(e,t){return et?1:0}function bc(e,t){const n=e.length;if(n<=1)return[e];const s=[];let i,l;for(let a=0;a1)for(let a=0;ae.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Gl,this.indexArray=new na,this.indexArray2=new oa,this.programConfigurations=new Za(e.layers,e.zoom),this.segments=new lr,this.segments2=new lr,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection}populate(e,t,n,s){this.hasPattern=Sc("fill",this.layers,t);const i=this.layers[0].layout.get("fill-sort-key"),l=[];for(const{feature:a,id:r,index:o,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=ru(a,e);if(!this.layers[0]._featureFilter.filter(new gl(this.zoom),c,n))continue;const h=i?i.evaluate(c,{},n,t.availableImages):void 0,p={id:r,properties:a.properties,type:a.type,sourceLayerIndex:u,index:o,geometry:e?c.geometry:au(a,n,s),patterns:{},sortKey:h};l.push(p)}i&&l.sort(((e,t)=>e.sortKey-t.sortKey));for(const a of l){const{geometry:s,index:i,sourceLayerIndex:l}=a;if(this.hasPattern){const e=Dc("fill",this.layers,a,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(a,s,i,n,{},t.availableImages);t.featureIndex.insert(e[i].feature,s,i,l,this.index)}}update(e,t,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n,s)}addFeatures(e,t,n,s,i){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,t,n,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ju),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,n,s,i){let l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];for(const a of bc(t,500)){let e=0;for(const r of a)e+=r.length;const t=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=t.vertexLength,s=[],i=[];for(const r of a){if(0===r.length)continue;r!==a[0]&&i.push(s.length/2);const e=this.segments2.prepareSegment(r.length,this.layoutVertexArray,this.indexArray2),t=e.vertexLength;this.layoutVertexArray.emplaceBack(r[0].x,r[0].y),this.indexArray2.emplaceBack(t+r.length-1,t),s.push(r[0].x),s.push(r[0].y);for(let n=1;n>3}if(i--,1===s||2===s)l+=e.readSVarint(),a+=e.readSVarint(),1===s&&(t&&r.push(t),t=[]),t.push(new Mc(l,a));else{if(7!==s)throw new Error("unknown command "+s);t&&t.push(t[0].clone())}}return t&&r.push(t),r},Bc.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,s=0,i=0,l=0,a=1/0,r=-1/0,o=1/0,u=-1/0;e.pos>3}if(s--,1===n||2===n)(i+=e.readSVarint())r&&(r=i),(l+=e.readSVarint())u&&(u=l);else if(7!==n)throw new Error("unknown command "+n)}return[a,o,r,u]},Bc.prototype.toGeoJSON=function(e,t,n){var s,i,l=this.extent*Math.pow(2,n),a=this.extent*e,r=this.extent*t,o=this.loadGeometry(),u=Bc.types[this.type];function c(e){for(var t=0;t>3;t=1===s?e.readString():2===s?e.readFloat():3===s?e.readDouble():4===s?e.readVarint64():5===s?e.readVarint():6===s?e.readSVarint():7===s?e.readBoolean():null}return t}(n))}zc.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new Gc(this._pbf,t,this.extent,this._keys,this._values)};var jc=kc;function Wc(e,t,n){if(3===e){var s=new jc(n,n.readVarint()+n.pos);s.length&&(t[s.name]=s)}}var Yc=Pc.VectorTile=function(e,t){this.layers=e.readFields(Wc,{},t)},qc=Pc.VectorTileFeature=Fc;function Xc(e,t,n,s){const i=[],l=0===s?(e,t,n,s,i,l)=>{e.push(new v(l,n+(l-t)/(s-t)*(i-n)))}:(e,t,n,s,i,l)=>{e.push(new v(t+(l-n)/(i-n)*(s-t),l))};for(const a of e){const e=[];for(const i of a){if(i.length<=2)continue;const a=[];for(let e=0;et&&l(a,r,o,u,c,t):h>n?p=t&&l(a,r,o,u,c,t),p>n&&h<=n&&l(a,r,o,u,c,n)}let r=i[i.length-1];const o=0===s?r.x:r.y;o>=t&&o<=n&&a.push(r),a.length&&(r=a[a.length-1],a[0].x===r.x&&a[0].y===r.y||a.push(a[0]),e.push(a))}e.length&&i.push(e)}return i}Pc.VectorTileLayer=kc;const Zc=qc.types,Kc=Math.pow(2,13);function Qc(e,t,n,s,i,l,a,r){e.emplaceBack((t<<1)+a,(n<<1)+l,(Math.floor(s*Kc)<<1)+i,Math.round(r))}function Jc(e,t,n){const s=16384;e.emplaceBack(t.x,t.y,t.z,n[0]*s,n[1]*s,n[2]*s)}class $c{constructor(){this.acc=new v(0,0),this.polyCount=[]}startRing(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new v(e.x,e.y),this.max=new v(e.x,e.y))}append(e,t){this.currentPolyCount.edges++,this.acc._add(e);const n=this.min,s=this.max;e.xs.x&&(s.x=e.x),e.ys.y&&(s.y=e.y),((0===e.x||e.x===ar)&&e.x===t.x)!=((0===e.y||e.y===ar)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,Nn(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>ar!=e.x>ar&&this.addBorderIntersection(1,Nn(t.y,e.y,(ar-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Nn(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>ar!=e.y>ar&&this.addBorderIntersection(3,Nn(t.x,e.x,(ar-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];tn[1]&&(n[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const n=0===e.x?0:1;this.addBorderIntersection(n,t.y),this.addBorderIntersection(n,e.y)}else{const n=0===e.y?2:3;this.addBorderIntersection(n,t.x),this.addBorderIntersection(n,e.x)}}centroid(){const e=this.polyCount.reduce(((e,t)=>e+t.edges),0);return 0!==e?this.acc.div(e)._round():new v(0,0)}span(){return new v(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0)}}class eh{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.layoutVertexArray=new zl,this.centroidVertexArray=new ga,this.indexArray=new na,this.programConfigurations=new Za(e.layers,e.zoom),this.segments=new lr,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.enableTerrain=e.enableTerrain}populate(e,t,n,s){this.features=[],this.hasPattern=Sc("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(e){const t=Math.exp(Math.PI*(1-e.y/(1<=0;I--){const e=p[I];(0===e.length||(d=e[0]).every((e=>e.x<=0))||d.every((e=>e.x>=ar))||d.every((e=>e.y<=0))||d.every((e=>e.y>=ar)))&&p.splice(I,1)}var d;let f;if(u)f=oh(p,r,s);else{f=[];for(const e of p)f.push({polygon:e,bounds:r})}const m=h?this.edgeRadius:0;for(const{polygon:I,bounds:y}of f){let e=0,t=0;for(const s of I)h&&!s[0].equals(s[s.length-1])&&s.push(s[0]),t+=h?s.length-1:s.length;const n=this.segments.prepareSegment((h?5:4)*t,this.layoutVertexArray,this.indexArray);if(h){const t=[],i=[];e=n.vertexLength;for(const e of I){let l,a;e.length&&e!==I[0]&&i.push(t.length/2),l=e[1].sub(e[0])._perp()._unit();for(let i=1;i4&&lh(i[i.length-2],i[0],i[1]),p=m?nh(i[i.length-2],i[0],i[1],m):0;l=i[1].sub(i[0])._perp()._unit();let d=!0;for(let f=1,I=0;f0?1:0,R=v.dist(E);if(I+R>32768&&(I=0),m){a=w.sub(E)._perp()._unit();let e=sh(v,E,w,th(l,a),m);isNaN(e)&&(e=0);const t=E.sub(v)._unit();v=v.add(t.mult(p))._round(),E=E.add(t.mult(-e))._round(),p=e,l=a}const S=n.vertexLength,D=i.length>4&&lh(v,E,w);let A=ah(I,r,d);if(Qc(this.layoutVertexArray,v.x,v.y,T,b,0,0,A),Qc(this.layoutVertexArray,v.x,v.y,T,b,0,1,A),I+=R,A=ah(I,D,!d),r=D,Qc(this.layoutVertexArray,E.x,E.y,T,b,0,0,A),Qc(this.layoutVertexArray,E.x,E.y,T,b,0,1,A),n.vertexLength+=4,this.indexArray.emplaceBack(S+0,S+1,S+2),this.indexArray.emplaceBack(S+1,S+3,S+2),n.primitiveLength+=2,m){const s=e+(1===f?i.length-2:f-2),l=1===f?e:s+1;if(this.indexArray.emplaceBack(S+1,s,S+3),this.indexArray.emplaceBack(s,l,S+3),n.primitiveLength+=2,void 0===t&&(t=S),!ih(w,i[f],y)){const e=f===i.length-1?t:n.vertexLength;this.indexArray.emplaceBack(S+2,S+3,e),this.indexArray.emplaceBack(S+3,e+1,e),this.indexArray.emplaceBack(S+3,l,e+1),n.primitiveLength+=3}d=!d}if(u){const e=this.layoutVertexExtArray,t=o.projectTilePoint(v.x,v.y,s),n=o.projectTilePoint(E.x,E.y,s),i=o.upVector(s,v.x,v.y),l=o.upVector(s,E.x,E.y);Jc(e,t,i),Jc(e,t,i),Jc(e,n,l),Jc(e,n,l)}}h&&(e+=i.length-1)}}if(c&&c.polyCount.length>0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;const e=c.borders,t=this.featuresOnBorder.push(c)-1;for(let n=0;n<4;n++)e[n][0]!==Number.MAX_VALUE&&this.borders[n].push(t)}this.encodeCentroid(c.borders?void 0:c.centroid(),c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,l,s)}sortBorders(){for(let e=0;e<4;e++)this.borders[e].sort(((t,n)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[n].borders[e][0]))}encodeCentroid(e,t){let n,s,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e)if(0!==e.y){const i=t.span()._mult(this.tileToMeter);n=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(i.x/10)),s=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(i.y/10))}else n=Math.ceil(7*(e.x+450)),s=0;else n=0,s=+i;let l=i?this.centroidVertexArray.length:t.vertexArrayOffset;for(const a of t.polyCount){i&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*a.edges+a.top);for(let e=0;en[1].x&&t.x>n[1].x||e.yn[1].y&&t.y>n[1].y}function lh(e,t,n){if(e.x<0||e.x>=ar||t.x<0||t.x>=ar||n.x<0||n.x>=ar)return!1;const s=n.sub(t),i=s.perp(),l=e.sub(t);return(s.x*l.x+s.y*l.y)/Math.sqrt((s.x*s.x+s.y*s.y)*(l.x*l.x+l.y*l.y))>-.866&&i.x*l.x+i.y*l.y<0}function ah(e,t,n){const s=t?2|e:-3&e;return n?1|s:-2&s}function rh(){const e=Math.PI/32,t=Math.tan(e),n=Uo;return n*Math.sqrt(1+2*t*t)-n}function oh(e,t,n){const s=1<4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5?arguments[5]:void 0;const a=[];if(!e.length||!n||!s)return a;const r=(e,t)=>{for(const n of e)a.push({polygon:n,bounds:t})},o=Math.ceil(Math.log2(n)),u=Math.ceil(Math.log2(s)),c=o-u,h=[];for(let f=0;f0?0:1);for(let f=0;ft+1?d.push({polygons:p,bounds:e,depth:t+1}):r(p,e)}if(f.length){const e=[new v(0===n?c:s.x,1===n?c:s.y),a];h.length>t+1?d.push({polygons:f,bounds:e,depth:t+1}):r(f,e)}}return a}(e,t,Math.ceil((l-i)/11.25),Math.ceil((a-r)/11.25),1,((e,t,i)=>{if(0===e)return.5*(t+i);{const e=Xo((n.y+t/ar)/s);return(Wo(.5*(Xo((n.y+i/ar)/s)+e))*s-n.y)*ar}}))}Zi(eh,"FillExtrusionBucket",{omit:["layers","features"]}),Zi($c,"PartMetadata");const uh=new Ll({"fill-extrusion-edge-radius":new _l(et["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var ch={paint:new Ll({"fill-extrusion-opacity":new _l(et["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ol(et["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new _l(et["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new _l(et["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ol(et["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ol(et["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ol(et["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new _l(et["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new _l(et["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new _l(et["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-rounded-roof":new _l(et["paint_fill-extrusion"]["fill-extrusion-rounded-roof"])}),layout:uh};function hh(e,t,n){var s=2*Math.PI*6378137/256/Math.pow(2,n);return[e*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class ph{constructor(e,t,n){this.z=e,this.x=t,this.y=n,this.key=mh(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t){const n=function(e,t,n){var s=hh(256*e,256*(t=Math.pow(2,n)-t-1),n),i=hh(256*(e+1),256*(t+1),n);return s[0]+","+s[1]+","+i[0]+","+i[1]}(this.x,this.y,this.z),s=function(e,t,n){let s,i="";for(let l=e;l>0;l--)s=1<this.canonical.z?new fh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new fh(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return mh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return mh(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new fh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,n=2*this.canonical.x,s=2*this.canonical.y;return[new fh(t,this.wrap,t,n,s),new fh(t,this.wrap,t,n+1,s),new fh(t,this.wrap,t,n,s+1),new fh(t,this.wrap,t,n+1,s+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ye.id)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Vl,this.layoutVertexArray2=new jl,this.indexArray=new na,this.programConfigurations=new Za(e.layers,e.zoom),this.segments=new lr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n,s){this.hasPattern=Sc("line",this.layers,t);const i=this.layers[0].layout.get("line-sort-key"),l=[];for(const{feature:u,id:c,index:h,sourceLayerIndex:p}of e){const e=this.layers[0]._featureFilter.needGeometry,t=ru(u,e);if(!this.layers[0]._featureFilter.filter(new gl(this.zoom),t,n))continue;const a=i?i.evaluate(t,{},n):void 0,r={id:c,properties:u.properties,type:u.type,sourceLayerIndex:p,index:h,geometry:e?t.geometry:au(u,n,s),patterns:{},sortKey:a};l.push(r)}i&&l.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:a,featureIndex:r}=t,o=this.addConstantDashes(a);for(const u of l){const{geometry:s,index:i,sourceLayerIndex:l}=u;if(o&&this.addFeatureDashes(u,a),this.hasPattern){const e=Dc("line",this.layers,u,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(u,s,i,n,a.positions,t.availableImages);r.insert(e[i].feature,s,i,l,this.index)}}addConstantDashes(e){let t=!1;for(const n of this.layers){const s=n.paint.get("line-dasharray").value,i=n.layout.get("line-cap").value;if("constant"!==s.kind||"constant"!==i.kind)t=!0;else{const t=i.value,n=s.value;if(!n)continue;e.addDash(n,t)}}return t}addFeatureDashes(e,t){const n=this.zoom;for(const s of this.layers){const i=s.paint.get("line-dasharray").value,l=s.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===l.kind)continue;let a,r;if("constant"===i.kind){if(a=i.value,!a)continue}else a=i.evaluate({zoom:n},e);r="constant"===l.kind?l.value:l.evaluate({zoom:n},e),t.addDash(a,r),e.patterns[s.id]=t.getKey(a,r)}}update(e,t,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n,s)}addFeatures(e,t,n,s,i){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,t,n,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,bh)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,gh),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,n,s,i,l){const a=this.layers[0].layout,r=a.get("line-join").evaluate(e,{}),o=a.get("line-cap").evaluate(e,{}),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const h of t)this.addLine(h,e,r,o,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,l,s)}addLine(e,t,n,s,i,l){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[r-1].equals(e[r-2]);)r--;let o=0;for(;o0;if(g&&I>o){const e=h.dist(p);if(e>2*u){const t=h.sub(h.sub(p)._mult(u/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,f,0,0,c),p=t}}const b=p&&d;let R=b?n:a?"butt":s;if(b&&"round"===R&&(Ei&&(R="bevel"),"bevel"===R&&(E>2&&(R="flipbevel"),E100)t=m.mult(-1);else{const e=E*f.add(m).mag()/f.sub(m).mag();t._perp()._mult(e*(T?-1:1))}this.addCurrentVertex(h,t,0,0,c),this.addCurrentVertex(h,t.mult(-1),0,0,c)}else if("bevel"===R||"fakeround"===R){const e=-Math.sqrt(E*E-1),t=T?e:0,n=T?0:e;if(p&&this.addCurrentVertex(h,f,t,n,c),"fakeround"===R){const e=Math.round(180*w/Math.PI/20);for(let t=1;t2*u){const t=h.add(d.sub(h)._mult(u/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,m,0,0,c),h=t}}}}addCurrentVertex(e,t,n,s,i){let l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const a=t.y*s-t.x,r=-t.y-t.x*s;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,l,!1,n,i),this.addHalfVertex(e,a,r,l,!0,-s,i)}addHalfVertex(e,t,n,s,i,l,a){let{x:r,y:o}=e;this.layoutVertexArray.emplaceBack((r<<1)+(s?1:0),(o<<1)+(i?1:0),Math.round(63*t)+128,Math.round(63*n)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const u=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),a.primitiveLength++),i?this.e2=u:this.e1=u}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}Zi(Dh,"LineBucket",{omit:["layers","patternFeatures"]});const Ah=new Ll({"line-cap":new Ol(et.layout_line["line-cap"]),"line-join":new Ol(et.layout_line["line-join"]),"line-miter-limit":new _l(et.layout_line["line-miter-limit"]),"line-round-limit":new _l(et.layout_line["line-round-limit"]),"line-sort-key":new Ol(et.layout_line["line-sort-key"])});var Ch={paint:new Ll({"line-opacity":new Ol(et.paint_line["line-opacity"]),"line-color":new Ol(et.paint_line["line-color"]),"line-translate":new _l(et.paint_line["line-translate"]),"line-translate-anchor":new _l(et.paint_line["line-translate-anchor"]),"line-width":new Ol(et.paint_line["line-width"]),"line-gap-width":new Ol(et.paint_line["line-gap-width"]),"line-offset":new Ol(et.paint_line["line-offset"]),"line-blur":new Ol(et.paint_line["line-blur"]),"line-dasharray":new Ol(et.paint_line["line-dasharray"]),"line-pattern":new Ol(et.paint_line["line-pattern"]),"line-gradient":new Nl(et.paint_line["line-gradient"]),"line-trim-offset":new _l(et.paint_line["line-trim-offset"])}),layout:Ah};const xh=new class extends Ol{possiblyEvaluate(e,t){return t=new gl(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,s){return t=N({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,s)}}(Ch.paint.properties["line-width"].specification);function _h(e,t){return t>0?t+2*e:e}xh.useIntegerZoom=!0;const Oh=Hl([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Nh=Hl([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Lh=Hl([{name:"a_projected_pos",components:4,type:"Float32"}],4);Hl([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ph=Hl([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Mh=Hl([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Hl([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Fh=Hl([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Bh=Hl([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Hl([{name:"triangle",components:3,type:"Uint16"}]),Hl([{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"}]),Hl([{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"}]),Hl([{type:"Float32",name:"offsetX"}]),Hl([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Hh=24;const Uh=128;function Gh(e,t){const{expression:n}=t;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new gl(e+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:s}=n;let i=0;for(;i{e.text=function(e,t,n){const s=t.layout.get("text-transform").evaluate(n,{});return"uppercase"===s?e=e.toLocaleUpperCase():"lowercase"===s&&(e=e.toLocaleLowerCase()),wl.applyArabicShaping&&(e=wl.applyArabicShaping(e)),e}(e.text,t,n)})),e}const Wh={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42","\u2190":"\u2191","\u2192":"\u2193"};function Yh(e){return"\ufe36"===e||"\ufe48"===e||"\ufe38"===e||"\ufe44"===e||"\ufe42"===e||"\ufe3e"===e||"\ufe3c"===e||"\ufe3a"===e||"\ufe18"===e||"\ufe40"===e||"\ufe10"===e||"\ufe13"===e||"\ufe14"===e||"\uff40"===e||"\uffe3"===e||"\ufe11"===e||"\ufe12"===e}function qh(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f"===e}var Xh=Qh,Zh=function(e,t,n,s,i){var l,a,r=8*i-s-1,o=(1<>1,c=-7,h=n?i-1:0,p=n?-1:1,d=e[t+h];for(h+=p,l=d&(1<<-c)-1,d>>=-c,c+=r;c>0;l=256*l+e[t+h],h+=p,c-=8);for(a=l&(1<<-c)-1,l>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=p,c-=8);if(0===l)l=1-u;else{if(l===o)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,s),l-=u}return(d?-1:1)*a*Math.pow(2,l-s)},Kh=function(e,t,n,s,i,l){var a,r,o,u=8*l-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=s?0:l-1,f=s?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(r=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-a))<1&&(a--,o*=2),(t+=a+h>=1?p/o:p*Math.pow(2,1-h))*o>=2&&(a++,o/=2),a+h>=c?(r=0,a=c):a+h>=1?(r=(t*o-1)*Math.pow(2,i),a+=h):(r=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&r,d+=f,r/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=f,a/=256,u-=8);e[n+d-f]|=128*m};function Qh(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Qh.Varint=0,Qh.Fixed64=1,Qh.Bytes=2,Qh.Fixed32=5;var Jh=4294967296,$h=1/Jh,ep="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tp(e){return e.type===Qh.Bytes?e.readVarint()+e.pos:e.pos+1}function np(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function sp(e,t,n){var s=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(s);for(var i=n.pos-1;i>=e;i--)n.buf[i+s]=n.buf[i]}function ip(e,t){for(var n=0;n>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function mp(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}Qh.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos>3,l=this.pos;this.type=7&s,e(i,t,this),this.pos===l&&this.skip(s)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=dp(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=mp(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=dp(this.buf,this.pos)+dp(this.buf,this.pos+4)*Jh;return this.pos+=8,e},readSFixed64:function(){var e=dp(this.buf,this.pos)+mp(this.buf,this.pos+4)*Jh;return this.pos+=8,e},readFloat:function(){var e=Zh(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Zh(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,n,s=this.buf;return t=127&(n=s[this.pos++]),n<128?t:(t|=(127&(n=s[this.pos++]))<<7,n<128?t:(t|=(127&(n=s[this.pos++]))<<14,n<128?t:(t|=(127&(n=s[this.pos++]))<<21,n<128?t:function(e,t,n){var s,i,l=n.buf;if(s=(112&(i=l[n.pos++]))>>4,i<128)return np(e,s,t);if(s|=(127&(i=l[n.pos++]))<<3,i<128)return np(e,s,t);if(s|=(127&(i=l[n.pos++]))<<10,i<128)return np(e,s,t);if(s|=(127&(i=l[n.pos++]))<<17,i<128)return np(e,s,t);if(s|=(127&(i=l[n.pos++]))<<24,i<128)return np(e,s,t);if(s|=(1&(i=l[n.pos++]))<<31,i<128)return np(e,s,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=s[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ep?function(e,t,n){return ep.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var s="",i=t;i239?4:o>223?3:o>191?2:1;if(i+c>n)break;1===c?o<128&&(u=o):2===c?128==(192&(l=e[i+1]))&&(u=(31&o)<<6|63&l)<=127&&(u=null):3===c?(a=e[i+2],128==(192&(l=e[i+1]))&&128==(192&a)&&((u=(15&o)<<12|(63&l)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=e[i+2],r=e[i+3],128==(192&(l=e[i+1]))&&128==(192&a)&&128==(192&r)&&((u=(15&o)<<18|(63&l)<<12|(63&a)<<6|63&r)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,s+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),s+=String.fromCharCode(u),i+=c}return s}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Qh.Bytes)return e.push(this.readVarint(t));var n=tp(this);for(e=e||[];this.pos127;);else if(t===Qh.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Qh.Fixed32)this.pos+=4;else{if(t!==Qh.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var n,s;if(e>=0?(n=e%4294967296|0,s=e/4294967296|0):(s=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,s=s+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(s,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var s,i,l=0;l55295&&s<57344){if(!i){s>56319||l+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=s;continue}if(s<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=s;continue}s=i-55296<<10|s-56320|65536,i=null}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);s<128?e[n++]=s:(s<2048?e[n++]=s>>6|192:(s<65536?e[n++]=s>>12|224:(e[n++]=s>>18|240,e[n++]=s>>12&63|128),e[n++]=s>>6&63|128),e[n++]=63&s|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&sp(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Kh(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Kh(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n=128&&sp(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s},writeMessage:function(e,t,n){this.writeTag(e,Qh.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ip,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,lp,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,op,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,ap,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,rp,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,up,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,cp,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,hp,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,pp,t)},writeBytesField:function(e,t){this.writeTag(e,Qh.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Qh.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Qh.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Qh.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Qh.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Qh.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Qh.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Qh.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Qh.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Qh.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var Ip=p(Xh);const yp=3;function vp(e,t,n){t.glyphs=[],1===e&&n.readMessage(Ep,t)}function Ep(e,t,n){if(3===e){const{id:e,bitmap:s,width:i,height:l,left:a,top:r,advance:o}=n.readMessage(wp,{});t.glyphs.push({id:e,bitmap:new Hu({width:i+2*yp,height:l+2*yp},s),metrics:{width:i,height:l,left:a,top:r,advance:o}})}else 4===e?t.ascender=n.readSVarint():5===e&&(t.descender=n.readSVarint())}function wp(e,t,n){1===e?t.id=n.readVarint():2===e?t.bitmap=n.readBytes():3===e?t.width=n.readVarint():4===e?t.height=n.readVarint():5===e?t.left=n.readSVarint():6===e?t.top=n.readSVarint():7===e&&(t.advance=n.readVarint())}const gp=yp;function Tp(e){let t=0,n=0;for(const a of e)t+=a.w*a.h,n=Math.max(n,a.w);e.sort(((e,t)=>t.h-e.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let i=0,l=0;for(const a of e)for(let e=s.length-1;e>=0;e--){const t=s[e];if(!(a.w>t.w||a.h>t.h)){if(a.x=t.x,a.y=t.y,l=Math.max(l,a.y+a.h),i=Math.max(i,a.x+a.w),a.w===t.w&&a.h===t.h){const t=s.pop();ee.hasImage(t))),e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[s,i]=e.tl;n.update(t.data,void 0,{x:s,y:i})}}Zi(Rp,"ImagePosition"),Zi(Sp,"ImageAtlas");const Dp={horizontal:1,vertical:2,horizontalOnly:3},Ap=-17;class Cp{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const n=new Cp;return n.scale=e||1,n.fontStack=t,n}static forImage(e){const t=new Cp;return t.imageName=e,t}}class xp{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const n=new xp;for(let s=0;s=0&&n>=e&&Op[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const n=new xp;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Cp.forText(e.scale,e.fontStack||t));const n=this.sections.length-1;for(let s=0;s=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function _p(e,t,n,s,i,l,a,r,o,u,c,h,p,d,f){const m=xp.fromFeature(e,i);h===Dp.vertical&&m.verticalizePunctuation(p);let I=[];const y=function(e,t,n,s,i,l){if(!e)return[];const a=[],r=function(e,t,n,s,i,l){let a=0;for(let r=0;r=0;let u=0;for(let h=0;h0&&l>w&&(w=l)}else{const e=n[a.fontStack];if(!e)continue;e[f]&&(R=e[f]);const s=t[a.fontStack];if(!s)continue;const l=s.glyphs[f];if(!l)continue;if(y=l.metrics,D=8203!==f?Hh:0,I){const e=void 0!==s.ascender?Math.abs(s.ascender):0,t=void 0!==s.descender?Math.abs(s.descender):0,n=(e+t)*m;g-n/2;){if(a--,a<0)return!1;r-=e[a].dist(l),l=e[a]}r+=e[a].dist(e[a+1]),a++;const o=[];let u=0;for(;rs;)u-=o.shift().angleDelta;if(u>i)return!1;a++,r+=t.dist(n)}return!0}function jp(e){let t=0;for(let n=0;nu){const l=(u-o)/i,h=Nn(n.x,s.x,l),p=Nn(n.y,s.y,l),d=new zp(h,p,0,s.angleTo(n),c);return!a||Vp(e,d,r,a,t)?d:void 0}o+=i}}function Xp(e,t,n,s,i,l,a,r,o){const u=Wp(s,l,a),c=Yp(s,i),h=c*a,p=0===e[0].x||e[0].x===o||0===e[0].y||e[0].y===o;return t-h=0&&y=0&&v=0&&p+u<=c){const t=new zp(y,v,0,m,f);t._round(),s&&!Vp(e,t,l,s,i)||d.push(t)}}h+=r}return r||d.length||a||(d=Zp(e,h/2,n,s,i,l,a,!0,o)),d}function Kp(e,t,n,s,i){const l=[];for(let a=0;a=s&&u.x>=s||(a.x>=s?a=new v(s,a.y+(s-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x>=s&&(u=new v(s,a.y+(s-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y>=i&&u.y>=i||(a.y>=i?a=new v(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round():u.y>=i&&(u=new v(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round()),o&&a.equals(o[o.length-1])||(o=[a],l.push(o)),o.push(u)))))}}return l}Zi(zp,"Anchor");const Qp=1e20;function Jp(e,t,n,s,i,l,a,r,o){for(let u=t;u-1);o++,l[o]=r,a[o]=u,a[o+1]=Qp}for(let r=0,o=0;r{let{stack:n,id:s}=e,i=this.entries[n];i||(i=this.entries[n]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let l=i.glyphs[s];if(void 0!==l)return void t(null,{stack:n,id:s,glyph:l});if(l=this._tinySDF(i,n,s),l)return i.glyphs[s]=l,void t(null,{stack:n,id:s,glyph:l});const a=Math.floor(s/256);if(256*a>65535)return void t(new Error("glyphs > 65535 not supported"));if(i.ranges[a])return void t(null,{stack:n,id:s,glyph:l});let r=i.requests[a];r||(r=i.requests[a]=[],nd.loadGlyphRange(n,a,this.url,this.requestManager,((e,t)=>{if(t){i.ascender=t.ascender,i.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(i.glyphs[+e]=t.glyphs[+e]);i.ranges[a]=!0}for(const n of r)n(e,t);delete i.requests[a]}))),r.push(((e,i)=>{e?t(e):i&&t(null,{stack:n,id:s,glyph:i.glyphs[s]||null})}))}),((e,n)=>{if(e)t(e);else if(n){const e={};for(const{stack:t,id:s,glyph:i}of n)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[s]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==td.none&&(this.localGlyphMode===td.all?!!this.localFontFamily:!!this.localFontFamily&&(el["CJK Unified Ideographs"](e)||el["Hangul Syllables"](e)||el.Hiragana(e)||el.Katakana(e)||el["CJK Symbols and Punctuation"](e)))}_tinySDF(e,t,n){const s=this.localFontFamily;if(!s||!this._doesCharSupportLocalGlyph(n))return;let i=e.tinySDF;if(!i){let n="400";/bold/i.test(t)?n="900":/medium/i.test(t)?n="500":/light/i.test(t)&&(n="200"),i=e.tinySDF=new nd.TinySDF({fontFamily:s,fontWeight:n,fontSize:24*ed,buffer:3*ed,radius:8*ed}),i.fontWeight=n}if(this.localGlyphs[i.fontWeight][n])return this.localGlyphs[i.fontWeight][n];const l=String.fromCharCode(n),{data:a,width:r,height:o,glyphWidth:u,glyphHeight:c,glyphLeft:h,glyphTop:p,glyphAdvance:d}=i.draw(l);return this.localGlyphs[i.fontWeight][n]={id:n,bitmap:new Hu({width:r,height:o},a),metrics:{width:u/ed,height:c/ed,left:h/ed,top:p/ed-27,advance:d/ed,localGlyph:!0}}}}nd.loadGlyphRange=function(e,t,n,s,i){const l=256*t,a=l+255,r=s.transformRequest(s.normalizeGlyphsURL(n).replace("{fontstack}",e).replace("{range}","".concat(l,"-").concat(a)),oe.Glyphs);pe(r,((e,t)=>{if(e)i(e);else if(t){const e={},n=function(e){return new Ip(e).readFields(vp,{})}(t);for(const t of n.glyphs)e[t.id]=t;i(null,{glyphs:e,ascender:n.ascender,descender:n.descender})}}))},nd.TinySDF=class{constructor(){let{fontSize:e=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:i="sans-serif",fontWeight:l="normal",fontStyle:a="normal"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.buffer=t,this.cutoff=s,this.radius=n;const r=this.size=e+4*t,o=this._createCanvas(r),u=this.ctx=o.getContext("2d",{willReadFrequently:!0});u.font="".concat(a," ").concat(l," ").concat(e,"px ").concat(i),u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(r*r),this.gridInner=new Float64Array(r*r),this.f=new Float64Array(r),this.z=new Float64Array(r+1),this.v=new Uint16Array(r)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:i,actualBoundingBoxRight:l}=this.ctx.measureText(e),a=Math.ceil(n),r=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l-i))),o=Math.min(this.size-this.buffer,a+Math.ceil(s)),u=r+2*this.buffer,c=o+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),d={data:p,width:u,height:c,glyphWidth:r,glyphHeight:o,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===r||0===o)return d;const{ctx:f,buffer:m,gridInner:I,gridOuter:y}=this;f.clearRect(m,m,r,o),f.fillText(e,m,m+a);const v=f.getImageData(m,m,r,o);y.fill(Qp,0,h),I.fill(0,0,h);for(let E=0;E0?e*e:0,I[n]=e<0?e*e:0}}Jp(y,0,0,u,c,u,this.f,this.v,this.z),Jp(I,m,m,r,o,u,this.f,this.v,this.z);for(let E=0;Ee+t[1]-t[0],f=h.reduce(d,0),m=p.reduce(d,0),I=r-f,y=o-m;let E=0,w=f,g=0,T=m,b=0,R=I,S=0,D=y;if(l.content&&s){const e=l.content;E=ld(h,0,e[0]),g=ld(p,0,e[1]),w=ld(h,e[0],e[2]),T=ld(p,e[1],e[3]),b=e[0]-E,S=e[1]-g,R=e[2]-e[0]-w,D=e[3]-e[1]-T}const A=(s,i,r,o)=>{const h=rd(s.stretch-E,w,u,e.left),p=od(s.fixed-b,R,s.stretch,f),d=rd(i.stretch-g,T,c,e.top),I=od(i.fixed-S,D,i.stretch,m),y=rd(r.stretch-E,w,u,e.left),A=od(r.fixed-b,R,r.stretch,f),C=rd(o.stretch-g,T,c,e.top),x=od(o.fixed-S,D,o.stretch,m),_=new v(h,d),O=new v(y,d),N=new v(y,C),L=new v(h,C),P=new v(p/a,I/a),M=new v(A/a,x/a),F=t*Math.PI/180;if(F){const e=Math.sin(F),t=Math.cos(F),n=[t,-e,e,t];_._matMult(n),O._matMult(n),L._matMult(n),N._matMult(n)}const B=s.stretch+s.fixed,H=i.stretch+i.fixed;return{tl:_,tr:O,bl:L,br:N,tex:{x:l.paddedRect.x+sd+B,y:l.paddedRect.y+sd+H,w:r.stretch+r.fixed-B,h:o.stretch+o.fixed-H},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:P,pixelOffsetBR:M,minFontScaleX:R/a/u,minFontScaleY:D/a/c,isSDF:n}};if(s&&(l.stretchX||l.stretchY)){const e=ad(h,I,f),t=ad(p,y,m);for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hd;if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,s=t[e];for(;e>0;){const i=e-1>>1,l=t[i];if(n(s,l)>=0)break;t[e]=l,e=i}t[e]=s}_down(e){const{data:t,compare:n}=this,s=this.length>>1,i=t[e];for(;e=0)break;t[e]=l,e=s}t[e]=i}}function hd(e,t){return et?1:0}function pd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=1/0,i=1/0,l=-1/0,a=-1/0;const r=e[0];for(let d=0;dl)&&(l=e.x),(!d||e.y>a)&&(a=e.y)}const o=Math.min(l-s,a-i);let u=o/2;const c=new cd([],dd);if(0===o)return new v(s,i);for(let d=s;dh.d||!h.d)&&(h=s,n&&console.log("found best %d after %d probes",Math.round(1e4*s.d)/1e4,p)),s.max-h.d<=t||(u=s.h/2,c.push(new fd(s.p.x-u,s.p.y-u,u,e)),c.push(new fd(s.p.x+u,s.p.y-u,u,e)),c.push(new fd(s.p.x-u,s.p.y+u,u,e)),c.push(new fd(s.p.x+u,s.p.y+u,u,e)),p+=4)}return n&&(console.log("num probes: ".concat(p)),console.log("best distance: ".concat(h.d))),h.p}function dd(e,t){return t.max-e.max}class fd{constructor(e,t,n,s){this.p=new v(e,t),this.h=n,this.d=function(e,t){let n=!1,s=1/0;for(let i=0;ie.y!=r.y>e.y&&e.x<(r.x-i.x)*(e.y-i.y)/(r.y-i.y)+i.x&&(n=!n),s=Math.min(s,vu(e,i,r))}}return(n?1:-1)*Math.sqrt(s)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}}const md=7,Id=Number.POSITIVE_INFINITY,yd=Math.sqrt(2);function vd(e,t){let[n,s]=t,i=0,l=0;if(s===Id){n<0&&(n=0);const t=n/yd;switch(e){case"top-right":case"top-left":l=t-md;break;case"bottom-right":case"bottom-left":l=-t+md;break;case"bottom":l=-n+md;break;case"top":l=n-md}switch(e){case"top-right":case"bottom-right":i=-t;break;case"top-left":case"bottom-left":i=t;break;case"left":i=n;break;case"right":i=-n}}else{switch(n=Math.abs(n),s=Math.abs(s),e){case"top-right":case"top-left":case"top":l=s-md;break;case"bottom-right":case"bottom-left":case"bottom":l=-s+md}switch(e){case"top-right":case"bottom-right":case"right":i=-n;break;case"top-left":case"bottom-left":case"left":i=n}}return[i,l]}function Ed(e,t,n,s,i,l,a,r,o,u){e.createArrays(),e.tilePixelRatio=ar/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const c=e.layers[0].layout,h=e.layers[0]._unevaluatedLayout._values,p={};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:n}=e.textSizeData;p.compositeTextSizes=[h["text-size"].possiblyEvaluate(new gl(t),r),h["text-size"].possiblyEvaluate(new gl(n),r)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:n}=e.iconSizeData;p.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new gl(t),r),h["icon-size"].possiblyEvaluate(new gl(n),r)]}p.layoutTextSize=h["text-size"].possiblyEvaluate(new gl(o+1),r),p.layoutIconSize=h["icon-size"].possiblyEvaluate(new gl(o+1),r),p.textMaxSize=h["text-size"].possiblyEvaluate(new gl(18),r);const d="map"===c.get("text-rotation-alignment")&&"point"!==c.get("symbol-placement"),f=c.get("text-size");for(const m of e.features){const l=c.get("text-font").evaluate(m,{},r).join(","),o=f.evaluate(m,{},r),h=p.layoutTextSize.evaluate(m,{},r),I=(p.layoutIconSize.evaluate(m,{},r),{horizontal:{},vertical:void 0}),y=m.text;let v,E=[0,0];if(y){const s=y.toString(),a=c.get("text-letter-spacing").evaluate(m,{},r)*Hh,u=c.get("text-line-height").evaluate(m,{},r)*Hh,p=nl(s)?a:0,f=c.get("text-anchor").evaluate(m,{},r),v=c.get("text-variable-anchor");if(!v){const e=c.get("text-radial-offset").evaluate(m,{},r);E=e?vd(f,[e*Hh,Id]):c.get("text-offset").evaluate(m,{},r).map((e=>e*Hh))}let w=d?"center":c.get("text-justify").evaluate(m,{},r);const g="point"===c.get("symbol-placement"),T=g?c.get("text-max-width").evaluate(m,{},r)*Hh:1/0,b=a=>{e.allowVerticalPlacement&&tl(s)&&(I.vertical=_p(y,t,n,i,l,T,u,f,a,p,E,Dp.vertical,!0,h,o))};if(!d&&v){const e="auto"===w?v.map((e=>wd(e))):[w];let s=!1;for(let a=0;a=0||!tl(s)){const e=_p(y,t,n,i,l,T,u,f,w,p,E,Dp.horizontal,!1,h,o);e&&(I.horizontal[w]=e)}b(g?"left":w)}}let w=!1;if(m.icon&&m.icon.name){const t=s[m.icon.name];t&&(v=Gp(i[m.icon.name],c.get("icon-offset").evaluate(m,{},r),c.get("icon-anchor").evaluate(m,{},r)),w=t.sdf,void 0===e.sdfIcons?e.sdfIcons=t.sdf:e.sdfIcons!==t.sdf&&j("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const g=Sd(I.horizontal)||I.vertical;e.iconsInText||(e.iconsInText=!!g&&g.iconsInText),(g||v)&&gd(e,m,I,v,s,p,h,0,E,w,a,r,u)}l&&e.generateCollisionDebugBuffers(o,e.collisionBoxArray)}function wd(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function gd(e,t,n,s,i,l,a,r,o,u,c,h,p){let d=l.textMaxSize.evaluate(t,{},h);void 0===d&&(d=a);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(t,{},h),I=Sd(n.horizontal)||n.vertical,y="globe"===p.name,v=Hh,E=a/v,w=e.tilePixelRatio*d/v,T=(_=e.overscaling,e.zoom>18&&_>2&&(_>>=1),Math.max(ar/(512*_),1)*f.get("symbol-spacing")),b=f.get("text-padding")*e.tilePixelRatio,R=f.get("icon-padding")*e.tilePixelRatio,S=g(f.get("text-max-angle")),D="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),A="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),C=f.get("symbol-placement"),x=T/2;var _;const O=f.get("icon-text-fit");let N;s&&"none"!==O&&(e.allowVerticalPlacement&&n.vertical&&(N=kp(s,n.vertical,O,f.get("icon-text-fit-padding"),m,E)),I&&(s=kp(s,I,O,f.get("icon-text-fit-padding"),m,E)));const L=(a,r,d)=>{if(r.x<0||r.x>=ar||r.y<0||r.y>=ar)return;let f=null;if(y){const{x:e,y:t,z:n}=p.projectTilePoint(r.x,r.y,d);f={anchor:new zp(e,t,n,0,void 0),up:p.upVector(d,r.x,r.y)}}!function(e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I,y,v,E,w,g,T,b,R){const S=e.addToLineVertexArray(t,s);let D,A,C,x,_,O,N,L=0,P=0,M=0,F=0,B=-1,H=-1;const U={};let G=_a("");const k=n?n.anchor:t;let z=0,V=0;if(void 0===o._unevaluatedLayout.getValue("text-radial-offset")?[z,V]=o.layout.get("text-offset").evaluate(w,{},R).map((e=>e*Hh)):(z=o.layout.get("text-radial-offset").evaluate(w,{},R)*Hh,V=Id),e.allowVerticalPlacement&&i.vertical){const e=i.vertical;if(f)O=Ad(e),r&&(N=Ad(r));else{const n=o.layout.get("text-rotate").evaluate(w,{},R)+90;C=Dd(u,k,t,c,h,p,e,d,n,m),r&&(x=Dd(u,k,t,c,h,p,r,y,n))}}if(l){const s=o.layout.get("icon-rotate").evaluate(w,{},R),i="none"!==o.layout.get("icon-text-fit"),a=id(l,s,T,i),d=r?id(r,s,T,i):void 0;A=Dd(u,k,t,c,h,p,l,y,s),L=4*a.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[Uh*o.layout.get("icon-size").evaluate(w,{},R)],m[0]>bd&&j("".concat(e.layerIds[0],': Value for "icon-size" is >= ').concat(Td,'. Reduce your "icon-size".'))):"composite"===f.kind&&(m=[Uh*g.compositeIconSizes[0].evaluate(w,{},R),Uh*g.compositeIconSizes[1].evaluate(w,{},R)],(m[0]>bd||m[1]>bd)&&j("".concat(e.layerIds[0],': Value for "icon-size" is >= ').concat(Td,'. Reduce your "icon-size".'))),e.addSymbols(e.icon,a,m,E,v,w,!1,n,t,S.lineStartIndex,S.lineLength,-1,b,R),B=e.icon.placedSymbolArray.length-1,d&&(P=4*d.length,e.addSymbols(e.icon,d,m,E,v,w,Dp.vertical,n,t,S.lineStartIndex,S.lineLength,-1,b,R),H=e.icon.placedSymbolArray.length-1)}for(const j in i.horizontal){const s=i.horizontal[j];D||(G=_a(s.text),f?_=Ad(s):D=Dd(u,k,t,c,h,p,s,d,o.layout.get("text-rotate").evaluate(w,{},R),m));const l=1===s.positionedLines.length;if(M+=Rd(e,n,t,s,a,o,f,w,m,S,i.vertical?Dp.horizontal:Dp.horizontalOnly,l?Object.keys(i.horizontal):[j],U,B,g,b,R),l)break}i.vertical&&(F+=Rd(e,n,t,i.vertical,a,o,f,w,m,S,Dp.vertical,["vertical"],U,H,g,b,R));let W=-1;const Y=(e,t)=>e?Math.max(e,t):t;W=Y(_,W),W=Y(O,W),W=Y(N,W);const q=W>-1?1:0;e.glyphOffsetArray.length>=rf.MAX_GLYPHS&&j("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey),e.symbolInstances.emplaceBack(k.x,k.y,k.z,t.x,t.y,U.right>=0?U.right:-1,U.center>=0?U.center:-1,U.left>=0?U.left:-1,U.vertical>=0?U.vertical:-1,B,H,G,void 0!==D?D:e.collisionBoxArray.length,void 0!==D?D+1:e.collisionBoxArray.length,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==A?A:e.collisionBoxArray.length,void 0!==A?A+1:e.collisionBoxArray.length,x||e.collisionBoxArray.length,x?x+1:e.collisionBoxArray.length,c,M,F,L,P,q,0,z,V,W)}(e,r,f,a,n,s,i,N,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,b,D,o,0,R,A,m,t,l,u,c,h)};if("line"===C)for(const g of Kp(t.geometry,0,0,ar,ar)){const t=Xp(g,T,S,n.vertical||I,s,v,w,e.overscaling,ar);for(const n of t)I&&Cd(e,I.text,x,n)||L(g,n,h)}else if("line-center"===C){for(const g of t.geometry)if(g.length>1){const e=qp(g,S,n.vertical||I,s,v,w);e&&L(g,e,h)}}else if("Polygon"===t.type)for(const g of bc(t.geometry,0)){const e=pd(g,16);L(g[0],new zp(e.x,e.y,0,0,void 0),h)}else if("LineString"===t.type)for(const g of t.geometry)L(g,new zp(g[0].x,g[0].y,0,0,void 0),h);else if("Point"===t.type)for(const g of t.geometry)for(const e of g)L([e],new zp(e.x,e.y,0,0,void 0),h)}const Td=255,bd=Td*Uh;function Rd(e,t,n,s,i,l,a,r,o,u,c,h,p,d,f,m,I){const y=function(e,t,n,s,i,l,a,r){const o=[];if(0===t.positionedLines.length)return o;const u=s.layout.get("text-rotate").evaluate(l,{})*Math.PI/180,c=function(e){const t=e[0],n=e[1],s=t*n;return s>0?[t,-n]:s<0?[-t,n]:0===t?[n,t]:[n,-t]}(n);let h=Math.abs(t.top-t.bottom);for(const m of t.positionedLines)h-=m.lineOffset;const p=t.positionedLines.length,d=h/p;let f=t.top-n[1];for(let m=0;mbd&&j("".concat(e.layerIds[0],': Value for "text-size" is >= ').concat(Td,'. Reduce your "text-size".'))):"composite"===E.kind&&(w=[Uh*f.compositeTextSizes[0].evaluate(r,{},I),Uh*f.compositeTextSizes[1].evaluate(r,{},I)],(w[0]>bd||w[1]>bd)&&j("".concat(e.layerIds[0],': Value for "text-size" is >= ').concat(Td,'. Reduce your "text-size".'))),e.addSymbols(e.text,y,w,o,a,r,c,t,n,u.lineStartIndex,u.lineLength,d,m,I);for(const v of h)p[v]=e.text.placedSymbolArray.length-1;return 4*y.length}function Sd(e){for(const t in e)return e[t];return null}function Dd(e,t,n,s,i,l,a,r,o,u){let c=a.top,h=a.bottom,p=a.left,d=a.right;const f=a.collisionPadding;if(f&&(p-=f[0],c-=f[1],d+=f[2],h+=f[3]),o){const e=new v(p,c),t=new v(d,c),n=new v(p,h),s=new v(d,h),i=g(o);let l=new v(0,0);u&&(l=new v(u[0],u[1])),e._rotateAround(i,l),t._rotateAround(i,l),n._rotateAround(i,l),s._rotateAround(i,l),p=Math.min(e.x,t.x,n.x,s.x),d=Math.max(e.x,t.x,n.x,s.x),c=Math.min(e.y,t.y,n.y,s.y),h=Math.max(e.y,t.y,n.y,s.y)}return e.emplaceBack(t.x,t.y,t.z,n.x,n.y,p,c,d,h,r,s,i,l),e.length-1}function Ad(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function Cd(e,t,n,s){const i=e.compareText;if(t in i){const e=i[t];for(let t=e.length-1;t>=0;t--)if(s.dist(e[t])E&&(w(e,u,s,i,r,o),w(u,n,r,o,l,a))}w(h,p,s,l,i,l),w(p,d,i,l,i,a),w(d,f,i,a,s,a),w(f,h,s,a,s,l),m-=E,I-=E,y+=E,v+=E;const g=1/Math.max(y-m,v-I);return{scale:g,x:m*g,y:I*g,x2:y*g,y2:v*g,projection:t}}const Od=pr(new Float32Array(16));class Nd{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new zo(0,0)}projectTilePoint(e,t,n){return{x:e,y:t,z:0}}locationPoint(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e._coordinatePoint(e.locationCoordinate(t),n)}pixelsPerMeter(e,t){return Yo(1,e)*t}pixelSpaceConversion(e,t,n){return 1}farthestPixelDistance(e){return xd(e,e.pixelsPerMeter)}pointCoordinate(e,t,n,s){const i=e.horizonLineFromTop(!1),l=new v(t,Math.max(i,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(l,s))}pointCoordinate3D(e,t,n){const s=new v(t,n);if(e.elevation)return e.elevation.pointCoordinate(s);{const t=this.pointCoordinate(e,s.x,s.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation)return!this.pointCoordinate3D(e,t.x,t.y);const n=e.horizonLineFromTop();return t.y0?t<-kd+n&&(t=-kd+n):t>kd-n&&(t=kd-n);const l=i/Math.pow(zd(t),s);let a=l*Math.sin(s*e),r=i-l*Math.cos(s*e);return a=.5*(a/Math.PI+.5),r=.5*(r/Math.PI+.5),{x:a,y:this.southernCenter?r:1-r,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:n,f:s}=this,i=s-t,l=Math.sign(i),a=Math.sign(n)*Math.sqrt(e*e+i*i);let r=Math.atan2(e,Math.abs(i))*l;i*n<0&&(r-=Math.PI*Math.sign(e)*l);const o=A(T(r/n)+this.center[0],-180,180),u=A(T(2*Math.atan(Math.pow(s/a,1/n))-kd),-Ko,Ko);return new zo(o,this.southernCenter?-u:u)}}class jd extends Nd{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:jo(e),y:Wo(t),z:0}}unproject(e,t){const n=qo(e),s=Xo(t);return new zo(n,s)}}const Wd=g(Ko);class Yd extends Nd{project(e,t){const n=(t=g(t))*t,s=n*n;return{x:.5*((e=g(e))*(.8707-.131979*n+s*(s*(.003971*n-.001529*s)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+n*(.015085+s*(.028874*n-.044475-.005916*s)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let n=t=(2*(1-t)-1)*Math.PI,s=25,i=0,l=n*n;do{l=n*n;const e=l*l;i=(n*(1.007226+l*(.015085+e*(.028874*l-.044475-.005916*e)))-t)/(1.007226+l*(.045255+e*(.259866*l-.311325-.005916*11*e))),n=A(n-i,-Wd,Wd)}while(Math.abs(i)>1e-6&&--s>0);l=n*n;const a=A(T(e/(.8707+l*(l*(l*l*l*(.003971-.001529*l)-.013791)-.131979))),-180,180),r=T(n);return new zo(a,r)}}const qd=g(Ko);class Xd extends Nd{project(e,t){t=g(t),e=g(e);const n=Math.cos(t),s=2/Math.PI,i=Math.acos(n*Math.cos(e/2)),l=Math.sin(i)/i,a=.5*(e*s+2*n*Math.sin(e/2)/l)||0,r=.5*(t+Math.sin(t)/l)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(r/Math.PI+1),z:0}}unproject(e,t){let n=e=(2*e-.5)*Math.PI,s=t=(2*(1-t)-1)*Math.PI,i=25;const l=1e-6;let a=0,r=0;do{const i=Math.cos(s),l=Math.sin(s),o=2*l*i,u=l*l,c=i*i,h=Math.cos(n/2),p=Math.sin(n/2),d=2*h*p,f=p*p,m=1-c*h*h,I=m?1/m:0,y=m?Math.acos(i*h)*Math.sqrt(1/m):0,v=.5*(2*y*i*p+2*n/Math.PI)-e,E=.5*(y*l+s)-t,w=.5*I*(c*f+y*i*h*u)+1/Math.PI,g=I*(d*o/4-y*l*p),T=.125*I*(o*p-y*l*c*d),b=.5*I*(u*h+y*f*i)+.5,R=g*T-b*w;a=(E*g-v*b)/R,r=(v*T-E*w)/R,n=A(n-a,-Math.PI,Math.PI),s=A(s-r,-qd,qd)}while((Math.abs(a)>l||Math.abs(r)>l)&&--i>0);return new zo(T(n),T(s))}}class Zd extends Nd{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(g(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:n,cosPhi:s}=this;return{x:g(e)*s*n+.5,y:-Math.sin(g(t))/s*n+.5,z:0}}unproject(e,t){const{scale:n,cosPhi:s}=this,i=-(t-.5)/n,l=A(T((e-.5)/n)/s,-180,180),a=Math.asin(A(i*s,-1,1)),r=A(T(a),-Ko,Ko);return new zo(l,r)}}class Kd extends jd{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,n){const s=Ao(e,t,n);return Fr(s,s,_o(vo(n))),{x:s[0],y:s[1],z:s[2]}}locationPoint(e,t){const n=Do(t.lat,t.lng),s=Lr([],n),i=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;Nr(n,n,s,Yo(1,0)*ar*i);const l=pr(new Float64Array(16));return fr(l,e.pixelMatrix,e.globeMatrix),Fr(n,n,l),new v(n[0],n[1])}pixelsPerMeter(e,t){return Yo(1,0)*t}pixelSpaceConversion(e,t,n){const s=Yo(1,e)*t,i=Nn(Yo(1,45)*t,s,n);return this.pixelsPerMeter(e,t)/i}createTileMatrix(e,t,n){const s=Oo(vo(n.canonical));return fr(new Float64Array(16),e.globeMatrix,s)}createInversionMatrix(e,t){const{center:n}=e,s=_o(vo(t));return vr(s,s,g(n.lng)),yr(s,s,g(n.lat)),Ir(s,s,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(s)}pointCoordinate(e,t,n,s){return mo(e,t,n,!0)||new Jo(0,0)}pointCoordinate3D(e,t,n){const s=this.pointCoordinate(e,t,n,0);return[s.x,s.y,s.z]}isPointAboveHorizon(e,t){return!mo(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const n=e.cameraToCenterDistance,s=e._centerAltitude*t,i=e._camera,l=e._camera.forward(),a=Dr([],Or([],l,-n),[0,0,s]),r=e.worldSize/(2*Math.PI),o=[0,0,-r],u=e.width/e.height,c=Math.tan(e.fovAboveCenter),h=Or([],i.up(),c),p=Or([],i.right(),c*u),d=Lr([],Dr([],Dr([],l,h),p)),f=[];let m;if(new eo(a,d).closestPointOnSphere(o,r,f)){const t=Dr([],f,o),n=Ur([],t,a);m=Math.cos(e.fovAboveCenter)*Rr(n)}else{const e=Ur([],a,o),t=Ur([],o,a);Lr(t,t);const n=Rr(e)-r;m=Math.sqrt(n*(n+2*r));const s=Math.acos(m/(r+n))-Math.acos(Pr(l,t));m*=Math.cos(s)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Lo(e.zoom);if(n>0){const s=xd(e,Yo(1,e.center.lat)*e.worldSize),i=e.worldSize/(2*Math.PI),l=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Nn(t,s+i*(1-Math.cos(l)),Math.pow(n,10))}return t}upVector(e,t,n){return Ao(t,n,e,1)}upVectorScale(e){return{metersToTile:fo(Co(vo(e)))}}}function Qd(e){const t=e.parallels,n=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new jd(e);case"equirectangular":return new Gd(e);case"naturalEarth":return new Yd(e);case"equalEarth":return new Ud(e);case"winkelTripel":return new Xd(e);case"albers":return n?new Zd(e):new Ld(e);case"lambertConformalConic":return n?new Zd(e):new Vd(e);case"globe":return new Kd(e)}throw new Error("Invalid projection name: ".concat(e.name))}const Jd=qc.types,$d=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ef(e,t,n,s,i,l,a,r,o,u,c,h,p){const d=r?Math.min(bd,Math.round(r[0])):0,f=r?Math.min(bd,Math.round(r[1])):0;e.emplaceBack(t,n,Math.round(32*s),Math.round(32*i),l,a,(d<<1)+(o?1:0),f,16*u,16*c,256*h,256*p)}function tf(e,t,n,s,i,l,a){e.emplaceBack(t,n,s,i,l,a)}function nf(e,t,n,s,i){e.emplaceBack(t,n,s,i),e.emplaceBack(t,n,s,i),e.emplaceBack(t,n,s,i),e.emplaceBack(t,n,s,i)}function sf(e){for(const t of e.sections)if(ol(t.text))return!0;return!1}class lf{constructor(e){this.layoutVertexArray=new Xl,this.indexArray=new na,this.programConfigurations=e,this.segments=new lr,this.dynamicLayoutVertexArray=new jl,this.opacityVertexArray=new Kl,this.placedSymbolArray=new fa,this.globeExtVertexArray=new Zl}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,n,s){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Oh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Lh.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,$d,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Nh.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||s)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Zi(lf,"SymbolBuffers");class af{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new lr,this.collisionVertexArray=new ea,this.collisionVertexArrayExt=new ta}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Ph.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Mh.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Zi(af,"CollisionBuffers");class rf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=pr([]),this.placementViewportMatrix=pr([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Gh(this.zoom,t["text-size"]),this.iconSizeData=Gh(this.zoom,t["icon-size"]);const n=this.layers[0].layout,s=n.get("symbol-sort-key"),i=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"!==i&&void 0!==s.constantOr(1),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map((e=>Dp[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection}createArrays(){this.text=new lf(new Za(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new lf(new Za(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new ya,this.lineVertexArray=new va,this.symbolInstances=new Ia}calculateGlyphDependencies(e,t,n,s,i){for(let l=0;l0)&&("constant"!==r.value.kind||r.value.value.length>0),h="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,p=l.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const d=t.iconDependencies,f=t.glyphDependencies,m=t.availableImages,I=new gl(this.zoom);for(const{feature:y,id:v,index:E,sourceLayerIndex:w}of e){const e=i._featureFilter.needGeometry,t=ru(y,e);if(!i._featureFilter.filter(I,t,n))continue;if(e||(t.geometry=au(y,n,s)),a&&1!==y.type&&n.z<=5){const e=t.geometry,s=.98078528056,i=(e,t)=>Pr(Ao(e.x,e.y,n,1),Ao(t.x,t.y,n,1))=0;for(const t of o.sections)if(t.image)d[t.image.name]=!0;else{const n=tl(o.toString()),i=t.fontStack||e,l=f[i]=f[i]||{};this.calculateGlyphDependencies(t.text,l,s,this.allowVerticalPlacement,n)}}}"line"===l.get("symbol-placement")&&(this.features=function(e){const t={},n={},s=[];let i=0;function l(t){s.push(e[t]),i++}function a(e,t,i){const l=n[e];return delete n[e],n[t]=l,s[l].geometry[0].pop(),s[l].geometry[0]=s[l].geometry[0].concat(i[0]),l}function r(e,n,i){const l=t[n];return delete t[n],t[e]=l,s[l].geometry[0].shift(),s[l].geometry[0]=i[0].concat(s[l].geometry[0]),l}function o(e,t,n){const s=n?t[0][t[0].length-1]:t[0][0];return"".concat(e,":").concat(s.x,":").concat(s.y)}for(let u=0;ue.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,n,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n,s),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n,s))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Qd(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const n=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:s,y:i}of t)this.lineVertexArray.emplaceBack(s,i);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,t,n,s,i,l,a,r,o,u,c,h,p,d){const f=e.indexArray,m=e.layoutVertexArray,I=e.globeExtVertexArray,y=e.segments.prepareSegment(4*t.length,m,f,this.canOverlap?l.sortKey:void 0),v=this.glyphOffsetArray.length,E=y.vertexLength,w=this.allowVerticalPlacement&&a===Dp.vertical?Math.PI/2:0,g=l.text&&l.text.sections;for(let b=0;b=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:s),l=kh(this.textSizeData,e,i)/Hh;return this.tilePixelRatio*l}getSymbolInstanceIconSize(e,t,n){const s=this.icon.placedSymbolArray.get(n),i=kh(this.iconSizeData,e,s);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(e,t,n){e.emplaceBack(t,-n,-n),e.emplaceBack(t,n,-n),e.emplaceBack(t,n,n),e.emplaceBack(t,-n,n)}_updateTextDebugCollisionBoxes(e,t,n,s,i,l){for(let a=s;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const n=e.placedSymbolArray.get(t),s=n.vertexStartIndex+4*n.numGlyphs;for(let i=n.vertexStartIndex;is[e]-s[t]||i[t]-i[e])),l}addToSortKeyRanges(e,t){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:s,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:l,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:r}=t;n>=0&&this.addIndicesForPlacedSymbol(this.text,n),s>=0&&s!==n&&this.addIndicesForPlacedSymbol(this.text,s),i>=0&&i!==s&&i!==n&&this.addIndicesForPlacedSymbol(this.text,i),l>=0&&this.addIndicesForPlacedSymbol(this.text,l),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),r>=0&&this.addIndicesForPlacedSymbol(this.icon,r)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Zi(rf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),rf.MAX_GLYPHS=65535,rf.addDynamicAttributes=nf;const of=new Ll({"symbol-placement":new _l(et.layout_symbol["symbol-placement"]),"symbol-spacing":new _l(et.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new _l(et.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ol(et.layout_symbol["symbol-sort-key"]),"symbol-z-order":new _l(et.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new _l(et.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new _l(et.layout_symbol["icon-ignore-placement"]),"icon-optional":new _l(et.layout_symbol["icon-optional"]),"icon-rotation-alignment":new _l(et.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ol(et.layout_symbol["icon-size"]),"icon-text-fit":new _l(et.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new _l(et.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ol(et.layout_symbol["icon-image"]),"icon-rotate":new Ol(et.layout_symbol["icon-rotate"]),"icon-padding":new _l(et.layout_symbol["icon-padding"]),"icon-keep-upright":new _l(et.layout_symbol["icon-keep-upright"]),"icon-offset":new Ol(et.layout_symbol["icon-offset"]),"icon-anchor":new Ol(et.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new _l(et.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new _l(et.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new _l(et.layout_symbol["text-rotation-alignment"]),"text-field":new Ol(et.layout_symbol["text-field"]),"text-font":new Ol(et.layout_symbol["text-font"]),"text-size":new Ol(et.layout_symbol["text-size"]),"text-max-width":new Ol(et.layout_symbol["text-max-width"]),"text-line-height":new Ol(et.layout_symbol["text-line-height"]),"text-letter-spacing":new Ol(et.layout_symbol["text-letter-spacing"]),"text-justify":new Ol(et.layout_symbol["text-justify"]),"text-radial-offset":new Ol(et.layout_symbol["text-radial-offset"]),"text-variable-anchor":new _l(et.layout_symbol["text-variable-anchor"]),"text-anchor":new Ol(et.layout_symbol["text-anchor"]),"text-max-angle":new _l(et.layout_symbol["text-max-angle"]),"text-writing-mode":new _l(et.layout_symbol["text-writing-mode"]),"text-rotate":new Ol(et.layout_symbol["text-rotate"]),"text-padding":new _l(et.layout_symbol["text-padding"]),"text-keep-upright":new _l(et.layout_symbol["text-keep-upright"]),"text-transform":new Ol(et.layout_symbol["text-transform"]),"text-offset":new Ol(et.layout_symbol["text-offset"]),"text-allow-overlap":new _l(et.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new _l(et.layout_symbol["text-ignore-placement"]),"text-optional":new _l(et.layout_symbol["text-optional"])});var uf={paint:new Ll({"icon-opacity":new Ol(et.paint_symbol["icon-opacity"]),"icon-color":new Ol(et.paint_symbol["icon-color"]),"icon-halo-color":new Ol(et.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ol(et.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ol(et.paint_symbol["icon-halo-blur"]),"icon-translate":new _l(et.paint_symbol["icon-translate"]),"icon-translate-anchor":new _l(et.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ol(et.paint_symbol["text-opacity"]),"text-color":new Ol(et.paint_symbol["text-color"],{runtimeType:pt,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Ol(et.paint_symbol["text-halo-color"]),"text-halo-width":new Ol(et.paint_symbol["text-halo-width"]),"text-halo-blur":new Ol(et.paint_symbol["text-halo-blur"]),"text-translate":new _l(et.paint_symbol["text-translate"]),"text-translate-anchor":new _l(et.paint_symbol["text-translate-anchor"])}),layout:of};class cf{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:ot,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Zi(cf,"FormatSectionOverride",{omit:["defaultValue"]});class hf extends nr{constructor(e){super(e,uf)}recalculate(e,t){super.recalculate(e,t),"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"));const n=this.layout.get("text-writing-mode");if(n){const e=[];for(const t of n)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,s){const i=this.layout.get(e).evaluate(t,{},n,s),l=this._unevaluatedLayout._values[e];return l.isDataDriven()||Zs(l.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,((t,n)=>n in e?String(e[n]):""))}(t.properties,i)}createBucket(e){return new rf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of uf.paint.overridableProperties){if(!hf.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),n=new cf(t),s=new Xs(n,t.property.specification);let i=null;i="constant"===t.value.kind||"source"===t.value.kind?new Qs("source",s):new Js("composite",s,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Cl(t.property,i,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&hf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const n=e.get("text-field"),s=uf.paint.properties[t];let i=!1;const l=e=>{for(const t of e)if(s.overrides&&s.overrides.hasOverride(t))return void(i=!0)};if("constant"===n.value.kind&&n.value.value instanceof Pt)l(n.value.value.sections);else if("source"===n.value.kind){const e=t=>{i||(t instanceof kt&&Ht(t.value)===It?l(t.value.sections):t instanceof Yt?l(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}getProgramConfiguration(e){return new Xa(this,e)}}var pf={paint:new Ll({"background-color":new _l(et.paint_background["background-color"]),"background-pattern":new _l(et.paint_background["background-pattern"]),"background-opacity":new _l(et.paint_background["background-opacity"])})},df={paint:new Ll({"raster-opacity":new _l(et.paint_raster["raster-opacity"]),"raster-hue-rotate":new _l(et.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new _l(et.paint_raster["raster-brightness-min"]),"raster-brightness-max":new _l(et.paint_raster["raster-brightness-max"]),"raster-saturation":new _l(et.paint_raster["raster-saturation"]),"raster-contrast":new _l(et.paint_raster["raster-contrast"]),"raster-resampling":new _l(et.paint_raster["raster-resampling"]),"raster-fade-duration":new _l(et.paint_raster["raster-fade-duration"])})};class ff extends nr{constructor(e){super(e,{}),this.implementation=e}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(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}var mf={paint:new Ll({"sky-type":new _l(et.paint_sky["sky-type"]),"sky-atmosphere-sun":new _l(et.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new _l(et.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new _l(et.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new _l(et.paint_sky["sky-gradient-radius"]),"sky-gradient":new Nl(et.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new _l(et.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new _l(et.paint_sky["sky-atmosphere-color"]),"sky-opacity":new _l(et.paint_sky["sky-opacity"])})};function If(e,t,n){const s=[0,0,1],i=Yr([]);return Xr(i,i,n?-g(e)+Math.PI:g(e)),qr(i,i,-g(t)),Br(s,s,i),Lr(s,s)}const yf={circle:class extends nr{constructor(e){super(e,Cu)}createBucket(e){return new cu(e)}queryRadius(e){const t=e;return bu("circle-radius",this,t)+bu("circle-stroke-width",this,t)+Ru(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,n,s,i,l,a,r){const o=Du(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),l.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(t,n)+this.paint.get("circle-stroke-width").evaluate(t,n);return xu(e,s,l,a,r,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),o,u)}getProgramIds(){return["circle"]}getProgramConfiguration(e){return new Xa(this,e)}},heatmap:class extends nr{createBucket(e){return new Pu(e)}constructor(e){super(e,Gu),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ku({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(e){return bu("heatmap-radius",this,e)}queryIntersectsFeature(e,t,n,s,i,l,a,r){const o=this.paint.get("heatmap-radius").evaluate(t,n);return xu(e,s,l,a,r,!0,!0,new v(0,0),o)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(e){return new Xa(this,e)}},hillshade:class extends nr{constructor(e){super(e,zu)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends nr{constructor(e){super(e,xc)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),n=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(e){return new Xa(this,e)}recalculate(e,t){super.recalculate(e,t);const 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(e){return new Ac(e)}queryRadius(){return Ru(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,n,s,i,l){return!e.queryGeometry.isAboveHorizon&&du(Su(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),l.angle,e.pixelToTileUnitsFactor),s)}isTileClipped(){return!0}},"fill-extrusion":class extends nr{constructor(e){super(e,ch)}createBucket(e){return new eh(e)}queryRadius(){return Ru(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(e){return new Xa(this,e)}queryIntersectsFeature(e,t,n,s,i,l,a,r,o){const u=Du(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),l.angle,e.pixelToTileUnitsFactor),c=this.paint.get("fill-extrusion-height").evaluate(t,n),h=this.paint.get("fill-extrusion-base").evaluate(t,n),p=[0,0],d=r&&l.elevation,f=l.elevation?l.elevation.exaggeration():1,m=e.tile.getBucket(this);if(d&&m instanceof eh){const e=m.centroidVertexArray,t=o+1;te.polygon)).flat());const I=d?r:null,[y,E]=function(e,t,n,s,i,l,a,r,o,u,c){return"globe"===e.projection.name?function(e,t,n,s,i,l,a,r,o,u,c){const h=[],p=[],d=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],I=(e,t,n,s)=>{e[0]=t,e[1]=n,e[2]=s,e[3]=1},y=rh();n>0&&(n+=y),s+=y;for(const v of t){const t=[],y=[];for(const h of v){const p=h.x+i.x,v=h.y+i.y,E=e.projection.projectTilePoint(p,v,c),w=e.projection.upVector(c,h.x,h.y);let g=n,T=s;if(a){const e=Eh(p,v,n,s,a,r,o,u);g+=e.base,T+=e.top}0!==n?I(f,E.x+w[0]*d*g,E.y+w[1]*d*g,E.z+w[2]*d*g):I(f,E.x,E.y,E.z),I(m,E.x+w[0]*d*T,E.y+w[1]*d*T,E.z+w[2]*d*T),Fr(f,f,l),Fr(m,m,l),t.push(new Ih(f[0],f[1],f[2])),y.push(new Ih(m[0],m[1],m[2]))}h.push(t),p.push(y)}return[h,p]}(e,t,n,s,i,l,a,r,o,u,c):a?function(e,t,n,s,i,l,a,r,o){const u=[],c=[],h=[0,0,0,1];for(const p of e){const e=[],d=[];for(const u of p){const c=u.x+s.x,p=u.y+s.y,f=Eh(c,p,t,n,l,a,r,o);h[0]=c,h[1]=p,h[2]=f.base,h[3]=1,jr(h,h,i),h[3]=Math.max(h[3],1e-5);const m=new Ih(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=c,h[1]=p,h[2]=f.top,h[3]=1,jr(h,h,i),h[3]=Math.max(h[3],1e-5);const I=new Ih(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),d.push(I)}u.push(e),c.push(d)}return[u,c]}(t,n,s,i,l,a,r,o,u):function(e,t,n,s,i){const l=[],a=[],r=i[8]*t,o=i[9]*t,u=i[10]*t,c=i[11]*t,h=i[8]*n,p=i[9]*n,d=i[10]*n,f=i[11]*n;for(const m of e){const e=[],t=[];for(const n of m){const l=n.x+s.x,a=n.y+s.y,m=i[0]*l+i[4]*a+i[12],I=i[1]*l+i[5]*a+i[13],y=i[2]*l+i[6]*a+i[14],v=i[3]*l+i[7]*a+i[15],E=m+r,w=I+o,g=y+u,T=Math.max(v+c,1e-5),b=m+h,R=I+p,S=y+d,D=Math.max(v+f,1e-5);e.push(new Ih(E/T,w/T,g/T)),t.push(new Ih(b/D,R/D,S/D))}l.push(e),a.push(t)}return[l,a]}(t,n,s,i,l)}(l,s,h,c,u,a,I,p,f,l.center.lat,e.tileID.canonical),w=e.queryGeometry;return function(e,t,n){let s=1/0;du(n,t)&&(s=vh(n,t[0]));for(let i=0;i=3)for(let t=0;t{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 wf{constructor(){this.tasks={},this.taskQueue=[],H(["process"],this),this.invoker=new Ef(this.process),this.nextId=0}add(e,t){const n=this.nextId++,s=function(e){let{type:t,isSymbolTile:n,zoom:s}=e;return s=s||0,"message"===t?0:"maybePrepare"!==t||n?"parseTile"!==t||n?"parseTile"===t&&n?300-s:"maybePrepare"===t&&n?400-s:500:200-s:100-s}(t);if(0===s){q();try{e()}finally{}return{cancel:()=>{}}}return this.tasks[n]={fn:e,metadata:t,priority:s,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){q();try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let s=0;s>=1)>1;){const r=t+s>>1,o=n+i>>1;1&e?(s=t,i=n,t=l,n=a):(t=s,n=i,s=l,i=a),l=r,a=o}const r=4*bm;Df[r+0]=t,Df[r+1]=n,Df[r+2]=s,Df[r+3]=i}const Af=new Uint16Array(2178),Cf=new Uint8Array(1089),xf=new Uint16Array(1089);function _f(e){return 0===e?-.03125:32===e?.03125:0}var Of=Hl([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Nf={type:2,extent:ar,loadGeometry:()=>[[new v(0,0),new v(ar+1,0),new v(ar+1,ar+1),new v(0,ar+1),new v(0,0)]]};class Lf{constructor(e,t,n,s,i){this.tileID=e,this.uid=P(),this.uses=0,this.tileSize=t,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=i,this.expiredRequestCount=0,this.state="loading",s&&s.transform&&(this.projection=s.transform.projection)}registerFadeDuration(e){const t=e+this.timeAdded;tt.getLayer(e))).filter(Boolean);if(0!==e.length){s.layers=e,s.stateDependentLayerIds&&(s.stateDependentLayers=s.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)n[t.id]=s}}return n}(e.buckets,t.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const t=this.buckets[e];if(t instanceof rf){if(this.hasSymbolBuckets=!0,!n)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const t=this.buckets[e];if(t instanceof rf&&t.hasRTLText){this.hasRTLText=!0,wl.isLoading()||wl.isLoaded()||"deferred"!==vl()||El();break}}this.queryPadding=0;for(const e in this.buckets){const n=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(n))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new pa}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._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(e){return this.buckets[e.id]}upload(e){for(const n in this.buckets){const t=this.buckets[n];t.uploadPending()&&t.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new vf(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new vf(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new vf(e,this.lineAtlas.image,t.ALPHA),this.lineAtlas.uploaded=!0)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,s,i,l,a,r){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:s,pixelPosMatrix:a,transform:l,params:i,tileTransform:this.tileTransform},e,t,n):{}}querySourceFeatures(e,t){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const s=n.loadVTLayers(),i=t?t.sourceLayer:"",l=s._geojsonTileLayer||s[i];if(!l)return;const a=hi(t&&t.filter),{z:r,x:o,y:u}=this.tileID.canonical,c={z:r,x:o,y:u};for(let h=0;he)n=!1;else if(t)if(this.expirationTime=0;u--){const e=4*u,t=Df[e+0],n=Df[e+1],s=Df[e+2],i=Df[e+3],l=t+s>>1,a=n+i>>1,r=l+a-n,o=a+t-l,c=n*Sf+t,h=i*Sf+s,p=a*Sf+l,d=Math.hypot((Af[2*c+0]+Af[2*h+0])/2-Af[2*p+0],(Af[2*c+1]+Af[2*h+1])/2-Af[2*p+1])>=16;Cf[p]=Cf[p]||(d?1:0),u<1022&&(Cf[p]=Cf[p]||Cf[(n+o>>1)*Sf+(t+r>>1)]||Cf[(i+o>>1)*Sf+(s+r>>1)])}const i=new zl,l=new na;let a=0;function r(e,t){const n=t*Sf+e;return 0===xf[n]&&(i.emplaceBack(Af[2*n+0],Af[2*n+1],e*ar/Rf,t*ar/Rf),xf[n]=++a),xf[n]-1}function o(e,t,n,s,i,a){const u=e+n>>1,c=t+s>>1;if(Math.abs(e-i)+Math.abs(t-a)>1&&Cf[c*Sf+u])o(i,a,e,t,u,c),o(n,s,i,a,u,c);else{const o=r(e,t),u=r(n,s),c=r(i,a);l.emplaceBack(o,u,c)}}return o(0,0,Rf,Rf,Rf,0),o(Rf,Rf,0,0,0,Rf),{vertices:i,indices:l}}(this.tileID.canonical,t);s=e.vertices,i=e.indices}else{s=new zl,i=new na;for(const{x:t,y:i}of n)s.emplaceBack(t,i,0,0);const e=vc(s.int16,void 0,4);for(let t=0;t0&&(a=dr(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,s,t,i,a,l),this._makeGlobeTileDebugTextBuffer(e,s,t,i,a,l)}_globePoint(e,t,n,s,i,l,a){let r=Ao(e,t,n);if(l){const i=1<.5?h=-1:c<-.5&&(h=1);let p=(e/ar+n.x)/i+h,d=(t/ar+n.y)/i;p=(p-o)*s._pixelsPerMercatorPixel+o,d=(d-u)*s._pixelsPerMercatorPixel+u;const f=[p*s.worldSize,d*s.worldSize,0];Fr(f,f,l),r=Eo(r,f,a)}return Fr(r,r,i)}_makeGlobeTileDebugBorderBuffer(e,t,n,s,i,l){const a=new Gl,r=new ua,o=new kl,u=(e,u,c,h,p)=>{const d=(c-e)/(p-1),f=(h-u)/(p-1),m=a.length;for(let I=0;Ic*e+t;for(let p=0;pt[a])return null}else{const r=1/s[a];let o=(e[a]-n[a])*r,u=(t[a]-n[a])*r;if(o>u){const e=o;o=u,u=e}if(o>i&&(i=o),ul)return null}return i}function Bf(e,t,n,s,i,l,a,r,o,u,c){const h=s-e,p=i-t,d=l-n,f=a-e,m=r-t,I=o-n,y=c[1]*I-c[2]*m,v=c[2]*f-c[0]*I,E=c[0]*m-c[1]*f,w=h*y+p*v+d*E;if(Math.abs(w)<1e-15)return null;const g=1/w,T=u[0]-e,b=u[1]-t,R=u[2]-n,S=(T*y+b*v+R*E)*g;if(S<0||S>1)return null;const D=b*d-R*p,A=R*h-T*d,C=T*p-b*h,x=(c[0]*D+c[1]*A+c[2]*C)*g;return x<0||S+x>1?null:(f*D+m*A+I*C)*g}function Hf(e,t,n){return(e-t)/(n-t)}function Uf(e,t,n,s,i,l,a,r,o){const u=1<{const l=s?1:0,a=(e+1)*n-l,r=t*n,o=(t+1)*n-l;i[0]=e*n,i[1]=r,i[2]=a,i[3]=o};let a=new Mf(s);const r=[];for(let o=0;o=1;s/=2){const e=n[n.length-1];a=new Mf(s);for(let t=0;t6&&void 0!==arguments[6]?arguments[6]:1;return Ff([e,t,-100],[n,s,this.maximums[0]*a],i,l)}raycast(e,t,n,s,i,l){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;if(!this.nodeCount)return null;const r=this.raycastRoot(e,t,n,s,i,l,a);if(null==r)return null;const o=[],u=[],c=[],h=[],p=[{idx:0,t:r,nodex:0,nodey:0,depth:0}];for(;p.length>0;){const{idx:r,t:d,nodex:f,nodey:m,depth:I}=p.pop();if(this.leaves[r]){Uf(f,m,I,e,t,n,s,c,h);const r=1<=e[2])return d}continue}let y=0;for(let p=0;p=o[u[n]]&&(u.splice(n,0,p),t=!0);t||(u[y]=p),y++}}for(let e=0;e3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(n&&"mapbox"!==n&&"terrarium"!==n)return j('"'.concat(n,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));this.stride=t.height;const l=this.dim=t.height-2,a=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.encoding=n||"mapbox",this.borderReady=s,!s){for(let e=0;e2&&void 0!==arguments[2]&&arguments[2]&&(e=A(e,-1,this.dim),t=A(t,-1,this.dim));const n=4*this._idx(e,t);return("terrarium"===this.encoding?Wf:jf)(this.pixels[n],this.pixels[n+1],this.pixels[n+2])}static getUnpackVector(e){return Vf[e]}get unpackVector(){return Vf[this.encoding]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const n=[0,0,0,0],s=Yf.getUnpackVector(t);let i=Math.floor((e+s[3])/s[2]);return n[2]=i%256,i=Math.floor(i/256),n[1]=i%256,i=Math.floor(i/256),n[0]=i,n}getPixels(){return new Uu({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let s=t*this.dim,i=t*this.dim+this.dim,l=n*this.dim,a=n*this.dim+this.dim;switch(t){case-1:s=i-1;break;case 1:i=s+1}switch(n){case-1:l=a-1;break;case 1:a=l+1}const r=-t*this.dim,o=-n*this.dim;for(let u=l;u{this.remove(e,i)}),n)),this.data[s].push(i),this.order.push(s),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const n=e.wrapped().key,s=void 0===t?0:this.data[n].indexOf(t),i=this.data[n][s];return this.data[n].splice(s,1),i.timeout&&clearTimeout(i.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const n in this.data)for(const s of this.data[n])e(s.value)||t.push(s);for(const n of t)this.remove(n.value.tileID,n)}}class Xf{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}}Xf.ReadOnly=!1,Xf.ReadWrite=!0,Xf.disabled=new Xf(519,Xf.ReadOnly,[0,1]);const Zf=7680;class Kf{constructor(e,t,n,s,i,l){this.test=e,this.ref=t,this.mask=n,this.fail=s,this.depthFail=i,this.pass=l}}Kf.disabled=new Kf({func:519,mask:0},0,0,Zf,Zf,Zf);class Qf{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}}Qf.Replace=[1,0],Qf.disabled=new Qf(Qf.Replace,Ot.transparent,[!1,!1,!1,!1]),Qf.unblended=new Qf(Qf.Replace,Ot.transparent,[!0,!0,!0,!0]),Qf.alphaBlended=new Qf([1,771],Ot.transparent,[!0,!0,!0,!0]);const Jf=1029,$f=2305;class em{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}}em.disabled=new em(!1,Jf,$f),em.backCCW=new em(!0,Jf,$f),em.backCW=new em(!0,Jf,2304),em.frontCW=new em(!0,1028,2304),em.frontCCW=new em(!0,1028,$f);class tm extends $e{constructor(e,t,n){super(),this.id=e,this._onlySymbols=n,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new qf(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new Pf,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,(()=>{}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return O(this._tiles).map((e=>e.tileID)).sort(nm).map((e=>e.key))}getRenderableIds(e){const t=[];for(const n in this._tiles)this._isIdRenderable(+n,e)&&t.push(this._tiles[n]);return e?t.sort(((e,t)=>{const n=e.tileID,s=t.tileID,i=new v(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),l=new v(s.canonical.x,s.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-s.overscaledZ||l.y-i.y||l.x-i.x})).map((e=>e.tileID.key)):t.map((e=>e.tileID)).sort(nm).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const n=this._tiles[e];n&&("loading"!==n.state&&(n.state=t),this._loadTile(n,this._tileLoaded.bind(this,n,e,t)))}_tileLoaded(e,t,n,s){if(s)if(e.state="errored",404!==s.status)this._source.fire(new Je(s,{tile:e}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform);else e.timeAdded=Xe.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new Qe("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let s=0;s1||(Math.abs(n)>1&&(1===Math.abs(n+i)?n+=i:1===Math.abs(n-i)&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,s),e.neighboringTiles&&e.neighboringTiles[l]&&(e.neighboringTiles[l].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,s){for(const i in this._tiles){let l=this._tiles[i];if(s[i]||!l.hasData()||l.tileID.overscaledZ<=t||l.tileID.overscaledZ>n)continue;let a=l.tileID;for(;l&&l.tileID.overscaledZ>t+1;){const e=l.tileID.scaledTo(l.tileID.overscaledZ-1);l=this._tiles[e.key],l&&l.hasData()&&(a=e)}let r=a;for(;r.overscaledZ>t;)if(r=r.scaledTo(r.overscaledZ-1),e[r.key]){s[a.key]=a;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){const t=e.scaledTo(n),s=this._getLoadedTile(t);if(s)return s}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const n=Math.ceil(e.width/t)+1,s=Math.ceil(e.height/t)+1,i=Math.floor(n*s*5),l="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,i):i,a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(a)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const n in this._tiles){const s=this._tiles[n];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),e[s.tileID.key]=s}this._tiles=e;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t])}}update(e,t,n){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!n)return;let s;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new fh(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(s=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(s=s.filter((e=>this._source.hasTile(e))))):s=[];const i=this._updateRetainedTiles(s);if(sm(this._source.type)&&0!==s.length){const e={},t={},n=Object.keys(i);for(const s of n){const n=i[s],l=this._tiles[s];if(!l||l.fadeEndTime&&l.fadeEndTime<=Xe.now())continue;const a=this.findLoadedParent(n,Math.max(n.overscaledZ-tm.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),e[a.tileID.key]=a.tileID),t[s]=n}const l=s[s.length-1].overscaledZ;for(const s in this._tiles){const e=this._tiles[s];if(i[s]||!e.hasData())continue;let n=e.tileID;for(;n.overscaledZ>l;){n=n.scaledTo(n.overscaledZ-1);const l=this._tiles[n.key];if(l&&l.hasData()&&t[n.key]){i[s]=e.tileID;break}}}for(const s in e)i[s]||(this._coveredTiles[s]=!0,i[s]=e[s])}for(const a in i)this._tiles[a].clearFadeHold();const l=function(e,t){const n=[];for(const s in e)s in t||n.push(s);return n}(this._tiles,i);for(const a of l){const e=this._tiles[a];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+a)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const n={},s=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),i=e[0].overscaledZ,l=Math.max(i-tm.maxOverzooming,this._source.minzoom),a=Math.max(i+tm.maxUnderzooming,this._source.minzoom),r={};for(const o of e){const e=this._addTile(o);t[o.key]=o,e.hasData()||s=this._source.maxzoom){const e=o.children(this._source.maxzoom)[0],n=this.getTile(e);if(n&&n.hasData()){t[e.key]=e;continue}}else{const e=o.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let s=e.wasRequested();for(let i=o.overscaledZ-1;i>=l;--i){const l=o.scaledTo(i);if(n[l.key])break;if(n[l.key]=!0,e=this.getTile(l),!e&&s&&(e=this._addTile(l)),e&&(t[l.key]=l,s=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let n,s=this._tiles[e].tileID;for(;s.overscaledZ>0;){if(s.key in this._loadedParentTiles){n=this._loadedParentTiles[s.key];break}t.push(s.key);const e=s.scaledTo(s.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;s=e}for(const e of t)this._loadedParentTiles[e]=n}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));const n=Boolean(t);if(!n){const n=this.map?this.map.painter:null;t=new Lf(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,n,this._isRaster),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,n||this._source.fire(new Qe("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),n))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,t,n){const s=[],i=this.transform;if(!i)return s;const l="globe"===i.projection.name,a=jo(i.center.lng);for(const r in this._tiles){const o=this._tiles[r];if(n&&o.clearQueryDebugViz(),o.holdingForFade())continue;let u;if(l){const e=o.tileID.canonical;if(0===e.z){const t=[Math.abs(A(a,...im(e,-1))-a),Math.abs(A(a,...im(e,1))-a)];u=[0,2*t.indexOf(Math.min(...t))-1]}else{const t=[Math.abs(A(a,...im(e,-1))-a),Math.abs(A(a,...im(e,0))-a),Math.abs(A(a,...im(e,1))-a)];u=[t.indexOf(Math.min(...t))-1]}}else u=[0];for(const n of u){const l=e.containsTile(o,i,t,n);l&&s.push(l)}}return s}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(const n of t)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(sm(this._source.type))for(const e in this._tiles){const t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=Xe.now())return!0}return!1}setFeatureState(e,t,n){this._state.updateState(e=e||"_geojsonTileLayer",t,n)}removeFeatureState(e,t,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,n)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,n){const s=this._tiles[e];s&&s.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(const n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(+n,"reloading");this._cache.filter((n=>!n.hasDependency(e,t)))}_preloadTiles(e,t){if(!this._sourceLoaded){const n=()=>{this._sourceLoaded&&(this._source.off("data",n),this._preloadTiles(e,t))};return void this._source.on("data",n)}const n=new Map,s=Array.isArray(e)?e:[e],i=this.map.painter.terrain,l=this.usedForTerrain&&i?i.getScaledDemTileSize():this._source.tileSize;for(const a of s){const e=a.coveringTiles({tileSize:l,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const t of e)n.set(t.key,t);this.usedForTerrain&&a.updateElevation(!1)}_(Array.from(n.values()),((e,t)=>{const n=new Lf(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(n,(e=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),t(e,n)}))}),t)}}function nm(e,t){const n=Math.abs(2*e.wrap)-+(e.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||s-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function sm(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function im(e,t){const n=1<5&&void 0!==arguments[5]?arguments[5]:0;const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,s,i,l);const r=this.grid;for(let o=0;o=0&&n[3]>=0&&r.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Yc(new Ip(this.rawTileData)).layers,this.sourceLayerCoder=new gf(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t,n,s){var i=this;this.loadVTLayers();const l=e.params||{},a=hi(l.filter),r=e.tileResult,o=e.transform,u=r.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,((e,t,n,s)=>gu(r.bufferedTilespaceGeometry,e,t,n,s)));c.sort(om);let h=null;o.elevation&&c.length>0&&(h=lm.create(o.elevation,this.tileID));const p={};let d;for(let f=0;f3&&void 0!==arguments[3]?arguments[3]:0;return m||(m=au(t,i.tileID.canonical,e.tileTransform)),n.queryIntersectsFeature(r,t,s,m,i.z,e.transform,e.pixelPosMatrix,h,l)}))}return p}loadMatchingFeature(e,t,n,s,i,l,a,r,o){const{featureIndex:u,bucketIndex:c,sourceLayerIndex:h,layoutVertexArrayOffset:p}=t,d=this.bucketLayerIDs[c];if(s&&!function(e,t){for(let n=0;n=0)return!0;return!1}(s,d))return;const f=this.sourceLayerCoder.decode(h),m=this.vtLayers[f].feature(u);if(n.needGeometry){const e=ru(m,!0);if(!n.filter(new gl(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new gl(this.tileID.overscaledZ),m))return;const I=this.getId(m,f);for(let y=0;y{const a=t instanceof xl?t.get(l):null;return a&&a.evaluate?a.evaluate(n,s,i):a}))}function om(e,t){return t-e}Zi(am,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class um{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Hu({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const n=this.getKey(e,t);return this.positions[n]}trim(){const e=this.width,t=this.height=F(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,n){const s=[];let i=e.length%2==1?-e[e.length-1]*n:0,l=e[0]*n,a=!0;s.push({left:i,right:l,isDash:a,zeroLength:0===e[0]});let r=e[0];for(let o=1;o1&&(a=e[++l]);const o=Math.abs(r-a.left),u=Math.abs(r-a.right),c=Math.min(o,u);let h;const p=i/n*(s+1);if(a.isDash){const e=s-Math.abs(p);h=Math.sqrt(c*c+e*e)}else h=s-Math.sqrt(c*c+p*p);this.image.data[t+r]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let r=e.length-1;r>=0;--r){const t=e[r],n=e[r+1];t.zeroLength?e.splice(r,1):n&&n.isDash===t.isDash&&(n.left=t.left,e.splice(r,1))}const n=e[0],s=e[e.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const i=this.width*this.nextRow;let l=0,a=e[l];for(let r=0;r1&&(a=e[++l]);const n=Math.abs(r-a.left),s=Math.abs(r-a.right),o=Math.min(n,s);this.image.data[i+r]=Math.max(0,Math.min(255,(a.isDash?o:-o)+t+128))}}addDash(e,t){const n=this.getKey(e,t);if(this.positions[n])return this.positions[n];const s="round"===t,i=s?7:0,l=2*i+1;if(this.nextRow+l>this.height)return j("LineAtlas out of space"),null;0===e.length&&e.push(1);let a=0;for(let u=0;u=t.maxzoom||"none"!==t.visibility&&(dm(e,this.zoom,n),(r[t.id]=t.createBucket({index:a.bucketLayerIDs.length,layers:e,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:n})).populate(h,u,this.tileID.canonical,this.tileTransform),a.bucketLayerIDs.push(e.map((e=>e.id))))}}let h,p,d,f;o.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},I=()=>{if(h)return i(h);if(p&&d&&f){const e=new hm(p),t=new Sp(d,f);for(const s in r){const i=r[s];i instanceof rf?(dm(i.layers,this.zoom,n),Ed(i,p,e.positions,d,t.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection)):i.hasPattern&&(i instanceof Dh||i instanceof Ac||i instanceof eh)&&(dm(i.layers,this.zoom,n),i.addFeatures(u,this.tileID.canonical,t.patternPositions,n,this.tileTransform))}this.status="done",i(null,{buckets:O(r).filter((e=>!e.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:o,imageAtlas:t,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?e.positions:null})}},y=G(u.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(y).length?s.send("getGlyphs",{uid:this.uid,stacks:y},((e,t)=>{h||(h=e,p=t,I())}),void 0,!1,m):p={};const v=Object.keys(u.iconDependencies);v.length?s.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"icons"},((e,t)=>{h||(h=e,d=t,I())}),void 0,!1,m):d={};const E=Object.keys(u.patternDependencies);E.length?s.send("getImages",{icons:E,source:this.source,tileID:this.tileID,type:"patterns"},((e,t)=>{h||(h=e,f=t,I())}),void 0,!1,m):f={},I()}}function dm(e,t,n){const s=new gl(t);for(const i of e)i.recalculate(s,n)}class fm{constructor(e){this.entries={},this.scheduler=e}request(e,t,n,s){const i=this.entries[e]=this.entries[e]||{callbacks:[]};if(i.result){const[e,n]=i.result;return this.scheduler?this.scheduler.add((()=>{s(e,n)}),t):s(e,n),()=>{}}return i.callbacks.push(s),i.cancel||(i.cancel=n(((n,s)=>{i.result=[n,s];for(const e of i.callbacks)this.scheduler?this.scheduler.add((()=>{e(n,s)}),t):e(n,s);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{i.result||(i.callbacks=i.callbacks.filter((e=>e!==s)),i.callbacks.length||(i.cancel(),delete this.entries[e]))}}}function mm(e,t,n){const s=JSON.stringify(e.request);return e.data&&(this.deduped.entries[s]={result:[null,e.data]}),this.deduped.request(s,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const s=pe(e.request,((e,s,i,l)=>{e?t(e):s&&t(null,{vectorTile:n?void 0:new Yc(new Ip(s)),rawData:s,cacheControl:i,expires:l})}));return()=>{s.cancel(),t()}}),t)}const Im=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ym{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(1!==s)throw new Error("Got v".concat(s," data when expected v1."));const i=Im[15&n];if(!i)throw new Error("Unrecognized array type.");const[l]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new ym(a,l,i,e)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,s=arguments.length>3?arguments[3]:void 0;if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const i=Im.indexOf(this.ArrayType),l=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,r=(8-a%8)%8;if(i<0)throw new Error("Unexpected typed array class: ".concat(n,"."));s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+r,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+l+a+r),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+r,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return vm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:l,nodeSize:a}=this,r=[0,i.length-1,0],o=[];for(;r.length;){const u=r.pop()||0,c=r.pop()||0,h=r.pop()||0;if(c-h<=a){for(let a=h;a<=c;a++){const r=l[2*a],u=l[2*a+1];r>=e&&r<=n&&u>=t&&u<=s&&o.push(i[a])}continue}const p=h+c>>1,d=l[2*p],f=l[2*p+1];d>=e&&d<=n&&f>=t&&f<=s&&o.push(i[p]),(0===u?e<=d:t<=f)&&(r.push(h),r.push(p-1),r.push(1-u)),(0===u?n>=d:s>=f)&&(r.push(p+1),r.push(c),r.push(1-u))}return o}within(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:l}=this,a=[0,s.length-1,0],r=[],o=n*n;for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=l){for(let n=h;n<=c;n++)Tm(i[2*n],i[2*n+1],e,t)<=o&&r.push(s[n]);continue}const p=h+c>>1,d=i[2*p],f=i[2*p+1];Tm(d,f,e,t)<=o&&r.push(s[p]),(0===u?e-n<=d:t-n<=f)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?e+n>=d:t+n>=f)&&(a.push(p+1),a.push(c),a.push(1-u))}return r}}function vm(e,t,n,s,i,l){if(i-s<=n)return;const a=s+i>>1;Em(e,t,a,s,i,l),vm(e,t,n,s,a-1,1-l),vm(e,t,n,a+1,i,1-l)}function Em(e,t,n,s,i,l){for(;i>s;){if(i-s>600){const a=i-s+1,r=n-s+1,o=Math.log(a),u=.5*Math.exp(2*o/3),c=.5*Math.sqrt(o*u*(a-u)/a)*(r-a/2<0?-1:1);Em(e,t,n,Math.max(s,Math.floor(n-r*u/a+c)),Math.min(i,Math.floor(n+(a-r)*u/a+c)),l)}const a=t[2*n+l];let r=s,o=i;for(wm(e,t,s,n),t[2*i+l]>a&&wm(e,t,s,i);ra;)o--}t[2*s+l]===a?wm(e,t,s,o):(o++,wm(e,t,o,i)),o<=n&&(s=o+1),n<=o&&(i=o-1)}}function wm(e,t,n,s){gm(e,n,s),gm(t,2*n,2*s),gm(t,2*n+1,2*s+1)}function gm(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function Tm(e,t,n,s){const i=e-n,l=t-s;return i*i+l*l}e.ARRAY_TYPE=ur,e.AUTH_ERR_MSG=ve,e.Aabb=so,e.Actor=class{constructor(e,n,s){this.target=e,this.parent=n,this.mapId=s,this.callbacks={},this.cancelCallbacks={},H(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=q()?e:t,this.scheduler=new wf}send(e,t,n,s){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5?arguments[5]:void 0;const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=l,this.callbacks[a]=n);const r=K(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:e,hasCallback:!!n,targetMapId:s,mustQueue:i,sourceMapId:this.mapId,data:Ji(t,r)},r),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"",targetMapId:s,sourceMapId:this.mapId})}}}receive(e){const t=e.data,n=t.id;if(n&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[n];delete this.cancelCallbacks[n],e&&e.cancel()}else if(t.mustQueue||q()){const e=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add((()=>this.processTask(n,t)),e&&e.metadata||{type:"message"})}else this.processTask(n,t)}processTask(e,t){if(""===t.type){const n=this.callbacks[e];delete this.callbacks[e],n&&(t.error?n($i(t.error)):n(null,$i(t.data)))}else{const n=K(this.globalScope)?void 0:[],s=t.hasCallback?(t,s)=>{delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?Ji(t):null,data:Ji(s,n)},n)}:e=>{},i=$i(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,i,s);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],i.source)[e[1]](i,s)}else s(new Error("Could not find function ".concat(t.type)))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.CanonicalTileID=ph,e.Color=Ot,e.ColorMode=Qf,e.CullFaceMode=em,e.DEMData=Yf,e.DataConstantProperty=_l,e.DedupedRequest=fm,e.DepthMode=Xf,e.EXTENT=ar,e.Elevation=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const n=t.getSource().maxzoom,s=1<1&&void 0!==arguments[1]?arguments[1]:0;return this.getAtPoint(e,t)||0}getAtPoint(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.isUsingMockSource())return null;null==t&&(t=null);const s=this._source();if(!s)return t;if(e.y<0||e.y>1)return t;const i=s.getSource().maxzoom,l=1<{const l=this.getAtTileOffset(e,i.x,i.y),a=s.upVector(e.canonical,i.x,i.y);return Or(a,a,l*s.upVectorScale(e.canonical,t,n).metersToTile),a}}getForTilePoints(e,t,n,s){if(this.isUsingMockSource())return!1;const i=lm.create(this,e,s);return!!i&&(t.forEach((e=>{e[2]=this.exaggeration()*i.getElevationAt(e[0],e[1],n)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const n=t.dem.tree,s=t.tileID,i=1<{let s=e===l-1?e-2:0===e?e:e-1;return s+=n?24575:0,[s,t]};for(let u=0;uthis._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,t){if(!Ee(e))return e;const n=Se(e);return n.path="/styles/v1".concat(n.path),this._makeAPIURL(n,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!Ee(e))return e;const n=Se(e);return n.path="/fonts/v1".concat(n.path),this._makeAPIURL(n,this._customAccessToken||t)}normalizeSourceURL(e,t,n,s){if(!Ee(e))return e;const i=Se(e);return i.path="/v4/".concat(i.authority,".json"),i.params.push("secure"),n&&i.params.push("language=".concat(n)),s&&i.params.push("worldview=".concat(s)),this._makeAPIURL(i,this._customAccessToken||t)}normalizeSpriteURL(e,t,n,s){const i=Se(e);return Ee(e)?(i.path="/styles/v1".concat(i.path,"/sprite").concat(t).concat(n),this._makeAPIURL(i,this._customAccessToken||s)):(i.path+="".concat(t).concat(n),De(i))}normalizeTileURL(e,t,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!Ee(e))return e;const s=Se(e);s.path=s.path.replace(/(\.(png|jpg)\d*)(?=$)/,"".concat(t||n&&"raster"!==s.authority&&512===n?"@2x":"").concat(l.supported?".webp":"$1")),"raster"===s.authority?s.path="/".concat(i.RASTER_URL_PREFIX).concat(s.path):(s.path=s.path.replace(/^.+\/v4\//,"/"),s.path="/".concat(i.TILE_URL_VERSION).concat(s.path));const a=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(s.params)||i.ACCESS_TOKEN;return i.REQUIRE_ACCESS_TOKEN&&a&&this._skuToken&&s.params.push("sku=".concat(this._skuToken)),this._makeAPIURL(s,a)}canonicalizeTileURL(e,t){const n=Se(e);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return e;let s="mapbox://";n.path.match(/^\/raster\/v1\//)?s+="raster/".concat(n.path.replace("/".concat(i.RASTER_URL_PREFIX,"/"),"")):s+="tiles/".concat(n.path.replace("/".concat(i.TILE_URL_VERSION,"/"),""));let l=n.params;return t&&(l=l.filter((e=>!e.match(/^access_token=/)))),l.length&&(s+="?".concat(l.join("&"))),s}canonicalizeTileset(e,t){const n=!!t&&Ee(t),s=[];for(const i of e.tiles||[])we(i)?s.push(this.canonicalizeTileURL(i,n)):s.push(i);return s}_makeAPIURL(e,t){const n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",s=Se(i.API_URL);if(e.protocol=s.protocol,e.authority=s.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==s.path&&(e.path="".concat(s.path).concat(e.path)),!i.REQUIRE_ACCESS_TOKEN)return De(e);if(t=t||i.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error("An API access token is required to use Mapbox GL. ".concat(n));if("s"===t[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ".concat(n))}return e.params=e.params.filter((e=>-1===e.indexOf("access_token"))),e.params.push("access_token=".concat(t||"")),De(e)}},e.ResourceType=oe,e.SegmentVector=lr,e.SourceCache=tm,e.StencilMode=Kf,e.StructArrayLayout1ui2=ua,e.StructArrayLayout2f1f2i16=$l,e.StructArrayLayout2i4=Gl,e.StructArrayLayout2ui4=oa,e.StructArrayLayout3f12=ta,e.StructArrayLayout3ui6=na,e.StructArrayLayout4i8=zl,e.StructArrayLayout5f20=aa,e.Texture=vf,e.Tile=Lf,e.Transitionable=Rl,e.Uniform1f=Fa,e.Uniform1i=class extends Ma{constructor(e){super(e),this.current=0}set(e,t,n){this.fetchUniformLocation(e,t)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},e.Uniform2f=class extends Ma{constructor(e){super(e),this.current=[0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}},e.Uniform3f=class extends Ma{constructor(e){super(e),this.current=[0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(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])))}},e.Uniform4f=Ba,e.UniformColor=Ha,e.UniformMatrix2f=class extends Ma{constructor(e){super(e),this.current=ka}set(e,t,n){if(this.fetchUniformLocation(e,t))for(let s=0;s<4;s++)if(n[s]!==this.current[s]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}},e.UniformMatrix3f=class extends Ma{constructor(e){super(e),this.current=Ga}set(e,t,n){if(this.fetchUniformLocation(e,t))for(let s=0;s<9;s++)if(n[s]!==this.current[s]){this.current=n,this.gl.uniformMatrix3fv(this.location,!1,n);break}}},e.UniformMatrix4f=class extends Ma{constructor(e){super(e),this.current=Ua}set(e,t,n){if(this.fetchUniformLocation(e,t)){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 e=1;e<16;e++)if(n[e]!==this.current[e]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}},e.UnwrappedTileID=dh,e.ValidationError=ni,e.VectorTileFeature=qc,e.VectorTileWorkerSource=class extends $e{constructor(e,t,n,s,i){super(),this.actor=e,this.layerIndex=t,this.availableImages=n,this.loadVectorData=i||mm,this.loading={},this.loaded={},this.deduped=new fm(e.scheduler),this.isSpriteLoaded=s,this.scheduler=e.scheduler}loadTile(e,t){const n=e.uid,s=e&&e.request,i=s&&s.collectResourceTiming,l=this.loading[n]=new pm(e);l.abort=this.loadVectorData(e,((a,r)=>{const o=!this.loading[n];if(delete this.loading[n],o||a||!r)return l.status="done",o||(this.loaded[n]=l),t(a);const u=r.rawData,c={};r.expires&&(c.expires=r.expires),r.cacheControl&&(c.cacheControl=r.cacheControl),l.vectorTile=r.vectorTile||new Yc(new Ip(u));const h=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,n)=>{if(e||!n)return t(e);const l={};if(i){const e=Ve(s);e.length>0&&(l.resourceTiming=JSON.parse(JSON.stringify(e)))}t(null,N({rawTileData:u.slice(0)},n,c,l))}))};this.isSpriteLoaded?h():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):h()})),this.loaded=this.loaded||{},this.loaded[n]=l}))}reloadTile(e,t){const n=this.loaded,s=e.uid,i=this;if(n&&n[s]){const l=n[s];l.showCollisionBoxes=e.showCollisionBoxes,l.enableTerrain=!!e.enableTerrain,l.projection=e.projection,l.tileTransform=_d(e.tileID.canonical,e.projection);const a=(e,n)=>{const s=l.reloadCallback;s&&(delete l.reloadCallback,l.parse(l.vectorTile,i.layerIndex,this.availableImages,i.actor,s)),t(e,n)};"parsing"===l.status?l.reloadCallback=a:"done"===l.status&&(l.vectorTile?l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(e,t){const n=e.uid,s=this.loading[n];s&&(s.abort&&s.abort(),delete this.loading[n]),t()}removeTile(e,t){const n=this.loaded,s=e.uid;n&&n[s]&&delete n[s],t()}},e.WritingMode=Dp,e.ZoomDependentExpression=Js,e.add=Dr,e.addDynamicAttributes=nf,e.adjoint=function(e,t){var n=t[0],s=t[1],i=t[2],l=t[3],a=t[4],r=t[5],o=t[6],u=t[7],c=t[8];return e[0]=a*c-r*u,e[1]=i*u-s*c,e[2]=s*r-i*a,e[3]=r*o-l*c,e[4]=n*c-i*o,e[5]=i*l-n*r,e[6]=l*u-a*o,e[7]=s*o-n*u,e[8]=n*a-s*l,e},e.asyncAll=_,e.bezier=S,e.bindAll=H,e.boundsAttributes=Of,e.bufferConvexPolygon=function(e,t){const n=[];for(let s=0;sse&&(e.getActor().send("enforceCacheSizeLimit",ne),re=0)},e.calculateGlobeLabelMatrix=function(e,t){const{x:n,y:s}=e.point,i=No(n,s,e.worldSize/e._pixelsPerMercatorPixel,0,0);return fr(i,i,Oo(vo(t)))},e.calculateGlobeMatrix=function(e){const{x:t,y:n}=e.point,{lng:s,lat:i}=e._center;return No(t,n,e.worldSize,s,i)},e.calculateGlobeMercatorMatrix=function(e){const t=e.pixelsPerMeter,n=t/Yo(1,e.center.lat),s=pr(new Float64Array(16));return mr(s,s,[e.point.x,e.point.y,0]),Ir(s,s,[n,n,t]),Float32Array.from(s)},e.circumferenceAtLatitude=Vo,e.clamp=A,e.clearTileCache=function(e){if(!ie())return;const n=t.caches.delete($);e&&n.catch(e).then((()=>e()))},e.clipLine=Kp,e.clone=function(e){var t=new ur(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=z,e.collisionCircleLayout=Bh,e.config=i,e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.create=function(){var e=new ur(16);return ur!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=cr,e.createExpression=Ks,e.createLayout=Hl,e.createStyleLayer=function(e){return"custom"===e.type?new ff(e):new yf[e.type](e)},e.cross=Mr,e.degToRad=g,e.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},e.div=function(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e},e.dot=Pr,e.earthRadius=Uo,e.ease=D,e.easeCubicInOut=R,e.ecefToLatLng=function(e){let[t,n,s]=e;const i=Math.hypot(t,n,s),l=Math.atan2(t,s),a=.5*Math.PI-Math.acos(-n/i);return new zo(T(l),T(a))},e.emitValidationErrors=Vi,e.endsWith=U,e.enforceCacheSizeLimit=function(e){le(),ee&&ee.then((t=>{t.keys().then((n=>{for(let s=0;sl&&(s+=(e[i]-l)*(e[i]-l)),t[i]0){const e=180/s;hr(d,d,[e/u+1,0,0,0,e/c+1,0,-.5*e/h,.5*e/p,1])}return d[2]=o,d[5]=e.x,d[8]=e.y,d},e.getImage=ye,e.getJSON=function(e,t){return he(N(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){const t=Ko-5;e=A(e,-t,t)/t*90;const n=Math.pow(Math.abs(Math.sin(g(e))),3);return Math.round(n*(uo.length-1))},e.getMapSessionAPI=Be,e.getPerformanceMeasurement=Ve,e.getProjection=Qd,e.getRTLTextPluginStatus=vl,e.getReferrer=ce,e.getTilePoint=function(e,t){let{x:n,y:s}=t;return new v(((n-(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0))*e.scale-e.x)*ar,(s*e.scale-e.y)*ar)},e.getTileVec3=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Sr(((t.x-n)*e.scale-e.x)*ar,(t.y*e.scale-e.y)*ar,Zo(t.z,t.y))},e.getVideo=function(e,n){const s=t.document.createElement("video");s.muted=!0,s.onloadstart=function(){n(null,s)};for(let i=0;i{}}},e.globeCenterToScreenPoint=function(e){const t=[0,0,0],n=pr(new Float64Array(16));return fr(n,e.pixelMatrix,e.globeMatrix),Fr(t,t,n),new v(t[0],t[1])},e.globeDenormalizeECEF=Oo,e.globeECEFOrigin=function(e,t){const n=[0,0,0];return Fr(n,n,_o(vo(t.canonical))),Fr(n,n,e),n},e.globeMetersToEcef=fo,e.globeNormalizeECEF=_o,e.globePixelsToTileUnits=function(e,t){return ar/(512*Math.pow(2,e))*Co(vo(t))},e.globePoleMatrixForTile=function(e,t,n){const s=pr(new Float64Array(16)),i=(t/(1<0;return 0===s&&!i&&!a&&l},e.identity=pr,e.identity$1=Yr,e.invert=dr,e.isFullscreen=function(){return!!t.document.fullscreenElement||!!t.document.webkitFullscreenElement},e.isLngLatBehindGlobe=Mo,e.isMapAuthenticated=function(e){return He.has(e)},e.isMapboxURL=Ee,e.isSafariWithAntialiasingBug=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!K(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.latFromMercatorY=Xo,e.latLngToECEF=Do,e.len=kr,e.length=Rr,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=qo,e.loadVectorTile=mm,e.makeRequest=he,e.mapValue=function(e,t,n,s,i){return A((e-t)/(n-t)*(i-s)+s,s,i)},e.mercatorScale=Qo,e.mercatorXfromLng=jo,e.mercatorYfromLat=Wo,e.mercatorZfromAltitude=Yo,e.mul=gr,e.mul$1=Gr,e.multiply=fr,e.multiply$1=hr,e.multiply$2=Cr,e.nextPowerOfTwo=F,e.normalize=Lr,e.normalize$1=Zr,e.normalize$2=Vr,e.number=Nn,e.ortho=function(e,t,n,s,i,l,a){var r=1/(t-n),o=1/(s-i),u=1/(l-a);return e[0]=-2*r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*r,e[13]=(i+s)*o,e[14]=(a+l)*u,e[15]=1,e},e.pbf=Xh,e.perspective=function(e,t,n,s,i){var l,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(e[10]=(i+s)*(l=1/(s-i)),e[14]=2*i*s*l):(e[10]=-1,e[14]=-2*s),e},e.pick=function(e,t){const n={};for(let s=0;s0&&n[0]<=e.width&&n[1]>0&&n[1]<=e.height&&!Mo(e,new zo(e.center.lat,90)),s[0]>0&&s[0]<=e.width&&s[1]>0&&s[1]<=e.height&&!Mo(e,new zo(e.center.lat,-90))]},e.polygonContainsPoint=wu,e.polygonIntersectsBox=gu,e.polygonIntersectsPolygon=hu,e.polygonizeBounds=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const i=new v(n,n),l=e.sub(i),a=t.add(i),r=[l,new v(a.x,l.y),a,new v(l.x,a.y)];return s&&r.push(l.clone()),r},e.posAttributes=$r,e.postMapLoadEvent=Le,e.postPerformanceEvent=Me,e.postTurnstileEvent=Oe,e.potpack=Tp,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=T,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:dl,pluginURL:fl}),yl.on("pluginStateChange",e),e},e.removeAuthState=function(e){He.delete(e)},e.renderColorRamp=ku,e.resample=eu,e.rotateX=yr,e.rotateX$1=qr,e.rotateY=vr,e.rotateY$1=Xr,e.rotateZ=function(e,t,n){var s=Math.sin(n),i=Math.cos(n),l=t[0],a=t[1],r=t[2],o=t[3],u=t[4],c=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=l*i+u*s,e[1]=a*i+c*s,e[2]=r*i+h*s,e[3]=o*i+p*s,e[4]=u*i-l*s,e[5]=c*i-a*s,e[6]=h*i-r*s,e[7]=p*i-o*s,e},e.rotateZ$1=function(e,t,n){n*=.5;var s=t[0],i=t[1],l=t[2],a=t[3],r=Math.sin(n),o=Math.cos(n);return e[0]=s*o+i*r,e[1]=i*o-s*r,e[2]=l*o+a*r,e[3]=a*o-l*r,e},e.scale=Ir,e.scale$1=zr,e.scale$2=Or,e.scaleAndAdd=Nr,e.set=function(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e},e.setCacheLimits=function(e,t){ne=e,se=t},e.setColumn=function(e,t,n){e[4*t+0]=n[0],e[4*t+1]=n[1],e[4*t+2]=n[2],e[4*t+3]=n[3]},e.setRTLTextPlugin=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(dl===ul||dl===cl||dl===hl)throw new Error("setRTLTextPlugin cannot be called multiple times.");fl=Xe.resolveURL(e),dl=ul,pl=t,Il(),n||El()},e.smoothstep=C,e.spec=et,e.squaredLength=function(e){var t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s},e.storeAuthState=function(e,t){t?He.add(e):He.delete(e)},e.sub=Ur,e.subtract=Ar,e.symbolSize=Vh,e.tileAABB=function(e,t,n,s,i,l,a,r,o){if("globe"===o.name)return To(e,t,new ph(n,s,i));const u=_d({z:n,x:s,y:i},o);return new so([(l+u.x/u.scale)*t,t*(u.y/u.scale),a],[(l+u.x2/u.scale)*t,t*(u.y2/u.scale),r])},e.tileCornersToBounds=bo,e.tileTransform=_d,e.transformMat3=function(e,t,n){var s=t[0],i=t[1],l=t[2];return e[0]=s*n[0]+i*n[3]+l*n[6],e[1]=s*n[1]+i*n[4]+l*n[7],e[2]=s*n[2]+i*n[5]+l*n[8],e},e.transformMat4=Fr,e.transformMat4$1=jr,e.transformQuat=Br,e.transitionTileAABBinECEF=wo,e.translate=mr,e.transpose=function(e,t){if(e===t){var n=t[1],s=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},e.triggerPluginCompletionEvent=ml,e.uniqueId=P,e.updateGlobeVertexNormal=function(e,t,n,s,i){const l=5*t+2;e.float32[l+0]=n,e.float32[l+1]=s,e.float32[l+2]=i},e.validateCustomStyleLayer=function(e){const t=[],n=e.id;return void 0===n&&t.push({message:"layers.".concat(n,': missing required property "id"')}),void 0===e.render&&t.push({message:"layers.".concat(n,': missing required method "render"')}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:"layers.".concat(n,': property "renderingMode" must be either "2d" or "3d"')}),t},e.validateFilter=e=>zi(bi(e)),e.validateFog=e=>zi(Mi(e)),e.validateLayer=e=>zi(Ci(e)),e.validateLight=e=>zi(Li(e)),e.validateSource=e=>zi(Oi(e)),e.validateStyle=Ui,e.validateTerrain=e=>zi(Pi(e)),e.values=O,e.vectorTile=Pc,e.version=n,e.warnOnce=j,e.window=t,e.wrap=x})),s(["./shared"],(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let n="[";for(const s of e)n+="".concat(t(s),",");return"".concat(n,"]")}let n="{";for(const s of Object.keys(e).sort())n+="".concat(s,":").concat(t(e[s]),",");return"".concat(n,"}")}function n(n){let s="";for(const i of e.refProperties)s+="/".concat(t(n[i]));return s}class s{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,s){for(const n of t)this._layerConfigs[n.id]=n,(this._layers[n.id]=e.createStyleLayer(n)).compileFilter(),this.keyCache[n.id]&&delete this.keyCache[n.id];for(const e of s)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const i=function(e,t){const s={};for(let l=0;lthis._layers[e.id])),n=t[0];if("none"===n.visibility)continue;const s=n.source||"";let i=this.familiesBySource[s];i||(i=this.familiesBySource[s]={});const l=n.sourceLayer||"_geojsonTileLayer";let a=i[l];a||(a=i[l]=[]),a.push(t)}}}class i{loadTile(t,n){const{uid:s,encoding:i,rawImageData:l,padding:a,buildQuadTree:r}=t,o=e.window.ImageBitmap&&l instanceof e.window.ImageBitmap?this.getImageData(l,a):l;n(null,new e.DEMData(s,o,i,a<1,r))}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const n=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),n}}function l(e,t){if(0!==e.length){a(e[0],t);for(var n=1;n=Math.abs(r)?n-o+r:r-o+n,n=o}n+s>=0!=!!t&&e.reverse()}var r=e.getDefaultExportFromCjs((function e(t,n){var s,i=t&&t.type;if("FeatureCollection"===i)for(s=0;s>31}function b(e,t){for(var n=e.loadGeometry(),s=e.type,i=0,l=0,a=n.length,r=0;re},A=Math.fround||(C=new Float32Array(1),e=>(C[0]=+e,C[0]));var C;const x=3,_=5,O=6;class N{constructor(e){this.options=Object.assign(Object.create(D),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:n,maxZoom:s}=this.options;t&&console.time("total time");const i="prepare ".concat(e.length," points");t&&console.time(i),this.points=e;const l=[];for(let r=0;r=n;r--){const e=+Date.now();a=this.trees[r]=this._createTree(this._cluster(a,r)),t&&console.log("z%d: %d clusters in %dms",r,a.numItems,+Date.now()-e)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,e[1]));let i=180===e[2]?180:((e[2]+180)%360+360)%360-180;const l=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){const e=this.getClusters([n,s,180,l],t),a=this.getClusters([-180,s,i,l],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],r=a.range(M(n),F(l),M(i),F(s)),o=a.data,u=[];for(const c of r){const e=this.stride*c;u.push(o[e+_]>1?L(o,e,this.clusterProps):this.points[o[e+x]])}return u}getChildren(e){const t=this._getOriginId(e),n=this._getOriginZoom(e),s="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(s);const l=i.data;if(t*this.stride>=l.length)throw new Error(s);const a=this.options.radius/(this.options.extent*Math.pow(2,n-1)),r=i.within(l[t*this.stride],l[t*this.stride+1],a),o=[];for(const u of r){const t=u*this.stride;l[t+4]===e&&o.push(l[t+_]>1?L(l,t,this.clusterProps):this.points[l[t+x]])}if(0===o.length)throw new Error(s);return o}getLeaves(e,t,n){const s=[];return this._appendLeaves(s,e,t=t||10,n=n||0,0),s}getTile(e,t,n){const s=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:l,radius:a}=this.options,r=a/l,o=(n-r)/i,u=(n+1+r)/i,c={features:[]};return this._addTileFeatures(s.range((t-r)/i,o,(t+1+r)/i,u),s.data,t,n,i,c),0===t&&this._addTileFeatures(s.range(1-r/i,o,1,u),s.data,i,n,i,c),t===i-1&&this._addTileFeatures(s.range(0,o,r/i,u),s.data,-1,n,i,c),c.features.length?c:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const n=this.getChildren(e);if(t++,1!==n.length)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,s,i){const l=this.getChildren(t);for(const a of l){const t=a.properties;if(t&&t.cluster?i+t.point_count<=s?i+=t.point_count:i=this._appendLeaves(e,t.cluster_id,n,s,i):i1;let o,u,c;if(r)o=P(t,e,this.clusterProps),u=t[e],c=t[e+1];else{const n=this.points[t[e+x]];o=n.properties;const[s,i]=n.geometry.coordinates;u=M(s),c=F(i)}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-n)),Math.round(this.options.extent*(c*i-s))]],tags:o};let p;p=r||this.options.generateId?t[e+x]:this.points[t[e+x]].id,void 0!==p&&(h.id=p),l.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:n,extent:s,reduce:i,minPoints:l}=this.options,a=n/(s*Math.pow(2,t)),r=e.data,o=[],u=this.stride;for(let c=0;ct&&(d+=r[n+_])}if(d>p&&d>=l){let e,l=n*p,a=s*p,f=-1;const m=((c/u|0)<<5)+(t+1)+this.points.length;for(const n of h){const s=n*u;if(r[s+2]<=t)continue;r[s+2]=t;const o=r[s+_];l+=r[s]*o,a+=r[s+1]*o,r[s+4]=m,i&&(e||(e=this._map(r,c,!0),f=this.clusterProps.length,this.clusterProps.push(e)),i(e,this._map(r,s)))}r[c+4]=m,o.push(l/d,a/d,1/0,m,-1,d),i&&o.push(f)}else{for(let e=0;e1)for(const e of h){const n=e*u;if(!(r[n+2]<=t)){r[n+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,n){if(e[t+_]>1){const s=this.clusterProps[e[t+O]];return n?Object.assign({},s):s}const s=this.points[e[t+x]].properties,i=this.options.map(s);return n&&i===s?Object.assign({},i):i}}function L(e,t,n){return{type:"Feature",id:e[t+x],properties:P(e,t,n),geometry:{type:"Point",coordinates:[(s=e[t],360*(s-.5)),B(e[t+1])]}};var s}function P(e,t,n){const s=e[t+_],i=s>=1e4?"".concat(Math.round(s/1e3),"k"):s>=1e3?Math.round(s/100)/10+"k":s,l=e[t+O],a=-1===l?{}:Object.assign({},n[l]);return Object.assign(a,{cluster:!0,cluster_id:e[t+x],point_count:s,point_count_abbreviated:i})}function M(e){return e/360+.5}function F(e){const t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function B(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function H(e,t,n,s){for(var i,l=s,a=n-t>>1,r=n-t,o=e[t],u=e[t+1],c=e[n],h=e[n+1],p=t+3;pl)i=p,l=d;else if(d===l){var f=Math.abs(p-a);fs&&(i-t>3&&H(e,t,i,s),e[i+2]=l,n-i>3&&H(e,i,n,s))}function U(e,t,n,s,i,l){var a=i-n,r=l-s;if(0!==a||0!==r){var o=((e-n)*a+(t-s)*r)/(a*a+r*r);o>1?(n=i,s=l):o>0&&(n+=a*o,s+=r*o)}return(a=e-n)*a+(r=t-s)*r}function G(e,t,n,s){var i={id:void 0===e?null:e,type:t,geometry:n,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)k(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var s=0;s0&&(a+=s?(i*u-o*l)/2:Math.sqrt(Math.pow(o-i,2)+Math.pow(u-l,2))),i=o,l=u}var c=t.length-3;t[2]=1,H(t,0,c,n),t[c+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function W(e,t,n,s){for(var i=0;i1?1:n}function X(e,t,n,s,i,l,a,r){if(s/=t,l>=(n/=t)&&a=s)return null;for(var o=[],u=0;u=n&&f=s)){var m=[];if("Point"===p||"MultiPoint"===p)Z(h,m,n,s,i);else if("LineString"===p)K(h,m,n,s,i,!1,r.lineMetrics);else if("MultiLineString"===p)J(h,m,n,s,i,!1);else if("Polygon"===p)J(h,m,n,s,i,!0);else if("MultiPolygon"===p)for(var I=0;I=n&&a<=s&&(t.push(e[l]),t.push(e[l+1]),t.push(e[l+2]))}}function K(e,t,n,s,i,l,a){for(var r,o,u=Q(e),c=0===i?ee:te,h=e.start,p=0;pn&&(o=c(u,d,f,I,y,n),a&&(u.start=h+r*o)):v>s?E=n&&(o=c(u,d,f,I,y,n),w=!0),E>s&&v<=s&&(o=c(u,d,f,I,y,s),w=!0),!l&&w&&(a&&(u.end=h+r*o),t.push(u),u=Q(e)),a&&(h+=r)}var g=e.length-3;d=e[g],f=e[g+1],m=e[g+2],(v=0===i?d:f)>=n&&v<=s&&$(u,d,f,m),g=u.length-3,l&&g>=3&&(u[g]!==u[0]||u[g+1]!==u[1])&&$(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Q(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function J(e,t,n,s,i,l){for(var a=0;aa.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function re(e,t,n,s){var i=t.geometry,l=t.type,a=[];if("Point"===l||"MultiPoint"===l)for(var r=0;r0&&t.size<(i?a:s))n.numPoints+=t.length/3;else{for(var r=[],o=0;oa)&&(n.numSimplified++,r.push(t[o]),r.push(t[o+1])),n.numPoints++;i&&function(e,t){for(var n=0,s=0,i=e.length,l=i-2;s0===t)for(s=0,i=e.length;s24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var s=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var s=0;s1&&console.time("creation"),p=this.tiles[h]=ae(e,t,n,s,o),this.tileCoords.push({z:t,x:n,y:s}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,s,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+t;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=e,i){if(t===o.maxZoom||t===i)continue;var f=1<1&&console.time("clipping");var m,I,y,v,E,w,g=.5*o.buffer/o.extent,T=.5-g,b=.5+g,R=1+g;m=I=y=v=null,E=X(e,c,n-g,n+b,0,p.minX,p.maxX,o),w=X(e,c,n+T,n+R,0,p.minX,p.maxX,o),e=null,E&&(m=X(E,c,s-g,s+b,1,p.minY,p.maxY,o),I=X(E,c,s+T,s+R,1,p.minY,p.maxY,o),E=null),w&&(y=X(w,c,s-g,s+b,1,p.minY,p.maxY,o),v=X(w,c,s+T,s+R,1,p.minY,p.maxY,o),w=null),u>1&&console.timeEnd("clipping"),r.push(m||[],t+1,2*n,2*s),r.push(I||[],t+1,2*n,2*s+1),r.push(y||[],t+1,2*n+1,2*s),r.push(v||[],t+1,2*n+1,2*s+1)}}},ue.prototype.getTile=function(e,t,n){var s=this.options,i=s.extent,l=s.debug;if(e<0||e>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var o,u=e,c=t,h=n;!o&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),o=this.tiles[ce(u,c,h)];return o&&o.source?(l>1&&console.log("found parent tile z%d-%d-%d",u,c,h),l>1&&console.time("drilling down"),this.splitTile(o.source,u,c,h,e,t,n),l>1&&console.timeEnd("drilling down"),this.tiles[r]?ie(this.tiles[r],i):null):null};class pe extends e.VectorTileWorkerSource{constructor(e,t,n,s,i){super(e,t,n,s,he),i&&(this.loadGeoJSON=i)}loadData(t,n){const s=t&&t.request,i=s&&s.collectResourceTiming;this.loadGeoJSON(t,((l,a)=>{if(l||!a)return n(l);if("object"!=typeof a)return n(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));{r(a,!0);try{if(t.filter){const n=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw new Error(n.value.map((e=>"".concat(e.key,": ").concat(e.message))).join(", "));const s=a.features.filter((e=>n.value.evaluate({zoom:0},e)));a={type:"FeatureCollection",features:s}}this._geoJSONIndex=t.cluster?new N(function(t){let{superclusterOptions:n,clusterProperties:s}=t;if(!s||!n)return n;const i={},l={},a={accumulated:null,zoom:0},r={properties:null},o=Object.keys(s);for(const u of o){const[t,n]=s[u],a=e.createExpression(n),r=e.createExpression("string"==typeof t?[t,["accumulated"],["get",u]]:t);i[u]=a.value,l[u]=r.value}return n.map=e=>{r.properties=e;const t={};for(const n of o)t[n]=i[n].evaluate(a,r);return t},n.reduce=(e,t)=>{r.properties=t;for(const n of o)a.accumulated=e[n],e[n]=l[n].evaluate(a,r)},n}(t)).load(a.features):function(e,t){return new ue(e,t)}(a,t.geojsonVtOptions)}catch(l){return n(l)}this.loaded={};const o={};if(i){const n=e.getPerformanceMeasurement(s);n&&(o.resourceTiming={},o.resourceTiming[t.source]=JSON.parse(JSON.stringify(n)))}n(null,o)}}))}reloadTile(e,t){const n=this.loaded;return n&&n[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,n){if(t.request)e.getJSON(t.request,n);else{if("string"!=typeof t.data)return n(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));try{return n(null,JSON.parse(t.data))}catch(e){return n(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class de{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:"mercator"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:pe},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error('Worker source with name "'.concat(e,'" already registered.'));this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,n){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],n()}checkIfReady(e,t,n){n()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,n){this.isSpriteLoaded[t]=n;for(const s in this.workerSources[t]){const i=this.workerSources[t][s];for(const t in i)i[t]instanceof e.VectorTileWorkerSource&&(i[t].isSpriteLoaded=n,i[t].fire(new e.Event("isSpriteLoaded")))}}setImages(e,t,n){this.availableImages[e]=t;for(const s in this.workerSources[e]){const n=this.workerSources[e][s];for(const e in n)n[e].availableImages=t}n()}enableTerrain(e,t,n){this.terrain=t,n()}setProjection(t,n){this.projections[t]=e.getProjection(n)}setLayers(e,t,n){this.getLayerIndex(e).replace(t),n()}updateLayers(e,t,n){this.getLayerIndex(e).update(t.layers,t.removedIds),n()}loadTile(t,n,s){const i=this.enableTerrain?e.extend({enableTerrain:this.terrain},n):n;i.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,n.type,n.source).loadTile(i,s)}loadDEMTile(t,n,s){const i=this.enableTerrain?e.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(t,n.source).loadTile(i,s)}reloadTile(t,n,s){const i=this.enableTerrain?e.extend({enableTerrain:this.terrain},n):n;i.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,n.type,n.source).reloadTile(i,s)}abortTile(e,t,n){this.getWorkerSource(e,t.type,t.source).abortTile(t,n)}removeTile(e,t,n){this.getWorkerSource(e,t.type,t.source).removeTile(t,n)}removeSource(e,t,n){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const s=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==s.removeSource?s.removeSource(t,n):n()}loadWorkerSource(e,t,n){try{this.self.importScripts(t.url),n()}catch(e){n(e.toString())}}syncRTLPluginState(t,n,s){try{e.plugin.setState(n);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const n=e.plugin.isParsed();s(n?void 0:new Error("RTL Text Plugin failed to import scripts from ".concat(t)),n)}}catch(e){s(e.toString())}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new s),t}getWorkerSource(e,t,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][n]){const s={send:(t,n,s,i,l,a)=>{this.actor.send(t,n,s,e,l,a)},scheduler:this.actor.scheduler};this.workerSources[e][t][n]=new this.workerSourceTypes[t](s,this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])}return this.workerSources[e][t][n]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new i),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,n){e.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(e,t,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new de(self)),de})),s(["./shared"],(function(e){function t(e,n){if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(let s=0;s{e.window.removeEventListener("click",p,!0)}),0)}function f(e,t){const n=e.getBoundingClientRect();return y(e,n,t)}function m(e,t){const n=e.getBoundingClientRect(),s=[];for(let i=0;i=0?0:t.button}function y(t,n,s){const i=t.offsetWidth===n.width?1:t.offsetWidth/n.width;return new e.Point((s.clientX-n.left)*i,(s.clientY-n.top)*i)}function v(e,t){var n=t[0],s=t[1],i=t[2],l=t[3],a=n*l-i*s;return a?(e[0]=l*(a=1/a),e[1]=-s*a,e[2]=-i*a,e[3]=n*a,e):null}function E(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class w extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}hasImage(e){return!!this.getImage(e)}getImage(e){return this.images[e]}addImage(e,t){this._validate(e,t)&&(this.images[e]=t)}_validate(t,n){let s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchX" value')))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchY" value')))),s=!1),this._validateContent(n.content,n)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "content" value')))),s=!1),s}_validateStretch(e,t){if(!e)return!0;let n=0;for(const s of e){if(s[0]1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateLight,t,n))for(const s in t){const n=t[s];e.endsWith(s,"-transition")?this._transitionable.setTransition(s.slice(0,-11),n):this._transitionable.setValue(s,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,n,s){return(!s||!1!==s.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}const b=new e.Properties({source:new e.DataConstantProperty(e.spec.terrain.source),exaggeration:new e.DataConstantProperty(e.spec.terrain.exaggeration)});let R=class extends e.Evented{constructor(t,n){super(),this._transitionable=new e.Transitionable(b),this.set(t),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=n}get(){return this._transitionable.serialize()}set(t){for(const n in t){const s=t[n];e.endsWith(n,"-transition")?this._transitionable.setTransition(n.slice(0,-11),s):this._transitionable.setValue(n,s)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function S(t,n,s,i){const l=e.smoothstep(45,65,s),[a,r]=D(t,i),o=e.length(n);let u=1-Math.min(1,Math.exp((o-a)/(r-a)*-6));return u*=u*u,u=Math.min(1,1.00747*u),u*l*t.alpha}function D(e,t){const n=.5/Math.tan(.5*t);return[e.range[0]+n,e.range[1]+n]}const A=new e.Properties({range:new e.DataConstantProperty(e.spec.fog.range),color:new e.DataConstantProperty(e.spec.fog.color),"high-color":new e.DataConstantProperty(e.spec.fog["high-color"]),"space-color":new e.DataConstantProperty(e.spec.fog["space-color"]),"horizon-blend":new e.DataConstantProperty(e.spec.fog["horizon-blend"]),"star-intensity":new e.DataConstantProperty(e.spec.fog["star-intensity"])});class C extends e.Evented{constructor(t,n){super(),this._transitionable=new e.Transitionable(A),this.set(t),this._transitioning=this._transitionable.untransitioned(),this._transform=n}get state(){const t=this._transform,n="globe"===t.projection.name,s=e.globeToMercatorTransition(t.zoom),i=this.properties.get("range"),l=[.5,3];return{range:n?[e.number(l[0],i[0],s),e.number(l[1],i[1],s)]:i,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateFog,t,n)){for(const n of Object.keys(e.spec.fog))t&&void 0===t[n]&&(t[n]=e.spec.fog[n].default);for(const n in t){const s=t[n];e.endsWith(n,"-transition")?this._transitionable.setTransition(n.slice(0,-11),s):this._transitionable.setValue(n,s)}}}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const n=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.smoothstep(45,65,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?function(t,n,s){const i=e.MercatorCoordinate.fromLngLat(n),l=s.elevation?s.elevation.getAtPointOrZero(i):0,a=[i.x,i.y,l];return e.transformMat4(a,a,s.mercatorFogMatrix),S(t,a,s.pitch,s._fov)}(this.state,t,n):0}getFovAdjustedRange(e){return this._transform.projection.supportsFog?D(this.state,e):[0,1]}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,n,s){return(!s||!1!==s.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}class x{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=e.uniqueId();const s=this.workerPool.acquire(this.id);for(let e=0;e{this.ready=!0}))}broadcast(t,n,s){e.asyncAll(this.actors,((e,s)=>{e.send(t,n,s)}),s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove()})),this.actors=[],this.workerPool.release(this.id)}}function _(t,n,s){return n*(e.EXTENT/(t.tileSize*Math.pow(2,s-t.tileID.overscaledZ)))}x.Actor=e.Actor;class O{constructor(e,t,n,s){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,s)}static createFromScreenPoints(t,n){let s,i;if(t instanceof e.Point||"number"==typeof t[0]){const l=e.Point.convert(t);s=[l],i=n.isPointAboveHorizon(l)}else{const l=e.Point.convert(t[0]),a=e.Point.convert(t[1]);s=[l,a],i=e.polygonizeBounds(l,a).every((e=>n.isPointAboveHorizon(e)))}return new O(s,n.getCameraPoint(),i,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],s=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],i=e.polygonizeBounds(n,s,0,!1);return this.cameraPoint.y>s.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=s.x?i[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(i[3]=this.cameraPoint)),e.bufferConvexPolygon(i,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],s=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],i=e.polygonizeBounds(n,s,t),l=this.cameraPoint.clone();switch(3*((l.y>n.y)+(l.y>s.y))+((l.x>n.x)+(l.x>s.x))){case 0:i[0]=l,i[4]=l.clone();break;case 1:i.splice(1,0,l);break;case 2:i[1]=l;break;case 3:i.splice(4,0,l);break;case 5:i.splice(2,0,l);break;case 6:i[3]=l;break;case 7:i.splice(3,0,l);break;case 8:i[2]=l}return i}containsTile(t,n,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const l=t.queryPadding/n._pixelsPerMercatorPixel+1,a=s?this._bufferedCameraMercator(l,n):this._bufferedScreenMercator(l,n);let r=t.tileID.wrap+(a.unwrapped?i:0);const o=a.polygon.map((n=>e.getTilePoint(t.tileTransform,n,r)));if(!e.polygonIntersectsBox(o,0,0,e.EXTENT,e.EXTENT))return;r=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?i:0);const u=this.screenGeometryMercator.polygon.map((n=>e.getTileVec3(t.tileTransform,n,r))),c=u.map((t=>new e.Point(t[0],t[1]))),h=n.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),p=e.getTileVec3(t.tileTransform,h,r),d=u.map((t=>{const n=e.sub(t,t,p);return e.normalize(n,n),new e.Ray(p,n)})),f=_(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:c,tilespaceRays:d,bufferedTilespaceGeometry:o,bufferedTilespaceBounds:(m=e.getBounds(o),m.min.x=e.clamp(m.min.x,0,e.EXTENT),m.min.y=e.clamp(m.min.y,0,e.EXTENT),m.max.x=e.clamp(m.max.x,0,e.EXTENT),m.max.y=e.clamp(m.max.y,0,e.EXTENT),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(e,t){const n=P(e);if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{let s;return s="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[n]=s,s}}_bufferedCameraMercator(e,t){const n=P(e);if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{let s;return s="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[n]=s,s}}_projectAndResample(t,n){const s=function(t,n){const s=e.multiply([],n.pixelMatrix,n.globeMatrix),i=[0,-e.GLOBE_RADIUS,0,1],l=[0,e.GLOBE_RADIUS,0,1],a=[0,0,0,1];e.transformMat4$1(i,i,s),e.transformMat4$1(l,l,s),e.transformMat4$1(a,a,s);const r=new e.Point(i[0]/i[3],i[1]/i[3]),o=new e.Point(l[0]/l[3],l[1]/l[3]),u=e.polygonContainsPoint(t,r)&&i[3]1?N(t.slice(0,p),n):[],m=pnew e.Point(L(t.x),t.y))),m=m.map((t=>new e.Point(L(t.x),t.y)));const I=[...f];0===I.length&&I.push(m[m.length-1]);const y=e.number(I[I.length-1].y,(0===m.length?f[0]:m[0]).y,d);let v;return v=u?[new e.Point(0,y),new e.Point(0,0),new e.Point(1,0),new e.Point(1,y)]:[new e.Point(1,y),new e.Point(1,1),new e.Point(0,1),new e.Point(0,y)],I.push(...v),0===m.length?I.push(f[0]):I.push(...m),{polygon:I.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:!1}}(t,n);if(s)return s;const i=function(t,n){let s=!1,i=-1/0,l=0;for(let e=0;e