@wemap/providers 12.11.4 → 12.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/package.json +4 -5
- package/dist/dist/index.d.ts +0 -43
- package/dist/helpers/CustomMapProvider.js +0 -2
- package/dist/helpers/CustomMapProvider.js.map +0 -1
- package/dist/helpers/CustomMapProvider.mjs +0 -18856
- package/dist/helpers/CustomMapProvider.mjs.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty,e=(e,i,r)=>(((e,i,r)=>{i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r})(e,"symbol"!=typeof i?i+"":i,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("@wemap/logger"),r=require("@wemap/geo"),n=require("@wemap/maths"),o=require("@wemap/routers"),a=require("@wemap/utils"),s=require("geomag"),l=require("@wemap/camera");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const i in t)if("default"!==i){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const c=u(s);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var h={exports:{}},p=h.exports=function(){var t,e,i;function r(r,n){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),i=n(a),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=n;else t=n}return r(["exports"],(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var i=r;function r(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=i,this.p2y=r}r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){var i,r,n,o,a;for(void 0===e&&(e=1e-6),n=t,a=0;a<8;a++){if(o=this.sampleCurveX(n)-t,Math.abs(o)<e)return n;var s=this.sampleCurveDerivativeX(n);if(Math.abs(s)<1e-6)break;n-=o/s}if((n=t)<(i=0))return i;if(n>(r=1))return r;for(;i<r;){if(o=this.sampleCurveX(n),Math.abs(o-t)<e)return n;t>o?i=n:r=n,n=.5*(r-i)+i}return n},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var n=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var a="undefined"!=typeof self?self:{},s=Math.pow(2,53)-1;function l(t,e,r,n){var o=new i(t,e,r,n);return function(t){return o.solve(t)}}var u=l(.25,.1,.25,1);function c(t,e,i){return Math.min(i,Math.max(e,t))}function h(t,e,i){var r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function p(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];for(var r=0,n=e;r<n.length;r+=1){var o=n[r];for(var a in o)t[a]=o[a]}return t}var d=1;function f(){return d++}function m(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function y(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function _(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function v(t,e){return-1!==t.indexOf(e,t.length-e.length)}function g(t,e,i){var r={};for(var n in t)r[n]=e.call(i||this,t[n],n,t);return r}function x(t,e,i){var r={};for(var n in t)e.call(i||this,t[n],n,t)&&(r[n]=t[n]);return r}function b(t){return Array.isArray(t)?t.map(b):"object"==typeof t&&t?g(t,b):t}var w={};function E(t){w[t]||("undefined"!=typeof console&&console.warn(t),w[t]=!0)}function I(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function S(t){for(var e=0,i=0,r=t.length,n=r-1,o=void 0,a=void 0;i<r;n=i++)e+=((a=t[n]).x-(o=t[i]).x)*(o.y+a.y);return e}function T(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function A(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,i,r,n){var o=r||n;return e[i]=!o||o.toLowerCase(),""})),e["max-age"]){var i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}var P=null;function M(t){if(null==P){var e=t.navigator?t.navigator.userAgent:null;P=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return P}function C(t){try{var e=a[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(i){return!1}}var z,k,L,D,R=a.performance&&a.performance.now?a.performance.now.bind(a.performance):Date.now.bind(Date),B=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,F=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame,O={now:R,frame:function(t){var e=B(t);return{cancel:function(){return F(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var i=a.document.createElement("canvas"),r=i.getContext("2d");if(!r)throw new Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,r.drawImage(t,0,0,t.width,t.height),r.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return z||(z=a.document.createElement("a")),z.href=t,z.href},hardwareConcurrency:a.navigator&&a.navigator.hardwareConcurrency||4,get devicePixelRatio(){return a.devicePixelRatio},get prefersReducedMotion(){return!!a.matchMedia&&(null==k&&(k=a.matchMedia("(prefers-reduced-motion: reduce)")),k.matches)}},U={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},N={supported:!1,testSupport:function(t){!V&&D&&(j?q(t):L=t)}},V=!1,j=!1;function q(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,D),t.isContextLost())return;N.supported=!0}catch(i){}t.deleteTexture(e),V=!0}a.document&&((D=a.document.createElement("img")).onload=function(){L&&q(L),L=null,j=!0},D.onerror=function(){V=!0,L=null},D.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var G="01",Z=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function W(t){return 0===t.indexOf("mapbox:")}Z.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",G,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},Z.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},Z.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},Z.prototype.normalizeStyleURL=function(t,e){if(!W(t))return t;var i=J(t);return i.path="/styles/v1"+i.path,this._makeAPIURL(i,this._customAccessToken||e)},Z.prototype.normalizeGlyphsURL=function(t,e){if(!W(t))return t;var i=J(t);return i.path="/fonts/v1"+i.path,this._makeAPIURL(i,this._customAccessToken||e)},Z.prototype.normalizeSourceURL=function(t,e){if(!W(t))return t;var i=J(t);return i.path="/v4/"+i.authority+".json",i.params.push("secure"),this._makeAPIURL(i,this._customAccessToken||e)},Z.prototype.normalizeSpriteURL=function(t,e,i,r){var n=J(t);return W(t)?(n.path="/styles/v1"+n.path+"/sprite"+e+i,this._makeAPIURL(n,this._customAccessToken||r)):(n.path+=""+e+i,Y(n))},Z.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!W(t))return t;var i=J(t);i.path=i.path.replace(/(\.(png|jpg)\d*)(?=$)/,(O.devicePixelRatio>=2||512===e?"@2x":"")+(N.supported?".webp":"$1")),i.path=i.path.replace(/^.+\/v4\//,"/"),i.path="/v4"+i.path;var r=this._customAccessToken||function(t){for(var e=0,i=t;e<i.length;e+=1){var r=i[e].match(/^access_token=(.*)$/);if(r)return r[1]}return null}(i.params)||U.ACCESS_TOKEN;return U.REQUIRE_ACCESS_TOKEN&&r&&this._skuToken&&i.params.push("sku="+this._skuToken),this._makeAPIURL(i,r)},Z.prototype.canonicalizeTileURL=function(t,e){var i=J(t);if(!i.path.match(/(^\/v4\/)/)||!i.path.match(/\.[\w]+$/))return t;var r="mapbox://tiles/";r+=i.path.replace("/v4/","");var n=i.params;return e&&(n=n.filter((function(t){return!t.match(/^access_token=/)}))),n.length&&(r+="?"+n.join("&")),r},Z.prototype.canonicalizeTileset=function(t,e){for(var i=!!e&&W(e),r=[],n=0,o=t.tiles||[];n<o.length;n+=1){var a=o[n];X(a)?r.push(this.canonicalizeTileURL(a,i)):r.push(a)}return r},Z.prototype._makeAPIURL=function(t,e){var i="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",r=J(U.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"http"===t.protocol){var n=t.params.indexOf("secure");n>=0&&t.params.splice(n,1)}if("/"!==r.path&&(t.path=""+r.path+t.path),!U.REQUIRE_ACCESS_TOKEN)return Y(t);if(!(e=e||U.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+i);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+i);return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+e),Y(t)};var H=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function X(t){return H.test(t)}var K=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function J(t){var e=t.match(K);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Y(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function Q(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(a.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(i){return null}}var $=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};$.prototype.getStorageKey=function(t){var e,i=Q(U.ACCESS_TOKEN);return e=i&&i.u?a.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):U.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},$.prototype.fetchEventData=function(){var t=C("localStorage"),e=this.getStorageKey(),i=this.getStorageKey("uuid");if(t)try{var r=a.localStorage.getItem(e);r&&(this.eventData=JSON.parse(r));var n=a.localStorage.getItem(i);n&&(this.anonId=n)}catch(o){E("Unable to read from LocalStorage")}},$.prototype.saveEventData=function(){var t=C("localStorage"),e=this.getStorageKey(),i=this.getStorageKey("uuid");if(t)try{a.localStorage.setItem(i,this.anonId),Object.keys(this.eventData).length>=1&&a.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(r){E("Unable to write to LocalStorage")}},$.prototype.processRequests=function(t){},$.prototype.postEvent=function(t,e,i,r){var n=this;if(U.EVENTS_URL){var o=J(U.EVENTS_URL);o.params.push("access_token="+(r||U.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.13.3",skuId:G,userId:this.anonId},s=e?p(a,e):a,l={url:Y(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=bt(l,(function(t){n.pendingRequest=null,i(t),n.saveEventData(),n.processRequests(r)}))}},$.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var tt,et,it=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,i,r){this.skuToken=i;var n=!(!r&&!U.ACCESS_TOKEN),o=Array.isArray(t)&&t.some((function(t){return W(t)||X(t)}));U.EVENTS_URL&&n&&o&&this.queueRequest({id:e,timestamp:Date.now()},r)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var i=this.queue.shift(),r=i.id,n=i.timestamp;r&&this.success[r]||(this.anonId||this.fetchEventData(),y(this.anonId)||(this.anonId=m()),this.postEvent(n,{skuToken:this.skuToken},(function(t){t||r&&(e.success[r]=!0)}),t))}},e}($),rt=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){U.EVENTS_URL&&U.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return W(t)||X(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var i=Q(U.ACCESS_TOKEN),r=i?i.u:U.ACCESS_TOKEN,n=r!==this.eventData.tokenU;y(this.anonId)||(this.anonId=m(),n=!0);var o=this.queue.shift();if(this.eventData.lastSuccess){var a=new Date(this.eventData.lastSuccess),s=new Date(o),l=(o-this.eventData.lastSuccess)/864e5;n=n||l>=1||l<-1||a.getDate()!==s.getDate()}else n=!0;if(!n)return this.processRequests();this.postEvent(o,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=o,e.eventData.tokenU=r)}),t)}},e}($)),nt=rt.postTurnstileEvent.bind(rt),ot=new it,at=ot.postMapLoadEvent.bind(ot),st=500,lt=50;function ut(){a.caches&&!tt&&(tt=a.caches.open("mapbox-tiles"))}function ct(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ht,pt=1/0;function dt(){return null==ht&&(ht=a.OffscreenCanvas&&new a.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.createImageBitmap),ht}var ft={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ft);var mt,yt,_t=function(t){function e(e,i,r){401===i&&X(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=i,this.url=r,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),vt=T()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===a.location.protocol?a.parent:a).location.href},gt=function(t,e){if(!(/^file:/.test(i=t.url)||/^file:/.test(vt())&&!/^\w+:/.test(i))){if(a.fetch&&a.Request&&a.AbortController&&a.Request.prototype.hasOwnProperty("signal"))return function(t,e){var i,r=new a.AbortController,n=new a.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:vt(),signal:r.signal}),o=!1,s=!1,l=(i=n.url).indexOf("sku=")>0&&X(i);"json"===t.type&&n.headers.set("Accept","application/json");var u=function(i,r,o){if(!s){if(i&&"SecurityError"!==i.message&&E(i),r&&o)return c(r);var u=Date.now();a.fetch(n).then((function(i){if(i.ok){var r=l?i.clone():null;return c(i,r,u)}return e(new _t(i.statusText,i.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},c=function(i,r,l){("arrayBuffer"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((function(t){s||(r&&l&&function(t,e,i){if(ut(),tt){var r={status:e.status,statusText:e.statusText,headers:new a.Headers};e.headers.forEach((function(t,e){return r.headers.set(e,t)}));var n=A(e.headers.get("Cache-Control")||"");n["no-store"]||(n["max-age"]&&r.headers.set("Expires",new Date(i+1e3*n["max-age"]).toUTCString()),new Date(r.headers.get("Expires")).getTime()-i<42e4||function(t,e){if(void 0===et)try{new Response(new ReadableStream),et=!0}catch(i){et=!1}et?e(t.body):t.blob().then(e)}(e,(function(e){var i=new a.Response(e,r);ut(),tt&&tt.then((function(e){return e.put(ct(t.url),i)})).catch((function(t){return E(t.message)}))})))}}(n,r,l),o=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((function(t){s||e(new Error(t.message))}))};return l?function(t,e){if(ut(),!tt)return e(null);var i=ct(t.url);tt.then((function(t){t.match(i).then((function(r){var n=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),i=A(t.headers.get("Cache-Control")||"");return e>Date.now()&&!i["no-cache"]}(r);t.delete(i),n&&t.put(i,r.clone()),e(null,r,n)})).catch(e)})).catch(e)}(n,u):u(null,null),{cancel:function(){s=!0,o||r.abort()}}}(t,e);if(T()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){var i=new a.XMLHttpRequest;for(var r in i.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(i.responseType="arraybuffer"),t.headers)i.setRequestHeader(r,t.headers[r]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=function(){e(new Error(i.statusText))},i.onload=function(){if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){var r=i.response;if("json"===t.type)try{r=JSON.parse(i.response)}catch(n){return e(n)}e(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else e(new _t(i.statusText,i.status,t.url))},i.send(t.body),{cancel:function(){return i.abort()}}}(t,e)},xt=function(t,e){return gt(p(t,{type:"arrayBuffer"}),e)},bt=function(t,e){return gt(p(t,{method:"POST"}),e)},wt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";mt=[],yt=0;var Et=function(t,e){if(N.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),yt>=U.MAX_PARALLEL_IMAGE_REQUESTS){var i={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return mt.push(i),i}yt++;var r=!1,n=function(){if(!r)for(r=!0,yt--;mt.length&&yt<U.MAX_PARALLEL_IMAGE_REQUESTS;){var t=mt.shift();t.cancelled||(t.cancel=Et(t.requestParameters,t.callback).cancel)}},o=xt(t,(function(t,i,r,o){var s,l,u;n(),t?e(t):i&&(dt()?(s=i,l=e,u=new a.Blob([new Uint8Array(s)],{type:"image/png"}),a.createImageBitmap(u).then((function(t){l(null,t)})).catch((function(t){l(new Error("Could not load image because of "+t.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}))):function(t,e,i,r){var n=new a.Image,o=a.URL;n.onload=function(){e(null,n),o.revokeObjectURL(n.src),n.onload=null,a.requestAnimationFrame((function(){n.src=wt}))},n.onerror=function(){return e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var s=new a.Blob([new Uint8Array(t)],{type:"image/png"});n.cacheControl=i,n.expires=r,n.src=t.byteLength?o.createObjectURL(s):wt}(i,e,r,o))}));return{cancel:function(){o.cancel(),n()}}};function It(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function St(t,e,i){if(i&&i[t]){var r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}var Tt=function(t,e){void 0===e&&(e={}),p(this,e),this.type=t},At=function(t){function e(e,i){void 0===i&&(i={}),t.call(this,"error",p({error:e},i))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Tt),Pt=function(){};Pt.prototype.on=function(t,e){return this._listeners=this._listeners||{},It(t,e,this._listeners),this},Pt.prototype.off=function(t,e){return St(t,e,this._listeners),St(t,e,this._oneTimeListeners),this},Pt.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},It(t,e,this._oneTimeListeners),this},Pt.prototype.fire=function(t,e){"string"==typeof t&&(t=new Tt(t,e||{}));var i=t.type;if(this.listens(i)){t.target=this;for(var r=0,n=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];r<n.length;r+=1)n[r].call(this,t);for(var o=0,a=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];o<a.length;o+=1){var s=a[o];St(i,s,this._oneTimeListeners),s.call(this,t)}var l=this._eventedParent;l&&(p(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),l.fire(t))}else t instanceof At&&console.error(t.error);return this},Pt.prototype.listens=function(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},Pt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Mt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,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:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},Ct=function(t,e,i,r){this.message=(t?t+": ":"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)};function zt(t){var e=t.value;return e?[new Ct(t.key,e,"constants have been deprecated as of v8")]:[]}function kt(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];for(var r=0,n=e;r<n.length;r+=1){var o=n[r];for(var a in o)t[a]=o[a]}return t}function Lt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Dt(t){if(Array.isArray(t))return t.map(Dt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var i in t)e[i]=Dt(t[i]);return e}return Lt(t)}var Rt=function(t){function e(e,i){t.call(this,i),this.message=i,this.key=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),Bt=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var i=0,r=e;i<r.length;i+=1){var n=r[i];this.bindings[n[0]]=n[1]}};Bt.prototype.concat=function(t){return new Bt(this,t)},Bt.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},Bt.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Ft={kind:"null"},Ot={kind:"number"},Ut={kind:"string"},Nt={kind:"boolean"},Vt={kind:"color"},jt={kind:"object"},qt={kind:"value"},Gt={kind:"collator"},Zt={kind:"formatted"},Wt={kind:"resolvedImage"};function Ht(t,e){return{kind:"array",itemType:t,N:e}}function Xt(t){if("array"===t.kind){var e=Xt(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Kt=[Ft,Ot,Ut,Nt,Vt,Zt,jt,Ht(qt),Wt];function Jt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Jt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var i=0,r=Kt;i<r.length;i+=1)if(!Jt(r[i],e))return null}return"Expected "+Xt(t)+" but found "+Xt(e)+" instead."}function Yt(t,e){return e.some((function(e){return e.kind===t.kind}))}function Qt(t,e){return e.some((function(e){return"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t}))}var $t=e((function(t,e){var i={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 r(t){return(t=Math.round(t))<0?0:t>255?255:t}function n(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in i)return i[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),u=s.indexOf(")");if(-1!==l&&u+1===s.length){var c=s.substr(0,l),h=s.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=o(h.pop());case"rgb":return 3!==h.length?null:[n(h[0]),n(h[1]),n(h[2]),p];case"hsla":if(4!==h.length)return null;p=o(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,f=o(h[1]),m=o(h[2]),y=m<=.5?m*(f+1):m+f-m*f,_=2*m-y;return[r(255*a(_,y,d+1/3)),r(255*a(_,y,d)),r(255*a(_,y,d-1/3)),p];default:return null}}return null}}catch(s){}})).parseCSSColor,te=function(t,e,i,r){void 0===r&&(r=1),this.r=t,this.g=e,this.b=i,this.a=r};te.parse=function(t){if(t){if(t instanceof te)return t;if("string"==typeof t){var e=$t(t);if(e)return new te(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},te.prototype.toString=function(){var t=this.toArray(),e=t[1],i=t[2],r=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(i)+","+r+")"},te.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},te.black=new te(0,0,0,1),te.white=new te(1,1,1,1),te.transparent=new te(0,0,0,0),te.red=new te(1,0,0,1);var ee=function(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};ee.prototype.compare=function(t,e){return this.collator.compare(t,e)},ee.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ie=function(t,e,i,r,n){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n},re=function(t){this.sections=t};re.fromString=function(t){return new re([new ie(t,null,null,null,null)])},re.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},re.factory=function(t){return t instanceof re?t:re.fromString(t)},re.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},re.prototype.serialize=function(){for(var t=["format"],e=0,i=this.sections;e<i.length;e+=1){var r=i[e];if(r.image)t.push(["image",r.image.name]);else{t.push(r.text);var n={};r.fontStack&&(n["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(n["font-scale"]=r.scale),r.textColor&&(n["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(n)}}return t};var ne=function(t){this.name=t.name,this.available=t.available};function oe(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:"Invalid rgba value ["+[t,e,i,r].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ae(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof te)return!0;if(t instanceof ee)return!0;if(t instanceof re)return!0;if(t instanceof ne)return!0;if(Array.isArray(t)){for(var e=0,i=t;e<i.length;e+=1)if(!ae(i[e]))return!1;return!0}if("object"==typeof t){for(var r in t)if(!ae(t[r]))return!1;return!0}return!1}function se(t){if(null===t)return Ft;if("string"==typeof t)return Ut;if("boolean"==typeof t)return Nt;if("number"==typeof t)return Ot;if(t instanceof te)return Vt;if(t instanceof ee)return Gt;if(t instanceof re)return Zt;if(t instanceof ne)return Wt;if(Array.isArray(t)){for(var e,i=t.length,r=0,n=t;r<n.length;r+=1){var o=se(n[r]);if(e){if(e===o)continue;e=qt;break}e=o}return Ht(e||qt,i)}return jt}function le(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof te||t instanceof re||t instanceof ne?t.toString():JSON.stringify(t)}ne.prototype.toString=function(){return this.name},ne.fromString=function(t){return t?new ne({name:t,available:!1}):null},ne.prototype.serialize=function(){return["image",this.name]};var ue=function(t,e){this.type=t,this.value=e};ue.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!ae(t[1]))return e.error("invalid value");var i=t[1],r=se(i),n=e.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new ue(r,i)},ue.prototype.evaluate=function(){return this.value},ue.prototype.eachChild=function(){},ue.prototype.outputDefined=function(){return!0},ue.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof te?["rgba"].concat(this.value.toArray()):this.value instanceof re?this.value.serialize():this.value};var ce=function(t){this.name="ExpressionEvaluationError",this.message=t};ce.prototype.toJSON=function(){return this.message};var he={string:Ut,number:Ot,boolean:Nt,object:jt},pe=function(t,e){this.type=t,this.args=e};pe.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i,r=1,n=t[0];if("array"===n){var o,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in he)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=he[s],r++}else o=qt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],r++}i=Ht(o,a)}else i=he[n];for(var l=[];r<t.length;r++){var u=e.parse(t[r],r,qt);if(!u)return null;l.push(u)}return new pe(i,l)},pe.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var i=this.args[e].evaluate(t);if(!Jt(this.type,se(i)))return i;if(e===this.args.length-1)throw new ce("Expected value to be of type "+Xt(this.type)+", but found "+Xt(se(i))+" instead.")}return null},pe.prototype.eachChild=function(t){this.args.forEach(t)},pe.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},pe.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);var r=t.N;("number"==typeof r||this.args.length>1)&&e.push(r)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var de=function(t){this.type=Zt,this.sections=t};de.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");for(var r=[],n=!1,o=1;o<=t.length-1;++o){var a=t[o];if(n&&"object"==typeof a&&!Array.isArray(a)){n=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,Ot)))return null;var l=null;if(a["text-font"]&&!(l=e.parse(a["text-font"],1,Ht(Ut))))return null;var u=null;if(a["text-color"]&&!(u=e.parse(a["text-color"],1,Vt)))return null;var c=r[r.length-1];c.scale=s,c.font=l,c.textColor=u}else{var h=e.parse(t[o],1,qt);if(!h)return null;var p=h.type.kind;if("string"!==p&&"value"!==p&&"null"!==p&&"resolvedImage"!==p)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:h,scale:null,font:null,textColor:null})}}return new de(r)},de.prototype.evaluate=function(t){return new re(this.sections.map((function(e){var i=e.content.evaluate(t);return se(i)===Wt?new ie("",i,null,null,null):new ie(le(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},de.prototype.eachChild=function(t){for(var e=0,i=this.sections;e<i.length;e+=1){var r=i[e];t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}},de.prototype.outputDefined=function(){return!1},de.prototype.serialize=function(){for(var t=["format"],e=0,i=this.sections;e<i.length;e+=1){var r=i[e];t.push(r.content.serialize());var n={};r.scale&&(n["font-scale"]=r.scale.serialize()),r.font&&(n["text-font"]=r.font.serialize()),r.textColor&&(n["text-color"]=r.textColor.serialize()),t.push(n)}return t};var fe=function(t){this.type=Wt,this.input=t};fe.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Ut);return i?new fe(i):e.error("No image name provided.")},fe.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=ne.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i},fe.prototype.eachChild=function(t){t(this.input)},fe.prototype.outputDefined=function(){return!1},fe.prototype.serialize=function(){return["image",this.input.serialize()]};var me={"to-boolean":Nt,"to-color":Vt,"to-number":Ot,"to-string":Ut},ye=function(t,e){this.type=t,this.args=e};ye.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");for(var r=me[i],n=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,qt);if(!a)return null;n.push(a)}return new ye(r,n)},ye.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,i,r=0,n=this.args;r<n.length;r+=1){if(i=null,(e=n[r].evaluate(t))instanceof te)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}else if(Array.isArray(e)&&!(i=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":oe(e[0],e[1],e[2],e[3])))return new te(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ce(i||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,l=this.args;s<l.length;s+=1){if(null===(a=l[s].evaluate(t)))return 0;var u=Number(a);if(!isNaN(u))return u}throw new ce("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?re.fromString(le(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?ne.fromString(le(this.args[0].evaluate(t))):le(this.args[0].evaluate(t))},ye.prototype.eachChild=function(t){this.args.forEach(t)},ye.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},ye.prototype.serialize=function(){if("formatted"===this.type.kind)return new de([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new fe(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var _e=["Unknown","Point","LineString","Polygon"],ve=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};ve.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},ve.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?_e[this.feature.type]:this.feature.type:null},ve.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},ve.prototype.canonicalID=function(){return this.canonical},ve.prototype.properties=function(){return this.feature&&this.feature.properties||{}},ve.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=te.parse(t)),e};var ge=function(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r};ge.prototype.evaluate=function(t){return this._evaluate(t,this.args)},ge.prototype.eachChild=function(t){this.args.forEach(t)},ge.prototype.outputDefined=function(){return!1},ge.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},ge.parse=function(t,e){var i,r=t[0],n=ge.definitions[r];if(!n)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=a.filter((function(e){var i=e[0];return!Array.isArray(i)||i.length===t.length-1})),l=null,u=0,c=s;u<c.length;u+=1){var h=c[u],p=h[0],d=h[1];l=new Ve(e.registry,e.path,null,e.scope);for(var f=[],m=!1,y=1;y<t.length;y++){var _=t[y],v=Array.isArray(p)?p[y-1]:p.type,g=l.parse(_,1+f.length,v);if(!g){m=!0;break}f.push(g)}if(!m)if(Array.isArray(p)&&p.length!==f.length)l.error("Expected "+p.length+" arguments, but found "+f.length+" instead.");else{for(var x=0;x<f.length;x++){var b=Array.isArray(p)?p[x]:p.type,w=f[x];l.concat(x+1).checkSubtype(b,w.type)}if(0===l.errors.length)return new ge(r,o,d,f)}}if(1===s.length)(i=e.errors).push.apply(i,l.errors);else{for(var E=(s.length?s:a).map((function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map(Xt).join(", ")+")":"("+Xt(e.type)+"...)"})).join(" | "),I=[],S=1;S<t.length;S++){var T=e.parse(t[S],1+I.length);if(!T)return null;I.push(Xt(T.type))}e.error("Expected arguments of type "+E+", but found ("+I.join(", ")+") instead.")}return null},ge.register=function(t,e){for(var i in ge.definitions=e,e)t[i]=ge};var xe=function(t,e,i){this.type=Gt,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e};function be(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function we(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ee(t,e){var i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*8192),Math.round(r*n*8192)]}function Ie(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function Se(t,e){for(var i,r,n,o,a,s,l,u=!1,c=0,h=e.length;c<h;c++)for(var p=e[c],d=0,f=p.length;d<f-1;d++){if((o=(i=t)[0]-(r=p[d])[0])*(l=i[1]-(n=p[d+1])[1])-(s=i[0]-n[0])*(a=i[1]-r[1])==0&&o*s<=0&&a*l<=0)return!1;Ie(t,p[d],p[d+1])&&(u=!u)}return u}function Te(t,e){for(var i=0;i<e.length;i++)if(Se(t,e[i]))return!0;return!1}function Ae(t,e,i,r){var n=r[0]-i[0],o=r[1]-i[1],a=(t[0]-i[0])*o-n*(t[1]-i[1]),s=(e[0]-i[0])*o-n*(e[1]-i[1]);return a>0&&s<0||a<0&&s>0}function Pe(t,e,i){for(var r=0,n=i;r<n.length;r+=1)for(var o=n[r],a=0;a<o.length-1;++a)if(0!=(h=[(c=o[a+1])[0]-(u=o[a])[0],c[1]-u[1]])[0]*(p=[(l=e)[0]-(s=t)[0],l[1]-s[1]])[1]-h[1]*p[0]&&Ae(s,l,u,c)&&Ae(u,c,s,l))return!0;var s,l,u,c,h,p;return!1}function Me(t,e){for(var i=0;i<t.length;++i)if(!Se(t[i],e))return!1;for(var r=0;r<t.length-1;++r)if(Pe(t[r],t[r+1],e))return!1;return!0}function Ce(t,e){for(var i=0;i<e.length;i++)if(Me(t,e[i]))return!0;return!1}function ze(t,e,i){for(var r=[],n=0;n<t.length;n++){for(var o=[],a=0;a<t[n].length;a++){var s=Ee(t[n][a],i);be(e,s),o.push(s)}r.push(o)}return r}function ke(t,e,i){for(var r=[],n=0;n<t.length;n++){var o=ze(t[n],e,i);r.push(o)}return r}function Le(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){var n=.5*r,o=t[0]-i[0]>n?-r:i[0]-t[0]>n?r:0;0===o&&(o=t[0]-i[2]>n?-r:i[2]-t[0]>n?r:0),t[0]+=o}be(e,t)}function De(t,e,i,r){for(var n=8192*Math.pow(2,r.z),o=[8192*r.x,8192*r.y],a=[],s=0,l=t;s<l.length;s+=1)for(var u=0,c=l[s];u<c.length;u+=1){var h=c[u],p=[h.x+o[0],h.y+o[1]];Le(p,e,i,n),a.push(p)}return a}function Re(t,e,i,r){for(var n,o=8192*Math.pow(2,r.z),a=[8192*r.x,8192*r.y],s=[],l=0,u=t;l<u.length;l+=1){for(var c=[],h=0,p=u[l];h<p.length;h+=1){var d=p[h],f=[d.x+a[0],d.y+a[1]];be(e,f),c.push(f)}s.push(c)}if(e[2]-e[0]<=o/2){(n=e)[0]=n[1]=1/0,n[2]=n[3]=-1/0;for(var m=0,y=s;m<y.length;m+=1)for(var _=0,v=y[m];_<v.length;_+=1)Le(v[_],e,i,o)}return s}xe.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");var r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Nt);if(!r)return null;var n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Nt);if(!n)return null;var o=null;return i.locale&&!(o=e.parse(i.locale,1,Ut))?null:new xe(r,n,o)},xe.prototype.evaluate=function(t){return new ee(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},xe.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},xe.prototype.outputDefined=function(){return!1},xe.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var Be=function(t,e){this.type=Nt,this.geojson=t,this.geometries=e};function Fe(t){if(t instanceof ge){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Be)return!1;var e=!0;return t.eachChild((function(t){e&&!Fe(t)&&(e=!1)})),e}function Oe(t){if(t instanceof ge&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!Oe(t)&&(e=!1)})),e}function Ue(t,e){if(t instanceof ge&&e.indexOf(t.name)>=0)return!1;var i=!0;return t.eachChild((function(t){i&&!Ue(t,e)&&(i=!1)})),i}Be.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(ae(t[1])){var i=t[1];if("FeatureCollection"===i.type)for(var r=0;r<i.features.length;++r){var n=i.features[r].geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new Be(i,i.features[r].geometry)}else if("Feature"===i.type){var o=i.geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new Be(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new Be(i,i)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},Be.prototype.evaluate=function(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){var o=ze(e.coordinates,r,n),a=De(t.geometry(),i,r,n);if(!we(i,r))return!1;for(var s=0,l=a;s<l.length;s+=1)if(!Se(l[s],o))return!1}if("MultiPolygon"===e.type){var u=ke(e.coordinates,r,n),c=De(t.geometry(),i,r,n);if(!we(i,r))return!1;for(var h=0,p=c;h<p.length;h+=1)if(!Te(p[h],u))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){var o=ze(e.coordinates,r,n),a=Re(t.geometry(),i,r,n);if(!we(i,r))return!1;for(var s=0,l=a;s<l.length;s+=1)if(!Me(l[s],o))return!1}if("MultiPolygon"===e.type){var u=ke(e.coordinates,r,n),c=Re(t.geometry(),i,r,n);if(!we(i,r))return!1;for(var h=0,p=c;h<p.length;h+=1)if(!Ce(p[h],u))return!1}return!0}(t,this.geometries)}return!1},Be.prototype.eachChild=function(){},Be.prototype.outputDefined=function(){return!0},Be.prototype.serialize=function(){return["within",this.geojson]};var Ne=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};Ne.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var i=t[1];return e.scope.has(i)?new Ne(i,e.scope.get(i)):e.error('Unknown variable "'+i+'". Make sure "'+i+'" has been bound in an enclosing "let" expression before using it.',1)},Ne.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},Ne.prototype.eachChild=function(){},Ne.prototype.outputDefined=function(){return!1},Ne.prototype.serialize=function(){return["var",this.name]};var Ve=function(t,e,i,r,n){void 0===e&&(e=[]),void 0===r&&(r=new Bt),void 0===n&&(n=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=r,this.errors=n,this.expectedType=i};function je(t,e){for(var i,r=t.length-1,n=0,o=r,a=0;n<=o;)if((i=t[a=Math.floor((n+o)/2)])<=e){if(a===r||e<t[a+1])return a;n=a+1}else{if(!(i>e))throw new ce("Input is not a number.");o=a-1}return 0}Ve.prototype.parse=function(t,e,i,r,n){return void 0===n&&(n={}),e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)},Ve.prototype._parse=function(t,e){function i(t,e,i){return"assert"===i?new pe(e,[t]):"coerce"===i?new ye(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var n=this.registry[r];if(n){var o=n.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=i(o,a,e.typeAnnotation||"coerce");else o=i(o,a,e.typeAnnotation||"assert")}if(!(o instanceof ue)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof Ne)return t(e.boundExpression);if(e instanceof ge&&"error"===e.name)return!1;if(e instanceof xe)return!1;if(e instanceof Be)return!1;var i=e instanceof ye||e instanceof pe,r=!0;return e.eachChild((function(e){r=i?r&&t(e):r&&e instanceof ue})),!!r&&Fe(e)&&Ue(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var l=new ve;try{o=new ue(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Ve.prototype.concat=function(t,e,i){var r="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new Ve(this.registry,r,e||null,n,this.errors)},Ve.prototype.error=function(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];var r=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Rt(r,t))},Ve.prototype.checkSubtype=function(t,e){var i=Jt(t,e);return i&&this.error(i),i};var qe=function(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var r=0,n=i;r<n.length;r+=1){var o=n[r],a=o[1];this.labels.push(o[0]),this.outputs.push(a)}};function Ge(t,e,i){return t*(1-i)+e*i}qe.parse=function(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");var i=e.parse(t[1],1,Ot);if(!i)return null;var r=[],n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var o=1;o<t.length;o+=2){var a=1===o?-1/0:t[o],s=t[o+1],l=o,u=o+1;if("number"!=typeof a)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',l);if(r.length&&r[r.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var c=e.parse(s,u,n);if(!c)return null;n=n||c.type,r.push([a,c])}return new qe(n,i,r)},qe.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);var n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[je(e,r)].evaluate(t)},qe.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e<i.length;e+=1)t(i[e])},qe.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},qe.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ze=Object.freeze({__proto__:null,number:Ge,color:function(t,e,i){return new te(Ge(t.r,e.r,i),Ge(t.g,e.g,i),Ge(t.b,e.b,i),Ge(t.a,e.a,i))},array:function(t,e,i){return t.map((function(t,r){return Ge(t,e[r],i)}))}}),We=6/29*3*(6/29),He=Math.PI/180,Xe=180/Math.PI;function Ke(t){return t>.008856451679035631?Math.pow(t,1/3):t/We+4/29}function Je(t){return t>6/29?t*t*t:We*(t-4/29)}function Ye(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Qe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $e(t){var e=Qe(t.r),i=Qe(t.g),r=Qe(t.b),n=Ke((.4124564*e+.3575761*i+.1804375*r)/.95047),o=Ke((.2126729*e+.7151522*i+.072175*r)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-Ke((.0193339*e+.119192*i+.9503041*r)/1.08883)),alpha:t.a}}function ti(t){var e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,r=isNaN(t.b)?e:e-t.b/200;return e=1*Je(e),i=.95047*Je(i),r=1.08883*Je(r),new te(Ye(3.2404542*i-1.5371385*e-.4985314*r),Ye(-.969266*i+1.8760108*e+.041556*r),Ye(.0556434*i-.2040259*e+1.0572252*r),t.alpha)}function ei(t,e,i){var r=e-t;return t+i*(r>180||r<-180?r-360*Math.round(r/360):r)}var ii={forward:$e,reverse:ti,interpolate:function(t,e,i){return{l:Ge(t.l,e.l,i),a:Ge(t.a,e.a,i),b:Ge(t.b,e.b,i),alpha:Ge(t.alpha,e.alpha,i)}}},ri={forward:function(t){var e=$e(t),i=e.l,r=e.a,n=e.b,o=Math.atan2(n,r)*Xe;return{h:o<0?o+360:o,c:Math.sqrt(r*r+n*n),l:i,alpha:t.a}},reverse:function(t){var e=t.h*He,i=t.c;return ti({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:ei(t.h,e.h,i),c:Ge(t.c,e.c,i),l:Ge(t.l,e.l,i),alpha:Ge(t.alpha,e.alpha,i)}}},ni=Object.freeze({__proto__:null,lab:ii,hcl:ri}),oi=function(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(var o=0,a=n;o<a.length;o+=1){var s=a[o],l=s[1];this.labels.push(s[0]),this.outputs.push(l)}};function ai(t,e,i,r){var n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}oi.interpolationFactor=function(t,e,r,n){var o=0;if("exponential"===t.name)o=ai(e,t.base,r,n);else if("linear"===t.name)o=ai(e,1,r,n);else if("cubic-bezier"===t.name){var a=t.controlPoints;o=new i(a[0],a[1],a[2],a[3]).solve(ai(e,1,r,n))}return o},oi.parse=function(t,e){var i=t[0],r=t[1],n=t[2],o=t.slice(3);if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){var a=r[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:a}}else{if("cubic-bezier"!==r[0])return e.error("Unknown interpolation type "+String(r[0]),1,0);var s=r.slice(1);if(4!==s.length||s.some((function(t){return"number"!=typeof t||t<0||t>1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,2,Ot)))return null;var l=[],u=null;"interpolate-hcl"===i||"interpolate-lab"===i?u=Vt:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var c=0;c<o.length;c+=2){var h=o[c],p=o[c+1],d=c+3,f=c+4;if("number"!=typeof h)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(l.length&&l[l.length-1][0]>=h)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);var m=e.parse(p,f,u);if(!m)return null;u=u||m.type,l.push([h,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new oi(u,i,r,n,l):e.error("Type "+Xt(u)+" is not interpolatable.")},oi.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);var n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);var o=je(e,r),a=oi.interpolationFactor(this.interpolation,r,e[o],e[o+1]),s=i[o].evaluate(t),l=i[o+1].evaluate(t);return"interpolate"===this.operator?Ze[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?ri.reverse(ri.interpolate(ri.forward(s),ri.forward(l),a)):ii.reverse(ii.interpolate(ii.forward(s),ii.forward(l),a))},oi.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e<i.length;e+=1)t(i[e])},oi.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},oi.prototype.serialize=function(){var t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],i=0;i<this.labels.length;i++)e.push(this.labels[i],this.outputs[i].serialize());return e};var si=function(t,e){this.type=t,this.args=e};si.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var i=null,r=e.expectedType;r&&"value"!==r.kind&&(i=r);for(var n=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=e.parse(a[o],1+n.length,i,void 0,{typeAnnotation:"omit"});if(!s)return null;i=i||s.type,n.push(s)}var l=r&&n.some((function(t){return Jt(r,t.type)}));return new si(l?qt:i,n)},si.prototype.evaluate=function(t){for(var e,i=null,r=0,n=0,o=this.args;n<o.length&&(r++,(i=o[n].evaluate(t))&&i instanceof ne&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null===i);n+=1);return i},si.prototype.eachChild=function(t){this.args.forEach(t)},si.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},si.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var li=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};li.prototype.evaluate=function(t){return this.result.evaluate(t)},li.prototype.eachChild=function(t){for(var e=0,i=this.bindings;e<i.length;e+=1)t(i[e][1]);t(this.result)},li.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var i=[],r=1;r<t.length-1;r+=2){var n=t[r];if("string"!=typeof n)return e.error("Expected string, but found "+typeof n+" instead.",r);if(/[^a-zA-Z0-9_]/.test(n))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);var o=e.parse(t[r+1],r+1);if(!o)return null;i.push([n,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return a?new li(i,a):null},li.prototype.outputDefined=function(){return this.result.outputDefined()},li.prototype.serialize=function(){for(var t=["let"],e=0,i=this.bindings;e<i.length;e+=1){var r=i[e];t.push(r[0],r[1].serialize())}return t.push(this.result.serialize()),t};var ui=function(t,e,i){this.type=t,this.index=e,this.input=i};ui.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Ot),r=e.parse(t[2],2,Ht(e.expectedType||qt));return i&&r?new ui(r.type.itemType,i,r):null},ui.prototype.evaluate=function(t){var e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new ce("Array index out of bounds: "+e+" < 0.");if(e>=i.length)throw new ce("Array index out of bounds: "+e+" > "+(i.length-1)+".");if(e!==Math.floor(e))throw new ce("Array index must be an integer, but found "+e+" instead.");return i[e]},ui.prototype.eachChild=function(t){t(this.index),t(this.input)},ui.prototype.outputDefined=function(){return!1},ui.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var ci=function(t,e){this.type=Nt,this.needle=t,this.haystack=e};ci.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,qt),r=e.parse(t[2],2,qt);return i&&r?Yt(i.type,[Nt,Ut,Ot,Ft,qt])?new ci(i,r):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Xt(i.type)+" instead"):null},ci.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Qt(e,["boolean","string","number","null"]))throw new ce("Expected first argument to be of type boolean, string, number or null, but found "+Xt(se(e))+" instead.");if(!Qt(i,["string","array"]))throw new ce("Expected second argument to be of type array or string, but found "+Xt(se(i))+" instead.");return i.indexOf(e)>=0},ci.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},ci.prototype.outputDefined=function(){return!0},ci.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var hi=function(t,e,i){this.type=Ot,this.needle=t,this.haystack=e,this.fromIndex=i};hi.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,qt),r=e.parse(t[2],2,qt);if(!i||!r)return null;if(!Yt(i.type,[Nt,Ut,Ot,Ft,qt]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Xt(i.type)+" instead");if(4===t.length){var n=e.parse(t[3],3,Ot);return n?new hi(i,r,n):null}return new hi(i,r)},hi.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Qt(e,["boolean","string","number","null"]))throw new ce("Expected first argument to be of type boolean, string, number or null, but found "+Xt(se(e))+" instead.");if(!Qt(i,["string","array"]))throw new ce("Expected second argument to be of type array or string, but found "+Xt(se(i))+" instead.");if(this.fromIndex){var r=this.fromIndex.evaluate(t);return i.indexOf(e,r)}return i.indexOf(e)},hi.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},hi.prototype.outputDefined=function(){return!1},hi.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var pi=function(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o};pi.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var n={},o=[],a=2;a<t.length-1;a+=2){var s=t[a],l=t[a+1];Array.isArray(s)||(s=[s]);var u=e.concat(a);if(0===s.length)return u.error("Expected at least one branch label.");for(var c=0,h=s;c<h.length;c+=1){var p=h[c];if("number"!=typeof p&&"string"!=typeof p)return u.error("Branch labels must be numbers or strings.");if("number"==typeof p&&Math.abs(p)>Number.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof p&&Math.floor(p)!==p)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,se(p)))return null}else i=se(p);if(void 0!==n[String(p)])return u.error("Branch labels must be unique.");n[String(p)]=o.length}var d=e.parse(l,a,r);if(!d)return null;r=r||d.type,o.push(d)}var f=e.parse(t[1],1,qt);if(!f)return null;var m=e.parse(t[t.length-1],t.length-1,r);return m?"value"!==f.type.kind&&e.concat(1).checkSubtype(i,f.type)?null:new pi(i,r,f,n,o,m):null},pi.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(se(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},pi.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},pi.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},pi.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],i=[],r={},n=0,o=Object.keys(this.cases).sort();n<o.length;n+=1){var a=o[n];void 0===(h=r[this.cases[a]])?(r[this.cases[a]]=i.length,i.push([this.cases[a],[a]])):i[h][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},l=0,u=i;l<u.length;l+=1){var c=u[l],h=c[0],p=c[1];e.push(1===p.length?s(p[0]):p.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var di=function(t,e,i){this.type=t,this.branches=e,this.otherwise=i};di.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var r=[],n=1;n<t.length-1;n+=2){var o=e.parse(t[n],n,Nt);if(!o)return null;var a=e.parse(t[n+1],n+1,i);if(!a)return null;r.push([o,a]),i=i||a.type}var s=e.parse(t[t.length-1],t.length-1,i);return s?new di(i,r,s):null},di.prototype.evaluate=function(t){for(var e=0,i=this.branches;e<i.length;e+=1){var r=i[e],n=r[1];if(r[0].evaluate(t))return n.evaluate(t)}return this.otherwise.evaluate(t)},di.prototype.eachChild=function(t){for(var e=0,i=this.branches;e<i.length;e+=1){var r=i[e],n=r[1];t(r[0]),t(n)}t(this.otherwise)},di.prototype.outputDefined=function(){return this.branches.every((function(t){return t[1].outputDefined()}))&&this.otherwise.outputDefined()},di.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var fi=function(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r};function mi(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function yi(t,e,i,r){return 0===r.compare(e,i)}function _i(t,e,i){var r="=="!==t&&"!="!==t;return function(){function n(t,e,i){this.type=Nt,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}return n.parse=function(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");var i=t[0],o=e.parse(t[1],1,qt);if(!o)return null;if(!mi(i,o.type))return e.concat(1).error('"'+i+"\" comparisons are not supported for type '"+Xt(o.type)+"'.");var a=e.parse(t[2],2,qt);if(!a)return null;if(!mi(i,a.type))return e.concat(2).error('"'+i+"\" comparisons are not supported for type '"+Xt(a.type)+"'.");if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+Xt(o.type)+"' and '"+Xt(a.type)+"'.");r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new pe(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new pe(o.type,[a])));var s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(!(s=e.parse(t[3],3,Gt)))return null}return new n(o,a,s)},n.prototype.evaluate=function(n){var o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){var s=se(o),l=se(a);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new ce('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+s.kind+", "+l.kind+") instead.")}if(this.collator&&!r&&this.hasUntypedArgument){var u=se(o),c=se(a);if("string"!==u.kind||"string"!==c.kind)return e(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):e(n,o,a)},n.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},n.prototype.outputDefined=function(){return!0},n.prototype.serialize=function(){var e=[t];return this.eachChild((function(t){e.push(t.serialize())})),e},n}()}fi.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,qt),r=e.parse(t[2],2,Ot);if(!i||!r)return null;if(!Yt(i.type,[Ht(qt),Ut,qt]))return e.error("Expected first argument to be of type array or string, but found "+Xt(i.type)+" instead");if(4===t.length){var n=e.parse(t[3],3,Ot);return n?new fi(i.type,i,r,n):null}return new fi(i.type,i,r)},fi.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Qt(e,["string","array"]))throw new ce("Expected first argument to be of type array or string, but found "+Xt(se(e))+" instead.");if(this.endIndex){var r=this.endIndex.evaluate(t);return e.slice(i,r)}return e.slice(i)},fi.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},fi.prototype.outputDefined=function(){return!1},fi.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var vi=_i("==",(function(t,e,i){return e===i}),yi),gi=_i("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!yi(0,e,i,r)})),xi=_i("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),bi=_i(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),wi=_i("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),Ei=_i(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0})),Ii=function(t,e,i,r,n){this.type=Ut,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n};Ii.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Ot);if(!i)return null;var r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");var n=null;if(r.locale&&!(n=e.parse(r.locale,1,Ut)))return null;var o=null;if(r.currency&&!(o=e.parse(r.currency,1,Ut)))return null;var a=null;if(r["min-fraction-digits"]&&!(a=e.parse(r["min-fraction-digits"],1,Ot)))return null;var s=null;return r["max-fraction-digits"]&&!(s=e.parse(r["max-fraction-digits"],1,Ot))?null:new Ii(i,n,o,a,s)},Ii.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},Ii.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},Ii.prototype.outputDefined=function(){return!1},Ii.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var Si=function(t){this.type=Ot,this.input=t};Si.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error("Expected argument of type string or array, but found "+Xt(i.type)+" instead."):new Si(i):null},Si.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ce("Expected value to be of type string or array, but found "+Xt(se(e))+" instead.")},Si.prototype.eachChild=function(t){t(this.input)},Si.prototype.outputDefined=function(){return!1},Si.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Ti={"==":vi,"!=":gi,">":bi,"<":xi,">=":Ei,"<=":wi,array:pe,at:ui,boolean:pe,case:di,coalesce:si,collator:xe,format:de,image:fe,in:ci,"index-of":hi,interpolate:oi,"interpolate-hcl":oi,"interpolate-lab":oi,length:Si,let:li,literal:ue,match:pi,number:pe,"number-format":Ii,object:pe,slice:fi,step:qe,string:pe,"to-boolean":ye,"to-color":ye,"to-number":ye,"to-string":ye,var:Ne,within:Be};function Ai(t,e){var i=e[0],r=e[1],n=e[2],o=e[3];i=i.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);var a=o?o.evaluate(t):1,s=oe(i,r,n,a);if(s)throw new ce(s);return new te(i/255*a,r/255*a,n/255*a,a)}function Pi(t,e){return t in e}function Mi(t,e){var i=e[t];return void 0===i?null:i}function Ci(t){return{type:t}}function zi(t){return{result:"success",value:t}}function ki(t){return{result:"error",value:t}}function Li(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Di(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ri(t){return!!t.expression&&t.expression.interpolated}function Bi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Fi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Oi(t){return t}function Ui(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Ni(t,e,i,r,n){return Ui(typeof i===n?r[i]:void 0,t.default,e.default)}function Vi(t,e,i){if("number"!==Bi(i))return Ui(t.default,e.default);var r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];var n=je(t.stops.map((function(t){return t[0]})),i);return t.stops[n][1]}function ji(t,e,i){var r=void 0!==t.base?t.base:1;if("number"!==Bi(i))return Ui(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];var o,a,s,l,u,c,h=je(t.stops.map((function(t){return t[0]})),i),p=(o=i,a=r,s=t.stops[h][0],l=t.stops[h+1][0],c=o-s,0==(u=l-s)?0:1===a?c/u:(Math.pow(a,c)-1)/(Math.pow(a,u)-1)),d=t.stops[h][1],f=t.stops[h+1][1],m=Ze[e.type]||Oi;if(t.colorSpace&&"rgb"!==t.colorSpace){var y=ni[t.colorSpace];m=function(t,e){return y.reverse(y.interpolate(y.forward(t),y.forward(e),p))}}return"function"==typeof d.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var i=d.evaluate.apply(void 0,t),r=f.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return m(i,r,p)}}:m(d,f,p)}function qi(t,e,i){return"color"===e.type?i=te.parse(i):"formatted"===e.type?i=re.fromString(i.toString()):"resolvedImage"===e.type?i=ne.fromString(i.toString()):Bi(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0),Ui(i,t.default,e.default)}ge.register(Ti,{error:[{kind:"error"},[Ut],function(t,e){throw new ce(e[0].evaluate(t))}],typeof:[Ut,[qt],function(t,e){return Xt(se(e[0].evaluate(t)))}],"to-rgba":[Ht(Ot,4),[Vt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Vt,[Ot,Ot,Ot],Ai],rgba:[Vt,[Ot,Ot,Ot,Ot],Ai],has:{type:Nt,overloads:[[[Ut],function(t,e){return Pi(e[0].evaluate(t),t.properties())}],[[Ut,jt],function(t,e){var i=e[1];return Pi(e[0].evaluate(t),i.evaluate(t))}]]},get:{type:qt,overloads:[[[Ut],function(t,e){return Mi(e[0].evaluate(t),t.properties())}],[[Ut,jt],function(t,e){var i=e[1];return Mi(e[0].evaluate(t),i.evaluate(t))}]]},"feature-state":[qt,[Ut],function(t,e){return Mi(e[0].evaluate(t),t.featureState||{})}],properties:[jt,[],function(t){return t.properties()}],"geometry-type":[Ut,[],function(t){return t.geometryType()}],id:[qt,[],function(t){return t.id()}],zoom:[Ot,[],function(t){return t.globals.zoom}],"heatmap-density":[Ot,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Ot,[],function(t){return t.globals.lineProgress||0}],accumulated:[qt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Ot,Ci(Ot),function(t,e){for(var i=0,r=0,n=e;r<n.length;r+=1)i+=n[r].evaluate(t);return i}],"*":[Ot,Ci(Ot),function(t,e){for(var i=1,r=0,n=e;r<n.length;r+=1)i*=n[r].evaluate(t);return i}],"-":{type:Ot,overloads:[[[Ot,Ot],function(t,e){var i=e[1];return e[0].evaluate(t)-i.evaluate(t)}],[[Ot],function(t,e){return-e[0].evaluate(t)}]]},"/":[Ot,[Ot,Ot],function(t,e){var i=e[1];return e[0].evaluate(t)/i.evaluate(t)}],"%":[Ot,[Ot,Ot],function(t,e){var i=e[1];return e[0].evaluate(t)%i.evaluate(t)}],ln2:[Ot,[],function(){return Math.LN2}],pi:[Ot,[],function(){return Math.PI}],e:[Ot,[],function(){return Math.E}],"^":[Ot,[Ot,Ot],function(t,e){var i=e[1];return Math.pow(e[0].evaluate(t),i.evaluate(t))}],sqrt:[Ot,[Ot],function(t,e){return Math.sqrt(e[0].evaluate(t))}],log10:[Ot,[Ot],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN10}],ln:[Ot,[Ot],function(t,e){return Math.log(e[0].evaluate(t))}],log2:[Ot,[Ot],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN2}],sin:[Ot,[Ot],function(t,e){return Math.sin(e[0].evaluate(t))}],cos:[Ot,[Ot],function(t,e){return Math.cos(e[0].evaluate(t))}],tan:[Ot,[Ot],function(t,e){return Math.tan(e[0].evaluate(t))}],asin:[Ot,[Ot],function(t,e){return Math.asin(e[0].evaluate(t))}],acos:[Ot,[Ot],function(t,e){return Math.acos(e[0].evaluate(t))}],atan:[Ot,[Ot],function(t,e){return Math.atan(e[0].evaluate(t))}],min:[Ot,Ci(Ot),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Ot,Ci(Ot),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Ot,[Ot],function(t,e){return Math.abs(e[0].evaluate(t))}],round:[Ot,[Ot],function(t,e){var i=e[0].evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Ot,[Ot],function(t,e){return Math.floor(e[0].evaluate(t))}],ceil:[Ot,[Ot],function(t,e){return Math.ceil(e[0].evaluate(t))}],"filter-==":[Nt,[Ut,qt],function(t,e){var i=e[0],r=e[1];return t.properties()[i.value]===r.value}],"filter-id-==":[Nt,[qt],function(t,e){var i=e[0];return t.id()===i.value}],"filter-type-==":[Nt,[Ut],function(t,e){var i=e[0];return t.geometryType()===i.value}],"filter-<":[Nt,[Ut,qt],function(t,e){var i=e[0],r=e[1],n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n<o}],"filter-id-<":[Nt,[qt],function(t,e){var i=e[0],r=t.id(),n=i.value;return typeof r==typeof n&&r<n}],"filter->":[Nt,[Ut,qt],function(t,e){var i=e[0],r=e[1],n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n>o}],"filter-id->":[Nt,[qt],function(t,e){var i=e[0],r=t.id(),n=i.value;return typeof r==typeof n&&r>n}],"filter-<=":[Nt,[Ut,qt],function(t,e){var i=e[0],r=e[1],n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[Nt,[qt],function(t,e){var i=e[0],r=t.id(),n=i.value;return typeof r==typeof n&&r<=n}],"filter->=":[Nt,[Ut,qt],function(t,e){var i=e[0],r=e[1],n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[Nt,[qt],function(t,e){var i=e[0],r=t.id(),n=i.value;return typeof r==typeof n&&r>=n}],"filter-has":[Nt,[qt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Nt,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Nt,[Ht(Ut)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Nt,[Ht(qt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Nt,[Ut,Ht(qt)],function(t,e){var i=e[0];return e[1].value.indexOf(t.properties()[i.value])>=0}],"filter-in-large":[Nt,[Ut,Ht(qt)],function(t,e){var i=e[0],r=e[1];return function(t,e,i,r){for(;i<=r;){var n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[i.value],r.value,0,r.value.length-1)}],all:{type:Nt,overloads:[[[Nt,Nt],function(t,e){var i=e[1];return e[0].evaluate(t)&&i.evaluate(t)}],[Ci(Nt),function(t,e){for(var i=0,r=e;i<r.length;i+=1)if(!r[i].evaluate(t))return!1;return!0}]]},any:{type:Nt,overloads:[[[Nt,Nt],function(t,e){var i=e[1];return e[0].evaluate(t)||i.evaluate(t)}],[Ci(Nt),function(t,e){for(var i=0,r=e;i<r.length;i+=1)if(r[i].evaluate(t))return!0;return!1}]]},"!":[Nt,[Nt],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[Nt,[Ut],function(t,e){var i=t.globals&&t.globals.isSupportedScript;return!i||i(e[0].evaluate(t))}],upcase:[Ut,[Ut],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Ut,[Ut],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Ut,Ci(qt),function(t,e){return e.map((function(e){return le(e.evaluate(t))})).join("")}],"resolved-locale":[Ut,[Gt],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var Gi=function(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new ve,this._defaultValue=e?"color"===(i=e).type&&Fi(i.default)?new te(0,0,0,0):"color"===i.type?te.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null};function Zi(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ti}function Wi(t,e){var i,r,n=new Ve(Ti,[],e?(r={color:Vt,string:Ut,number:Ot,enum:Ut,boolean:Nt,formatted:Zt,resolvedImage:Wt},"array"===(i=e).type?Ht(r[i.value]||qt,i.length):r[i.type]):void 0),o=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return o?zi(new Gi(o,e)):ki(n.errors)}Gi.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,n,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)},Gi.prototype.evaluate=function(t,e,i,r,n,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{var a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new ce("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(a)+" instead.");return a}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,"undefined"!=typeof console&&console.warn(s.message)),this._defaultValue}};var Hi=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Oe(e.expression)};Hi.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)},Hi.prototype.evaluate=function(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)};var Xi=function(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Oe(e.expression),this.interpolationType=r};function Ki(t,e){if("error"===(t=Wi(t,e)).result)return t;var i=t.value.expression,r=Fe(i);if(!r&&!Li(e))return ki([new Rt("","data expressions not supported")]);var n=Ue(i,["zoom"]);if(!n&&!Di(e))return ki([new Rt("","zoom expressions not supported")]);var o=function t(e){var i=null;if(e instanceof li)i=t(e.result);else if(e instanceof si)for(var r=0,n=e.args;r<n.length&&!(i=t(n[r]));r+=1);else(e instanceof qe||e instanceof oi)&&e.input instanceof ge&&"zoom"===e.input.name&&(i=e);return i instanceof Rt||e.eachChild((function(e){var r=t(e);r instanceof Rt?i=r:!i&&r?i=new Rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&r&&i!==r&&(i=new Rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),i}(i);return o||n?o instanceof Rt?ki([o]):o instanceof oi&&!Ri(e)?ki([new Rt("",'"interpolate" expressions cannot be used with this property')]):zi(o?new Xi(r?"camera":"composite",t.value,o.labels,o instanceof oi?o.interpolation:void 0):new Hi(r?"constant":"source",t.value)):ki([new Rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Xi.prototype.evaluateWithoutErrorHandling=function(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)},Xi.prototype.evaluate=function(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)},Xi.prototype.interpolationFactor=function(t,e,i){return this.interpolationType?oi.interpolationFactor(this.interpolationType,t,e,i):0};var Ji=function(t,e){this._parameters=t,this._specification=e,kt(this,function t(e,i){var r,n,o,a="color"===i.type,s=e.stops&&"object"==typeof e.stops[0][0],l=s||!(s||void 0!==e.property),u=e.type||(Ri(i)?"exponential":"interval");if(a&&((e=kt({},e)).stops&&(e.stops=e.stops.map((function(t){return[t[0],te.parse(t[1])]}))),e.default=te.parse(e.default?e.default:i.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!ni[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===u)r=ji;else if("interval"===u)r=Vi;else if("categorical"===u){r=Ni,n=Object.create(null);for(var c=0,h=e.stops;c<h.length;c+=1){var p=h[c];n[p[0]]=p[1]}o=typeof e.stops[0][0]}else{if("identity"!==u)throw new Error('Unknown function type "'+u+'"');r=qi}if(s){for(var d={},f=[],m=0;m<e.stops.length;m++){var y=e.stops[m],_=y[0].zoom;void 0===d[_]&&(d[_]={zoom:_,type:e.type,property:e.property,default:e.default,stops:[]},f.push(_)),d[_].stops.push([y[0].value,y[1]])}for(var v=[],g=0,x=f;g<x.length;g+=1){var b=x[g];v.push([d[b].zoom,t(d[b],i)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:oi.interpolationFactor.bind(void 0,w),zoomStops:v.map((function(t){return t[0]})),evaluate:function(t,r){var n=t.zoom;return ji({stops:v,base:e.base},i,n).evaluate(n,r)}}}if(l){var E="exponential"===u?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:oi.interpolationFactor.bind(void 0,E),zoomStops:e.stops.map((function(t){return t[0]})),evaluate:function(t){return r(e,i,t.zoom,n,o)}}}return{kind:"source",evaluate:function(t,a){var s=a&&a.properties?a.properties[e.property]:void 0;return void 0===s?Ui(e.default,i.default):r(e,i,s,n,o)}}}(this._parameters,this._specification))};function Yi(t){var e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=[],l=Bi(i);if("object"!==l)return[new Ct(e,i,"object expected, "+l+" found")];for(var u in i){var c=u.split(".")[0],h=r[c]||r["*"],p=void 0;if(n[c])p=n[c];else if(r[c])p=wr;else if(n["*"])p=n["*"];else{if(!r["*"]){s.push(new Ct(e,i[u],'unknown property "'+u+'"'));continue}p=wr}s=s.concat(p({key:(e?e+".":e)+u,value:i[u],valueSpec:h,style:o,styleSpec:a,object:i,objectKey:u},i))}for(var d in r)n[d]||r[d].required&&void 0===r[d].default&&void 0===i[d]&&s.push(new Ct(e,i,'missing required property "'+d+'"'));return s}function Qi(t){var e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||wr;if("array"!==Bi(e))return[new Ct(o,e,"array expected, "+Bi(e)+" found")];if(i.length&&e.length!==i.length)return[new Ct(o,e,"array length "+i.length+" expected, length "+e.length+" found")];if(i["min-length"]&&e.length<i["min-length"])return[new Ct(o,e,"array length at least "+i["min-length"]+" expected, length "+e.length+" found")];var s={type:i.value,values:i.values};n.$version<7&&(s.function=i.function),"object"===Bi(i.value)&&(s=i.value);for(var l=[],u=0;u<e.length;u++)l=l.concat(a({array:e,arrayIndex:u,value:e[u],valueSpec:s,style:r,styleSpec:n,key:o+"["+u+"]"}));return l}function $i(t){var e=t.key,i=t.value,r=t.valueSpec,n=Bi(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new Ct(e,i,"number expected, "+n+" found")]:"minimum"in r&&i<r.minimum?[new Ct(e,i,i+" is less than the minimum value "+r.minimum)]:"maximum"in r&&i>r.maximum?[new Ct(e,i,i+" is greater than the maximum value "+r.maximum)]:[]}function tr(t){var e,i,r,n=t.valueSpec,o=Lt(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,l=!s,u="array"===Bi(t.value.stops)&&"array"===Bi(t.value.stops[0])&&"object"===Bi(t.value.stops[0][0]),c=Yi({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new Ct(t.key,t.value,'identity function may not have a "stops" property')];var e=[],i=t.value;return e=e.concat(Qi({key:t.key,value:i,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Bi(i)&&0===i.length&&e.push(new Ct(t.key,i,"array must have at least one stop")),e},default:function(t){return wr({key:t.key,value:t.value,valueSpec:n,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new Ct(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new Ct(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!Ri(t.valueSpec)&&c.push(new Ct(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Li(t.valueSpec)?c.push(new Ct(t.key,t.value,"property functions not supported")):s&&!Di(t.valueSpec)&&c.push(new Ct(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!u||void 0!==t.value.property||c.push(new Ct(t.key,t.value,'"property" property is required')),c;function h(t){var e=[],o=t.value,s=t.key;if("array"!==Bi(o))return[new Ct(s,o,"array expected, "+Bi(o)+" found")];if(2!==o.length)return[new Ct(s,o,"array length 2 expected, length "+o.length+" found")];if(u){if("object"!==Bi(o[0]))return[new Ct(s,o,"object expected, "+Bi(o[0])+" found")];if(void 0===o[0].zoom)return[new Ct(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new Ct(s,o,"object stop key must have value")];if(r&&r>Lt(o[0].zoom))return[new Ct(s,o[0].zoom,"stop zoom values must appear in ascending order")];Lt(o[0].zoom)!==r&&(r=Lt(o[0].zoom),i=void 0,a={}),e=e.concat(Yi({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:$i,value:p}}))}else e=e.concat(p({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return Zi(Dt(o[1]))?e.concat([new Ct(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(wr({key:s+"[1]",value:o[1],valueSpec:n,style:t.style,styleSpec:t.styleSpec}))}function p(t,r){var s=Bi(t.value),l=Lt(t.value),u=null!==t.value?t.value:r;if(e){if(s!==e)return[new Ct(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Ct(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return Li(n)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ct(t.key,u,c)]}return"categorical"!==o||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===s&&void 0!==i&&l<i?[new Ct(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===o&&l in a?[new Ct(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new Ct(t.key,u,"integer expected, found "+l)]}}function er(t){var e=("property"===t.expressionContext?Ki:Wi)(Dt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((function(e){return new Ct(""+t.key+e.key,t.value,e.message)}));var i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new Ct(t.key,t.value,'Invalid data expression for "'+t.propertyKey+'". Output values must be contained as literals within the expression.')];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Oe(i))return[new Ct(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Oe(i))return[new Ct(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ue(i,["zoom","feature-state"]))return[new Ct(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Fe(i))return[new Ct(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ir(t){var e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(Lt(i))&&n.push(new Ct(e,i,"expected one of ["+r.values.join(", ")+"], "+JSON.stringify(i)+" found")):-1===Object.keys(r.values).indexOf(Lt(i))&&n.push(new Ct(e,i,"expected one of ["+Object.keys(r.values).join(", ")+"], "+JSON.stringify(i)+" found")),n}function rr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,i=t.slice(1);e<i.length;e+=1){var r=i[e];if(!rr(r)&&"boolean"!=typeof r)return!1}return!0;default:return!0}}Ji.deserialize=function(t){return new Ji(t._parameters,t._specification)},Ji.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var nr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function or(t){if(null==t)return{filter:function(){return!0},needGeometry:!1};rr(t)||(t=sr(t));var e=Wi(t,nr);if("error"===e.result)throw new Error(e.value.map((function(t){return t.key+": "+t.message})).join(", "));return{filter:function(t,i,r){return e.value.evaluate(t,i,{},r)},needGeometry:function t(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var i=1;i<e.length;i++)if(t(e[i]))return!0;return!1}(t)}}function ar(t,e){return t<e?-1:t>e?1:0}function sr(t){if(!t)return!0;var e,i=t[0];return t.length<=1?"any"!==i:"=="===i?lr(t[1],t[2],"=="):"!="===i?hr(lr(t[1],t[2],"==")):"<"===i||">"===i||"<="===i||">="===i?lr(t[1],t[2],i):"any"===i?(e=t.slice(1),["any"].concat(e.map(sr))):"all"===i?["all"].concat(t.slice(1).map(sr)):"none"===i?["all"].concat(t.slice(1).map(sr).map(hr)):"in"===i?ur(t[1],t.slice(2)):"!in"===i?hr(ur(t[1],t.slice(2))):"has"===i?cr(t[1]):"!has"===i?hr(cr(t[1])):"within"!==i||t}function lr(t,e,i){switch(t){case"$type":return["filter-type-"+i,e];case"$id":return["filter-id-"+i,e];default:return["filter-"+i,t,e]}}function ur(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(ar)]]:["filter-in-small",t,["literal",e]]}}function cr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function hr(t){return["!",t]}function pr(t){return rr(Dt(t.value))?er(kt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var i=e.value,r=e.key;if("array"!==Bi(i))return[new Ct(r,i,"array expected, "+Bi(i)+" found")];var n,o=e.styleSpec,a=[];if(i.length<1)return[new Ct(r,i,"filter array must have at least 1 element")];switch(a=a.concat(ir({key:r+"[0]",value:i[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),Lt(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===Lt(i[1])&&a.push(new Ct(r,i,'"$type" cannot be use with operator "'+i[0]+'"'));case"==":case"!=":3!==i.length&&a.push(new Ct(r,i,'filter array for operator "'+i[0]+'" must have 3 elements'));case"in":case"!in":i.length>=2&&"string"!==(n=Bi(i[1]))&&a.push(new Ct(r+"[1]",i[1],"string expected, "+n+" found"));for(var s=2;s<i.length;s++)n=Bi(i[s]),"$type"===Lt(i[1])?a=a.concat(ir({key:r+"["+s+"]",value:i[s],valueSpec:o.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&a.push(new Ct(r+"["+s+"]",i[s],"string, number, or boolean expected, "+n+" found"));break;case"any":case"all":case"none":for(var l=1;l<i.length;l++)a=a.concat(t({key:r+"["+l+"]",value:i[l],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=Bi(i[1]),2!==i.length?a.push(new Ct(r,i,'filter array for "'+i[0]+'" operator must have 2 elements')):"string"!==n&&a.push(new Ct(r+"[1]",i[1],"string expected, "+n+" found"));break;case"within":n=Bi(i[1]),2!==i.length?a.push(new Ct(r,i,'filter array for "'+i[0]+'" operator must have 2 elements')):"object"!==n&&a.push(new Ct(r+"[1]",i[1],"object expected, "+n+" found"))}return a}(t)}function dr(t,e){var i=t.key,r=t.style,n=t.styleSpec,o=t.value,a=t.objectKey,s=n[e+"_"+t.layerType];if(!s)return[];var l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&s[l[1]]&&s[l[1]].transition)return wr({key:i,value:o,valueSpec:n.transition,style:r,styleSpec:n});var u,c=t.valueSpec||s[a];if(!c)return[new Ct(i,o,'unknown property "'+a+'"')];if("string"===Bi(o)&&Li(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new Ct(i,o,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(u[1])+" }`.")];var h=[];return"symbol"===t.layerType&&("text-field"===a&&r&&!r.glyphs&&h.push(new Ct(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Fi(Dt(o))&&"identity"===Lt(o.type)&&h.push(new Ct(i,o,'"text-font" does not support identity functions'))),h.concat(wr({key:t.key,value:o,valueSpec:c,style:r,styleSpec:n,expressionContext:"property",propertyType:e,propertyKey:a}))}function fr(t){return dr(t,"paint")}function mr(t){return dr(t,"layout")}function yr(t){var e=[],i=t.value,r=t.key,n=t.style,o=t.styleSpec;i.type||i.ref||e.push(new Ct(r,i,'either "type" or "ref" is required'));var a,s=Lt(i.type),l=Lt(i.ref);if(i.id)for(var u=Lt(i.id),c=0;c<t.arrayIndex;c++){var h=n.layers[c];Lt(h.id)===u&&e.push(new Ct(r,i.id,'duplicate layer id "'+i.id+'", previously used at line '+h.id.__line__))}if("ref"in i)["type","source","source-layer","filter","layout"].forEach((function(t){t in i&&e.push(new Ct(r,i[t],'"'+t+'" is prohibited for ref layers'))})),n.layers.forEach((function(t){Lt(t.id)===l&&(a=t)})),a?a.ref?e.push(new Ct(r,i.ref,"ref cannot reference another ref layer")):s=Lt(a.type):e.push(new Ct(r,i.ref,'ref layer "'+l+'" not found'));else if("background"!==s)if(i.source){var p=n.sources&&n.sources[i.source],d=p&&Lt(p.type);p?"vector"===d&&"raster"===s?e.push(new Ct(r,i.source,'layer "'+i.id+'" requires a raster source')):"raster"===d&&"raster"!==s?e.push(new Ct(r,i.source,'layer "'+i.id+'" requires a vector source')):"vector"!==d||i["source-layer"]?"raster-dem"===d&&"hillshade"!==s?e.push(new Ct(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]||"geojson"===d&&p.lineMetrics||e.push(new Ct(r,i,'layer "'+i.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new Ct(r,i,'layer "'+i.id+'" must specify a "source-layer"')):e.push(new Ct(r,i.source,'source "'+i.source+'" not found'))}else e.push(new Ct(r,i,'missing required property "source"'));return e=e.concat(Yi({key:r,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return wr({key:r+".type",value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"})},filter:pr,layout:function(t){return Yi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return mr(kt({layerType:s},t))}}})},paint:function(t){return Yi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return fr(kt({layerType:s},t))}}})}}}))}function _r(t){var e=t.value,i=t.key,r=Bi(e);return"string"!==r?[new Ct(i,e,"string expected, "+r+" found")]:[]}var vr={promoteId:function(t){var e=t.key,i=t.value;if("string"===Bi(i))return _r({key:e,value:i});var r=[];for(var n in i)r.push.apply(r,_r({key:e+"."+n,value:i[n]}));return r}};function gr(t){var e=t.value,i=t.key,r=t.styleSpec,n=t.style;if(!e.type)return[new Ct(i,e,'"type" is required')];var o,a=Lt(e.type);switch(a){case"vector":case"raster":case"raster-dem":return Yi({key:i,value:e,valueSpec:r["source_"+a.replace("-","_")],style:t.style,styleSpec:r,objectElementValidators:vr});case"geojson":if(o=Yi({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,objectElementValidators:vr}),e.cluster)for(var s in e.clusterProperties){var l=e.clusterProperties[s],u=l[0],c="string"==typeof u?[u,["accumulated"],["get",s]]:u;o.push.apply(o,er({key:i+"."+s+".map",value:l[1],expressionContext:"cluster-map"})),o.push.apply(o,er({key:i+"."+s+".reduce",value:c,expressionContext:"cluster-reduce"}))}return o;case"video":return Yi({key:i,value:e,valueSpec:r.source_video,style:n,styleSpec:r});case"image":return Yi({key:i,value:e,valueSpec:r.source_image,style:n,styleSpec:r});case"canvas":return[new Ct(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ir({key:i+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,styleSpec:r})}}function xr(t){var e=t.value,i=t.styleSpec,r=i.light,n=t.style,o=[],a=Bi(e);if(void 0===e)return o;if("object"!==a)return o.concat([new Ct("light",e,"object expected, "+a+" found")]);for(var s in e){var l=s.match(/^(.*)-transition$/);o=o.concat(l&&r[l[1]]&&r[l[1]].transition?wr({key:s,value:e[s],valueSpec:i.transition,style:n,styleSpec:i}):r[s]?wr({key:s,value:e[s],valueSpec:r[s],style:n,styleSpec:i}):[new Ct(s,e[s],'unknown property "'+s+'"')])}return o}var br={"*":function(){return[]},array:Qi,boolean:function(t){var e=t.value,i=t.key,r=Bi(e);return"boolean"!==r?[new Ct(i,e,"boolean expected, "+r+" found")]:[]},number:$i,color:function(t){var e=t.key,i=t.value,r=Bi(i);return"string"!==r?[new Ct(e,i,"color expected, "+r+" found")]:null===$t(i)?[new Ct(e,i,'color expected, "'+i+'" found')]:[]},constants:zt,enum:ir,filter:pr,function:tr,layer:yr,object:Yi,source:gr,light:xr,string:_r,formatted:function(t){return 0===_r(t).length?[]:er(t)},resolvedImage:function(t){return 0===_r(t).length?[]:er(t)}};function wr(t){var e=t.value,i=t.valueSpec,r=t.styleSpec;return i.expression&&Fi(Lt(e))?tr(t):i.expression&&Zi(Dt(e))?er(t):i.type&&br[i.type]?br[i.type](t):Yi(kt({},t,{valueSpec:i.type?r[i.type]:i}))}function Er(t){var e=t.value,i=t.key,r=_r(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new Ct(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new Ct(i,e,'"glyphs" url must include a "{range}" token'))),r}function Ir(t,e){void 0===e&&(e=Mt);var i=[];return i=i.concat(wr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Er,"*":function(){return[]}}})),t.constants&&(i=i.concat(zt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Sr(i)}function Sr(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function Tr(t){return function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];return Sr(t.apply(this,e))}}Ir.source=Tr(gr),Ir.light=Tr(xr),Ir.layer=Tr(yr),Ir.filter=Tr(pr),Ir.paintProperty=Tr(fr),Ir.layoutProperty=Tr(mr);var Ar=Ir,Pr=Ar.light,Mr=Ar.paintProperty,Cr=Ar.layoutProperty;function zr(t,e){var i=!1;if(e&&e.length)for(var r=0,n=e;r<n.length;r+=1)t.fire(new At(new Error(n[r].message))),i=!0;return i}var kr=Lr;function Lr(t,e,i){var r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(var o=0;o<this.d*this.d;o++){var a=n[3+o],s=n[3+o+1];r.push(a===s?null:n.subarray(a,s))}var l=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*i;for(var u=0;u<this.d*this.d;u++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;var c=i/e*t;this.min=-c,this.max=t+c}Lr.prototype.insert=function(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},Lr.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},Lr.prototype._insertCell=function(t,e,i,r,n,o){this.cells[n].push(o)},Lr.prototype.query=function(t,e,i,r,n){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=i&&a<=r&&!n)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,i,r,this._queryCell,s,{},n),s},Lr.prototype._queryCell=function(t,e,i,r,n,o,a,s){var l=this.cells[n];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var p=l[h];if(void 0===a[p]){var d=4*p;(s?s(c[d+0],c[d+1],c[d+2],c[d+3]):t<=c[d+2]&&e<=c[d+3]&&i>=c[d+0]&&r>=c[d+1])?(a[p]=!0,o.push(u[p])):a[p]=!1}}},Lr.prototype._forEachCell=function(t,e,i,r,n,o,a,s){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(i),h=this._convertToCellCoord(r),p=l;p<=c;p++)for(var d=u;d<=h;d++){var f=this.d*d+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&n.call(this,t,e,i,r,f,o,a,s))return}},Lr.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Lr.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Lr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,i=0,r=0;r<this.cells.length;r++)i+=this.cells[r].length;var n=new Int32Array(e+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;for(var o=e,a=0;a<t.length;a++){var s=t[a];n[3+a]=o,n.set(s,o),o+=s.length}return n[3+t.length]=o,n.set(this.keys,o),n[3+t.length+1]=o+=this.keys.length,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer};var Dr=a.ImageData,Rr=a.ImageBitmap,Br={};function Fr(t,e,i){void 0===i&&(i={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Br[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}for(var Or in Fr("Object",Object),kr.serialize=function(t,e){var i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}},kr.deserialize=function(t){return new kr(t.buffer)},Fr("Grid",kr),Fr("Color",te),Fr("Error",Error),Fr("ResolvedImage",ne),Fr("StylePropertyFunction",Ji),Fr("StyleExpression",Gi,{omit:["_evaluator"]}),Fr("ZoomDependentExpression",Xi),Fr("ZoomConstantExpression",Hi),Fr("CompoundExpression",ge,{omit:["_evaluate"]}),Ti)Ti[Or]._classRegistryKey||Fr("Expression_"+Or,Ti[Or]);function Ur(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Nr(t){return Rr&&t instanceof Rr}function Vr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(Ur(t)||Nr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var i=t;return e&&e.push(i.buffer),i}if(t instanceof Dr)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var r=[],n=0,o=t;n<o.length;n+=1)r.push(Vr(o[n],e));return r}if("object"==typeof t){var a=t.constructor,s=a._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");var l=a.serialize?a.serialize(t,e):{};if(!a.serialize){for(var u in t)if(t.hasOwnProperty(u)&&!(Br[s].omit.indexOf(u)>=0)){var c=t[u];l[u]=Br[s].shallow.indexOf(u)>=0?c:Vr(c,e)}t instanceof Error&&(l.message=t.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof t)}function jr(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Ur(t)||Nr(t)||ArrayBuffer.isView(t)||t instanceof Dr)return t;if(Array.isArray(t))return t.map(jr);if("object"==typeof t){var e=t.$name||"Object",i=Br[e].klass;if(!i)throw new Error("can't deserialize unregistered class "+e);if(i.deserialize)return i.deserialize(t);for(var r=Object.create(i.prototype),n=0,o=Object.keys(t);n<o.length;n+=1){var a=o[n];if("$name"!==a){var s=t[a];r[a]=Br[e].shallow.indexOf(a)>=0?s:jr(s)}}return r}throw new Error("can't deserialize object of type "+typeof t)}var qr=function(){this.first=!0};qr.prototype.update=function(t,e){var i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))};var Gr={"Latin-1 Supplement":function(t){return t>=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Zr(t){for(var e=0,i=t;e<i.length;e+=1)if(Wr(i[e].charCodeAt(0)))return!0;return!1}function Wr(t){return!(746!==t&&747!==t&&(t<4352||!(Gr["Bopomofo Extended"](t)||Gr.Bopomofo(t)||Gr["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Gr["CJK Compatibility Ideographs"](t)||Gr["CJK Compatibility"](t)||Gr["CJK Radicals Supplement"](t)||Gr["CJK Strokes"](t)||!(!Gr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Gr["CJK Unified Ideographs Extension A"](t)||Gr["CJK Unified Ideographs"](t)||Gr["Enclosed CJK Letters and Months"](t)||Gr["Hangul Compatibility Jamo"](t)||Gr["Hangul Jamo Extended-A"](t)||Gr["Hangul Jamo Extended-B"](t)||Gr["Hangul Jamo"](t)||Gr["Hangul Syllables"](t)||Gr.Hiragana(t)||Gr["Ideographic Description Characters"](t)||Gr.Kanbun(t)||Gr["Kangxi Radicals"](t)||Gr["Katakana Phonetic Extensions"](t)||Gr.Katakana(t)&&12540!==t||!(!Gr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Gr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Gr["Unified Canadian Aboriginal Syllabics"](t)||Gr["Unified Canadian Aboriginal Syllabics Extended"](t)||Gr["Vertical Forms"](t)||Gr["Yijing Hexagram Symbols"](t)||Gr["Yi Syllables"](t)||Gr["Yi Radicals"](t))))}function Hr(t){return!(Wr(t)||(e=t,Gr["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Gr["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)||Gr["Letterlike Symbols"](e)||Gr["Number Forms"](e)||Gr["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)||Gr["Control Pictures"](e)&&9251!==e||Gr["Optical Character Recognition"](e)||Gr["Enclosed Alphanumerics"](e)||Gr["Geometric Shapes"](e)||Gr["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Gr["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Gr["CJK Symbols and Punctuation"](e)||Gr.Katakana(e)||Gr["Private Use Area"](e)||Gr["CJK Compatibility Forms"](e)||Gr["Small Form Variants"](e)||Gr["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e));var e}function Xr(t){return t>=1424&&t<=2303||Gr["Arabic Presentation Forms-A"](t)||Gr["Arabic Presentation Forms-B"](t)}function Kr(t,e){return!(!e&&Xr(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Gr.Khmer(t))}function Jr(t){for(var e=0,i=t;e<i.length;e+=1)if(Xr(i[e].charCodeAt(0)))return!0;return!1}var Yr=null,Qr="unavailable",$r=null,tn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Qr="error"),Yr&&Yr(t)};function en(){rn.fire(new Tt("pluginStateChange",{pluginStatus:Qr,pluginURL:$r}))}var rn=new Pt,nn=function(){return Qr},on=function(){if("deferred"!==Qr||!$r)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Qr="loading",en(),$r&&xt({url:$r},(function(t){t?tn(t):(Qr="loaded",en())}))},an={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===Qr||null!=an.applyArabicShaping},isLoading:function(){return"loading"===Qr},setState:function(t){Qr=t.pluginStatus,$r=t.pluginURL},isParsed:function(){return null!=an.applyArabicShaping&&null!=an.processBidirectionalText&&null!=an.processStyledBidirectionalText},getPluginURL:function(){return $r}},sn=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new qr,this.transition={})};sn.prototype.isSupportedScript=function(t){return function(t,e){for(var i=0,r=t;i<r.length;i+=1)if(!Kr(r[i].charCodeAt(0),e))return!1;return!0}(t,an.isLoaded())},sn.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},sn.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}};var ln=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Fi(t))return new Ji(t,e);if(Zi(t)){var i=Ki(t,e);if("error"===i.result)throw new Error(i.value.map((function(t){return t.key+": "+t.message})).join(", "));return i.value}var r=t;return"string"==typeof t&&"color"===e.type&&(r=te.parse(t)),{kind:"constant",evaluate:function(){return r}}}(void 0===e?t.specification.default:e,t.specification)};ln.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ln.prototype.possiblyEvaluate=function(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)};var un=function(t){this.property=t,this.value=new ln(t,void 0)};un.prototype.transitioned=function(t,e){return new hn(this.property,this.value,e,p({},t.transition,this.transition),t.now)},un.prototype.untransitioned=function(){return new hn(this.property,this.value,null,{},0)};var cn=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};cn.prototype.getValue=function(t){return b(this._values[t].value.value)},cn.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new un(this._values[t].property)),this._values[t].value=new ln(this._values[t].property,null===e?void 0:b(e))},cn.prototype.getTransition=function(t){return b(this._values[t].transition)},cn.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new un(this._values[t].property)),this._values[t].transition=b(e)||void 0},cn.prototype.serialize=function(){for(var t={},e=0,i=Object.keys(this._values);e<i.length;e+=1){var r=i[e],n=this.getValue(r);void 0!==n&&(t[r]=n);var o=this.getTransition(r);void 0!==o&&(t[r+"-transition"]=o)}return t},cn.prototype.transitioned=function(t,e){for(var i=new pn(this._properties),r=0,n=Object.keys(this._values);r<n.length;r+=1){var o=n[r];i._values[o]=this._values[o].transitioned(t,e._values[o])}return i},cn.prototype.untransitioned=function(){for(var t=new pn(this._properties),e=0,i=Object.keys(this._values);e<i.length;e+=1){var r=i[e];t._values[r]=this._values[r].untransitioned()}return t};var hn=function(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)};hn.prototype.possiblyEvaluate=function(t,e,i){var r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(t,e,i);var a=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),n,function(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(a))}return n};var pn=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};pn.prototype.possiblyEvaluate=function(t,e,i){for(var r=new mn(this._properties),n=0,o=Object.keys(this._values);n<o.length;n+=1){var a=o[n];r._values[a]=this._values[a].possiblyEvaluate(t,e,i)}return r},pn.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1)if(this._values[e[t]].prior)return!0;return!1};var dn=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};dn.prototype.getValue=function(t){return b(this._values[t].value)},dn.prototype.setValue=function(t,e){this._values[t]=new ln(this._values[t].property,null===e?void 0:b(e))},dn.prototype.serialize=function(){for(var t={},e=0,i=Object.keys(this._values);e<i.length;e+=1){var r=i[e],n=this.getValue(r);void 0!==n&&(t[r]=n)}return t},dn.prototype.possiblyEvaluate=function(t,e,i){for(var r=new mn(this._properties),n=0,o=Object.keys(this._values);n<o.length;n+=1){var a=o[n];r._values[a]=this._values[a].possiblyEvaluate(t,e,i)}return r};var fn=function(t,e,i){this.property=t,this.value=e,this.parameters=i};fn.prototype.isConstant=function(){return"constant"===this.value.kind},fn.prototype.constantOr=function(t){return"constant"===this.value.kind?this.value.value:t},fn.prototype.evaluate=function(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)};var mn=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};mn.prototype.get=function(t){return this._values[t]};var yn=function(t){this.specification=t};yn.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},yn.prototype.interpolate=function(t,e,i){var r=Ze[this.specification.type];return r?r(t,e,i):t};var _n=function(t,e){this.specification=t,this.overrides=e};_n.prototype.possiblyEvaluate=function(t,e,i,r){return new fn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)},_n.prototype.interpolate=function(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new fn(this,{kind:"constant",value:void 0},t.parameters);var r=Ze[this.specification.type];return r?new fn(this,{kind:"constant",value:r(t.value.value,e.value.value,i)},t.parameters):t},_n.prototype.evaluate=function(t,e,i,r,n,o){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,o)};var vn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(t,e,i,r){if(void 0===t.value)return new fn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){var n=t.expression.evaluate(e,null,{},i,r),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,e);return new fn(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){var s=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new fn(this,{kind:"constant",value:s},e)}return new fn(this,t.expression,e)},e.prototype.evaluate=function(t,e,i,r,n,o){if("source"===t.kind){var a=t.evaluate(e,i,r,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value},e.prototype._calculate=function(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}},e.prototype.interpolate=function(t){return t},e}(_n),gn=function(t){this.specification=t};gn.prototype.possiblyEvaluate=function(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){var n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new sn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new sn(Math.floor(e.zoom),e)),t.expression.evaluate(new sn(Math.floor(e.zoom+1),e)),e)}},gn.prototype._calculate=function(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}},gn.prototype.interpolate=function(t){return t};var xn=function(t){this.specification=t};xn.prototype.possiblyEvaluate=function(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)},xn.prototype.interpolate=function(){return!1};var bn=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var i=t[e];i.specification.overridable&&this.overridableProperties.push(e);var r=this.defaultPropertyValues[e]=new ln(i,void 0),n=this.defaultTransitionablePropertyValues[e]=new un(i);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}};Fr("DataDrivenProperty",_n),Fr("DataConstantProperty",yn),Fr("CrossFadedDataDrivenProperty",vn),Fr("CrossFadedProperty",gn),Fr("ColorRampProperty",xn);var wn=function(t){function e(e,i){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),i.layout&&(this._unevaluatedLayout=new dn(i.layout)),i.paint)){for(var r in this._transitionablePaint=new cn(i.paint),e.paint)this.setPaintProperty(r,e.paint[r],{validate:!1});for(var n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new mn(i.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,i){void 0===i&&(i={}),null!=e&&this._validate(Cr,"layers."+this.id+".layout."+t,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return v(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,i){if(void 0===i&&(i={}),null!=e&&this._validate(Mr,"layers."+this.id+".paint."+t,t,e,i))return!1;if(v(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;var r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],o=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||o||n||this._handleOverridablePaintPropertyUpdate(t,a,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,i){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),x(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,i,r,n){return void 0===n&&(n={}),(!n||!1!==n.validate)&&zr(this,t.call(Ar,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:Mt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof fn&&Li(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Pt),En={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},In=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Sn=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Tn(t,e){void 0===e&&(e=1);var i=0,r=0;return{members:t.map((function(t){var n=En[t.type].BYTES_PER_ELEMENT,o=i=An(i,Math.max(e,n)),a=t.components||1;return r=Math.max(r,n),i+=n*a,{name:t.name,type:t.type,components:a,offset:o}})),size:An(i,Math.max(r,e)),alignment:e}}function An(t,e){return Math.ceil(t/e)*e}Sn.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Sn.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Sn.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Sn.prototype.clear=function(){this.length=0},Sn.prototype.resize=function(t){this.reserve(t),this.length=t},Sn.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},Sn.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var i=this.length;return this.resize(i+1),this.emplace(i,t,e)},e.prototype.emplace=function(t,e,i){var r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t},e}(Sn);Pn.prototype.bytesPerElement=4,Fr("StructArrayLayout2i4",Pn);var Mn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)},e.prototype.emplace=function(t,e,i,r,n){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,t},e}(Sn);Mn.prototype.bytesPerElement=8,Fr("StructArrayLayout4i8",Mn);var Cn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)},e.prototype.emplace=function(t,e,i,r,n,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Sn);Cn.prototype.bytesPerElement=12,Fr("StructArrayLayout2i4i12",Cn);var zn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)},e.prototype.emplace=function(t,e,i,r,n,o,a){var s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,t},e}(Sn);zn.prototype.bytesPerElement=8,Fr("StructArrayLayout2i4ub8",zn);var kn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var i=this.length;return this.resize(i+1),this.emplace(i,t,e)},e.prototype.emplace=function(t,e,i){var r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t},e}(Sn);kn.prototype.bytesPerElement=8,Fr("StructArrayLayout2f8",kn);var Ln=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o,a,s,l,u){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,n,o,a,s,l,u)},e.prototype.emplace=function(t,e,i,r,n,o,a,s,l,u,c){var h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t},e}(Sn);Ln.prototype.bytesPerElement=20,Fr("StructArrayLayout10ui20",Ln);var Dn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o,a,s,l,u,c,h){var p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,o,a,s,l,u,c,h)},e.prototype.emplace=function(t,e,i,r,n,o,a,s,l,u,c,h,p){var d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,t},e}(Sn);Dn.prototype.bytesPerElement=24,Fr("StructArrayLayout4i4ui4i24",Dn);var Rn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)},e.prototype.emplace=function(t,e,i,r){var n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t},e}(Sn);Rn.prototype.bytesPerElement=12,Fr("StructArrayLayout3f12",Rn);var Bn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(Sn);Bn.prototype.bytesPerElement=4,Fr("StructArrayLayout1ul4",Bn);var Fn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o,a,s,l){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,r,n,o,a,s,l)},e.prototype.emplace=function(t,e,i,r,n,o,a,s,l,u){var c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=i,this.int16[c+2]=r,this.int16[c+3]=n,this.int16[c+4]=o,this.int16[c+5]=a,this.uint32[h+3]=s,this.uint16[c+8]=l,this.uint16[c+9]=u,t},e}(Sn);Fn.prototype.bytesPerElement=20,Fr("StructArrayLayout6i1ul2ui20",Fn);var On=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)},e.prototype.emplace=function(t,e,i,r,n,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Sn);On.prototype.bytesPerElement=12,Fr("StructArrayLayout2i2i2i12",On);var Un=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)},e.prototype.emplace=function(t,e,i,r,n,o){var a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[s+6]=n,this.int16[s+7]=o,t},e}(Sn);Un.prototype.bytesPerElement=16,Fr("StructArrayLayout2f1f2i16",Un);var Nn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)},e.prototype.emplace=function(t,e,i,r,n){var o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[a+1]=r,this.float32[a+2]=n,t},e}(Sn);Nn.prototype.bytesPerElement=12,Fr("StructArrayLayout2ub2f12",Nn);var Vn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)},e.prototype.emplace=function(t,e,i,r){var n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t},e}(Sn);Vn.prototype.bytesPerElement=6,Fr("StructArrayLayout3ui6",Vn);var jn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m,y){var _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m,y)},e.prototype.emplace=function(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m,y,_){var v=24*t,g=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=i,this.uint16[v+2]=r,this.uint16[v+3]=n,this.uint32[g+2]=o,this.uint32[g+3]=a,this.uint32[g+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=c,this.float32[g+7]=h,this.float32[g+8]=p,this.uint8[x+36]=d,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[g+10]=y,this.int16[v+22]=_,t},e}(Sn);jn.prototype.bytesPerElement=48,Fr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",jn);var qn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m,y,_,v,g,x,b,w,E,I,S,T,A){var P=this.length;return this.resize(P+1),this.emplace(P,t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m,y,_,v,g,x,b,w,E,I,S,T,A)},e.prototype.emplace=function(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m,y,_,v,g,x,b,w,E,I,S,T,A,P){var M=34*t,C=17*t;return this.int16[M+0]=e,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=n,this.int16[M+4]=o,this.int16[M+5]=a,this.int16[M+6]=s,this.int16[M+7]=l,this.uint16[M+8]=u,this.uint16[M+9]=c,this.uint16[M+10]=h,this.uint16[M+11]=p,this.uint16[M+12]=d,this.uint16[M+13]=f,this.uint16[M+14]=m,this.uint16[M+15]=y,this.uint16[M+16]=_,this.uint16[M+17]=v,this.uint16[M+18]=g,this.uint16[M+19]=x,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=E,this.uint32[C+12]=I,this.float32[C+13]=S,this.float32[C+14]=T,this.float32[C+15]=A,this.float32[C+16]=P,t},e}(Sn);qn.prototype.bytesPerElement=68,Fr("StructArrayLayout8i15ui1ul4f68",qn);var Gn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(Sn);Gn.prototype.bytesPerElement=4,Fr("StructArrayLayout1f4",Gn);var Zn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)},e.prototype.emplace=function(t,e,i,r){var n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t},e}(Sn);Zn.prototype.bytesPerElement=6,Fr("StructArrayLayout3i6",Zn);var Wn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)},e.prototype.emplace=function(t,e,i,r){var n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t},e}(Sn);Wn.prototype.bytesPerElement=8,Fr("StructArrayLayout1ul2ui8",Wn);var Hn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var i=this.length;return this.resize(i+1),this.emplace(i,t,e)},e.prototype.emplace=function(t,e,i){var r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t},e}(Sn);Hn.prototype.bytesPerElement=4,Fr("StructArrayLayout2ui4",Hn);var Xn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(Sn);Xn.prototype.bytesPerElement=2,Fr("StructArrayLayout1ui2",Xn);var Kn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)},e.prototype.emplace=function(t,e,i,r,n){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,t},e}(Sn);Kn.prototype.bytesPerElement=16,Fr("StructArrayLayout4f16",Kn);var Jn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return i.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},i.x1.get=function(){return this._structArray.int16[this._pos2+2]},i.y1.get=function(){return this._structArray.int16[this._pos2+3]},i.x2.get=function(){return this._structArray.int16[this._pos2+4]},i.y2.get=function(){return this._structArray.int16[this._pos2+5]},i.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},i.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},i.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},i.anchorPoint.get=function(){return new n(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,i),e}(In);Jn.prototype.size=20;var Yn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Jn(this,t)},e}(Fn);Fr("CollisionBoxArray",Yn);var Qn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return i.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},i.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},i.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},i.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},i.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},i.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},i.segment.get=function(){return this._structArray.uint16[this._pos2+10]},i.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},i.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},i.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},i.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},i.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},i.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},i.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},i.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},i.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},i.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},i.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},i.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,i),e}(In);Qn.prototype.size=48;var $n=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Qn(this,t)},e}(jn);Fr("PlacedSymbolArray",$n);var to=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return i.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},i.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},i.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},i.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},i.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},i.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},i.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},i.key.get=function(){return this._structArray.uint16[this._pos2+8]},i.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},i.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},i.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},i.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},i.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},i.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},i.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},i.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},i.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},i.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},i.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},i.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},i.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},i.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},i.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},i.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},i.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},i.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},i.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},i.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,i),e}(In);to.prototype.size=68;var eo=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new to(this,t)},e}(qn);Fr("SymbolInstanceArray",eo);var io=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Gn);Fr("GlyphOffsetArray",io);var ro=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(Zn);Fr("SymbolLineVertexArray",ro);var no=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return i.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},i.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},i.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,i),e}(In);no.prototype.size=8;var oo=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new no(this,t)},e}(Wn);Fr("FeatureIndexArray",oo);var ao=Tn([{name:"a_pos",components:2,type:"Int16"}],4).members,so=function(t){void 0===t&&(t=[]),this.segments=t};function lo(t,e){return 256*(t=c(Math.floor(t),0,255))+c(Math.floor(e),0,255)}so.prototype.prepareSegment=function(t,e,i,r){var n=this.segments[this.segments.length-1];return t>so.MAX_VERTEX_ARRAY_LENGTH&&E("Max vertices per segment is "+so.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!n||n.vertexLength+t>so.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n},so.prototype.get=function(){return this.segments},so.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var i=e[t];for(var r in i.vaos)i.vaos[r].destroy()}},so.simpleSegment=function(t,e,i,r){return new so([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])},so.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fr("SegmentVector",so);var uo=Tn([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),co=e((function(t){t.exports=function(t,e){var i,r,n,o,a,s,l,u;for(r=t.length-(i=3&t.length),n=e,a=3432918353,s=461845907,u=0;u<r;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}})),ho=e((function(t){t.exports=function(t,e){for(var i,r=t.length,n=e^r,o=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}})),po=co,fo=ho;po.murmur3=co,po.murmur2=fo;var mo=function(){this.ids=[],this.positions=[],this.indexed=!1};mo.prototype.add=function(t,e,i,r){this.ids.push(_o(t)),this.positions.push(e,i,r)},mo.prototype.getPositions=function(t){for(var e=_o(t),i=0,r=this.ids.length-1;i<r;){var n=i+r>>1;this.ids[n]>=e?r=n:i=n+1}for(var o=[];this.ids[i]===e;)o.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return o},mo.serialize=function(t,e){var i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return function t(e,i,r,n){for(;r<n;){for(var o=e[r+n>>1],a=r-1,s=n+1;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;vo(e,a,s),vo(i,3*a,3*s),vo(i,3*a+1,3*s+1),vo(i,3*a+2,3*s+2)}s-r<n-s?(t(e,i,r,s),r=s+1):(t(e,i,s+1,n),n=s)}}(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}},mo.deserialize=function(t){var e=new mo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e};var yo=Math.pow(2,53)-1;function _o(t){var e=+t;return!isNaN(e)&&e<=yo?e:po(String(t))}function vo(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}Fr("FeaturePositionMap",mo);var go=function(t,e){this.gl=t.gl,this.location=e},xo=function(t){function e(e,i){t.call(this,e,i),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))},e}(go),bo=function(t){function e(e,i){t.call(this,e,i),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))},e}(go),wo=function(t){function e(e,i){t.call(this,e,i),this.current=[0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))},e}(go),Eo=function(t){function e(e,i){t.call(this,e,i),this.current=[0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))},e}(go),Io=function(t){function e(e,i){t.call(this,e,i),this.current=[0,0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))},e}(go),So=function(t){function e(e,i){t.call(this,e,i),this.current=te.transparent}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))},e}(go),To=new Float32Array(16),Ao=function(t){function e(e,i){t.call(this,e,i),this.current=To}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(var e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}},e}(go);function Po(t){return[lo(255*t.r,255*t.g),lo(255*t.b,255*t.a)]}var Mo=function(t,e,i){this.value=t,this.uniformNames=e.map((function(t){return"u_"+t})),this.type=i};Mo.prototype.setUniform=function(t,e,i){t.set(i.constantOr(this.value))},Mo.prototype.getBinding=function(t,e,i){return"color"===this.type?new So(t,e):new bo(t,e)};var Co=function(t,e){this.uniformNames=e.map((function(t){return"u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};Co.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr},Co.prototype.setUniform=function(t,e,i,r){var n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&t.set(n)},Co.prototype.getBinding=function(t,e,i){return"u_pattern"===i.substr(0,9)?new Io(t,e):new bo(t,e)};var zo=function(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===i?2:1,offset:0}})),this.paintVertexArray=new r};zo.prototype.populatePaintArray=function(t,e,i,r,n){var o=this.paintVertexArray.length,a=this.expression.evaluate(new sn(0),e,{},r,[],n);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)},zo.prototype.updatePaintArray=function(t,e,i,r){var n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,n)},zo.prototype._setPaintValue=function(t,e,i){if("color"===this.type)for(var r=Po(i),n=t;n<e;n++)this.paintVertexArray.emplace(n,r[0],r[1]);else{for(var o=t;o<e;o++)this.paintVertexArray.emplace(o,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}},zo.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},zo.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var ko=function(t,e,i,r,n,o){this.expression=t,this.uniformNames=e.map((function(t){return"u_"+t+"_t"})),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===i?4:2,offset:0}})),this.paintVertexArray=new o};ko.prototype.populatePaintArray=function(t,e,i,r,n){var o=this.expression.evaluate(new sn(this.zoom),e,{},r,[],n),a=this.expression.evaluate(new sn(this.zoom+1),e,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)},ko.prototype.updatePaintArray=function(t,e,i,r){var n=this.expression.evaluate({zoom:this.zoom},i,r),o=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,n,o)},ko.prototype._setPaintValue=function(t,e,i,r){if("color"===this.type)for(var n=Po(i),o=Po(r),a=t;a<e;a++)this.paintVertexArray.emplace(a,n[0],n[1],o[0],o[1]);else{for(var s=t;s<e;s++)this.paintVertexArray.emplace(s,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}},ko.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},ko.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},ko.prototype.setUniform=function(t,e){var i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=c(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)},ko.prototype.getBinding=function(t,e,i){return new bo(t,e)};var Lo=function(t,e,i,r,n,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n};Lo.prototype.populatePaintArray=function(t,e,i){var r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)},Lo.prototype.updatePaintArray=function(t,e,i,r,n){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],n)},Lo.prototype._setPaintValues=function(t,e,i,r){if(r&&i){var n=r[i.min],o=r[i.mid],a=r[i.max];if(n&&o&&a)for(var s=t;s<e;s++)this.zoomInPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],n.tl[0],n.tl[1],n.br[0],n.br[1],o.pixelRatio,n.pixelRatio),this.zoomOutPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],o.pixelRatio,a.pixelRatio)}},Lo.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,uo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,uo.members,this.expression.isStateDependent))},Lo.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var Do=function(t,e,i){this.binders={},this._buffers=[];var r=[];for(var n in t.paint._values)if(i(n)){var o=t.paint.get(n);if(o instanceof fn&&Li(o.property.specification)){var a=Bo(n,t.type),s=o.value,l=o.property.specification.type,u=o.property.useIntegerZoom,c=o.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===s.kind)this.binders[n]=h?new Co(s.value,a):new Mo(s.value,a,l),r.push("/u_"+n);else if("source"===s.kind||h){var p=Fo(n,l,"source");this.binders[n]=h?new Lo(s,l,u,e,p,t.id):new zo(s,a,l,p),r.push("/a_"+n)}else{var d=Fo(n,l,"composite");this.binders[n]=new ko(s,a,l,u,e,d),r.push("/z_"+n)}}}this.cacheKey=r.sort().join("")};Do.prototype.getMaxValue=function(t){var e=this.binders[t];return e instanceof zo||e instanceof ko?e.maxValue:0},Do.prototype.populatePaintArrays=function(t,e,i,r,n){for(var o in this.binders){var a=this.binders[o];(a instanceof zo||a instanceof ko||a instanceof Lo)&&a.populatePaintArray(t,e,i,r,n)}},Do.prototype.setConstantPatternPositions=function(t,e){for(var i in this.binders){var r=this.binders[i];r instanceof Co&&r.setConstantPatternPositions(t,e)}},Do.prototype.updatePaintArrays=function(t,e,i,r,n){var o=!1;for(var a in t)for(var s=0,l=e.getPositions(a);s<l.length;s+=1){var u=l[s],c=i.feature(u.index);for(var h in this.binders){var p=this.binders[h];if((p instanceof zo||p instanceof ko||p instanceof Lo)&&!0===p.expression.isStateDependent){var d=r.paint.get(h);p.expression=d.value,p.updatePaintArray(u.start,u.end,c,t[a],n),o=!0}}}return o},Do.prototype.defines=function(){var t=[];for(var e in this.binders){var i=this.binders[e];(i instanceof Mo||i instanceof Co)&&t.push.apply(t,i.uniformNames.map((function(t){return"#define HAS_UNIFORM_"+t})))}return t},Do.prototype.getBinderAttributes=function(){var t=[];for(var e in this.binders){var i=this.binders[e];if(i instanceof zo||i instanceof ko)for(var r=0;r<i.paintVertexAttributes.length;r++)t.push(i.paintVertexAttributes[r].name);else if(i instanceof Lo)for(var n=0;n<uo.members.length;n++)t.push(uo.members[n].name)}return t},Do.prototype.getBinderUniforms=function(){var t=[];for(var e in this.binders){var i=this.binders[e];if(i instanceof Mo||i instanceof Co||i instanceof ko)for(var r=0,n=i.uniformNames;r<n.length;r+=1)t.push(n[r])}return t},Do.prototype.getPaintVertexBuffers=function(){return this._buffers},Do.prototype.getUniforms=function(t,e){var i=[];for(var r in this.binders){var n=this.binders[r];if(n instanceof Mo||n instanceof Co||n instanceof ko)for(var o=0,a=n.uniformNames;o<a.length;o+=1){var s=a[o];if(e[s]){var l=n.getBinding(t,e[s],s);i.push({name:s,property:r,binding:l})}}}return i},Do.prototype.setUniforms=function(t,e,i,r){for(var n=0,o=e;n<o.length;n+=1){var a=o[n],s=a.name,l=a.property;this.binders[l].setUniform(a.binding,r,i.get(l),s)}},Do.prototype.updatePaintBuffers=function(t){for(var e in this._buffers=[],this.binders){var i=this.binders[e];if(t&&i instanceof Lo){var r=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof zo||i instanceof ko)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}},Do.prototype.upload=function(t){for(var e in this.binders){var i=this.binders[e];(i instanceof zo||i instanceof ko||i instanceof Lo)&&i.upload(t)}this.updatePaintBuffers()},Do.prototype.destroy=function(){for(var t in this.binders){var e=this.binders[t];(e instanceof zo||e instanceof ko||e instanceof Lo)&&e.destroy()}};var Ro=function(t,e,i){void 0===i&&(i=function(){return!0}),this.programConfigurations={};for(var r=0,n=t;r<n.length;r+=1){var o=n[r];this.programConfigurations[o.id]=new Do(o,e,i)}this.needsUpload=!1,this._featureMap=new mo,this._bufferOffset=0};function Bo(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function Fo(t,e,i){var r={color:{source:kn,composite:Kn},number:{source:Gn,composite:kn}},n={"line-pattern":{source:Ln,composite:Ln},"fill-pattern":{source:Ln,composite:Ln},"fill-extrusion-pattern":{source:Ln,composite:Ln}}[t];return n&&n[i]||r[e][i]}Ro.prototype.populatePaintArrays=function(t,e,i,r,n,o){for(var a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,r,n,o);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},Ro.prototype.updatePaintArrays=function(t,e,i,r){for(var n=0,o=i;n<o.length;n+=1){var a=o[n];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,e,a,r)||this.needsUpload}},Ro.prototype.get=function(t){return this.programConfigurations[t]},Ro.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},Ro.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},Fr("ConstantBinder",Mo),Fr("CrossFadedConstantBinder",Co),Fr("SourceExpressionBinder",zo),Fr("CrossFadedCompositeBinder",Lo),Fr("CompositeExpressionBinder",ko),Fr("ProgramConfiguration",Do,{omit:["_buffers"]}),Fr("ProgramConfigurationSet",Ro);var Oo=Math.pow(2,14)-1,Uo=-Oo-1;function No(t){for(var e=8192/t.extent,i=t.loadGeometry(),r=0;r<i.length;r++)for(var n=i[r],o=0;o<n.length;o++){var a=n[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=c(s,Uo,Oo),a.y=c(l,Uo,Oo),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&E("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function Vo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?No(t):[]}}function jo(t,e,i,r,n){t.emplaceBack(2*e+(r+1)/2,2*i+(n+1)/2)}var qo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Pn,this.indexArray=new Vn,this.segments=new so,this.programConfigurations=new Ro(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Go(t,e){for(var i=0;i<t.length;i++)if($o(e,t[i]))return!0;for(var r=0;r<e.length;r++)if($o(t,e[r]))return!0;return!!Xo(t,e)}function Zo(t,e,i){return!!$o(t,e)||!!Jo(e,t,i)}function Wo(t,e){if(1===t.length)return Qo(e,t[0]);for(var i=0;i<e.length;i++)for(var r=e[i],n=0;n<r.length;n++)if($o(t,r[n]))return!0;for(var o=0;o<t.length;o++)if(Qo(e,t[o]))return!0;for(var a=0;a<e.length;a++)if(Xo(t,e[a]))return!0;return!1}function Ho(t,e,i){if(t.length>1){if(Xo(t,e))return!0;for(var r=0;r<e.length;r++)if(Jo(e[r],t,i))return!0}for(var n=0;n<t.length;n++)if(Jo(t[n],e,i))return!0;return!1}function Xo(t,e){if(0===t.length||0===e.length)return!1;for(var i=0;i<t.length-1;i++)for(var r=t[i],n=t[i+1],o=0;o<e.length-1;o++)if(Ko(r,n,e[o],e[o+1]))return!0;return!1}function Ko(t,e,i,r){return I(t,i,r)!==I(e,i,r)&&I(t,e,i)!==I(t,e,r)}function Jo(t,e,i){var r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(var n=1;n<e.length;n++)if(Yo(t,e[n-1],e[n])<r)return!0;return!1}function Yo(t,e,i){var r=e.distSqr(i);if(0===r)return t.distSqr(e);var n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function Qo(t,e){for(var i,r,n,o=!1,a=0;a<t.length;a++)for(var s=0,l=(i=t[a]).length-1;s<i.length;l=s++)(r=i[s]).y>e.y!=(n=i[l]).y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(o=!o);return o}function $o(t,e){for(var i=!1,r=0,n=t.length-1;r<t.length;n=r++){var o=t[r],a=t[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function ta(t,e,i){var r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;var o=I(t,e,i[0]);return o!==I(t,e,i[1])||o!==I(t,e,i[2])||o!==I(t,e,i[3])}function ea(t,e,i){var r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function ia(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ra(t,e,i,r,o){if(!e[0]&&!e[1])return t;var a=n.convert(e)._mult(o);"viewport"===i&&a._rotate(-r);for(var s=[],l=0;l<t.length;l++)s.push(t[l].sub(a));return s}qo.prototype.populate=function(t,e,i){var r=this.layers[0],n=[],o=null;"circle"===r.type&&(o=r.layout.get("circle-sort-key"));for(var a=0,s=t;a<s.length;a+=1){var l=s[a],u=l.feature,c=l.id,h=l.index,p=l.sourceLayerIndex,d=this.layers[0]._featureFilter.needGeometry,f=Vo(u,d);if(this.layers[0]._featureFilter.filter(new sn(this.zoom),f,i)){var m=o?o.evaluate(f,{},i):void 0,y={id:c,properties:u.properties,type:u.type,sourceLayerIndex:p,index:h,geometry:d?f.geometry:No(u),patterns:{},sortKey:m};n.push(y)}}o&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var _=0,v=n;_<v.length;_+=1){var g=v[_],x=g.geometry,b=g.index,w=g.sourceLayerIndex,E=t[b].feature;this.addFeature(g,x,b,i),e.featureIndex.insert(E,x,b,w,this.index)}},qo.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},qo.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},qo.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},qo.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ao),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},qo.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},qo.prototype.addFeature=function(t,e,i,r){for(var n=0,o=e;n<o.length;n+=1)for(var a=0,s=o[n];a<s.length;a+=1){var l=s[a],u=l.x,c=l.y;if(!(u<0||u>=8192||c<0||c>=8192)){var h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),p=h.vertexLength;jo(this.layoutVertexArray,u,c,-1,-1),jo(this.layoutVertexArray,u,c,1,-1),jo(this.layoutVertexArray,u,c,1,1),jo(this.layoutVertexArray,u,c,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),h.vertexLength+=4,h.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)},Fr("CircleBucket",qo,{omit:["layers"]});var na=new bn({"circle-sort-key":new _n(Mt.layout_circle["circle-sort-key"])}),oa={paint:new bn({"circle-radius":new _n(Mt.paint_circle["circle-radius"]),"circle-color":new _n(Mt.paint_circle["circle-color"]),"circle-blur":new _n(Mt.paint_circle["circle-blur"]),"circle-opacity":new _n(Mt.paint_circle["circle-opacity"]),"circle-translate":new yn(Mt.paint_circle["circle-translate"]),"circle-translate-anchor":new yn(Mt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new yn(Mt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new yn(Mt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new _n(Mt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new _n(Mt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new _n(Mt.paint_circle["circle-stroke-opacity"])}),layout:na},aa="undefined"!=typeof Float32Array?Float32Array:Array;function sa(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function la(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],y=e[13],_=e[14],v=e[15],g=i[0],x=i[1],b=i[2],w=i[3];return t[0]=g*r+x*s+b*h+w*m,t[1]=g*n+x*l+b*p+w*y,t[2]=g*o+x*u+b*d+w*_,t[3]=g*a+x*c+b*f+w*v,t[4]=(g=i[4])*r+(x=i[5])*s+(b=i[6])*h+(w=i[7])*m,t[5]=g*n+x*l+b*p+w*y,t[6]=g*o+x*u+b*d+w*_,t[7]=g*a+x*c+b*f+w*v,t[8]=(g=i[8])*r+(x=i[9])*s+(b=i[10])*h+(w=i[11])*m,t[9]=g*n+x*l+b*p+w*y,t[10]=g*o+x*u+b*d+w*_,t[11]=g*a+x*c+b*f+w*v,t[12]=(g=i[12])*r+(x=i[13])*s+(b=i[14])*h+(w=i[15])*m,t[13]=g*n+x*l+b*p+w*y,t[14]=g*o+x*u+b*d+w*_,t[15]=g*a+x*c+b*f+w*v,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,i=arguments.length;i--;)e+=t[i]*t[i];return Math.sqrt(e)});var ua,ca,ha=la;function pa(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*a,t[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*a,t[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*a,t[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*a,t}ua=new aa(3),aa!=Float32Array&&(ua[0]=0,ua[1]=0,ua[2]=0),ca=new aa(4),aa!=Float32Array&&(ca[0]=0,ca[1]=0,ca[2]=0,ca[3]=0);var da=(function(){var t=new aa(2);aa!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,oa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new qo(t)},e.prototype.queryRadius=function(t){var e=t;return ea("circle-radius",this,e)+ea("circle-stroke-width",this,e)+ia(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,i,r,n,o,a,s){for(var l=ra(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),u=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((function(t){return fa(t,e)}))}(l,s),p=c?u*a:u,d=0,f=r;d<f.length;d+=1)for(var m=0,y=f[d];m<y.length;m+=1){var _=y[m],v=c?_:fa(_,s),g=p,x=pa([],[_.x,_.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?g*=x[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(g*=o.cameraToCenterDistance/x[3]),Zo(h,v,g))return!0}return!1},e}(wn));function fa(t,e){var i=pa([],[t.x,t.y,0,1],e);return new n(i[0]/i[3],i[1]/i[3])}var ma=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(qo);function ya(t,e,i,r){var n=e.width,o=e.height;if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==n*o*i)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*o*i);return t.width=n,t.height=o,t.data=r,t}function _a(t,e,i){var r=e.width,n=e.height;if(r!==t.width||n!==t.height){var o=ya({},{width:r,height:n},i);va(t,o,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,r),height:Math.min(t.height,n)},i),t.width=r,t.height=n,t.data=o.data}}function va(t,e,i,r,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l<n.height;l++)for(var u=((i.y+l)*t.width+i.x)*o,c=((r.y+l)*e.width+r.x)*o,h=0;h<n.width*o;h++)s[c+h]=a[u+h];return e}Fr("HeatmapBucket",ma,{omit:["layers"]});var ga=function(t,e){ya(this,t,1,e)};ga.prototype.resize=function(t){_a(this,t,1)},ga.prototype.clone=function(){return new ga({width:this.width,height:this.height},new Uint8Array(this.data))},ga.copy=function(t,e,i,r,n){va(t,e,i,r,n,1)};var xa=function(t,e){ya(this,t,4,e)};xa.prototype.resize=function(t){_a(this,t,4)},xa.prototype.replace=function(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t},xa.prototype.clone=function(){return new xa({width:this.width,height:this.height},new Uint8Array(this.data))},xa.copy=function(t,e,i,r,n){va(t,e,i,r,n,4)},Fr("AlphaImage",ga),Fr("RGBAImage",xa);var ba={paint:new bn({"heatmap-radius":new _n(Mt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new _n(Mt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new yn(Mt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new xn(Mt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new yn(Mt.paint_heatmap["heatmap-opacity"])})};function wa(t){var e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new xa({width:i,height:r}),o=function(i,r,o){e[t.evaluationKey]=o;var a=t.expression.evaluate(e);n.data[i+r+0]=Math.floor(255*a.r/a.a),n.data[i+r+1]=Math.floor(255*a.g/a.a),n.data[i+r+2]=Math.floor(255*a.b/a.a),n.data[i+r+3]=Math.floor(255*a.a)};if(t.clips)for(var a=0,s=0;a<r;++a,s+=4*i)for(var l=0,u=0;l<i;l++,u+=4){var c=l/(i-1),h=t.clips[a];o(s,u,h.start*(1-c)+h.end*c)}else for(var p=0,d=0;p<i;p++,d+=4)o(0,d,p/(i-1));return n}var Ea=function(t){function e(e){t.call(this,e,ba),this._updateColorRamp()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new ma(t)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){"heatmap-color"===t&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){this.colorRamp=wa({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null},e.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility},e}(wn),Ia={paint:new bn({"hillshade-illumination-direction":new yn(Mt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new yn(Mt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new yn(Mt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new yn(Mt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new yn(Mt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new yn(Mt.paint_hillshade["hillshade-accent-color"])})},Sa=function(t){function e(e){t.call(this,e,Ia)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility},e}(wn),Ta=Tn([{name:"a_pos",components:2,type:"Int16"}],4).members,Aa=Ma,Pa=Ma;function Ma(t,e,i){i=i||2;var r,n,o,a,s,l,u,c=e&&e.length,h=c?e[0]*i:t.length,p=Ca(t,0,h,i,!0),d=[];if(!p||p.next===p.prev)return d;if(c&&(p=function(t,e,i,r){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=Ca(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1))===a.next&&(a.steiner=!0),s.push(Va(a));for(s.sort(Fa),n=0;n<s.length;n++)Oa(s[n],i),i=za(i,i.next);return i}(t,e,p,i)),t.length>80*i){r=o=t[0],n=a=t[1];for(var f=i;f<h;f+=i)(s=t[f])<r&&(r=s),(l=t[f+1])<n&&(n=l),s>o&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-r,a-n))?1/u:0}return ka(p,d,i,r,n,u),d}function Ca(t,e,i,r,n){var o,a;if(n===ts(t,e,i,r)>0)for(o=e;o<i;o+=r)a=Ya(o,t[o],t[o+1],a);else for(o=i-r;o>=e;o-=r)a=Ya(o,t[o],t[o+1],a);return a&&Za(a,a.next)&&(Qa(a),a=a.next),a}function za(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Za(r,r.next)&&0!==Ga(r.prev,r,r.next))r=r.next;else{if(Qa(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function ka(t,e,i,r,n,o,a){if(t){!a&&o&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=Na(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,o,a,s,l,u=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,r=i,s=0,e=0;e<u&&(s++,r=r.nextZ);e++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,l--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,u*=2}while(a>1)}(n)}(t,r,n,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?Da(t,r,n,o):La(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),Qa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ka(t=Ra(za(t),e,i),e,i,r,n,o,2):2===a&&Ba(t,e,i,r,n,o):ka(za(t),e,i,r,n,o,1);break}}}function La(t){var e=t.prev,i=t,r=t.next;if(Ga(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(ja(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&Ga(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Da(t,e,i,r){var n=t.prev,o=t,a=t.next;if(Ga(n,o,a)>=0)return!1;for(var s=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,u=Na(n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,e,i,r),c=Na(s,l,e,i,r),h=t.prevZ,p=t.nextZ;h&&h.z>=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&ja(n.x,n.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ga(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&ja(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ga(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&ja(n.x,n.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ga(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&ja(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ga(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Ra(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!Za(n,o)&&Wa(n,r,r.next,o)&&Ka(n,o)&&Ka(o,n)&&(e.push(n.i/i),e.push(r.i/i),e.push(o.i/i),Qa(r),Qa(r.next),r=t=o),r=r.next}while(r!==t);return za(r)}function Ba(t,e,i,r,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&qa(a,s)){var l=Ja(a,s);return a=za(a,a.next),l=za(l,l.next),ka(a,e,i,r,n,o),void ka(l,e,i,r,n,o)}s=s.next}a=a.next}while(a!==t)}function Fa(t,e){return t.x-e.x}function Oa(t,e){if(e=function(t,e){var i,r=e,n=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>a){if(a=s,s===n){if(o===r.y)return r;if(o===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===a)return i;var l,u=i,c=i.x,h=i.y,p=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&ja(o<h?n:a,o,c,h,o<h?a:n,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(n-r.x),Ka(r,t)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&Ua(i,r)))&&(i=r,p=l)),r=r.next}while(r!==u);return i}(t,e)){var i=Ja(e,t);za(e,e.next),za(i,i.next)}}function Ua(t,e){return Ga(t.prev,t,e.prev)<0&&Ga(e.next,t,t.next)<0}function Na(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Va(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ja(t,e,i,r,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(n-a)*(r-s)>=0}function qa(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Wa(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Ka(t,e)&&Ka(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(Ga(t.prev,t,e.prev)||Ga(t,e.prev,e))||Za(t,e)&&Ga(t.prev,t,t.next)>0&&Ga(e.prev,e,e.next)>0)}function Ga(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Za(t,e){return t.x===e.x&&t.y===e.y}function Wa(t,e,i,r){var n=Xa(Ga(t,e,i)),o=Xa(Ga(t,e,r)),a=Xa(Ga(i,r,t)),s=Xa(Ga(i,r,e));return n!==o&&a!==s||!(0!==n||!Ha(t,i,e))||!(0!==o||!Ha(t,r,e))||!(0!==a||!Ha(i,t,r))||!(0!==s||!Ha(i,e,r))}function Ha(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Xa(t){return t>0?1:t<0?-1:0}function Ka(t,e){return Ga(t.prev,t,t.next)<0?Ga(t,e,t.next)>=0&&Ga(t,t.prev,e)>=0:Ga(t,e,t.prev)<0||Ga(t,t.next,e)<0}function Ja(t,e){var i=new $a(t.i,t.x,t.y),r=new $a(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function Ya(t,e,i,r){var n=new $a(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Qa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function $a(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ts(t,e,i,r){for(var n=0,o=e,a=i-r;o<i;o+=r)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}function es(t,e,i,r,n){!function t(e,i,r,n,o){for(;n>r;){if(n-r>600){var a=n-r+1,s=i-r+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,i,Math.max(r,Math.floor(i-s*u/a+c)),Math.min(n,Math.floor(i+(a-s)*u/a+c)),o)}var h=e[i],p=r,d=n;for(is(e,r,i),o(e[n],h)>0&&is(e,r,n);p<d;){for(is(e,p,d),p++,d--;o(e[p],h)<0;)p++;for(;o(e[d],h)>0;)d--}0===o(e[r],h)?is(e,r,d):is(e,++d,n),d<=i&&(r=d+1),i<=d&&(n=d-1)}}(t,e,i||0,r||t.length-1,n||rs)}function is(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function rs(t,e){return t<e?-1:t>e?1:0}function ns(t,e){var i=t.length;if(i<=1)return[t];for(var r,n,o=[],a=0;a<i;a++){var s=S(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===n&&(n=s<0),n===s<0?(r&&o.push(r),r=[t[a]]):r.push(t[a]))}if(r&&o.push(r),e>1)for(var l=0;l<o.length;l++)o[l].length<=e||(es(o[l],e,1,o[l].length-1,os),o[l]=o[l].slice(0,e));return o}function os(t,e){return e.area-t.area}function as(t,e,i){for(var r=i.patternDependencies,n=!1,o=0,a=e;o<a.length;o+=1){var s=a[o].paint.get(t+"-pattern");s.isConstant()||(n=!0);var l=s.constantOr(null);l&&(n=!0,r[l.to]=!0,r[l.from]=!0)}return n}function ss(t,e,i,r,n){for(var o=n.patternDependencies,a=0,s=e;a<s.length;a+=1){var l=s[a],u=l.paint.get(t+"-pattern").value;if("constant"!==u.kind){var c=u.evaluate({zoom:r-1},i,{},n.availableImages),h=u.evaluate({zoom:r},i,{},n.availableImages),p=u.evaluate({zoom:r+1},i,{},n.availableImages);h=h&&h.name?h.name:h,p=p&&p.name?p.name:p,o[c=c&&c.name?c.name:c]=!0,o[h]=!0,o[p]=!0,i.patterns[l.id]={min:c,mid:h,max:p}}}return i}Ma.deviation=function(t,e,i,r){var n=e&&e.length,o=Math.abs(ts(t,0,n?e[0]*i:t.length,i));if(n)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(ts(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i));var l=0;for(a=0;a<r.length;a+=3){var u=r[a]*i,c=r[a+1]*i,h=r[a+2]*i;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},Ma.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var o=0;o<t[n].length;o++)for(var a=0;a<e;a++)i.vertices.push(t[n][o][a]);n>0&&i.holes.push(r+=t[n-1].length)}return i},Aa.default=Pa;var ls=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Pn,this.indexArray=new Vn,this.indexArray2=new Hn,this.programConfigurations=new Ro(t.layers,t.zoom),this.segments=new so,this.segments2=new so,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};ls.prototype.populate=function(t,e,i){this.hasPattern=as("fill",this.layers,e);for(var r=this.layers[0].layout.get("fill-sort-key"),n=[],o=0,a=t;o<a.length;o+=1){var s=a[o],l=s.feature,u=s.id,c=s.index,h=s.sourceLayerIndex,p=this.layers[0]._featureFilter.needGeometry,d=Vo(l,p);if(this.layers[0]._featureFilter.filter(new sn(this.zoom),d,i)){var f=r?r.evaluate(d,{},i,e.availableImages):void 0,m={id:u,properties:l.properties,type:l.type,sourceLayerIndex:h,index:c,geometry:p?d.geometry:No(l),patterns:{},sortKey:f};n.push(m)}}r&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,_=n;y<_.length;y+=1){var v=_[y],g=v.geometry,x=v.index,b=v.sourceLayerIndex;if(this.hasPattern){var w=ss("fill",this.layers,v,this.zoom,e);this.patternFeatures.push(w)}else this.addFeature(v,g,x,i,{});e.featureIndex.insert(t[x].feature,g,x,b,this.index)}},ls.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},ls.prototype.addFeatures=function(t,e,i){for(var r=0,n=this.patternFeatures;r<n.length;r+=1){var o=n[r];this.addFeature(o,o.geometry,o.index,e,i)}},ls.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},ls.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},ls.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ta),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},ls.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},ls.prototype.addFeature=function(t,e,i,r,n){for(var o=0,a=ns(e,500);o<a.length;o+=1){for(var s=a[o],l=0,u=0,c=s;u<c.length;u+=1)l+=c[u].length;for(var h=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray),p=h.vertexLength,d=[],f=[],m=0,y=s;m<y.length;m+=1){var _=y[m];if(0!==_.length){_!==s[0]&&f.push(d.length/2);var v=this.segments2.prepareSegment(_.length,this.layoutVertexArray,this.indexArray2),g=v.vertexLength;this.layoutVertexArray.emplaceBack(_[0].x,_[0].y),this.indexArray2.emplaceBack(g+_.length-1,g),d.push(_[0].x),d.push(_[0].y);for(var x=1;x<_.length;x++)this.layoutVertexArray.emplaceBack(_[x].x,_[x].y),this.indexArray2.emplaceBack(g+x-1,g+x),d.push(_[x].x),d.push(_[x].y);v.vertexLength+=_.length,v.primitiveLength+=_.length}}for(var b=Aa(d,f),w=0;w<b.length;w+=3)this.indexArray.emplaceBack(p+b[w],p+b[w+1],p+b[w+2]);h.vertexLength+=l,h.primitiveLength+=b.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)},Fr("FillBucket",ls,{omit:["layers","patternFeatures"]});var us=new bn({"fill-sort-key":new _n(Mt.layout_fill["fill-sort-key"])}),cs={paint:new bn({"fill-antialias":new yn(Mt.paint_fill["fill-antialias"]),"fill-opacity":new _n(Mt.paint_fill["fill-opacity"]),"fill-color":new _n(Mt.paint_fill["fill-color"]),"fill-outline-color":new _n(Mt.paint_fill["fill-outline-color"]),"fill-translate":new yn(Mt.paint_fill["fill-translate"]),"fill-translate-anchor":new yn(Mt.paint_fill["fill-translate-anchor"]),"fill-pattern":new vn(Mt.paint_fill["fill-pattern"])}),layout:us},hs=function(t){function e(e){t.call(this,e,cs)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,i){t.prototype.recalculate.call(this,e,i);var r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new ls(t)},e.prototype.queryRadius=function(){return ia(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,i,r,n,o,a){return Wo(ra(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),r)},e.prototype.isTileClipped=function(){return!0},e}(wn),ps=Tn([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,ds=fs;function fs(t,e,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=n,t.readFields(ms,this,e)}function ms(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function ys(t){for(var e,i,r=0,n=0,o=t.length,a=o-1;n<o;a=n++)r+=((i=t[a]).x-(e=t[n]).x)*(e.y+i.y);return r}fs.types=["Unknown","Point","LineString","Polygon"],fs.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,r=1,o=0,a=0,s=0,l=[];t.pos<i;){if(o<=0){var u=t.readVarint();r=7&u,o=u>>3}if(o--,1===r||2===r)a+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&l.push(e),e=[]),e.push(new n(a,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&l.push(e),l},fs.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var c=t.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)(n+=t.readSVarint())<a&&(a=n),n>s&&(s=n),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},fs.prototype.toGeoJSON=function(t,e,i){var r,n,o=this.extent*Math.pow(2,i),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=fs.types[this.type];function c(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(r=0;r<l.length;r++)h[r]=l[r][0];c(l=h);break;case 2:for(r=0;r<l.length;r++)c(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,r,n=[],o=0;o<e;o++){var a=ys(t[o]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(i&&n.push(i),i=[t[o]]):i.push(t[o]))}return i&&n.push(i),n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)c(l[r][n])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var _s=vs;function vs(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(gs,this,e),this.length=this._features.length}function gs(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}function xs(t,e,i){if(3===t){var r=new _s(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}vs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ds(this._pbf,e,this.extent,this._keys,this._values)};var bs={VectorTile:function(t,e){this.layers=t.readFields(xs,{},e)},VectorTileFeature:ds,VectorTileLayer:_s},ws=bs.VectorTileFeature.types,Es=Math.pow(2,13);function Is(t,e,i,r,n,o,a,s){t.emplaceBack(e,i,2*Math.floor(r*Es)+a,n*Es*2,o*Es*2,Math.round(s))}var Ss=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Cn,this.indexArray=new Vn,this.programConfigurations=new Ro(t.layers,t.zoom),this.segments=new so,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Ts(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}Ss.prototype.populate=function(t,e,i){this.features=[],this.hasPattern=as("fill-extrusion",this.layers,e);for(var r=0,n=t;r<n.length;r+=1){var o=n[r],a=o.feature,s=o.id,l=o.index,u=o.sourceLayerIndex,c=this.layers[0]._featureFilter.needGeometry,h=Vo(a,c);if(this.layers[0]._featureFilter.filter(new sn(this.zoom),h,i)){var p={id:s,sourceLayerIndex:u,index:l,geometry:c?h.geometry:No(a),properties:a.properties,type:a.type,patterns:{}};this.hasPattern?this.features.push(ss("fill-extrusion",this.layers,p,this.zoom,e)):this.addFeature(p,p.geometry,l,i,{}),e.featureIndex.insert(a,p.geometry,l,u,this.index,!0)}}},Ss.prototype.addFeatures=function(t,e,i){for(var r=0,n=this.features;r<n.length;r+=1){var o=n[r];this.addFeature(o,o.geometry,o.index,e,i)}},Ss.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},Ss.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ss.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ss.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ps),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Ss.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ss.prototype.addFeature=function(t,e,i,r,n){for(var o=0,a=ns(e,500);o<a.length;o+=1){for(var s=a[o],l=0,u=0,c=s;u<c.length;u+=1)l+=c[u].length;for(var h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),p=0,d=s;p<d.length;p+=1){var f=d[p];if(0!==f.length&&!((k=f).every((function(t){return t.x<0}))||k.every((function(t){return t.x>8192}))||k.every((function(t){return t.y<0}))||k.every((function(t){return t.y>8192}))))for(var m=0,y=0;y<f.length;y++){var _=f[y];if(y>=1){var v=f[y-1];if(!Ts(_,v)){h.vertexLength+4>so.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var g=_.sub(v)._perp()._unit(),x=v.dist(_);m+x>32768&&(m=0),Is(this.layoutVertexArray,_.x,_.y,g.x,g.y,0,0,m),Is(this.layoutVertexArray,_.x,_.y,g.x,g.y,0,1,m),Is(this.layoutVertexArray,v.x,v.y,g.x,g.y,0,0,m+=x),Is(this.layoutVertexArray,v.x,v.y,g.x,g.y,0,1,m);var b=h.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),h.vertexLength+=4,h.primitiveLength+=2}}}}if(h.vertexLength+l>so.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===ws[t.type]){for(var w=[],E=[],I=h.vertexLength,S=0,T=s;S<T.length;S+=1){var A=T[S];if(0!==A.length){A!==s[0]&&E.push(w.length/2);for(var P=0;P<A.length;P++){var M=A[P];Is(this.layoutVertexArray,M.x,M.y,0,0,1,1,0),w.push(M.x),w.push(M.y)}}}for(var C=Aa(w,E),z=0;z<C.length;z+=3)this.indexArray.emplaceBack(I+C[z],I+C[z+2],I+C[z+1]);h.primitiveLength+=C.length/3,h.vertexLength+=l}}var k;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)},Fr("FillExtrusionBucket",Ss,{omit:["layers","features"]});var As={paint:new bn({"fill-extrusion-opacity":new yn(Mt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new _n(Mt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new yn(Mt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new yn(Mt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new vn(Mt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new _n(Mt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new _n(Mt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new yn(Mt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},Ps=function(t){function e(e){t.call(this,e,As)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Ss(t)},e.prototype.queryRadius=function(){return ia(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.queryIntersectsFeature=function(t,e,i,r,o,a,s,l){var u=ra(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(e,i),h=this.paint.get("fill-extrusion-base").evaluate(e,i),p=function(t,e){for(var i=[],r=0,o=t;r<o.length;r+=1){var a=o[r],s=[a.x,a.y,0,1];pa(s,s,e),i.push(new n(s[0]/s[3],s[1]/s[3]))}return i}(u,l),d=function(t,e,i,r){for(var o=[],a=[],s=r[8]*e,l=r[9]*e,u=r[10]*e,c=r[11]*e,h=r[8]*i,p=r[9]*i,d=r[10]*i,f=r[11]*i,m=0,y=t;m<y.length;m+=1){for(var _=[],v=[],g=0,x=y[m];g<x.length;g+=1){var b=x[g],w=b.x,E=b.y,I=r[0]*w+r[4]*E+r[12],S=r[1]*w+r[5]*E+r[13],T=r[2]*w+r[6]*E+r[14],A=r[3]*w+r[7]*E+r[15],P=T+u,M=A+c,C=I+h,z=S+p,k=T+d,L=A+f,D=new n((I+s)/M,(S+l)/M);D.z=P/M,_.push(D);var R=new n(C/L,z/L);R.z=k/L,v.push(R)}o.push(_),a.push(v)}return[o,a]}(r,h,c,l);return function(t,e,i){var r=1/0;Wo(i,e)&&(r=Cs(i,e[0]));for(var n=0;n<e.length;n++)for(var o=e[n],a=t[n],s=0;s<o.length-1;s++){var l=o[s],u=[l,o[s+1],a[s+1],a[s],l];Go(i,u)&&(r=Math.min(r,Cs(i,u)))}return r!==1/0&&r}(d[0],d[1],p)},e}(wn);function Ms(t,e){return t.x*e.x+t.y*e.y}function Cs(t,e){if(1===t.length){for(var i,r=0,n=e[r++];!i||n.equals(i);)if(!(i=e[r++]))return 1/0;for(;r<e.length;r++){var o=e[r],a=t[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=Ms(s,s),h=Ms(s,l),p=Ms(l,l),d=Ms(u,s),f=Ms(u,l),m=c*p-h*h,y=(p*d-h*f)/m,_=(c*f-h*d)/m,v=n.z*(1-y-_)+i.z*y+o.z*_;if(isFinite(v))return v}return 1/0}for(var g=1/0,x=0,b=e;x<b.length;x+=1)g=Math.min(g,b[x].z);return g}var zs=Tn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,ks=Tn([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,Ls=bs.VectorTileFeature.types,Ds=Math.cos(Math.PI/180*37.5),Rs=Math.pow(2,14)/.5,Bs=function(t){var e=this;this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((function(t){e.gradients[t.id]={}})),this.layoutVertexArray=new zn,this.layoutVertexArray2=new kn,this.indexArray=new Vn,this.programConfigurations=new Ro(t.layers,t.zoom),this.segments=new so,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};Bs.prototype.populate=function(t,e,i){this.hasPattern=as("line",this.layers,e);for(var r=this.layers[0].layout.get("line-sort-key"),n=[],o=0,a=t;o<a.length;o+=1){var s=a[o],l=s.feature,u=s.id,c=s.index,h=s.sourceLayerIndex,p=this.layers[0]._featureFilter.needGeometry,d=Vo(l,p);if(this.layers[0]._featureFilter.filter(new sn(this.zoom),d,i)){var f=r?r.evaluate(d,{},i):void 0,m={id:u,properties:l.properties,type:l.type,sourceLayerIndex:h,index:c,geometry:p?d.geometry:No(l),patterns:{},sortKey:f};n.push(m)}}r&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,_=n;y<_.length;y+=1){var v=_[y],g=v.geometry,x=v.index,b=v.sourceLayerIndex;if(this.hasPattern){var w=ss("line",this.layers,v,this.zoom,e);this.patternFeatures.push(w)}else this.addFeature(v,g,x,i,{});e.featureIndex.insert(t[x].feature,g,x,b,this.index)}},Bs.prototype.update=function(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)},Bs.prototype.addFeatures=function(t,e,i){for(var r=0,n=this.patternFeatures;r<n.length;r+=1){var o=n[r];this.addFeature(o,o.geometry,o.index,e,i)}},Bs.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Bs.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Bs.prototype.upload=function(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,ks)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,zs),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Bs.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Bs.prototype.lineFeatureClips=function(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}},Bs.prototype.addFeature=function(t,e,i,r,n){var o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),l=o.get("line-miter-limit"),u=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(var c=0,h=e;c<h.length;c+=1)this.addLine(h[c],t,a,s,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)},Bs.prototype.addLine=function(t,e,i,r,n,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var a=0;a<t.length-1;a++)this.totalDistance+=t[a].dist(t[a+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var s="Polygon"===Ls[e.type],l=t.length;l>=2&&t[l-1].equals(t[l-2]);)l--;for(var u=0;u<l-1&&t[u].equals(t[u+1]);)u++;if(!(l<(s?3:2))){"bevel"===i&&(n=1.05);var c,h=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),d=void 0,f=void 0,m=void 0,y=void 0;this.e1=this.e2=-1,s&&(y=t[u].sub(c=t[l-2])._unit()._perp());for(var _=u;_<l;_++)if(!(f=_===l-1?s?t[u+1]:void 0:t[_+1])||!t[_].equals(f)){y&&(m=y),c&&(d=c),c=t[_],y=f?f.sub(c)._unit()._perp():m;var v=(m=m||y).add(y);0===v.x&&0===v.y||v._unit();var g=m.x*y.x+m.y*y.y,x=v.x*y.x+v.y*y.y,b=0!==x?1/x:1/0,w=2*Math.sqrt(2-2*x),E=x<Ds&&d&&f,I=m.x*y.y-m.y*y.x>0;if(E&&_>u){var S=c.dist(d);if(S>2*h){var T=c.sub(c.sub(d)._mult(h/S)._round());this.updateDistance(d,T),this.addCurrentVertex(T,m,0,0,p),d=T}}var A=d&&f,P=A?i:s?"butt":r;if(A&&"round"===P&&(b<o?P="miter":b<=2&&(P="fakeround")),"miter"===P&&b>n&&(P="bevel"),"bevel"===P&&(b>2&&(P="flipbevel"),b<n&&(P="miter")),d&&this.updateDistance(d,c),"miter"===P)v._mult(b),this.addCurrentVertex(c,v,0,0,p);else if("flipbevel"===P){if(b>100)v=y.mult(-1);else{var M=b*m.add(y).mag()/m.sub(y).mag();v._perp()._mult(M*(I?-1:1))}this.addCurrentVertex(c,v,0,0,p),this.addCurrentVertex(c,v.mult(-1),0,0,p)}else if("bevel"===P||"fakeround"===P){var C=-Math.sqrt(b*b-1),z=I?C:0,k=I?0:C;if(d&&this.addCurrentVertex(c,m,z,k,p),"fakeround"===P)for(var L=Math.round(180*w/Math.PI/20),D=1;D<L;D++){var R=D/L;if(.5!==R){var B=R-.5;R+=R*B*(R-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*B*B+(.848013+g*(.215638*g-1.06021)))}var F=y.sub(m)._mult(R)._add(m)._unit()._mult(I?-1:1);this.addHalfVertex(c,F.x,F.y,!1,I,0,p)}f&&this.addCurrentVertex(c,y,-z,-k,p)}else if("butt"===P)this.addCurrentVertex(c,v,0,0,p);else if("square"===P){var O=d?1:-1;this.addCurrentVertex(c,v,O,O,p)}else"round"===P&&(d&&(this.addCurrentVertex(c,m,0,0,p),this.addCurrentVertex(c,m,1,1,p,!0)),f&&(this.addCurrentVertex(c,y,-1,-1,p,!0),this.addCurrentVertex(c,y,0,0,p)));if(E&&_<l-1){var U=c.dist(f);if(U>2*h){var N=c.add(f.sub(c)._mult(h/U)._round());this.updateDistance(c,N),this.addCurrentVertex(N,y,0,0,p),c=N}}}}},Bs.prototype.addCurrentVertex=function(t,e,i,r,n,o){void 0===o&&(o=!1);var a=e.y*r-e.x,s=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,n),this.addHalfVertex(t,a,s,o,!0,-r,n),this.distance>Rs/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,i,r,n,o))},Bs.prototype.addHalfVertex=function(t,e,i,r,n,o,a){var s=.5*(this.lineClips?this.scaledDistance*(Rs-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(r?1:0),(t.y<<1)+(n?1:0),Math.round(63*e)+128,Math.round(63*i)+128,1+(0===o?0:o<0?-1:1)|(63&s)<<2,s>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),a.primitiveLength++),n?this.e2=l:this.e1=l},Bs.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Bs.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Fr("LineBucket",Bs,{omit:["layers","patternFeatures"]});var Fs=new bn({"line-cap":new yn(Mt.layout_line["line-cap"]),"line-join":new _n(Mt.layout_line["line-join"]),"line-miter-limit":new yn(Mt.layout_line["line-miter-limit"]),"line-round-limit":new yn(Mt.layout_line["line-round-limit"]),"line-sort-key":new _n(Mt.layout_line["line-sort-key"])}),Os={paint:new bn({"line-opacity":new _n(Mt.paint_line["line-opacity"]),"line-color":new _n(Mt.paint_line["line-color"]),"line-translate":new yn(Mt.paint_line["line-translate"]),"line-translate-anchor":new yn(Mt.paint_line["line-translate-anchor"]),"line-width":new _n(Mt.paint_line["line-width"]),"line-gap-width":new _n(Mt.paint_line["line-gap-width"]),"line-offset":new _n(Mt.paint_line["line-offset"]),"line-blur":new _n(Mt.paint_line["line-blur"]),"line-dasharray":new gn(Mt.paint_line["line-dasharray"]),"line-pattern":new vn(Mt.paint_line["line-pattern"]),"line-gradient":new xn(Mt.paint_line["line-gradient"])}),layout:Fs},Us=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,i){return i=new sn(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),t.prototype.possiblyEvaluate.call(this,e,i)},e.prototype.evaluate=function(e,i,r,n){return i=p({},i,{zoom:Math.floor(i.zoom)}),t.prototype.evaluate.call(this,e,i,r,n)},e}(_n))(Os.paint.properties["line-width"].specification);Us.useIntegerZoom=!0;var Ns=function(t){function e(e){t.call(this,e,Os),this.gradientVersion=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof qe,this.gradientVersion=(this.gradientVersion+1)%s)},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,i){t.prototype.recalculate.call(this,e,i),this.paint._values["line-floorwidth"]=Us.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Bs(t)},e.prototype.queryRadius=function(t){var e=t,i=Vs(ea("line-width",this,e),ea("line-gap-width",this,e)),r=ea("line-offset",this,e);return i/2+Math.abs(r)+ia(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,i,r,o,a,s){var l=ra(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Vs(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(r=function(t,e){for(var i=[],r=new n(0,0),o=0;o<t.length;o++){for(var a=t[o],s=[],l=0;l<a.length;l++){var u=a[l],c=a[l+1],h=0===l?r:u.sub(a[l-1])._unit()._perp(),p=l===a.length-1?r:c.sub(u)._unit()._perp(),d=h._add(p)._unit();d._mult(1/(d.x*p.x+d.y*p.y)),s.push(d._mult(e)._add(u))}i.push(s)}return i}(r,c*s)),function(t,e,i){for(var r=0;r<e.length;r++){var n=e[r];if(t.length>=3)for(var o=0;o<n.length;o++)if($o(t,n[o]))return!0;if(Ho(t,n,i))return!0}return!1}(l,r,u)},e.prototype.isTileClipped=function(){return!0},e}(wn);function Vs(t,e){return e>0?e+2*t:t}var js=Tn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),qs=Tn([{name:"a_projected_pos",components:3,type:"Float32"}],4),Gs=(Tn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Tn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Zs=(Tn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Tn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Ws=Tn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Hs(t,e,i){return t.sections.forEach((function(t){var r,n,o;t.text=(r=t.text,n=i,"uppercase"===(o=e.layout.get("text-transform").evaluate(n,{}))?r=r.toLocaleUpperCase():"lowercase"===o&&(r=r.toLocaleLowerCase()),an.applyArabicShaping&&(r=an.applyArabicShaping(r)),r)})),t}Tn([{name:"triangle",components:3,type:"Uint16"}]),Tn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Tn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Tn([{type:"Float32",name:"offsetX"}]),Tn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Xs={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Ks=function(t,e,i,r,n){var o,a,s=8*n-r-1,l=(1<<s)-1,u=l>>1,c=-7,h=i?n-1:0,p=i?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=u}return(d?-1:1)*a*Math.pow(2,o-r)},Js=function(t,e,i,r,n,o){var a,s,l,u=8*o-n-1,c=(1<<u)-1,h=c>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,n),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;t[i+d]=255&s,d+=f,s/=256,n-=8);for(a=a<<n|s,u+=n;u>0;t[i+d]=255&a,d+=f,a/=256,u-=8);t[i+d-f]|=128*m},Ys=Qs;function Qs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Qs.Varint=0,Qs.Fixed64=1,Qs.Bytes=2,Qs.Fixed32=5;var $s="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tl(t){return t.type===Qs.Bytes?t.readVarint()+t.pos:t.pos+1}function el(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function il(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function rl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function nl(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function ol(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function al(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function sl(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function ll(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function ul(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function cl(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function hl(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function pl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function dl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function fl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ml(t,e,i){1===t&&i.readMessage(yl,e)}function yl(t,e,i){if(3===t){var r=i.readMessage(_l,{}),n=r.width,o=r.height,a=r.left,s=r.top,l=r.advance;e.push({id:r.id,bitmap:new ga({width:n+6,height:o+6},r.bitmap),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function _l(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function vl(t){for(var e=0,i=0,r=0,n=t;r<n.length;r+=1){var o=n[r];e+=o.w*o.h,i=Math.max(i,o.w)}t.sort((function(t,e){return e.h-t.h}));for(var a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}],s=0,l=0,u=0,c=t;u<c.length;u+=1)for(var h=c[u],p=a.length-1;p>=0;p--){var d=a[p];if(!(h.w>d.w||h.h>d.h)){if(h.x=d.x,h.y=d.y,l=Math.max(l,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===d.w&&h.h===d.h){var f=a.pop();p<a.length&&(a[p]=f)}else h.h===d.h?(d.x+=h.w,d.w-=h.w):h.w===d.w?(d.y+=h.h,d.h-=h.h):(a.push({x:d.x+h.w,y:d.y,w:d.w-h.w,h:h.h}),d.y+=h.h,d.h-=h.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}Qs.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=pl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=fl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=pl(this.buf,this.pos)+4294967296*pl(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=pl(this.buf,this.pos)+4294967296*fl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Ks(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ks(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return el(t,r,e);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return el(t,r,e);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return el(t,r,e);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return el(t,r,e);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return el(t,r,e);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return el(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t,e,i,r=this.readVarint()+this.pos,n=this.pos;return this.pos=r,r-n>=12&&$s?(t=this.buf,e=n,i=r,$s.decode(t.subarray(e,i))):function(t,e,i){for(var r="",n=e;n<i;){var o,a,s,l=t[n],u=null,c=l>239?4:l>223?3:l>191?2:1;if(n+c>i)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[n+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(a=t[n+2],128==(192&(o=t[n+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[n+2],s=t[n+3],128==(192&(o=t[n+1]))&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=c}return r}(this.buf,n,r)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Qs.Bytes)return t.push(this.readVarint(e));var i=tl(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Qs.Bytes)return t.push(this.readSVarint());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Qs.Bytes)return t.push(this.readBoolean());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Qs.Bytes)return t.push(this.readFloat());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Qs.Bytes)return t.push(this.readDouble());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Qs.Bytes)return t.push(this.readFixed32());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Qs.Bytes)return t.push(this.readSFixed32());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Qs.Bytes)return t.push(this.readFixed64());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Qs.Bytes)return t.push(this.readSFixed64());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Qs.Varint)for(;this.buf[this.pos++]>127;);else if(e===Qs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Qs.Fixed32)this.pos+=4;else{if(e!==Qs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),dl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),dl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),dl(this.buf,-1&t,this.pos),dl(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),dl(this.buf,-1&t,this.pos),dl(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r,n,o;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),n=i,(o=e).buf[o.pos++]=127&n|128,n>>>=7,o.buf[o.pos++]=127&n|128,n>>>=7,o.buf[o.pos++]=127&n|128,n>>>=7,o.buf[o.pos++]=127&n|128,o.buf[o.pos]=127&(n>>>=7),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,n,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&il(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Js(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Js(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&il(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,Qs.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ll,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,ul,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,cl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,hl,e)},writeBytesField:function(t,e){this.writeTag(t,Qs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Qs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Qs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Qs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Qs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Qs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Qs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Qs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Qs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Qs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var gl=function(t,e){var i=e.pixelRatio,r=e.version,n=e.stretchX,o=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=i,this.stretchX=n,this.stretchY=o,this.content=a,this.version=r},xl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};xl.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},xl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},xl.tlbr.get=function(){return this.tl.concat(this.br)},xl.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(gl.prototype,xl);var bl=function(t,e){var i={},r={};this.haveRenderCallbacks=[];var n=[];this.addImages(t,i,n),this.addImages(e,r,n);var o=vl(n),a=new xa({width:o.w||1,height:o.h||1});for(var s in t){var l=t[s],u=i[s].paddedRect;xa.copy(l.data,a,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(var c in e){var h=e[c],p=r[c].paddedRect,d=p.x+1,f=p.y+1,m=h.data.width,y=h.data.height;xa.copy(h.data,a,{x:0,y:0},{x:d,y:f},h.data),xa.copy(h.data,a,{x:0,y:y-1},{x:d,y:f-1},{width:m,height:1}),xa.copy(h.data,a,{x:0,y:0},{x:d,y:f+y},{width:m,height:1}),xa.copy(h.data,a,{x:m-1,y:0},{x:d-1,y:f},{width:1,height:y}),xa.copy(h.data,a,{x:0,y:0},{x:d+m,y:f},{width:1,height:y})}this.image=a,this.iconPositions=i,this.patternPositions=r};bl.prototype.addImages=function(t,e,i){for(var r in t){var n=t[r],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(o),e[r]=new gl(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}},bl.prototype.patchUpdatedImages=function(t,e){for(var i in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)},bl.prototype.patchUpdatedImage=function(t,e,i){if(t&&e&&t.version!==e.version){t.version=e.version;var r=t.tl;i.update(e.data,void 0,{x:r[0],y:r[1]})}},Fr("ImagePosition",gl),Fr("ImageAtlas",bl);var wl={horizontal:1,vertical:2,horizontalOnly:3},El=function(){this.scale=1,this.fontStack="",this.imageName=null};El.forText=function(t,e){var i=new El;return i.scale=t||1,i.fontStack=e,i},El.forImage=function(t){var e=new El;return e.imageName=t,e};var Il=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Sl(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m){var y,_=Il.fromFeature(t,n);h===wl.vertical&&_.verticalizePunctuation();var v=an.processBidirectionalText,g=an.processStyledBidirectionalText;if(v&&1===_.sections.length){y=[];for(var x=0,b=v(_.toString(),kl(_,u,o,e,r,d,f));x<b.length;x+=1){var w=b[x],E=new Il;E.text=w,E.sections=_.sections;for(var I=0;I<w.length;I++)E.sectionIndex.push(0);y.push(E)}}else if(g){y=[];for(var S=0,T=g(_.text,_.sectionIndex,kl(_,u,o,e,r,d,f));S<T.length;S+=1){var A=T[S],P=new Il;P.text=A[0],P.sectionIndex=A[1],P.sections=_.sections,y.push(P)}}else y=function(t,e){for(var i=[],r=t.text,n=0,o=0,a=e;o<a.length;o+=1){var s=a[o];i.push(t.substring(n,s)),n=s}return n<r.length&&i.push(t.substring(n,r.length)),i}(_,kl(_,u,o,e,r,d,f));var M=[],C={positionedLines:M,text:_.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(t,e,i,r,n,o,a,s,l,u,c,h){for(var p=0,d=-17,f=0,m=0,y="right"===s?1:"left"===s?0:.5,_=0,v=0,g=n;v<g.length;v+=1){var x=g[v];x.trim();var b=x.getMaxScale(),w=24*(b-1),E={positionedGlyphs:[],lineOffset:0};t.positionedLines[_]=E;var I=E.positionedGlyphs,S=0;if(x.length()){for(var T=0;T<x.length();T++){var A=x.getSection(T),P=x.getSectionIndex(T),M=x.getCharCode(T),C=0,z=null,k=null,L=null,D=24,R=!(l===wl.horizontal||!c&&!Wr(M)||c&&(Tl[M]||(G=M,Gr.Arabic(G)||Gr["Arabic Supplement"](G)||Gr["Arabic Extended-A"](G)||Gr["Arabic Presentation Forms-A"](G)||Gr["Arabic Presentation Forms-B"](G))));if(A.imageName){var B=r[A.imageName];if(!B)continue;L=A.imageName,t.iconsInText=t.iconsInText||!0,k=B.paddedRect;var F=B.displaySize;A.scale=24*A.scale/h,C=w+(24-F[1]*A.scale),D=(z={width:F[0],height:F[1],left:1,top:-3,advance:R?F[1]:F[0]}).advance;var O=R?F[0]*A.scale-24*b:F[1]*A.scale-24*b;O>0&&O>S&&(S=O)}else{var U=i[A.fontStack],N=U&&U[M];if(N&&N.rect)k=N.rect,z=N.metrics;else{var V=e[A.fontStack],j=V&&V[M];if(!j)continue;z=j.metrics}C=24*(b-A.scale)}R?(t.verticalizable=!0,I.push({glyph:M,imageName:L,x:p,y:d+C,vertical:R,scale:A.scale,fontStack:A.fontStack,sectionIndex:P,metrics:z,rect:k}),p+=D*A.scale+u):(I.push({glyph:M,imageName:L,x:p,y:d+C,vertical:R,scale:A.scale,fontStack:A.fontStack,sectionIndex:P,metrics:z,rect:k}),p+=z.advance*A.scale+u)}0!==I.length&&(f=Math.max(p-u,f),Dl(I,0,I.length-1,y,S)),p=0;var q=o*b+S;E.lineOffset=Math.max(S,w),d+=q,m=Math.max(q,m),++_}else d+=o,++_}var G,Z=d- -17,W=Ll(a),H=W.horizontalAlign,X=W.verticalAlign;(function(t,e,i,r,n,o,a,s,l){var u,c=(e-i)*n;u=o!==a?-s*r- -17:(-r*l+.5)*a;for(var h=0,p=t;h<p.length;h+=1)for(var d=0,f=p[h].positionedGlyphs;d<f.length;d+=1){var m=f[d];m.x+=c,m.y+=u}})(t.positionedLines,y,H,X,f,m,o,Z,n.length),t.top+=-X*Z,t.bottom=t.top+Z,t.left+=-H*f,t.right=t.left+f}(C,e,i,r,y,a,s,l,h,u,p,m),!function(t){for(var e=0,i=t;e<i.length;e+=1)if(0!==i[e].positionedGlyphs.length)return!1;return!0}(M)&&C}Il.fromFeature=function(t,e){for(var i=new Il,r=0;r<t.sections.length;r++){var n=t.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,e)}return i},Il.prototype.length=function(){return this.text.length},Il.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},Il.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},Il.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},Il.prototype.verticalizePunctuation=function(){this.text=function(t){for(var e="",i=0;i<t.length;i++){var r=t.charCodeAt(i+1)||null,n=t.charCodeAt(i-1)||null;e+=r&&Hr(r)&&!Xs[t[i+1]]||n&&Hr(n)&&!Xs[t[i-1]]||!Xs[t[i]]?t[i]:Xs[t[i]]}return e}(this.text)},Il.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&Tl[this.text.charCodeAt(e)];e++)t++;for(var i=this.text.length,r=this.text.length-1;r>=0&&r>=t&&Tl[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(t,i),this.sectionIndex=this.sectionIndex.slice(t,i)},Il.prototype.substring=function(t,e){var i=new Il;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i},Il.prototype.toString=function(){return this.text},Il.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,i){return Math.max(e,t.sections[i].scale)}),0)},Il.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(El.forText(t.scale,t.fontStack||e));for(var i=this.sections.length-1,r=0;r<t.text.length;++r)this.sectionIndex.push(i)},Il.prototype.addImageSection=function(t){var e=t.image?t.image.name:"";if(0!==e.length){var i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(El.forImage(e)),this.sectionIndex.push(this.sections.length-1)):E("Reached maximum number of images 6401")}else E("Can't add FormattedSection with an empty image.")},Il.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Tl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Al={};function Pl(t,e,i,r,n,o){if(e.imageName){var a=r[e.imageName];return a?a.displaySize[0]*e.scale*24/o+n:0}var s=i[e.fontStack],l=s&&s[t];return l?l.metrics.advance*e.scale+n:0}function Ml(t,e,i,r){var n=Math.pow(t-e,2);return r?t<e?n/2:2*n:n+Math.abs(i)*i}function Cl(t,e,i){var r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function zl(t,e,i,r,n,o){for(var a=null,s=Ml(e,i,n,o),l=0,u=r;l<u.length;l+=1){var c=u[l],h=Ml(e-c.x,i,n,o)+c.badness;h<=s&&(a=c,s=h)}return{index:t,x:e,priorBreak:a,badness:s}}function kl(t,e,i,r,n,o,a){if("point"!==o)return[];if(!t)return[];for(var s,l=[],u=function(t,e,i,r,n,o){for(var a=0,s=0;s<t.length();s++){var l=t.getSection(s);a+=Pl(t.getCharCode(s),l,r,n,e,o)}return a/Math.max(1,Math.ceil(a/i))}(t,e,i,r,n,a),c=t.text.indexOf("")>=0,h=0,p=0;p<t.length();p++){var d=t.getSection(p),f=t.getCharCode(p);if(Tl[f]||(h+=Pl(f,d,r,n,e,a)),p<t.length()-1){var m=!((s=f)<11904||!(Gr["Bopomofo Extended"](s)||Gr.Bopomofo(s)||Gr["CJK Compatibility Forms"](s)||Gr["CJK Compatibility Ideographs"](s)||Gr["CJK Compatibility"](s)||Gr["CJK Radicals Supplement"](s)||Gr["CJK Strokes"](s)||Gr["CJK Symbols and Punctuation"](s)||Gr["CJK Unified Ideographs Extension A"](s)||Gr["CJK Unified Ideographs"](s)||Gr["Enclosed CJK Letters and Months"](s)||Gr["Halfwidth and Fullwidth Forms"](s)||Gr.Hiragana(s)||Gr["Ideographic Description Characters"](s)||Gr["Kangxi Radicals"](s)||Gr["Katakana Phonetic Extensions"](s)||Gr.Katakana(s)||Gr["Vertical Forms"](s)||Gr["Yi Radicals"](s)||Gr["Yi Syllables"](s)));(Al[f]||m||d.imageName)&&l.push(zl(p+1,h,u,l,Cl(f,t.getCharCode(p+1),m&&c),!1))}}return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(zl(t.length(),h,u,l,0,!0))}function Ll(t){var e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Dl(t,e,i,r,n){if(r||n)for(var o=t[i],a=(t[i].x+o.metrics.advance*o.scale)*r,s=e;s<=i;s++)t[s].x-=a,t[s].y+=n}function Rl(t,e,i,r,n,o){var a,s=t.image;if(s.content){var l=s.content,u=s.pixelRatio||1;a=[l[0]/u,l[1]/u,s.displaySize[0]-l[2]/u,s.displaySize[1]-l[3]/u]}var c,h,p,d,f=e.left*o,m=e.right*o;"width"===i||"both"===i?(d=n[0]+f-r[3],h=n[0]+m+r[1]):h=(d=n[0]+(f+m-s.displaySize[0])/2)+s.displaySize[0];var y=e.top*o,_=e.bottom*o;return"height"===i||"both"===i?(c=n[1]+y-r[0],p=n[1]+_+r[2]):p=(c=n[1]+(y+_-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:c,right:h,bottom:p,left:d,collisionPadding:a}}Al[10]=!0,Al[32]=!0,Al[38]=!0,Al[40]=!0,Al[41]=!0,Al[43]=!0,Al[45]=!0,Al[47]=!0,Al[173]=!0,Al[183]=!0,Al[8203]=!0,Al[8208]=!0,Al[8211]=!0,Al[8231]=!0;var Bl=function(t){function e(e,i,r,n){t.call(this,e,i),this.angle=r,void 0!==n&&(this.segment=n)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(n);function Fl(t,e){var i=e.expression;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new sn(t+1))};if("source"===i.kind)return{kind:"source"};for(var r=i.zoomStops,n=i.interpolationType,o=0;o<r.length&&r[o]<=t;)o++;for(var a=o=Math.max(0,o-1);a<r.length&&r[a]<t+1;)a++;a=Math.min(r.length-1,a);var s=r[o],l=r[a];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n}:{kind:"camera",minZoom:s,maxZoom:l,minSize:i.evaluate(new sn(s)),maxSize:i.evaluate(new sn(l)),interpolationType:n}}function Ol(t,e,i){var r=e.uSize,n=i.lowerSize;return"source"===t.kind?n/128:"composite"===t.kind?Ge(n/128,i.upperSize/128,e.uSizeT):r}function Ul(t,e){var i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){var n=t.interpolationType,o=n?c(oi.interpolationFactor(n,e,t.minZoom,t.maxZoom),0,1):0;"camera"===t.kind?r=Ge(t.minSize,t.maxSize,o):i=o}return{uSizeT:i,uSize:r}}Fr("Anchor",Bl);var Nl=Object.freeze({__proto__:null,getSizeData:Fl,evaluateSizeForFeature:Ol,evaluateSizeForZoom:Ul,SIZE_PACK_FACTOR:128});function Vl(t,e,i,r,n){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-i/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;s<i/2;){var c=t[a],h=t[a+1];if(!h)return!1;var p=t[a-1].angleTo(c)-c.angleTo(h);for(p=Math.abs((p+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:p}),u+=p;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>n)return!1;a++,s+=c.dist(h)}return!0}function jl(t){for(var e=0,i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function ql(t,e,i){return t?.6*e*i:0}function Gl(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Zl(t,e,i,r,n,o){for(var a=ql(i,n,o),s=Gl(i,r)*o,l=0,u=jl(t)/2,c=0;c<t.length-1;c++){var h=t[c],p=t[c+1],d=h.dist(p);if(l+d>u){var f=(u-l)/d,m=Ge(h.x,p.x,f),y=Ge(h.y,p.y,f),_=new Bl(m,y,p.angleTo(h),c);return _._round(),!a||Vl(t,_,s,a,e)?_:void 0}l+=d}}function Wl(t,e,i,r,n,o,a,s,l){var u=ql(r,o,a),c=Gl(r,n),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),function t(e,i,r,n,o,a,s,l,u){for(var c=a/2,h=jl(e),p=0,d=i-r,f=[],m=0;m<e.length-1;m++){for(var y=e[m],_=e[m+1],v=y.dist(_),g=_.angleTo(y);d+r<p+v;){var x=((d+=r)-p)/v,b=Ge(y.x,_.x,x),w=Ge(y.y,_.y,x);if(b>=0&&b<u&&w>=0&&w<u&&d-c>=0&&d+c<=h){var E=new Bl(b,w,g,m);E._round(),n&&!Vl(e,E,a,n,o)||f.push(E)}}p+=v}return l||f.length||s||(f=t(e,p/2,r,n,o,a,s,!0,u)),f}(t,p?e/2*s%e:(c/2+2*o)*a*s%e,e,u,i,h,p,!1,l)}function Hl(t,e,i,r,o){for(var a=[],s=0;s<t.length;s++)for(var l=t[s],u=void 0,c=0;c<l.length-1;c++){var h=l[c],p=l[c+1];h.x<e&&p.x<e||(h.x<e?h=new n(e,h.y+(e-h.x)/(p.x-h.x)*(p.y-h.y))._round():p.x<e&&(p=new n(e,h.y+(e-h.x)/(p.x-h.x)*(p.y-h.y))._round()),h.y<i&&p.y<i||(h.y<i?h=new n(h.x+(i-h.y)/(p.y-h.y)*(p.x-h.x),i)._round():p.y<i&&(p=new n(h.x+(i-h.y)/(p.y-h.y)*(p.x-h.x),i)._round()),h.x>=r&&p.x>=r||(h.x>=r?h=new n(r,h.y+(r-h.x)/(p.x-h.x)*(p.y-h.y))._round():p.x>=r&&(p=new n(r,h.y+(r-h.x)/(p.x-h.x)*(p.y-h.y))._round()),h.y>=o&&p.y>=o||(h.y>=o?h=new n(h.x+(o-h.y)/(p.y-h.y)*(p.x-h.x),o)._round():p.y>=o&&(p=new n(h.x+(o-h.y)/(p.y-h.y)*(p.x-h.x),o)._round()),u&&h.equals(u[u.length-1])||a.push(u=[h]),u.push(p)))))}return a}function Xl(t,e,i,r){var o=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,u=a.paddedRect.h-2,c=t.right-t.left,h=t.bottom-t.top,p=a.stretchX||[[0,l]],d=a.stretchY||[[0,u]],f=function(t,e){return t+e[1]-e[0]},m=p.reduce(f,0),y=d.reduce(f,0),_=l-m,v=u-y,g=0,x=m,b=0,w=y,E=0,I=_,S=0,T=v;if(a.content&&r){var A=a.content;g=Kl(p,0,A[0]),b=Kl(d,0,A[1]),x=Kl(p,A[0],A[2]),w=Kl(d,A[1],A[3]),E=A[0]-g,S=A[1]-b,I=A[2]-A[0]-x,T=A[3]-A[1]-w}var P=function(r,o,l,u){var p=Yl(r.stretch-g,x,c,t.left),d=Ql(r.fixed-E,I,r.stretch,m),f=Yl(o.stretch-b,w,h,t.top),_=Ql(o.fixed-S,T,o.stretch,y),v=Yl(l.stretch-g,x,c,t.left),A=Ql(l.fixed-E,I,l.stretch,m),P=Yl(u.stretch-b,w,h,t.top),M=Ql(u.fixed-S,T,u.stretch,y),C=new n(p,f),z=new n(v,f),k=new n(v,P),L=new n(p,P),D=new n(d/s,_/s),R=new n(A/s,M/s),B=e*Math.PI/180;if(B){var F=Math.sin(B),O=Math.cos(B),U=[O,-F,F,O];C._matMult(U),z._matMult(U),L._matMult(U),k._matMult(U)}var N=r.stretch+r.fixed,V=o.stretch+o.fixed;return{tl:C,tr:z,bl:L,br:k,tex:{x:a.paddedRect.x+1+N,y:a.paddedRect.y+1+V,w:l.stretch+l.fixed-N,h:u.stretch+u.fixed-V},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:I/s/c,minFontScaleY:T/s/h,isSDF:i}};if(r&&(a.stretchX||a.stretchY))for(var M=Jl(p,_,m),C=Jl(d,v,y),z=0;z<M.length-1;z++)for(var k=M[z],L=M[z+1],D=0;D<C.length-1;D++)o.push(P(k,C[D],L,C[D+1]));else o.push(P({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return o}function Kl(t,e,i){for(var r=0,n=0,o=t;n<o.length;n+=1){var a=o[n];r+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]))}return r}function Jl(t,e,i){for(var r=[{fixed:-1,stretch:0}],n=0,o=t;n<o.length;n+=1){var a=o[n],s=a[0],l=a[1],u=r[r.length-1];r.push({fixed:s-u.stretch,stretch:u.stretch}),r.push({fixed:s-u.stretch,stretch:u.stretch+(l-s)})}return r.push({fixed:e+1,stretch:i}),r}function Yl(t,e,i,r){return t/e*i+r}function Ql(t,e,i,r){return t-e*i/r}var $l=function(t,e,i,r,o,a,s,l,u,c){if(this.boxStartIndex=t.length,u){var h=a.top,p=a.bottom,d=a.collisionPadding;d&&(h-=d[1],p+=d[3]);var f=p-h;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{var m=a.top*s-l,y=a.bottom*s+l,_=a.left*s-l,v=a.right*s+l,g=a.collisionPadding;if(g&&(_-=g[0]*s,m-=g[1]*s,v+=g[2]*s,y+=g[3]*s),c){var x=new n(_,m),b=new n(v,m),w=new n(_,y),E=new n(v,y),I=c*Math.PI/180;x._rotate(I),b._rotate(I),w._rotate(I),E._rotate(I),_=Math.min(x.x,b.x,w.x,E.x),v=Math.max(x.x,b.x,w.x,E.x),m=Math.min(x.y,b.y,w.y,E.y),y=Math.max(x.y,b.y,w.y,E.y)}t.emplaceBack(e.x,e.y,_,m,v,y,i,r,o)}this.boxEndIndex=t.length},tu=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=eu),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};function eu(t,e){return t<e?-1:t>e?1:0}function iu(t,e,i){void 0===e&&(e=1),void 0===i&&(i=!1);for(var r=1/0,o=1/0,a=-1/0,s=-1/0,l=t[0],u=0;u<l.length;u++){var c=l[u];(!u||c.x<r)&&(r=c.x),(!u||c.y<o)&&(o=c.y),(!u||c.x>a)&&(a=c.x),(!u||c.y>s)&&(s=c.y)}var h=Math.min(a-r,s-o),p=h/2,d=new tu([],ru);if(0===h)return new n(r,o);for(var f=r;f<a;f+=h)for(var m=o;m<s;m+=h)d.push(new nu(f+p,m+p,p,t));for(var y=function(t){for(var e=0,i=0,r=0,n=t[0],o=0,a=n.length,s=a-1;o<a;s=o++){var l=n[o],u=n[s],c=l.x*u.y-u.x*l.y;i+=(l.x+u.x)*c,r+=(l.y+u.y)*c,e+=3*c}return new nu(i/e,r/e,0,t)}(t),_=d.length;d.length;){var v=d.pop();(v.d>y.d||!y.d)&&(y=v,i&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,_)),v.max-y.d<=e||(d.push(new nu(v.p.x-(p=v.h/2),v.p.y-p,p,t)),d.push(new nu(v.p.x+p,v.p.y-p,p,t)),d.push(new nu(v.p.x-p,v.p.y+p,p,t)),d.push(new nu(v.p.x+p,v.p.y+p,p,t)),_+=4)}return i&&(console.log("num probes: "+_),console.log("best distance: "+y.d)),y.p}function ru(t,e){return e.max-t.max}function nu(t,e,i,r){this.p=new n(t,e),this.h=i,this.d=function(t,e){for(var i=!1,r=1/0,n=0;n<e.length;n++)for(var o=e[n],a=0,s=o.length,l=s-1;a<s;l=a++){var u=o[a],c=o[l];u.y>t.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(i=!i),r=Math.min(r,Yo(t,u,c))}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}tu.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},tu.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},tu.prototype.peek=function(){return this.data[0]},tu.prototype._up=function(t){for(var e=this.data,i=this.compare,r=e[t];t>0;){var n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r},tu.prototype._down=function(t){for(var e=this.data,i=this.compare,r=this.length>>1,n=e[t];t<r;){var o=1+(t<<1),a=e[o],s=o+1;if(s<this.length&&i(e[s],a)<0&&(o=s,a=e[s]),i(a,n)>=0)break;e[t]=a,t=o}e[t]=n};var ou=Number.POSITIVE_INFINITY;function au(t,e){return e[1]!==ou?function(t,e,i){var r=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,n]}(t,e[0],e[1]):function(t,e){var i=0,r=0;e<0&&(e=0);var n=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":r=n-7;break;case"bottom-right":case"bottom-left":r=7-n;break;case"bottom":r=7-e;break;case"top":r=e-7}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function su(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function lu(t,e,i,r,o,a,s,l,u,c,h,p,d,f,m){var y=function(t,e,i,r,o,a,s,l){for(var u=r.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,c=[],h=0,p=e.positionedLines;h<p.length;h+=1)for(var d=p[h],f=0,m=d.positionedGlyphs;f<m.length;f+=1){var y=m[f];if(y.rect){var _=y.rect||{},v=4,g=!0,x=1,b=0,w=(o||l)&&y.vertical,E=y.metrics.advance*y.scale/2;if(l&&e.verticalizable&&(b=d.lineOffset/2-(y.imageName?-(24-y.metrics.width*y.scale)/2:24*(y.scale-1))),y.imageName){var I=s[y.imageName];g=I.sdf,v=1/(x=I.pixelRatio)}var S=o?[y.x+E,y.y]:[0,0],T=o?[0,0]:[y.x+E+i[0],y.y+i[1]-b],A=[0,0];w&&(A=T,T=[0,0]);var P=(y.metrics.left-v)*y.scale-E+T[0],M=(-y.metrics.top-v)*y.scale+T[1],C=P+_.w*y.scale/x,z=M+_.h*y.scale/x,k=new n(P,M),L=new n(C,M),D=new n(P,z),R=new n(C,z);if(w){var B=new n(-E,E- -17),F=-Math.PI/2,O=12-E,U=new n(22-O,-(y.imageName?O:0)),N=new(Function.prototype.bind.apply(n,[null].concat(A)));k._rotateAround(F,B)._add(U)._add(N),L._rotateAround(F,B)._add(U)._add(N),D._rotateAround(F,B)._add(U)._add(N),R._rotateAround(F,B)._add(U)._add(N)}if(u){var V=Math.sin(u),j=Math.cos(u),q=[j,-V,V,j];k._matMult(q),L._matMult(q),D._matMult(q),R._matMult(q)}var G=new n(0,0),Z=new n(0,0);c.push({tl:k,tr:L,bl:D,br:R,tex:_,writingMode:e.writingMode,glyphOffset:S,sectionIndex:y.sectionIndex,isSDF:g,pixelOffsetTL:G,pixelOffsetBR:Z,minFontScaleX:0,minFontScaleY:0})}}return c}(0,i,l,o,a,s,r,t.allowVerticalPlacement),_=t.textSizeData,v=null;"source"===_.kind?(v=[128*o.layout.get("text-size").evaluate(s,{})])[0]>32640&&E(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===_.kind&&((v=[128*f.compositeTextSizes[0].evaluate(s,{},m),128*f.compositeTextSizes[1].evaluate(s,{},m)])[0]>32640||v[1]>32640)&&E(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,y,v,l,a,s,c,e,u.lineStartIndex,u.lineLength,d,m);for(var g=0,x=h;g<x.length;g+=1)p[x[g]]=t.text.placedSymbolArray.length-1;return 4*y.length}function uu(t){for(var e in t)return t[e];return null}function cu(t,e,i,r){var n=t.compareText;if(e in n){for(var o=n[e],a=o.length-1;a>=0;a--)if(r.dist(o[a])<i)return!0}else n[e]=[];return n[e].push(r),!1}var hu=bs.VectorTileFeature.types,pu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function du(t,e,i,r,n,o,a,s,l,u,c,h,p){var d=s?Math.min(32640,Math.round(s[0])):0,f=s?Math.min(32640,Math.round(s[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),o,a,(d<<1)+(l?1:0),f,16*u,16*c,256*h,256*p)}function fu(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function mu(t){for(var e=0,i=t.sections;e<i.length;e+=1)if(Jr(i[e].text))return!0;return!1}var yu=function(t){this.layoutVertexArray=new Dn,this.indexArray=new Vn,this.programConfigurations=t,this.segments=new so,this.dynamicLayoutVertexArray=new Rn,this.opacityVertexArray=new Bn,this.placedSymbolArray=new $n};yu.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length},yu.prototype.upload=function(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,js.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,qs.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,pu,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))},yu.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},Fr("SymbolBuffers",yu);var _u=function(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new so,this.collisionVertexArray=new Nn};_u.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Gs.members,!0)},_u.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},Fr("CollisionBuffers",_u);var vu=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=sa([]),this.placementViewportMatrix=sa([]);var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Fl(this.zoom,e["text-size"]),this.iconSizeData=Fl(this.zoom,e["icon-size"]);var i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map((function(t){return wl[t]}))),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.sourceID=t.sourceID};vu.prototype.createArrays=function(){this.text=new yu(new Ro(this.layers,this.zoom,(function(t){return/^text/.test(t)}))),this.icon=new yu(new Ro(this.layers,this.zoom,(function(t){return/^icon/.test(t)}))),this.glyphOffsetArray=new io,this.lineVertexArray=new ro,this.symbolInstances=new eo},vu.prototype.calculateGlyphDependencies=function(t,e,i,r,n){for(var o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(i||r)&&n){var a=Xs[t.charAt(o)];a&&(e[a.charCodeAt(0)]=!0)}},vu.prototype.populate=function(t,e,i){var r=this.layers[0],n=r.layout,o=n.get("text-font"),a=n.get("text-field"),s=n.get("icon-image"),l=("constant"!==a.value.kind||a.value.value instanceof re&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),u="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,c=n.get("symbol-sort-key");if(this.features=[],l||u){for(var h=e.iconDependencies,p=e.glyphDependencies,d=e.availableImages,f=new sn(this.zoom),m=0,y=t;m<y.length;m+=1){var _=y[m],v=_.feature,g=_.id,x=_.index,b=_.sourceLayerIndex,w=r._featureFilter.needGeometry,E=Vo(v,w);if(r._featureFilter.filter(f,E,i)){w||(E.geometry=No(v));var I=void 0;if(l){var S=r.getValueAndResolveTokens("text-field",E,i,d),T=re.factory(S);mu(T)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nn()||this.hasRTLText&&an.isParsed())&&(I=Hs(T,r,E))}var A=void 0;if(u){var P=r.getValueAndResolveTokens("icon-image",E,i,d);A=P instanceof ne?P:ne.fromString(P)}if(I||A){var M=this.sortFeaturesByKey?c.evaluate(E,{},i):void 0;if(this.features.push({id:g,text:I,icon:A,index:x,sourceLayerIndex:b,geometry:E.geometry,properties:v.properties,type:hu[v.type],sortKey:M}),A&&(h[A.name]=!0),I){var C=o.evaluate(E,{},i).join(","),z="map"===n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(wl.vertical)>=0;for(var k=0,L=I.sections;k<L.length;k+=1){var D=L[k];if(D.image)h[D.image.name]=!0;else{var R=Zr(I.toString()),B=D.fontStack||C,F=p[B]=p[B]||{};this.calculateGlyphDependencies(D.text,F,z,this.allowVerticalPlacement,R)}}}}}}"line"===n.get("symbol-placement")&&(this.features=function(t){var e={},i={},r=[],n=0;function o(e){r.push(t[e]),n++}function a(t,e,n){var o=i[t];return delete i[t],i[e]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function s(t,i,n){var o=e[i];return delete e[i],e[t]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(t,e,i){var r=i?e[0][e[0].length-1]:e[0][0];return t+":"+r.x+":"+r.y}for(var u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(p){var d=l(p,h),f=l(p,h,!0);if(d in i&&f in e&&i[d]!==e[f]){var m=s(d,f,h),y=a(d,f,r[m].geometry);delete e[d],delete i[f],i[l(p,r[y].geometry,!0)]=y,r[m].geometry=null}else d in i?a(d,f,h):f in e?s(d,f,h):(o(u),e[d]=n-1,i[f]=n-1)}else o(u)}return r.filter((function(t){return t.geometry}))}(this.features)),this.sortFeaturesByKey&&this.features.sort((function(t,e){return t.sortKey-e.sortKey}))}},vu.prototype.update=function(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))},vu.prototype.isEmpty=function(){return 0===this.symbolInstances.length&&!this.hasRTLText},vu.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},vu.prototype.upload=function(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},vu.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},vu.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},vu.prototype.addToLineVertexArray=function(t,e){var i=this.lineVertexArray.length;if(void 0!==t.segment){for(var r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),o={},a=t.segment+1;a<e.length;a++)o[a]={x:e[a].x,y:e[a].y,tileUnitDistanceFromAnchor:r},a<e.length-1&&(r+=e[a+1].dist(e[a]));for(var s=t.segment||0;s>=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(var l=0;l<e.length;l++){var u=o[l];this.lineVertexArray.emplaceBack(u.x,u.y,u.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}},vu.prototype.addSymbols=function(t,e,i,r,n,o,a,s,l,u,c,h){for(var p=t.indexArray,d=t.layoutVertexArray,f=t.segments.prepareSegment(4*e.length,d,p,this.canOverlap?o.sortKey:void 0),m=this.glyphOffsetArray.length,y=f.vertexLength,_=this.allowVerticalPlacement&&a===wl.vertical?Math.PI/2:0,v=o.text&&o.text.sections,g=0;g<e.length;g++){var x=e[g],b=x.tl,w=x.tr,E=x.bl,I=x.br,S=x.tex,T=x.pixelOffsetTL,A=x.pixelOffsetBR,P=x.minFontScaleX,M=x.minFontScaleY,C=x.glyphOffset,z=x.isSDF,k=x.sectionIndex,L=f.vertexLength,D=C[1];du(d,s.x,s.y,b.x,D+b.y,S.x,S.y,i,z,T.x,T.y,P,M),du(d,s.x,s.y,w.x,D+w.y,S.x+S.w,S.y,i,z,A.x,T.y,P,M),du(d,s.x,s.y,E.x,D+E.y,S.x,S.y+S.h,i,z,T.x,A.y,P,M),du(d,s.x,s.y,I.x,D+I.y,S.x+S.w,S.y+S.h,i,z,A.x,A.y,P,M),fu(t.dynamicLayoutVertexArray,s,_),p.emplaceBack(L,L+1,L+2),p.emplaceBack(L+1,L+2,L+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(C[0]),g!==e.length-1&&k===e[g+1].sectionIndex||t.programConfigurations.populatePaintArrays(d.length,o,o.index,{},h,v&&v[k])}t.placedSymbolArray.emplaceBack(s.x,s.y,m,this.glyphOffsetArray.length-m,y,l,u,s.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],a,0,!1,0,c)},vu.prototype._addCollisionDebugVertex=function(t,e,i,r,n,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(o.x),Math.round(o.y))},vu.prototype.addCollisionDebugVertices=function(t,e,i,r,o,a,s){var l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,h=o.collisionVertexArray,p=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(c,h,a,p,d,new n(t,e)),this._addCollisionDebugVertex(c,h,a,p,d,new n(i,e)),this._addCollisionDebugVertex(c,h,a,p,d,new n(i,r)),this._addCollisionDebugVertex(c,h,a,p,d,new n(t,r)),l.vertexLength+=4;var f=o.indexArray;f.emplaceBack(u,u+1),f.emplaceBack(u+1,u+2),f.emplaceBack(u+2,u+3),f.emplaceBack(u+3,u),l.primitiveLength+=4},vu.prototype.addDebugCollisionBoxes=function(t,e,i,r){for(var n=t;n<e;n++){var o=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(o.x1,o.y1,o.x2,o.y2,r?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,i)}},vu.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new _u(On,Zs.members,Hn),this.iconCollisionBox=new _u(On,Zs.members,Hn);for(var t=0;t<this.symbolInstances.length;t++){var e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}},vu.prototype._deserializeCollisionBoxesForSymbol=function(t,e,i,r,n,o,a,s,l){for(var u={},c=e;c<i;c++){var h=t.get(c);u.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},u.textFeatureIndex=h.featureIndex;break}for(var p=r;p<n;p++){var d=t.get(p);u.verticalTextBox={x1:d.x1,y1:d.y1,x2:d.x2,y2:d.y2,anchorPointX:d.anchorPointX,anchorPointY:d.anchorPointY},u.verticalTextFeatureIndex=d.featureIndex;break}for(var f=o;f<a;f++){var m=t.get(f);u.iconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},u.iconFeatureIndex=m.featureIndex;break}for(var y=s;y<l;y++){var _=t.get(y);u.verticalIconBox={x1:_.x1,y1:_.y1,x2:_.x2,y2:_.y2,anchorPointX:_.anchorPointX,anchorPointY:_.anchorPointY},u.verticalIconFeatureIndex=_.featureIndex;break}return u},vu.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}},vu.prototype.hasTextData=function(){return this.text.segments.get().length>0},vu.prototype.hasIconData=function(){return this.icon.segments.get().length>0},vu.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},vu.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},vu.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},vu.prototype.addIndicesForPlacedSymbol=function(t,e){for(var i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs,n=i.vertexStartIndex;n<r;n+=4)t.indexArray.emplaceBack(n,n+1,n+2),t.indexArray.emplaceBack(n+1,n+2,n+3)},vu.prototype.getSortedSymbolIndexes=function(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;for(var e=Math.sin(t),i=Math.cos(t),r=[],n=[],o=[],a=0;a<this.symbolInstances.length;++a){o.push(a);var s=this.symbolInstances.get(a);r.push(0|Math.round(e*s.anchorX+i*s.anchorY)),n.push(s.featureIndex)}return o.sort((function(t,e){return r[t]-r[e]||n[e]-n[t]})),o},vu.prototype.addToSortKeyRanges=function(t,e){var i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})},vu.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var i=0,r=this.symbolInstanceIndexes;i<r.length;i+=1){var n=this.symbolInstances.get(r[i]);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((function(t,i,r){t>=0&&r.indexOf(t)===i&&e.addIndicesForPlacedSymbol(e.text,t)})),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Fr("SymbolBucket",vu,{omit:["layers","collisionBoxArray","features","compareText"]}),vu.MAX_GLYPHS=65535,vu.addDynamicAttributes=fu;var gu=new bn({"symbol-placement":new yn(Mt.layout_symbol["symbol-placement"]),"symbol-spacing":new yn(Mt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new yn(Mt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new _n(Mt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new yn(Mt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new yn(Mt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new yn(Mt.layout_symbol["icon-ignore-placement"]),"icon-optional":new yn(Mt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new yn(Mt.layout_symbol["icon-rotation-alignment"]),"icon-size":new _n(Mt.layout_symbol["icon-size"]),"icon-text-fit":new yn(Mt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new yn(Mt.layout_symbol["icon-text-fit-padding"]),"icon-image":new _n(Mt.layout_symbol["icon-image"]),"icon-rotate":new _n(Mt.layout_symbol["icon-rotate"]),"icon-padding":new yn(Mt.layout_symbol["icon-padding"]),"icon-keep-upright":new yn(Mt.layout_symbol["icon-keep-upright"]),"icon-offset":new _n(Mt.layout_symbol["icon-offset"]),"icon-anchor":new _n(Mt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new yn(Mt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new yn(Mt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new yn(Mt.layout_symbol["text-rotation-alignment"]),"text-field":new _n(Mt.layout_symbol["text-field"]),"text-font":new _n(Mt.layout_symbol["text-font"]),"text-size":new _n(Mt.layout_symbol["text-size"]),"text-max-width":new _n(Mt.layout_symbol["text-max-width"]),"text-line-height":new yn(Mt.layout_symbol["text-line-height"]),"text-letter-spacing":new _n(Mt.layout_symbol["text-letter-spacing"]),"text-justify":new _n(Mt.layout_symbol["text-justify"]),"text-radial-offset":new _n(Mt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new yn(Mt.layout_symbol["text-variable-anchor"]),"text-anchor":new _n(Mt.layout_symbol["text-anchor"]),"text-max-angle":new yn(Mt.layout_symbol["text-max-angle"]),"text-writing-mode":new yn(Mt.layout_symbol["text-writing-mode"]),"text-rotate":new _n(Mt.layout_symbol["text-rotate"]),"text-padding":new yn(Mt.layout_symbol["text-padding"]),"text-keep-upright":new yn(Mt.layout_symbol["text-keep-upright"]),"text-transform":new _n(Mt.layout_symbol["text-transform"]),"text-offset":new _n(Mt.layout_symbol["text-offset"]),"text-allow-overlap":new yn(Mt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new yn(Mt.layout_symbol["text-ignore-placement"]),"text-optional":new yn(Mt.layout_symbol["text-optional"])}),xu={paint:new bn({"icon-opacity":new _n(Mt.paint_symbol["icon-opacity"]),"icon-color":new _n(Mt.paint_symbol["icon-color"]),"icon-halo-color":new _n(Mt.paint_symbol["icon-halo-color"]),"icon-halo-width":new _n(Mt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new _n(Mt.paint_symbol["icon-halo-blur"]),"icon-translate":new yn(Mt.paint_symbol["icon-translate"]),"icon-translate-anchor":new yn(Mt.paint_symbol["icon-translate-anchor"]),"text-opacity":new _n(Mt.paint_symbol["text-opacity"]),"text-color":new _n(Mt.paint_symbol["text-color"],{runtimeType:Vt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new _n(Mt.paint_symbol["text-halo-color"]),"text-halo-width":new _n(Mt.paint_symbol["text-halo-width"]),"text-halo-blur":new _n(Mt.paint_symbol["text-halo-blur"]),"text-translate":new yn(Mt.paint_symbol["text-translate"]),"text-translate-anchor":new yn(Mt.paint_symbol["text-translate-anchor"])}),layout:gu},bu=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ft,this.defaultValue=t};bu.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},bu.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},bu.prototype.outputDefined=function(){return!1},bu.prototype.serialize=function(){return null},Fr("FormatSectionOverride",bu,{omit:["defaultValue"]});var wu=function(t){function e(e){t.call(this,e,xu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,i){if(t.prototype.recalculate.call(this,e,i),"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")),"point"===this.layout.get("symbol-placement")){var r=this.layout.get("text-writing-mode");if(r){for(var n=[],o=0,a=r;o<a.length;o+=1){var s=a[o];n.indexOf(s)<0&&n.push(s)}this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},e.prototype.getValueAndResolveTokens=function(t,e,i,r){var n,o=this.layout.get(t).evaluate(e,{},i,r),a=this._unevaluatedLayout._values[t];return a.isDataDriven()||Zi(a.value)||!o?o:(n=e.properties,o.replace(/{([^{}]+)}/g,(function(t,e){return e in n?String(n[e]):""})))},e.prototype.createBucket=function(t){return new vu(t)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype._setPaintOverrides=function(){for(var t=0,i=xu.paint.overridableProperties;t<i.length;t+=1){var r=i[t];if(e.hasPaintOverride(this.layout,r)){var n,o=this.paint.get(r),a=new bu(o),s=new Gi(a,o.property.specification);n="constant"===o.value.kind||"source"===o.value.kind?new Hi("source",s):new Xi("composite",s,o.value.zoomStops,o.value._interpolationType),this.paint._values[r]=new fn(o.property,n,o.parameters)}}},e.prototype._handleOverridablePaintPropertyUpdate=function(t,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&e.hasPaintOverride(this.layout,t)},e.hasPaintOverride=function(t,e){var i=t.get("text-field"),r=xu.paint.properties[e],n=!1,o=function(t){for(var e=0,i=t;e<i.length;e+=1)if(r.overrides&&r.overrides.hasOverride(i[e]))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof re)o(i.value.value.sections);else if("source"===i.value.kind){var a=function(t){n||(t instanceof ue&&se(t.value)===Zt?o(t.value.sections):t instanceof de?o(t.sections):t.eachChild(a))},s=i.value;s._styleExpression&&a(s._styleExpression.expression)}return n},e}(wn),Eu={paint:new bn({"background-color":new yn(Mt.paint_background["background-color"]),"background-pattern":new gn(Mt.paint_background["background-pattern"]),"background-opacity":new yn(Mt.paint_background["background-opacity"])})},Iu=function(t){function e(e){t.call(this,e,Eu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(wn),Su={paint:new bn({"raster-opacity":new yn(Mt.paint_raster["raster-opacity"]),"raster-hue-rotate":new yn(Mt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new yn(Mt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new yn(Mt.paint_raster["raster-brightness-max"]),"raster-saturation":new yn(Mt.paint_raster["raster-saturation"]),"raster-contrast":new yn(Mt.paint_raster["raster-contrast"]),"raster-resampling":new yn(Mt.paint_raster["raster-resampling"]),"raster-fade-duration":new yn(Mt.paint_raster["raster-fade-duration"])})},Tu=function(t){function e(e){t.call(this,e,Su)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(wn),Au=function(t){function e(e){t.call(this,e,{}),this.implementation=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.is3D=function(){return"3d"===this.implementation.renderingMode},e.prototype.hasOffscreenPass=function(){return void 0!==this.implementation.prerender},e.prototype.recalculate=function(){},e.prototype.updateTransitions=function(){},e.prototype.hasTransition=function(){},e.prototype.serialize=function(){},e.prototype.onAdd=function(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},e.prototype.onRemove=function(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},e}(wn),Pu={circle:da,heatmap:Ea,hillshade:Sa,fill:hs,"fill-extrusion":Ps,line:Ns,symbol:wu,background:Iu,raster:Tu},Mu=a.HTMLImageElement,Cu=a.HTMLCanvasElement,zu=a.HTMLVideoElement,ku=a.ImageData,Lu=a.ImageBitmap,Du=function(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)};Du.prototype.update=function(t,e,i){var r=t.width,n=t.height,o=!(this.size&&this.size[0]===r&&this.size[1]===n||i),a=this.context,s=a.gl;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[r,n],t instanceof Mu||t instanceof Cu||t instanceof zu||t instanceof ku||Lu&&t instanceof Lu?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,r,n,0,this.format,s.UNSIGNED_BYTE,t.data);else{var l=i||{x:0,y:0},u=l.x,c=l.y;t instanceof Mu||t instanceof Cu||t instanceof zu||t instanceof ku||Lu&&t instanceof Lu?s.texSubImage2D(s.TEXTURE_2D,0,u,c,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,u,c,r,n,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D)},Du.prototype.bind=function(t,e,i){var r=this.context.gl;r.bindTexture(r.TEXTURE_2D,this.texture),i!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=r.LINEAR),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,e),this.wrap=e)},Du.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Du.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Ru=function(t){var e=this;this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){e._triggered=!1,e._callback()})};Ru.prototype.trigger=function(){var t=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((function(){t._triggered=!1,t._callback()}),0))},Ru.prototype.remove=function(){delete this._channel,this._callback=function(){}};var Bu=function(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},_(["receive","process"],this),this.invoker=new Ru(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=T()?t:a};function Fu(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}Bu.prototype.send=function(t,e,i,r,n){var o=this;void 0===n&&(n=!1);var a=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[a]=i);var s=M(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!i,targetMapId:r,mustQueue:n,sourceMapId:this.mapId,data:Vr(e,s)},s),{cancel:function(){i&&delete o.callbacks[a],o.target.postMessage({id:a,type:"<cancel>",targetMapId:r,sourceMapId:o.mapId})}}},Bu.prototype.receive=function(t){var e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];var r=this.cancelCallbacks[i];delete this.cancelCallbacks[i],r&&r()}else T()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)},Bu.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Bu.prototype.processTask=function(t,e){var i=this;if("<response>"===e.type){var r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(jr(e.error)):r(null,jr(e.data)))}else{var n=!1,o=M(this.globalScope)?void 0:[],a=e.hasCallback?function(e,r){n=!0,delete i.cancelCallbacks[t],i.target.postMessage({id:t,type:"<response>",sourceMapId:i.mapId,error:e?Vr(e):null,data:Vr(r,o)},o)}:function(t){n=!0},s=null,l=jr(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,l,a);else if(this.parent.getWorkerSource){var u=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,u[0],l.source)[u[1]](l,a)}else a(new Error("Could not find function "+e.type));!n&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Bu.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Ou=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Ou.prototype.setNorthEast=function(t){return this._ne=t instanceof Uu?new Uu(t.lng,t.lat):Uu.convert(t),this},Ou.prototype.setSouthWest=function(t){return this._sw=t instanceof Uu?new Uu(t.lng,t.lat):Uu.convert(t),this},Ou.prototype.extend=function(t){var e,i,r=this._sw,n=this._ne;if(t instanceof Uu)e=t,i=t;else{if(!(t instanceof Ou))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Ou.convert(t)):this.extend(Uu.convert(t)):this;if(i=t._ne,!(e=t._sw)||!i)return this}return r||n?(r.lng=Math.min(e.lng,r.lng),r.lat=Math.min(e.lat,r.lat),n.lng=Math.max(i.lng,n.lng),n.lat=Math.max(i.lat,n.lat)):(this._sw=new Uu(e.lng,e.lat),this._ne=new Uu(i.lng,i.lat)),this},Ou.prototype.getCenter=function(){return new Uu((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Ou.prototype.getSouthWest=function(){return this._sw},Ou.prototype.getNorthEast=function(){return this._ne},Ou.prototype.getNorthWest=function(){return new Uu(this.getWest(),this.getNorth())},Ou.prototype.getSouthEast=function(){return new Uu(this.getEast(),this.getSouth())},Ou.prototype.getWest=function(){return this._sw.lng},Ou.prototype.getSouth=function(){return this._sw.lat},Ou.prototype.getEast=function(){return this._ne.lng},Ou.prototype.getNorth=function(){return this._ne.lat},Ou.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Ou.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Ou.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Ou.prototype.contains=function(t){var e=Uu.convert(t),i=e.lng,r=e.lat,n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n},Ou.convert=function(t){return!t||t instanceof Ou?t:new Ou(t)};var Uu=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Uu.prototype.wrap=function(){return new Uu(h(this.lng,-180,180),this.lat)},Uu.prototype.toArray=function(){return[this.lng,this.lat]},Uu.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Uu.prototype.distanceTo=function(t){var e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(n,1))},Uu.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return new Ou(new Uu(this.lng-i,this.lat-e),new Uu(this.lng+i,this.lat+e))},Uu.convert=function(t){if(t instanceof Uu)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Uu(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Uu(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var Nu=2*Math.PI*6371008.8;function Vu(t){return Nu*Math.cos(t*Math.PI/180)}function ju(t){return(180+t)/360}function qu(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Gu(t,e){return t/Vu(e)}function Zu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Wu=function(t,e,i){void 0===i&&(i=0),this.x=+t,this.y=+e,this.z=+i};Wu.fromLngLat=function(t,e){void 0===e&&(e=0);var i=Uu.convert(t);return new Wu(ju(i.lng),qu(i.lat),Gu(e,i.lat))},Wu.prototype.toLngLat=function(){return new Uu(360*this.x-180,Zu(this.y))},Wu.prototype.toAltitude=function(){return this.z*Vu(Zu(this.y))},Wu.prototype.meterInMercatorCoordinateUnits=function(){return 1/Nu*(t=Zu(this.y),1/Math.cos(t*Math.PI/180));var t};var Hu=function(t,e,i){this.z=t,this.x=e,this.y=i,this.key=Ju(0,t,t,e,i)};Hu.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Hu.prototype.url=function(t,e){var i,r,n,o,a,s=(r=this.y,n=this.z,o=Fu(256*(i=this.x),256*(r=Math.pow(2,n)-r-1),n),a=Fu(256*(i+1),256*(r+1),n),o[0]+","+o[1]+","+a[0]+","+a[1]),l=function(t,e,i){for(var r,n="",o=t;o>0;o--)n+=(e&(r=1<<o-1)?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",s)},Hu.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new n(8192*(t.x*e-this.x),8192*(t.y*e-this.y))},Hu.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var Xu=function(t,e){this.wrap=t,this.canonical=e,this.key=Ju(t,e.z,e.z,e.x,e.y)},Ku=function(t,e,i,r,n){this.overscaledZ=t,this.wrap=e,this.canonical=new Hu(i,+r,+n),this.key=Ju(e,t,i,r,n)};function Ju(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);var o=1<<i;return(o*o*t+o*n+r).toString(36)+i.toString(36)+e.toString(36)}Ku.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},Ku.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new Ku(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ku(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Ku.prototype.calculateScaledKey=function(t,e){var i=this.canonical.z-t;return t>this.canonical.z?Ju(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Ju(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)},Ku.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e},Ku.prototype.children=function(t){if(this.overscaledZ>=t)return[new Ku(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Ku(e,this.wrap,e,i,r),new Ku(e,this.wrap,e,i+1,r),new Ku(e,this.wrap,e,i,r+1),new Ku(e,this.wrap,e,i+1,r+1)]},Ku.prototype.isLessThan=function(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))},Ku.prototype.wrapped=function(){return new Ku(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},Ku.prototype.unwrapTo=function(t){return new Ku(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},Ku.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},Ku.prototype.toUnwrapped=function(){return new Xu(this.wrap,this.canonical)},Ku.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},Ku.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new Wu(t.x-this.wrap,t.y))},Fr("CanonicalTileID",Hu),Fr("OverscaledTileID",Ku,{omit:["posMatrix"]});var Yu=function(t,e,i){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return E('"'+i+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=e.height;var r=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=i||"mapbox";for(var n=0;n<r;n++)this.data[this._idx(-1,n)]=this.data[this._idx(0,n)],this.data[this._idx(r,n)]=this.data[this._idx(r-1,n)],this.data[this._idx(n,-1)]=this.data[this._idx(n,0)],this.data[this._idx(n,r)]=this.data[this._idx(n,r-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(r,-1)]=this.data[this._idx(r-1,0)],this.data[this._idx(-1,r)]=this.data[this._idx(0,r-1)],this.data[this._idx(r,r)]=this.data[this._idx(r-1,r-1)]};Yu.prototype.get=function(t,e){var i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(i[r],i[r+1],i[r+2])},Yu.prototype.getUnpackVector=function(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},Yu.prototype._idx=function(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Yu.prototype._unpackMapbox=function(t,e,i){return(256*t*256+256*e+i)/10-1e4},Yu.prototype._unpackTerrarium=function(t,e,i){return 256*t+e+i/256-32768},Yu.prototype.getPixels=function(){return new xa({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Yu.prototype.backfillBorder=function(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var r=e*this.dim,n=e*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,l=-i*this.dim,u=o;u<a;u++)for(var c=r;c<n;c++)this.data[this._idx(c,u)]=t.data[this._idx(c+s,u+l)]},Fr("DEMData",Yu);var Qu=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}};Qu.prototype.encode=function(t){return this._stringToNumber[t]},Qu.prototype.decode=function(t){return this._numberToString[t]};var $u=function(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=n},tc={geometry:{configurable:!0}};tc.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},tc.geometry.set=function(t){this._geometry=t},$u.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties($u.prototype,tc);var ec=function(){this.state={},this.stateChanges={},this.deletedStates={}};ec.prototype.updateState=function(t,e,i){var r=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},p(this.stateChanges[t][r],i),null===this.deletedStates[t])for(var n in this.deletedStates[t]={},this.state[t])n!==r&&(this.deletedStates[t][n]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][r])for(var o in this.deletedStates[t][r]={},this.state[t][r])i[o]||(this.deletedStates[t][r][o]=null);else for(var a in i)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][a]&&delete this.deletedStates[t][r][a]},ec.prototype.removeFeatureState=function(t,e,i){if(null!==this.deletedStates[t]){var r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}},ec.prototype.getState=function(t,e){var i=String(e),r=p({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var n=this.deletedStates[t][e];if(null===n)return{};for(var o in n)delete r[o]}return r},ec.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},ec.prototype.coalesceChanges=function(t,e){var i={};for(var r in this.stateChanges){this.state[r]=this.state[r]||{};var n={};for(var o in this.stateChanges[r])this.state[r][o]||(this.state[r][o]={}),p(this.state[r][o],this.stateChanges[r][o]),n[o]=this.state[r][o];i[r]=n}for(var a in this.deletedStates){this.state[a]=this.state[a]||{};var s={};if(null===this.deletedStates[a])for(var l in this.state[a])s[l]={},this.state[a][l]={};else for(var u in this.deletedStates[a]){if(null===this.deletedStates[a][u])this.state[a][u]={};else for(var c=0,h=Object.keys(this.deletedStates[a][u]);c<h.length;c+=1)delete this.state[a][u][h[c]];s[u]=this.state[a][u]}i[a]=i[a]||{},p(i[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(var d in t)t[d].setFeatureState(i,e)};var ic=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new kr(8192,16,0),this.grid3D=new kr(8192,16,0),this.featureIndexArray=new oo,this.promoteId=e};function rc(t,e,i,r,n){return g(t,(function(t,o){var a=e instanceof mn?e.get(o):null;return a&&a.evaluate?a.evaluate(i,r,n):a}))}function nc(t){for(var e=1/0,i=1/0,r=-1/0,n=-1/0,o=0,a=t;o<a.length;o+=1){var s=a[o];e=Math.min(e,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x),n=Math.max(n,s.y)}return{minX:e,minY:i,maxX:r,maxY:n}}function oc(t,e){return e-t}ic.prototype.insert=function(t,e,i,r,n,o){var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);for(var s=o?this.grid3D:this.grid,l=0;l<e.length;l++){for(var u=e[l],c=[1/0,1/0,-1/0,-1/0],h=0;h<u.length;h++){var p=u[h];c[0]=Math.min(c[0],p.x),c[1]=Math.min(c[1],p.y),c[2]=Math.max(c[2],p.x),c[3]=Math.max(c[3],p.y)}c[0]<8192&&c[1]<8192&&c[2]>=0&&c[3]>=0&&s.insert(a,c[0],c[1],c[2],c[3])}},ic.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new bs.VectorTile(new Ys(this.rawTileData)).layers,this.sourceLayerCoder=new Qu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},ic.prototype.query=function(t,e,i,r){var o=this;this.loadVTLayers();for(var a=t.params||{},s=8192/t.tileSize/t.scale,l=or(a.filter),u=t.queryGeometry,c=t.queryPadding*s,h=nc(u),p=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),d=nc(t.cameraQueryGeometry),f=0,m=this.grid3D.query(d.minX-c,d.minY-c,d.maxX+c,d.maxY+c,(function(e,i,r,o){return function(t,e,i,r,o){for(var a=0,s=t;a<s.length;a+=1){var l=s[a];if(e<=l.x&&i<=l.y&&r>=l.x&&o>=l.y)return!0}var u=[new n(e,i),new n(e,o),new n(r,o),new n(r,i)];if(t.length>2)for(var c=0,h=u;c<h.length;c+=1)if($o(t,h[c]))return!0;for(var p=0;p<t.length-1;p++)if(ta(t[p],t[p+1],u))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,r+c,o+c)}));f<m.length;f+=1)p.push(m[f]);p.sort(oc);for(var y,_={},v=function(n){var c=p[n];if(c!==y){y=c;var h=o.featureIndexArray.get(c),d=null;o.loadMatchingFeature(_,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,l,a.layers,a.availableImages,e,i,r,(function(e,i,r){return d||(d=No(e)),i.queryIntersectsFeature(u,e,r,d,o.z,t.transform,s,t.pixelPosMatrix)}))}},g=0;g<p.length;g++)v(g);return _},ic.prototype.loadMatchingFeature=function(t,e,i,r,n,o,a,s,l,u,c){var h=this.bucketLayerIDs[e];if(!o||function(t,e){for(var i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(o,h)){var d=this.sourceLayerCoder.decode(i),f=this.vtLayers[d].feature(r);if(n.needGeometry){var m=Vo(f,!0);if(!n.filter(new sn(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!n.filter(new sn(this.tileID.overscaledZ),f))return;for(var y=this.getId(f,d),_=0;_<h.length;_++){var v=h[_];if(!(o&&o.indexOf(v)<0)){var g=s[v];if(g){var x={};void 0!==y&&u&&(x=u.getState(g.sourceLayer||"_geojsonTileLayer",y));var b=p({},l[v]);b.paint=rc(b.paint,g.paint,f,x,a),b.layout=rc(b.layout,g.layout,f,x,a);var w=!c||c(f,g,x);if(w){var E=new $u(f,this.z,this.x,this.y,y);E.layer=b;var I=t[v];void 0===I&&(I=t[v]=[]),I.push({featureIndex:r,feature:E,intersectionZ:w})}}}}}},ic.prototype.lookupSymbolFeatures=function(t,e,i,r,n,o,a,s){var l={};this.loadVTLayers();for(var u=or(n),c=0,h=t;c<h.length;c+=1)this.loadMatchingFeature(l,i,r,h[c],u,o,a,s,e);return l},ic.prototype.hasLayer=function(t){for(var e=0,i=this.bucketLayerIDs;e<i.length;e+=1)for(var r=0,n=i[e];r<n.length;r+=1)if(t===n[r])return!0;return!1},ic.prototype.getId=function(t,e){var i=t.id;return this.promoteId&&"boolean"==typeof(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]])&&(i=Number(i)),i},Fr("FeatureIndex",ic,{omit:["rawTileData","sourceLayerCoder"]});var ac=function(t,e){this.tileID=t,this.uid=f(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};ac.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<O.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},ac.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},ac.prototype.loadVectorData=function(t,e,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var r in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){var i={};if(!e)return i;for(var r=function(){var t=o[n],r=t.layerIds.map((function(t){return e.getLayer(t)})).filter(Boolean);if(0!==r.length){t.layers=r,t.stateDependentLayerIds&&(t.stateDependentLayers=t.stateDependentLayerIds.map((function(t){return r.filter((function(e){return e.id===t}))[0]})));for(var a=0,s=r;a<s.length;a+=1)i[s[a].id]=t}},n=0,o=t;n<o.length;n+=1)r();return i}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var n=this.buckets[r];if(n instanceof vu){if(this.hasSymbolBuckets=!0,!i)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var o in this.buckets){var a=this.buckets[o];if(a instanceof vu&&a.hasRTLText){this.hasRTLText=!0,an.isLoading()||an.isLoaded()||"deferred"!==nn()||on();break}}for(var s in this.queryPadding=0,this.buckets){var l=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(s).queryRadius(l))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new Yn},ac.prototype.unloadVectorData=function(){for(var t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},ac.prototype.getBucket=function(t){return this.buckets[t.id]},ac.prototype.upload=function(t){for(var e in this.buckets){var i=this.buckets[e];i.uploadPending()&&i.upload(t)}var r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Du(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Du(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)},ac.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},ac.prototype.queryRenderedFeatures=function(t,e,i,r,n,o,a,s,l,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:a,queryPadding:this.queryPadding*l},t,e,i):{}},ac.prototype.querySourceFeatures=function(t,e){var i=this.latestFeatureIndex;if(i&&i.rawTileData){var r=i.loadVTLayers(),n=e?e.sourceLayer:"",o=r._geojsonTileLayer||r[n];if(o)for(var a=or(e&&e.filter),s=this.tileID.canonical,l=s.z,u=s.x,c=s.y,h={z:l,x:u,y:c},p=0;p<o.length;p++){var d=o.feature(p);if(a.needGeometry){var f=Vo(d,!0);if(!a.filter(new sn(this.tileID.overscaledZ),f,this.tileID.canonical))continue}else if(!a.filter(new sn(this.tileID.overscaledZ),d))continue;var m=i.getId(d,n),y=new $u(d,l,u,c,m);y.tile=h,t.push(y)}}},ac.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},ac.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},ac.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var i=A(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var r=Date.now(),n=!1;if(this.expirationTime>r)n=!1;else if(e)if(this.expirationTime<e)n=!0;else{var o=this.expirationTime-e;o?this.expirationTime=r+Math.max(o,3e4):n=!0}else n=!0;n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},ac.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)},ac.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(t).length){var i=this.latestFeatureIndex.loadVTLayers();for(var r in this.buckets)if(e.style.hasLayer(r)){var n=this.buckets[r],o=n.layers[0].sourceLayer||"_geojsonTileLayer",a=i[o],s=t[o];if(a&&s&&0!==Object.keys(s).length){n.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});var l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}}},ac.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},ac.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<O.now()},ac.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},ac.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=O.now()+t},ac.prototype.setDependencies=function(t,e){for(var i={},r=0,n=e;r<n.length;r+=1)i[n[r]]=!0;this.dependencies[t]=i},ac.prototype.hasDependency=function(t,e){for(var i=0,r=t;i<r.length;i+=1){var n=this.dependencies[r[i]];if(n)for(var o=0,a=e;o<a.length;o+=1)if(n[a[o]])return!0}return!1};var sc=a.performance,lc=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},sc.mark(this._marks.start)};lc.prototype.finish=function(){sc.mark(this._marks.end);var t=sc.getEntriesByName(this._marks.measure);return 0===t.length&&(sc.measure(this._marks.measure,this._marks.start,this._marks.end),t=sc.getEntriesByName(this._marks.measure),sc.clearMarks(this._marks.start),sc.clearMarks(this._marks.end),sc.clearMeasures(this._marks.measure)),t},t.Actor=Bu,t.AlphaImage=ga,t.CanonicalTileID=Hu,t.CollisionBoxArray=Yn,t.Color=te,t.DEMData=Yu,t.DataConstantProperty=yn,t.DictionaryCoder=Qu,t.EXTENT=8192,t.ErrorEvent=At,t.EvaluationParameters=sn,t.Event=Tt,t.Evented=Pt,t.FeatureIndex=ic,t.FillBucket=ls,t.FillExtrusionBucket=Ss,t.ImageAtlas=bl,t.ImagePosition=gl,t.LineBucket=Bs,t.LngLat=Uu,t.LngLatBounds=Ou,t.MercatorCoordinate=Wu,t.ONE_EM=24,t.OverscaledTileID=Ku,t.Point=n,t.Point$1=n,t.Properties=bn,t.Protobuf=Ys,t.RGBAImage=xa,t.RequestManager=Z,t.RequestPerformance=lc,t.ResourceType=ft,t.SegmentVector=so,t.SourceFeatureState=ec,t.StructArrayLayout1ui2=Xn,t.StructArrayLayout2f1f2i16=Un,t.StructArrayLayout2i4=Pn,t.StructArrayLayout3ui6=Vn,t.StructArrayLayout4i8=Mn,t.SymbolBucket=vu,t.Texture=Du,t.Tile=ac,t.Transitionable=cn,t.Uniform1f=bo,t.Uniform1i=xo,t.Uniform2f=wo,t.Uniform3f=Eo,t.Uniform4f=Io,t.UniformColor=So,t.UniformMatrix4f=Ao,t.UnwrappedTileID=Xu,t.ValidationError=Ct,t.WritingMode=wl,t.ZoomHistory=qr,t.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},t.addDynamicAttributes=fu,t.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);var r=t.length,n=new Array(t.length),o=null;t.forEach((function(t,a){e(t,(function(t,e){t&&(o=t),n[a]=e,0==--r&&i(o,n)}))}))},t.bezier=l,t.bindAll=_,t.browser=O,t.cacheEntryPossiblyAdded=function(t){++pt>lt&&(t.getActor().send("enforceCacheSizeLimit",st),pt=0)},t.clamp=c,t.clearTileCache=function(t){var e=a.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=Hl,t.clone=function(t){var e=new aa(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],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},t.clone$1=b,t.clone$2=function(t){var e=new aa(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Ws,t.config=U,t.create=function(){var t=new aa(16);return aa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new aa(9);return aa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new aa(4);return aa!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Wi,t.createLayout=Tn,t.createStyleLayer=function(t){return"custom"===t.type?new Au(t):new Pu[t.type](t)},t.cross=function(t,e,i){var r=e[0],n=e[1],o=e[2],a=i[0],s=i[1],l=i[2];return t[0]=n*l-o*s,t[1]=o*a-r*l,t[2]=r*s-n*a,t},t.deepEqual=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(var r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(var n in e)if(!t(e[n],i[n]))return!1;return!0}return e===i},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=u,t.emitValidationErrors=zr,t.endsWith=v,t.enforceCacheSizeLimit=function(t){ut(),tt&&tt.then((function(e){e.keys().then((function(i){for(var r=0;r<i.length-t;r++)e.delete(i[r])}))}))},t.evaluateSizeForFeature=Ol,t.evaluateSizeForZoom=Ul,t.evaluateVariableOffset=au,t.evented=rn,t.extend=p,t.featureFilter=or,t.filterObject=x,t.fromRotation=function(t,e){var i=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.getAnchorAlignment=Ll,t.getAnchorJustification=su,t.getArrayBuffer=xt,t.getImage=Et,t.getJSON=function(t,e){return gt(p(t,{type:"json"}),e)},t.getRTLTextPluginStatus=nn,t.getReferrer=vt,t.getVideo=function(t,e){var i,r,n=a.document.createElement("video");n.muted=!0,n.onloadstart=function(){e(null,n)};for(var o=0;o<t.length;o++){var s=a.document.createElement("source");i=t[o],r=void 0,(r=a.document.createElement("a")).href=i,(r.protocol!==a.document.location.protocol||r.host!==a.document.location.host)&&(n.crossOrigin="Anonymous"),s.src=t[o],n.appendChild(s)}return{cancel:function(){}}},t.identity=sa,t.invert=function(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],y=e[14],_=e[15],v=i*s-r*a,g=i*l-n*a,x=i*u-o*a,b=r*l-n*s,w=r*u-o*s,E=n*u-o*l,I=c*m-h*f,S=c*y-p*f,T=c*_-d*f,A=h*y-p*m,P=h*_-d*m,M=p*_-d*y,C=v*M-g*P+x*A+b*T-w*S+E*I;return C?(t[0]=(s*M-l*P+u*A)*(C=1/C),t[1]=(n*P-r*M-o*A)*C,t[2]=(m*E-y*w+_*b)*C,t[3]=(p*w-h*E-d*b)*C,t[4]=(l*T-a*M-u*S)*C,t[5]=(i*M-n*T+o*S)*C,t[6]=(y*x-f*E-_*g)*C,t[7]=(c*E-p*x+d*g)*C,t[8]=(a*P-s*T+u*I)*C,t[9]=(r*T-i*P-o*I)*C,t[10]=(f*w-m*x+_*v)*C,t[11]=(h*x-c*w-d*v)*C,t[12]=(s*S-a*A-l*I)*C,t[13]=(i*A-r*S+n*I)*C,t[14]=(m*g-f*b-y*v)*C,t[15]=(c*b-h*g+p*v)*C,t):null},t.isChar=Gr,t.isMapboxURL=W,t.keysDifference=function(t,e){var i=[];for(var r in t)r in e||i.push(r);return i},t.makeRequest=gt,t.mapObject=g,t.mercatorXfromLng=ju,t.mercatorYfromLat=qu,t.mercatorZfromAltitude=Gu,t.mul=ha,t.multiply=la,t.mvt=bs,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.normalize=function(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.number=Ge,t.offscreenCanvasSupported=dt,t.ortho=function(t,e,i,r,n,o,a){var s=1/(e-i),l=1/(r-n),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+i)*s,t[13]=(n+r)*l,t[14]=(a+o)*u,t[15]=1,t},t.parseGlyphPBF=function(t){return new Ys(t).readFields(ml,[])},t.pbf=Ys,t.performSymbolLayout=function(t,e,i,r,n,o,a){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,l=t.layers[0]._unevaluatedLayout._values,u={};if("composite"===t.textSizeData.kind){var c=t.textSizeData,h=c.maxZoom;u.compositeTextSizes=[l["text-size"].possiblyEvaluate(new sn(c.minZoom),a),l["text-size"].possiblyEvaluate(new sn(h),a)]}if("composite"===t.iconSizeData.kind){var p=t.iconSizeData,d=p.maxZoom;u.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new sn(p.minZoom),a),l["icon-size"].possiblyEvaluate(new sn(d),a)]}u.layoutTextSize=l["text-size"].possiblyEvaluate(new sn(t.zoom+1),a),u.layoutIconSize=l["icon-size"].possiblyEvaluate(new sn(t.zoom+1),a),u.textMaxSize=l["text-size"].possiblyEvaluate(new sn(18));for(var f=24*s.get("text-line-height"),m="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),y=s.get("text-keep-upright"),_=s.get("text-size"),v=function(){var o=x[g],l=s.get("text-font").evaluate(o,{},a).join(","),c=_.evaluate(o,{},a),h=u.layoutTextSize.evaluate(o,{},a),p=u.layoutIconSize.evaluate(o,{},a),d={horizontal:{},vertical:void 0},v=o.text,b=[0,0];if(v){var w=v.toString(),I=24*s.get("text-letter-spacing").evaluate(o,{},a),S=function(t){for(var e=0,i=t;e<i.length;e+=1)if(r=i[e].charCodeAt(0),Gr.Arabic(r)||Gr["Arabic Supplement"](r)||Gr["Arabic Extended-A"](r)||Gr["Arabic Presentation Forms-A"](r)||Gr["Arabic Presentation Forms-B"](r))return!1;var r;return!0}(w)?I:0,T=s.get("text-anchor").evaluate(o,{},a),A=s.get("text-variable-anchor");if(!A){var P=s.get("text-radial-offset").evaluate(o,{},a);b=P?au(T,[24*P,ou]):s.get("text-offset").evaluate(o,{},a).map((function(t){return 24*t}))}var M=m?"center":s.get("text-justify").evaluate(o,{},a),C=s.get("symbol-placement"),z="point"===C?24*s.get("text-max-width").evaluate(o,{},a):0,k=function(){t.allowVerticalPlacement&&Zr(w)&&(d.vertical=Sl(v,e,i,n,l,z,f,T,"left",S,b,wl.vertical,!0,C,h,c))};if(!m&&A){for(var L="auto"===M?A.map((function(t){return su(t)})):[M],D=!1,R=0;R<L.length;R++){var B=L[R];if(!d.horizontal[B])if(D)d.horizontal[B]=d.horizontal[0];else{var F=Sl(v,e,i,n,l,z,f,"center",B,S,b,wl.horizontal,!1,C,h,c);F&&(d.horizontal[B]=F,D=1===F.positionedLines.length)}}k()}else{"auto"===M&&(M=su(T));var O=Sl(v,e,i,n,l,z,f,T,M,S,b,wl.horizontal,!1,C,h,c);O&&(d.horizontal[M]=O),k(),Zr(w)&&m&&y&&(d.vertical=Sl(v,e,i,n,l,z,f,T,M,S,b,wl.vertical,!1,C,h,c))}}var U,N,V,j,q,G,Z=void 0,W=!1;if(o.icon&&o.icon.name){var H=r[o.icon.name];H&&(U=n[o.icon.name],N=s.get("icon-offset").evaluate(o,{},a),V=s.get("icon-anchor").evaluate(o,{},a),j=Ll(V),q=N[0]-U.displaySize[0]*j.horizontalAlign,G=N[1]-U.displaySize[1]*j.verticalAlign,Z={image:U,top:G,bottom:G+U.displaySize[1],left:q,right:q+U.displaySize[0]},W=H.sdf,void 0===t.sdfIcons?t.sdfIcons=H.sdf:t.sdfIcons!==H.sdf&&E("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(H.pixelRatio!==t.pixelRatio||0!==s.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}var X=uu(d.horizontal)||d.vertical;t.iconsInText=!!X&&X.iconsInText,(X||Z)&&function(t,e,i,r,n,o,a,s,l,u,c){var h=o.textMaxSize.evaluate(e,{});void 0===h&&(h=a);var p,d=t.layers[0].layout,f=d.get("icon-offset").evaluate(e,{},c),m=uu(i.horizontal),y=a/24,_=t.tilePixelRatio*y,v=t.tilePixelRatio*h/24,g=t.tilePixelRatio*s,x=t.tilePixelRatio*d.get("symbol-spacing"),b=d.get("text-padding")*t.tilePixelRatio,w=d.get("icon-padding")*t.tilePixelRatio,I=d.get("text-max-angle")/180*Math.PI,S="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),T="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),A=d.get("symbol-placement"),P=x/2,M=d.get("icon-text-fit");r&&"none"!==M&&(t.allowVerticalPlacement&&i.vertical&&(p=Rl(r,i.vertical,M,d.get("icon-text-fit-padding"),f,y)),m&&(r=Rl(r,m,M,d.get("icon-text-fit-padding"),f,y)));var C=function(s,h){h.x<0||h.x>=8192||h.y<0||h.y>=8192||function(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m,y,_,v,g,x,b,w,I,S){var T,A,P,M,C,z=t.addToLineVertexArray(e,i),k=0,L=0,D=0,R=0,B=-1,F=-1,O={},U=po(""),N=0,V=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(N=(T=s.layout.get("text-offset").evaluate(x,{},I).map((function(t){return 24*t})))[0],V=T[1]):(N=24*s.layout.get("text-radial-offset").evaluate(x,{},I),V=ou),t.allowVerticalPlacement&&r.vertical){var j=s.layout.get("text-rotate").evaluate(x,{},I)+90;M=new $l(l,e,u,c,h,r.vertical,p,d,f,j),a&&(C=new $l(l,e,u,c,h,a,y,_,f,j))}if(n){var q=s.layout.get("icon-rotate").evaluate(x,{}),G="none"!==s.layout.get("icon-text-fit"),Z=Xl(n,q,w,G),W=a?Xl(a,q,w,G):void 0;P=new $l(l,e,u,c,h,n,y,_,!1,q),k=4*Z.length;var H=t.iconSizeData,X=null;"source"===H.kind?(X=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&E(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===H.kind&&((X=[128*b.compositeIconSizes[0].evaluate(x,{},I),128*b.compositeIconSizes[1].evaluate(x,{},I)])[0]>32640||X[1]>32640)&&E(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,Z,X,g,v,x,!1,e,z.lineStartIndex,z.lineLength,-1,I),B=t.icon.placedSymbolArray.length-1,W&&(L=4*W.length,t.addSymbols(t.icon,W,X,g,v,x,wl.vertical,e,z.lineStartIndex,z.lineLength,-1,I),F=t.icon.placedSymbolArray.length-1)}for(var K in r.horizontal){var J=r.horizontal[K];if(!A){U=po(J.text);var Y=s.layout.get("text-rotate").evaluate(x,{},I);A=new $l(l,e,u,c,h,J,p,d,f,Y)}var Q=1===J.positionedLines.length;if(D+=lu(t,e,J,o,s,f,x,m,z,r.vertical?wl.horizontal:wl.horizontalOnly,Q?Object.keys(r.horizontal):[K],O,B,b,I),Q)break}r.vertical&&(R+=lu(t,e,r.vertical,o,s,f,x,m,z,wl.vertical,["vertical"],O,F,b,I));var $=A?A.boxStartIndex:t.collisionBoxArray.length,tt=A?A.boxEndIndex:t.collisionBoxArray.length,et=M?M.boxStartIndex:t.collisionBoxArray.length,it=M?M.boxEndIndex:t.collisionBoxArray.length,rt=P?P.boxStartIndex:t.collisionBoxArray.length,nt=P?P.boxEndIndex:t.collisionBoxArray.length,ot=C?C.boxStartIndex:t.collisionBoxArray.length,at=C?C.boxEndIndex:t.collisionBoxArray.length,st=-1,lt=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=lt(A,st),st=lt(M,st),st=lt(P,st);var ut=(st=lt(C,st))>-1?1:0;ut&&(st*=S/24),t.glyphOffsetArray.length>=vu.MAX_GLYPHS&&E("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,B,F,U,$,tt,et,it,rt,nt,ot,at,u,D,R,k,L,ut,0,p,N,V,st)}(t,h,s,i,r,n,p,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,_,b,S,l,g,w,T,f,e,o,u,c,a)};if("line"===A)for(var z=0,k=Hl(e.geometry,0,0,8192,8192);z<k.length;z+=1)for(var L=k[z],D=0,R=Wl(L,x,I,i.vertical||m,r,24,v,t.overscaling,8192);D<R.length;D+=1){var B=R[D];m&&cu(t,m.text,P,B)||C(L,B)}else if("line-center"===A)for(var F=0,O=e.geometry;F<O.length;F+=1){var U=O[F];if(U.length>1){var N=Zl(U,I,i.vertical||m,r,24,v);N&&C(U,N)}}else if("Polygon"===e.type)for(var V=0,j=ns(e.geometry,0);V<j.length;V+=1){var q=j[V],G=iu(q,16);C(q[0],new Bl(G.x,G.y,0))}else if("LineString"===e.type)for(var Z=0,W=e.geometry;Z<W.length;Z+=1){var H=W[Z];C(H,new Bl(H[0].x,H[0].y,0))}else if("Point"===e.type)for(var X=0,K=e.geometry;X<K.length;X+=1)for(var J=0,Y=K[X];J<Y.length;J+=1){var Q=Y[J];C([Q],new Bl(Q.x,Q.y,0))}}(t,o,d,Z,r,u,h,p,b,W,a)},g=0,x=t.features;g<x.length;g+=1)v();o&&t.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,r,n){var o,a=1/Math.tan(e/2);return t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+r)*(o=1/(r-n)),t[14]=2*n*r*o):(t[10]=-1,t[14]=-2*r),t},t.pick=function(t,e){for(var i={},r=0;r<e.length;r++){var n=e[r];n in t&&(i[n]=t[n])}return i},t.plugin=an,t.polygonIntersectsPolygon=Go,t.postMapLoadEvent=at,t.postTurnstileEvent=nt,t.potpack=vl,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=Fr,t.registerForPluginStateChange=function(t){return t({pluginStatus:Qr,pluginURL:$r}),rn.on("pluginStateChange",t),t},t.renderColorRamp=wa,t.rotate=function(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);return t[0]=r*l+o*s,t[1]=n*l+a*s,t[2]=r*-s+o*l,t[3]=n*-s+a*l,t},t.rotateX=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+u*r,t[5]=a*n+c*r,t[6]=s*n+h*r,t[7]=l*n+p*r,t[8]=u*n-o*r,t[9]=c*n-a*r,t[10]=h*n-s*r,t[11]=p*n-l*r,t},t.rotateZ=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(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[0]=o*n+u*r,t[1]=a*n+c*r,t[2]=s*n+h*r,t[3]=l*n+p*r,t[4]=u*n-o*r,t[5]=c*n-a*r,t[6]=h*n-s*r,t[7]=p*n-l*r,t},t.scale=function(t,e,i){var r=i[0],n=i[1],o=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},t.scale$2=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},t.setCacheLimits=function(t,e){st=t,lt=e},t.setRTLTextPlugin=function(t,e,i){if(void 0===i&&(i=!1),"deferred"===Qr||"loading"===Qr||"loaded"===Qr)throw new Error("setRTLTextPlugin cannot be called multiple times.");$r=O.resolveURL(t),Qr="deferred",Yr=e,en(),i||on()},t.sphericalToCartesian=function(t){var e=t[0],i=t[1],r=t[2];return i+=90,i*=Math.PI/180,r*=Math.PI/180,{x:e*Math.cos(i)*Math.sin(r),y:e*Math.sin(i)*Math.sin(r),z:e*Math.cos(r)}},t.sqrLen=function(t){var e=t[0],i=t[1];return e*e+i*i},t.styleSpec=Mt,t.sub=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t},t.symbolSize=Nl,t.transformMat3=function(t,e,i){var r=e[0],n=e[1],o=e[2];return t[0]=r*i[0]+n*i[3]+o*i[6],t[1]=r*i[1]+n*i[4]+o*i[7],t[2]=r*i[2]+n*i[5]+o*i[8],t},t.transformMat4=pa,t.translate=function(t,e,i){var r,n,o,a,s,l,u,c,h,p,d,f,m=i[0],y=i[1],_=i[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*_+e[12],t[13]=e[1]*m+e[5]*y+e[9]*_+e[13],t[14]=e[2]*m+e[6]*y+e[10]*_+e[14],t[15]=e[3]*m+e[7]*y+e[11]*_+e[15]):(n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=r=e[0],t[1]=n,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=r*m+s*y+h*_+e[12],t[13]=n*m+l*y+p*_+e[13],t[14]=o*m+u*y+d*_+e[14],t[15]=a*m+c*y+f*_+e[15]),t},t.triggerPluginCompletionEvent=tn,t.uniqueId=f,t.validateCustomStyleLayer=function(t){var e=[],i=t.id;return void 0===i&&e.push({message:"layers."+i+': missing required property "id"'}),void 0===t.render&&e.push({message:"layers."+i+': missing required method "render"'}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers."+i+': property "renderingMode" must be either "2d" or "3d"'}),e},t.validateLight=Pr,t.validateStyle=Ar,t.values=function(t){var e=[];for(var i in t)e.push(t[i]);return e},t.vectorTile=bs,t.version="1.13.3",t.warnOnce=E,t.webpSupported=N,t.window=a,t.wrap=h})),r(["./shared"],(function(t){function e(t){var i=typeof t;if("number"===i||"boolean"===i||"string"===i||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var r="[",n=0,o=t;n<o.length;n+=1)r+=e(o[n])+",";return r+"]"}for(var a=Object.keys(t).sort(),s="{",l=0;l<a.length;l++)s+=JSON.stringify(a[l])+":"+e(t[a[l]])+",";return s+"}"}function i(i){for(var r="",n=0,o=t.refProperties;n<o.length;n+=1)r+="/"+e(i[o[n]]);return r}var r=function(t){this.keyCache={},t&&this.replace(t)};r.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},r.prototype.update=function(e,r){for(var n=this,o=0,a=e;o<a.length;o+=1){var s=a[o];this._layerConfigs[s.id]=s;var l=this._layers[s.id]=t.createStyleLayer(s);l._featureFilter=t.featureFilter(l.filter),this.keyCache[s.id]&&delete this.keyCache[s.id]}for(var u=0,c=r;u<c.length;u+=1){var h=c[u];delete this.keyCache[h],delete this._layerConfigs[h],delete this._layers[h]}this.familiesBySource={};for(var p=0,d=function(t,e){for(var r={},n=0;n<t.length;n++){var o=e&&e[t[n].id]||i(t[n]);e&&(e[t[n].id]=o);var a=r[o];a||(a=r[o]=[]),a.push(t[n])}var s=[];for(var l in r)s.push(r[l]);return s}(t.values(this._layerConfigs),this.keyCache);p<d.length;p+=1){var f=d[p].map((function(t){return n._layers[t.id]})),m=f[0];if("none"!==m.visibility){var y=m.source||"",_=this.familiesBySource[y];_||(_=this.familiesBySource[y]={});var v=m.sourceLayer||"_geojsonTileLayer",g=_[v];g||(g=_[v]=[]),g.push(f)}}};var n=function(e){var i={},r=[];for(var n in e){var o=e[n],a=i[n]={};for(var s in o){var l=o[+s];if(l&&0!==l.bitmap.width&&0!==l.bitmap.height){var u={x:0,y:0,w:l.bitmap.width+2,h:l.bitmap.height+2};r.push(u),a[s]={rect:u,metrics:l.metrics}}}}var c=t.potpack(r),h=new t.AlphaImage({width:c.w||1,height:c.h||1});for(var p in e){var d=e[p];for(var f in d){var m=d[+f];if(m&&0!==m.bitmap.width&&0!==m.bitmap.height){var y=i[p][f].rect;t.AlphaImage.copy(m.bitmap,h,{x:0,y:0},{x:y.x+1,y:y.y+1},m.bitmap)}}}this.image=h,this.positions=i};t.register("GlyphAtlas",n);var o=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId};function a(e,i,r){for(var n=new t.EvaluationParameters(i),o=0,a=e;o<a.length;o+=1)a[o].recalculate(n,r)}function s(e,i){var r=t.getArrayBuffer(e.request,(function(e,r,n,o){e?i(e):r&&i(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(r)),rawData:r,cacheControl:n,expires:o})}));return function(){r.cancel(),i()}}o.prototype.parse=function(e,i,r,o,s){var l=this;this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;var u=new t.DictionaryCoder(Object.keys(e.layers).sort()),c=new t.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];var h,p,d,f,m={},y={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},_=i.familiesBySource[this.source];for(var v in _){var g=e.layers[v];if(g){1===g.version&&t.warnOnce('Vector tile source "'+this.source+'" layer "'+v+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var x=u.encode(v),b=[],w=0;w<g.length;w++){var E=g.feature(w),I=c.getId(E,v);b.push({feature:E,id:I,index:w,sourceLayerIndex:x})}for(var S=0,T=_[v];S<T.length;S+=1){var A=T[S],P=A[0];P.minzoom&&this.zoom<Math.floor(P.minzoom)||P.maxzoom&&this.zoom>=P.maxzoom||"none"!==P.visibility&&(a(A,this.zoom,r),(m[P.id]=P.createBucket({index:c.bucketLayerIDs.length,layers:A,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,y,this.tileID.canonical),c.bucketLayerIDs.push(A.map((function(t){return t.id}))))}}}var M=t.mapObject(y.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(M).length?o.send("getGlyphs",{uid:this.uid,stacks:M},(function(t,e){h||(h=t,p=e,k.call(l))})):p={};var C=Object.keys(y.iconDependencies);C.length?o.send("getImages",{icons:C,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){h||(h=t,d=e,k.call(l))})):d={};var z=Object.keys(y.patternDependencies);function k(){if(h)return s(h);if(p&&d&&f){var e=new n(p),i=new t.ImageAtlas(d,f);for(var o in m){var l=m[o];l instanceof t.SymbolBucket?(a(l.layers,this.zoom,r),t.performSymbolLayout(l,p,e.positions,d,i.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):l.hasPattern&&(l instanceof t.LineBucket||l instanceof t.FillBucket||l instanceof t.FillExtrusionBucket)&&(a(l.layers,this.zoom,r),l.addFeatures(y,this.tileID.canonical,i.patternPositions))}this.status="done",s(null,{buckets:t.values(m).filter((function(t){return!t.isEmpty()})),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:i,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?e.positions:null})}}z.length?o.send("getImages",{icons:z,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){h||(h=t,f=e,k.call(l))})):f={},k.call(this)};var l=function(t,e,i,r){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=r||s,this.loading={},this.loaded={}};l.prototype.loadTile=function(e,i){var r=this,n=e.uid;this.loading||(this.loading={});var a=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[n]=new o(e);s.abort=this.loadVectorData(e,(function(e,o){if(delete r.loading[n],e||!o)return s.status="done",r.loaded[n]=s,i(e);var l=o.rawData,u={};o.expires&&(u.expires=o.expires),o.cacheControl&&(u.cacheControl=o.cacheControl);var c={};if(a){var h=a.finish();h&&(c.resourceTiming=JSON.parse(JSON.stringify(h)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,r.layerIndex,r.availableImages,r.actor,(function(e,r){if(e||!r)return i(e);i(null,t.extend({rawTileData:l.slice(0)},r,u,c))})),r.loaded=r.loaded||{},r.loaded[n]=s}))},l.prototype.reloadTile=function(t,e){var i=this,r=this.loaded,n=t.uid,o=this;if(r&&r[n]){var a=r[n];a.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,r){var n=a.reloadCallback;n&&(delete a.reloadCallback,a.parse(a.vectorTile,o.layerIndex,i.availableImages,o.actor,n)),e(t,r)};"parsing"===a.status?a.reloadCallback=s:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},l.prototype.abortTile=function(t,e){var i=this.loading,r=t.uid;i&&i[r]&&i[r].abort&&(i[r].abort(),delete i[r]),e()},l.prototype.removeTile=function(t,e){var i=this.loaded,r=t.uid;i&&i[r]&&delete i[r],e()};var u=t.window.ImageBitmap,c=function(){this.loaded={}};function h(t,e){if(0!==t.length){p(t[0],e);for(var i=1;i<t.length;i++)p(t[i],!e)}}function p(t,e){for(var i=0,r=0,n=0,o=t.length,a=o-1;n<o;a=n++){var s=(t[n][0]-t[a][0])*(t[a][1]+t[n][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!e&&t.reverse()}c.prototype.loadTile=function(e,i){var r=e.uid,n=e.encoding,o=e.rawImageData,a=u&&o instanceof u?this.getImageData(o):o,s=new t.DEMData(r,a,n);this.loaded=this.loaded||{},this.loaded[r]=s,i(null,s)},c.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var i=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)},c.prototype.removeTile=function(t){var e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]};var d=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,f=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};f.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],i=0,r=this._feature.geometry;i<r.length;i+=1){var n=r[i];e.push([new t.Point$1(n[0],n[1])])}return e}for(var o=[],a=0,s=this._feature.geometry;a<s.length;a+=1){for(var l=[],u=0,c=s[a];u<c.length;u+=1){var h=c[u];l.push(new t.Point$1(h[0],h[1]))}o.push(l)}return o},f.prototype.toGeoJSON=function(t,e,i){return d.call(this,t,e,i)};var m=function(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e};m.prototype.feature=function(t){return new f(this._features[t])};var y=t.vectorTile.VectorTileFeature,_=v;function v(t,e){this.options=e||{},this.features=t,this.length=t.length}function g(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}v.prototype.feature=function(t){return new g(this.features[t],this.options.extent)},g.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var i=0;i<e.length;i++){for(var r=e[i],n=[],o=0;o<r.length;o++)n.push(new t.Point$1(r[o][0],r[o][1]));this.geometry.push(n)}return this.geometry},g.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,n=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[e,r,i,n]},g.prototype.toGeoJSON=y.prototype.toGeoJSON;var x=w,b=_;function w(e){var i=new t.pbf;return function(t,e){for(var i in t.layers)e.writeMessage(3,E,t.layers[i])}(e,i),i.finish()}function E(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,I,r);var n=r.keys;for(i=0;i<n.length;i++)e.writeStringField(3,n[i]);var o=r.values;for(i=0;i<o.length;i++)e.writeMessage(4,M,o[i])}function I(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,S,t),e.writeVarintField(3,i.type),e.writeMessage(4,P,i)}function S(t,e){var i=t.feature,r=t.keys,n=t.values,o=t.keycache,a=t.valuecache;for(var s in i.properties){var l=o[s];void 0===l&&(r.push(s),o[s]=l=r.length-1),e.writeVarint(l);var u=i.properties[s],c=typeof u;"string"!==c&&"boolean"!==c&&"number"!==c&&(u=JSON.stringify(u));var h=c+":"+u,p=a[h];void 0===p&&(n.push(u),a[h]=p=n.length-1),e.writeVarint(p)}}function T(t,e){return(e<<3)+(7&t)}function A(t){return t<<1^t>>31}function P(t,e){for(var i=t.loadGeometry(),r=t.type,n=0,o=0,a=i.length,s=0;s<a;s++){var l=i[s],u=1;1===r&&(u=l.length),e.writeVarint(T(1,u));for(var c=3===r?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==r&&e.writeVarint(T(2,c-1));var p=l[h].x-n,d=l[h].y-o;e.writeVarint(A(p)),e.writeVarint(A(d)),n+=p,o+=d}3===r&&e.writeVarint(T(7,1))}}function M(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function C(t,e,i,r){z(t,i,r),z(e,2*i,2*r),z(e,2*i+1,2*r+1)}function z(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function k(t,e,i,r){var n=t-i,o=e-r;return n*n+o*o}x.fromVectorTileJs=w,x.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var r in t)i[r]=new _(t[r].features,e),i[r].name=r,i[r].version=e.version,i[r].extent=e.extent;return w({layers:i})},x.GeoJSONWrapper=b;var L=function(t){return t[0]},D=function(t){return t[1]},R=function(t,e,i,r,n){void 0===e&&(e=L),void 0===i&&(i=D),void 0===r&&(r=64),void 0===n&&(n=Float64Array),this.nodeSize=r,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new n(2*t.length),l=0;l<t.length;l++)a[l]=l,s[2*l]=e(t[l]),s[2*l+1]=i(t[l]);!function t(e,i,r,n,o,a){if(!(o-n<=r)){var s=n+o>>1;!function t(e,i,r,n,o,a){for(;o>n;){if(o-n>600){var s=o-n+1,l=r-n+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,i,r,Math.max(n,Math.floor(r-l*c/s+h)),Math.min(o,Math.floor(r+(s-l)*c/s+h)),a)}var p=i[2*r+a],d=n,f=o;for(C(e,i,n,r),i[2*o+a]>p&&C(e,i,n,o);d<f;){for(C(e,i,d,f),d++,f--;i[2*d+a]<p;)d++;for(;i[2*f+a]>p;)f--}i[2*n+a]===p?C(e,i,n,f):C(e,i,++f,o),f<=r&&(n=f+1),r<=f&&(o=f-1)}}(e,i,s,n,o,a%2),t(e,i,r,n,s-1,a+1),t(e,i,r,s+1,o,a+1)}}(a,s,r,0,a.length-1,0)};R.prototype.range=function(t,e,i,r){return function(t,e,i,r,n,o,a){for(var s,l,u=[0,t.length-1,0],c=[];u.length;){var h=u.pop(),p=u.pop(),d=u.pop();if(p-d<=a)for(var f=d;f<=p;f++)l=e[2*f+1],(s=e[2*f])>=i&&s<=n&&l>=r&&l<=o&&c.push(t[f]);else{var m=Math.floor((d+p)/2);l=e[2*m+1],(s=e[2*m])>=i&&s<=n&&l>=r&&l<=o&&c.push(t[m]);var y=(h+1)%2;(0===h?i<=s:r<=l)&&(u.push(d),u.push(m-1),u.push(y)),(0===h?n>=s:o>=l)&&(u.push(m+1),u.push(p),u.push(y))}}return c}(this.ids,this.coords,t,e,i,r,this.nodeSize)},R.prototype.within=function(t,e,i){return function(t,e,i,r,n,o){for(var a=[0,t.length-1,0],s=[],l=n*n;a.length;){var u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o)for(var p=h;p<=c;p++)k(e[2*p],e[2*p+1],i,r)<=l&&s.push(t[p]);else{var d=Math.floor((h+c)/2),f=e[2*d],m=e[2*d+1];k(f,m,i,r)<=l&&s.push(t[d]);var y=(u+1)%2;(0===u?i-n<=f:r-n<=m)&&(a.push(h),a.push(d-1),a.push(y)),(0===u?i+n>=f:r+n>=m)&&(a.push(d+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,i,this.nodeSize)};var B={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},F=function(t){this.options=G(Object.create(B),t),this.trees=new Array(this.options.maxZoom+1)};function O(t,e,i,r,n){return{x:t,y:e,zoom:1/0,id:i,parentId:-1,numPoints:r,properties:n}}function U(t,e){var i=t.geometry.coordinates,r=i[1];return{x:j(i[0]),y:q(r),zoom:1/0,index:e,parentId:-1}}function N(t){return{type:"Feature",id:t.id,properties:V(t),geometry:{type:"Point",coordinates:[(r=t.x,360*(r-.5)),(e=t.y,i=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(i))/Math.PI-90)]}};var e,i,r}function V(t){var e=t.numPoints,i=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return G(G({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:i})}function j(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function G(t,e){for(var i in e)t[i]=e[i];return t}function Z(t){return t.x}function W(t){return t.y}function H(t,e,i,r,n,o){var a=n-i,s=o-r;if(0!==a||0!==s){var l=((t-i)*a+(e-r)*s)/(a*a+s*s);l>1?(i=n,r=o):l>0&&(i+=a*l,r+=s*l)}return(a=t-i)*a+(s=e-r)*s}function X(t,e,i,r){var n={id:void 0===t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)K(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<e.length;r++)K(t,e[r]);else if("MultiPolygon"===i)for(r=0;r<e.length;r++)for(var n=0;n<e[r].length;n++)K(t,e[r][n])}(n),n}function K(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function J(t,e,i,r){if(e.geometry){var n=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)Y(n,s);else if("MultiPoint"===o)for(var u=0;u<n.length;u++)Y(n[u],s);else if("LineString"===o)Q(n,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(u=0;u<n.length;u++)Q(n[u],s=[],a,!1),t.push(X(l,"LineString",s,e.properties));return}$(n,s,a,!1)}else if("Polygon"===o)$(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<e.geometry.geometries.length;u++)J(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<n.length;u++){var c=[];$(n[u],c,a,!0),s.push(c)}}t.push(X(l,o,s,e.properties))}}function Y(t,e){e.push(tt(t[0])),e.push(et(t[1])),e.push(0)}function Q(t,e,i,r){for(var n,o,a=0,s=0;s<t.length;s++){var l=tt(t[s][0]),u=et(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(a+=r?(n*u-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-o,2))),n=l,o=u}var c=e.length-3;e[2]=1,function t(e,i,r,n){for(var o,a=n,s=r-i>>1,l=r-i,u=e[i],c=e[i+1],h=e[r],p=e[r+1],d=i+3;d<r;d+=3){var f=H(e[d],e[d+1],u,c,h,p);if(f>a)o=d,a=f;else if(f===a){var m=Math.abs(d-s);m<l&&(o=d,l=m)}}a>n&&(o-i>3&&t(e,i,o,n),e[o+2]=a,r-o>3&&t(e,o,r,n))}(e,0,c,i),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function $(t,e,i,r){for(var n=0;n<t.length;n++){var o=[];Q(t[n],o,i,r),e.push(o)}}function tt(t){return t/360+.5}function et(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function it(t,e,i,r,n,o,a,s){if(r/=e,o>=(i/=e)&&a<r)return t;if(a<i||o>=r)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,d=0===n?c.minX:c.minY,f=0===n?c.maxX:c.maxY;if(d>=i&&f<r)l.push(c);else if(!(f<i||d>=r)){var m=[];if("Point"===p||"MultiPoint"===p)rt(h,m,i,r,n);else if("LineString"===p)nt(h,m,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===p)at(h,m,i,r,n,!1);else if("Polygon"===p)at(h,m,i,r,n,!0);else if("MultiPolygon"===p)for(var y=0;y<h.length;y++){var _=[];at(h[y],_,i,r,n,!0),_.length&&m.push(_)}if(m.length){if(s.lineMetrics&&"LineString"===p){for(y=0;y<m.length;y++)l.push(X(c.id,p,m[y],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===m.length?(p="LineString",m=m[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===m.length?"Point":"MultiPoint"),l.push(X(c.id,p,m,c.tags))}}}return l.length?l:null}function rt(t,e,i,r,n){for(var o=0;o<t.length;o+=3){var a=t[o+n];a>=i&&a<=r&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function nt(t,e,i,r,n,o,a){for(var s,l,u=ot(t),c=0===n?lt:ut,h=t.start,p=0;p<t.length-3;p+=3){var d=t[p],f=t[p+1],m=t[p+2],y=t[p+3],_=t[p+4],v=0===n?d:f,g=0===n?y:_,x=!1;a&&(s=Math.sqrt(Math.pow(d-y,2)+Math.pow(f-_,2))),v<i?g>i&&(l=c(u,d,f,y,_,i),a&&(u.start=h+s*l)):v>r?g<r&&(l=c(u,d,f,y,_,r),a&&(u.start=h+s*l)):st(u,d,f,m),g<i&&v>=i&&(l=c(u,d,f,y,_,i),x=!0),g>r&&v<=r&&(l=c(u,d,f,y,_,r),x=!0),!o&&x&&(a&&(u.end=h+s*l),e.push(u),u=ot(t)),a&&(h+=s)}var b=t.length-3;d=t[b],f=t[b+1],m=t[b+2],(v=0===n?d:f)>=i&&v<=r&&st(u,d,f,m),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&st(u,u[0],u[1],u[2]),u.length&&e.push(u)}function ot(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function at(t,e,i,r,n,o){for(var a=0;a<t.length;a++)nt(t[a],e,i,r,n,o,!1)}function st(t,e,i,r){t.push(e),t.push(i),t.push(r)}function lt(t,e,i,r,n,o){var a=(o-e)/(r-e);return t.push(o),t.push(i+(n-i)*a),t.push(1),a}function ut(t,e,i,r,n,o){var a=(o-i)/(n-i);return t.push(e+(r-e)*a),t.push(o),t.push(1),a}function ct(t,e){for(var i=[],r=0;r<t.length;r++){var n,o=t[r],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)n=ht(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){n=[];for(var s=0;s<o.geometry.length;s++)n.push(ht(o.geometry[s],e))}else if("MultiPolygon"===a)for(n=[],s=0;s<o.geometry.length;s++){for(var l=[],u=0;u<o.geometry[s].length;u++)l.push(ht(o.geometry[s][u],e));n.push(l)}i.push(X(o.id,a,n,o.tags))}return i}function ht(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function pt(t,e){if(t.transformed)return t;var i,r,n,o=1<<t.z,a=t.x,s=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<u.length;r+=2)l.geometry.push(dt(u[r],u[r+1],e,o,a,s));else for(r=0;r<u.length;r++){var h=[];for(n=0;n<u[r].length;n+=2)h.push(dt(u[r][n],u[r][n+1],e,o,a,s));l.geometry.push(h)}}return t.transformed=!0,t}function dt(t,e,i,r,n,o){return[Math.round(i*(t*r-n)),Math.round(i*(e*r-o))]}function ft(t,e,i,r,n){for(var o=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,mt(a,t[s],o,n);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,h=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function mt(t,e,i,r){var n=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<n.length;s+=3)a.push(n[s]),a.push(n[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)yt(a,n,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<n.length;s++)yt(a,n[s],t,i,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var l=0;l<n.length;l++){var u=n[l];for(s=0;s<u.length;s++)yt(a,u[s],t,i,!0,0===s)}if(a.length){var c=e.tags||null;if("LineString"===o&&r.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=n.start/n.size,c.mapbox_clip_end=n.end/n.size}var p={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function yt(t,e,i,r,n,o){var a=r*r;if(r>0&&e.size<(n?a:r))i.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===r||e[l+2]>a)&&(i.numSimplified++,s.push(e[l]),s.push(e[l+1])),i.numPoints++;n&&function(t,e){for(var i=0,r=0,n=t.length,o=n-2;r<n;o=r,r+=2)i+=(t[r]-t[o])*(t[r+1]+t[o+1]);if(i>0===e)for(r=0,n=t.length;r<n/2;r+=2){var a=t[r],s=t[r+1];t[r]=t[n-2-r],t[r+1]=t[n-1-r],t[n-2-r]=a,t[n-1-r]=s}}(s,o),t.push(s)}}function _t(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var r,n,o,a,s,l,u=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)J(i,t.features[r],e,r);else J(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(r=u,n=e,o=n.buffer/n.extent,a=r,s=it(r,1,-1-o,o,0,-1,2,n),l=it(r,1,1-o,2+o,0,-1,2,n),(s||l)&&(a=it(r,1,-o,1+o,0,-1,2,n)||[],s&&(a=ct(s,1).concat(a)),l&&(a=a.concat(ct(l,-1)))),u=a).length&&this.splitTile(u,0,0,0),i&&(u.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function vt(t,e,i){return 32*((1<<t)*i+e)+t}function gt(t,e){var i=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return e(null,null);var n=new m(r.features),o=x(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:n,rawData:o.buffer})}F.prototype.load=function(t){var e=this.options,i=e.log,r=e.minZoom,n=e.maxZoom,o=e.nodeSize;i&&console.time("total time");var a="prepare "+t.length+" points";i&&console.time(a),this.points=t;for(var s=[],l=0;l<t.length;l++)t[l].geometry&&s.push(U(t[l],l));this.trees[n+1]=new R(s,Z,W,o,Float32Array),i&&console.timeEnd(a);for(var u=n;u>=r;u--){var c=+Date.now();s=this._cluster(s,u),this.trees[u]=new R(s,Z,W,o,Float32Array),i&&console.log("z%d: %d clusters in %dms",u,s.length,+Date.now()-c)}return i&&console.timeEnd("total time"),this},F.prototype.getClusters=function(t,e){var i=((t[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,t[1])),n=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,n=180;else if(i>n){var a=this.getClusters([i,r,180,o],e),s=this.getClusters([-180,r,n,o],e);return a.concat(s)}for(var l=this.trees[this._limitZoom(e)],u=[],c=0,h=l.range(j(i),q(o),j(n),q(r));c<h.length;c+=1){var p=l.points[h[c]];u.push(p.numPoints?N(p):this.points[p.index])}return u},F.prototype.getChildren=function(t){var e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);var o=n.points[e];if(!o)throw new Error(r);for(var a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=[],l=0,u=n.within(o.x,o.y,a);l<u.length;l+=1){var c=n.points[u[l]];c.parentId===t&&s.push(c.numPoints?N(c):this.points[c.index])}if(0===s.length)throw new Error(r);return s},F.prototype.getLeaves=function(t,e,i){var r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r},F.prototype.getTile=function(t,e,i){var r=this.trees[this._limitZoom(t)],n=Math.pow(2,t),o=this.options,a=o.radius/o.extent,s=(i-a)/n,l=(i+1+a)/n,u={features:[]};return this._addTileFeatures(r.range((e-a)/n,s,(e+1+a)/n,l),r.points,e,i,n,u),0===e&&this._addTileFeatures(r.range(1-a/n,s,1,l),r.points,n,i,n,u),e===n-1&&this._addTileFeatures(r.range(0,s,a/n,l),r.points,-1,i,n,u),u.features.length?u:null},F.prototype.getClusterExpansionZoom=function(t){for(var e=this._getOriginZoom(t)-1;e<=this.options.maxZoom;){var i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e},F.prototype._appendLeaves=function(t,e,i,r,n){for(var o=0,a=this.getChildren(e);o<a.length;o+=1){var s=a[o],l=s.properties;if(l&&l.cluster?n+l.point_count<=r?n+=l.point_count:n=this._appendLeaves(t,l.cluster_id,i,r,n):n<r?n++:t.push(s),t.length===i)break}return n},F.prototype._addTileFeatures=function(t,e,i,r,n,o){for(var a=0,s=t;a<s.length;a+=1){var l=e[s[a]],u=l.numPoints,c={type:1,geometry:[[Math.round(this.options.extent*(l.x*n-i)),Math.round(this.options.extent*(l.y*n-r))]],tags:u?V(l):this.points[l.index].properties},h=void 0;u?h=l.id:this.options.generateId?h=l.index:this.points[l.index].id&&(h=this.points[l.index].id),void 0!==h&&(c.id=h),o.features.push(c)}},F.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))},F.prototype._cluster=function(t,e){for(var i=[],r=this.options,n=r.reduce,o=r.minPoints,a=r.radius/(r.extent*Math.pow(2,e)),s=0;s<t.length;s++){var l=t[s];if(!(l.zoom<=e)){l.zoom=e;for(var u=this.trees[e+1],c=u.within(l.x,l.y,a),h=l.numPoints||1,p=h,d=0,f=c;d<f.length;d+=1){var m=u.points[f[d]];m.zoom>e&&(p+=m.numPoints||1)}if(p>=o){for(var y=l.x*h,_=l.y*h,v=n&&h>1?this._map(l,!0):null,g=(s<<5)+(e+1)+this.points.length,x=0,b=c;x<b.length;x+=1){var w=u.points[b[x]];if(!(w.zoom<=e)){w.zoom=e;var E=w.numPoints||1;y+=w.x*E,_+=w.y*E,w.parentId=g,n&&(v||(v=this._map(l,!0)),n(v,this._map(w)))}}l.parentId=g,i.push(O(y/p,_/p,g,p,v))}else if(i.push(l),p>1)for(var I=0,S=c;I<S.length;I+=1){var T=u.points[S[I]];T.zoom<=e||(T.zoom=e,i.push(T))}}}return i},F.prototype._getOriginId=function(t){return t-this.points.length>>5},F.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},F.prototype._map=function(t,e){if(t.numPoints)return e?G({},t.properties):t.properties;var i=this.points[t.index].properties,r=this.options.map(i);return e&&r===i?G({},r):r},_t.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},_t.prototype.splitTile=function(t,e,i,r,n,o,a){for(var s=[t,e,i,r],l=this.options,u=l.debug;s.length;){r=s.pop(),i=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,h=vt(e,i,r),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=ft(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,n){if(e===l.maxZoom||e===n)continue;var f=1<<n-e;if(i!==Math.floor(o/f)||r!==Math.floor(a/f))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var m,y,_,v,g,x,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,I=1+b;m=y=_=v=null,g=it(t,c,i-b,i+E,0,p.minX,p.maxX,l),x=it(t,c,i+w,i+I,0,p.minX,p.maxX,l),t=null,g&&(m=it(g,c,r-b,r+E,1,p.minY,p.maxY,l),y=it(g,c,r+w,r+I,1,p.minY,p.maxY,l),g=null),x&&(_=it(x,c,r-b,r+E,1,p.minY,p.maxY,l),v=it(x,c,r+w,r+I,1,p.minY,p.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*i,2*r),s.push(y||[],e+1,2*i,2*r+1),s.push(_||[],e+1,2*i+1,2*r),s.push(v||[],e+1,2*i+1,2*r+1)}}},_t.prototype.getTile=function(t,e,i){var r=this.options,n=r.extent,o=r.debug;if(t<0||t>24)return null;var a=1<<t,s=vt(t,e=(e%a+a)%a,i);if(this.tiles[s])return pt(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,u=t,c=e,h=i;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[vt(u,c,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,h),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[s]?pt(this.tiles[s],n):null):null};var xt=function(e){function i(t,i,r,n){e.call(this,t,i,r,gt),n&&(this.loadGeoJSON=n)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},i.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var i=this._pendingCallback,r=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var n=!!(r&&r.request&&r.request.collectResourceTiming)&&new t.RequestPerformance(r.request);this.loadGeoJSON(r,(function(o,a){if(o||!a)return i(o);if("object"!=typeof a)return i(new Error("Input data given to '"+r.source+"' is not a valid GeoJSON object."));!function t(e,i){var r,n=e&&e.type;if("FeatureCollection"===n)for(r=0;r<e.features.length;r++)t(e.features[r],i);else if("GeometryCollection"===n)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],i);else if("Feature"===n)t(e.geometry,i);else if("Polygon"===n)h(e.coordinates,i);else if("MultiPolygon"===n)for(r=0;r<e.coordinates.length;r++)h(e.coordinates[r],i);return e}(a,!0);try{if(r.filter){var s=t.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===s.result)throw new Error(s.value.map((function(t){return t.key+": "+t.message})).join(", "));var l=a.features.filter((function(t){return s.value.evaluate({zoom:0},t)}));a={type:"FeatureCollection",features:l}}e._geoJSONIndex=r.cluster?new F(function(e){var i=e.superclusterOptions,r=e.clusterProperties;if(!r||!i)return i;for(var n={},o={},a={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r),u=0,c=l;u<c.length;u+=1){var h=c[u],p=r[h],d=p[0],f=t.createExpression(p[1]),m=t.createExpression("string"==typeof d?[d,["accumulated"],["get",h]]:d);n[h]=f.value,o[h]=m.value}return i.map=function(t){s.properties=t;for(var e={},i=0,r=l;i<r.length;i+=1){var o=r[i];e[o]=n[o].evaluate(a,s)}return e},i.reduce=function(t,e){s.properties=e;for(var i=0,r=l;i<r.length;i+=1){var n=r[i];a.accumulated=t[n],t[n]=o[n].evaluate(a,s)}},i}(r)).load(a.features):(u=a,c=r.geojsonVtOptions,new _t(u,c))}catch(f){return i(f)}var u,c;e.loaded={};var p={};if(n){var d=n.finish();d&&(p.resourceTiming={},p.resourceTiming[r.source]=JSON.parse(JSON.stringify(d)))}i(null,p)}))}},i.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},i.prototype.reloadTile=function(t,i){var r=this.loaded;return r&&r[t.uid]?e.prototype.reloadTile.call(this,t,i):this.loadTile(t,i)},i.prototype.loadGeoJSON=function(e,i){if(e.request)t.getJSON(e.request,i);else{if("string"!=typeof e.data)return i(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));try{return i(null,JSON.parse(e.data))}catch(r){return i(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."))}}},i.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},i.prototype.getClusterExpansionZoom=function(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(i){e(i)}},i.prototype.getClusterChildren=function(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(i){e(i)}},i.prototype.getClusterLeaves=function(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(i){e(i)}},i}(l),bt=function(e){var i=this;this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:xt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(i.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');i.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}};return bt.prototype.setReferrer=function(t,e){this.referrer=e},bt.prototype.setImages=function(t,e,i){for(var r in this.availableImages[t]=e,this.workerSources[t]){var n=this.workerSources[t][r];for(var o in n)n[o].availableImages=e}i()},bt.prototype.setLayers=function(t,e,i){this.getLayerIndex(t).replace(e),i()},bt.prototype.updateLayers=function(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()},bt.prototype.loadTile=function(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)},bt.prototype.loadDEMTile=function(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)},bt.prototype.reloadTile=function(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)},bt.prototype.abortTile=function(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)},bt.prototype.removeTile=function(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)},bt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},bt.prototype.removeSource=function(t,e,i){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var r=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==r.removeSource?r.removeSource(e,i):i()}},bt.prototype.loadWorkerSource=function(t,e,i){try{this.self.importScripts(e.url),i()}catch(r){i(r.toString())}},bt.prototype.syncRTLPluginState=function(e,i,r){try{t.plugin.setState(i);var n=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=n){this.self.importScripts(n);var o=t.plugin.isParsed();r(o?void 0:new Error("RTL Text Plugin failed to import scripts from "+n),o)}}catch(a){r(a.toString())}},bt.prototype.getAvailableImages=function(t){var e=this.availableImages[t];return e||(e=[]),e},bt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new r),e},bt.prototype.getWorkerSource=function(t,e,i){var r=this;return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][i]||(this.workerSources[t][e][i]=new this.workerSourceTypes[e]({send:function(e,i,n){r.actor.send(e,i,n,t)}},this.getLayerIndex(t),this.getAvailableImages(t))),this.workerSources[t][e][i]},bt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new c),this.demWorkerSources[t][e]},bt.prototype.enforceCacheSizeLimit=function(e,i){t.enforceCacheSizeLimit(i)},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new bt(self)),bt})),r(["./shared"],(function(t){var e=t.createCommonjsModule((function(t){function e(t){return!i(t)}function i(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{e=new Worker(r),t=!0}catch(n){t=!1}return e&&e.terminate(),URL.revokeObjectURL(r),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===r[i=t&&t.failIfMajorPerformanceCaveat]&&(r[i]=function(t){var i,r,n,o=(i=t,r=document.createElement("canvas"),(n=Object.create(e.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.probablySupportsContext?r.probablySupportsContext("webgl",n)||r.probablySupportsContext("experimental-webgl",n):r.supportsContext?r.supportsContext("webgl",n)||r.supportsContext("experimental-webgl",n):r.getContext("webgl",n)||r.getContext("experimental-webgl",n));if(!o)return!1;var a=o.createShader(o.VERTEX_SHADER);return!(!a||o.isContextLost())&&(o.shaderSource(a,"void main() {}"),o.compileShader(a),!0===o.getShaderParameter(a,o.COMPILE_STATUS))}(i)),r[i]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var i}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e,window.mapboxgl.notSupportedReason=i);var r={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}})),i={create:function(e,i,r){var n=t.window.document.createElement(e);return void 0!==i&&(n.className=i),r&&r.appendChild(n),n},createNS:function(e,i){return t.window.document.createElementNS(e,i)}},r=t.window.document&&t.window.document.documentElement.style;function n(t){if(!r)return t[0];for(var e=0;e<t.length;e++)if(t[e]in r)return t[e];return t[0]}var o,a=n(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);i.disableDrag=function(){r&&a&&(o=r[a],r[a]="none")},i.enableDrag=function(){r&&a&&(r[a]=o)};var s=n(["transform","WebkitTransform"]);i.setTransform=function(t,e){t.style[s]=e};var l=!1;try{var u=Object.defineProperty({},"passive",{get:function(){l=!0}});t.window.addEventListener("test",u,u),t.window.removeEventListener("test",u,u)}catch(Jn){l=!1}i.addEventListener=function(t,e,i,r){void 0===r&&(r={}),t.addEventListener(e,i,"passive"in r&&l?r:r.capture)},i.removeEventListener=function(t,e,i,r){void 0===r&&(r={}),t.removeEventListener(e,i,"passive"in r&&l?r:r.capture)};var c=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",c,!0)};function h(t){var e=t.userImage;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}i.suppressClick=function(){t.window.addEventListener("click",c,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",c,!0)}),0)},i.mousePos=function(e,i){var r=e.getBoundingClientRect();return new t.Point(i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop)},i.touchPos=function(e,i){for(var r=e.getBoundingClientRect(),n=[],o=0;o<i.length;o++)n.push(new t.Point(i[o].clientX-r.left-e.clientLeft,i[o].clientY-r.top-e.clientTop));return n},i.mouseButton=function(e){return void 0!==t.window.InstallTrigger&&2===e.button&&e.ctrlKey&&t.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button},i.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var p=function(e){function i(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.isLoaded=function(){return this.loaded},i.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,i=this.requestors;e<i.length;e+=1){var r=i[e];this._notify(r.ids,r.callback)}this.requestors=[]}},i.prototype.getImage=function(t){return this.images[t]},i.prototype.addImage=function(t,e){this._validate(t,e)&&(this.images[t]=e)},i.prototype._validate=function(e,i){var r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchX" value'))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchY" value'))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "content" value'))),r=!1),r},i.prototype._validateStretch=function(t,e){if(!t)return!0;for(var i=0,r=0,n=t;r<n.length;r+=1){var o=n[r];if(o[0]<i||o[1]<o[0]||e<o[1])return!1;i=o[1]}return!0},i.prototype._validateContent=function(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))},i.prototype.updateImage=function(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0},i.prototype.removeImage=function(t){var e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()},i.prototype.listImages=function(){return Object.keys(this.images)},i.prototype.getImages=function(t,e){var i=!0;if(!this.isLoaded())for(var r=0,n=t;r<n.length;r+=1)this.images[n[r]]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})},i.prototype._notify=function(e,i){for(var r={},n=0,o=e;n<o.length;n+=1){var a=o[n];this.images[a]||this.fire(new t.Event("styleimagemissing",{id:a}));var s=this.images[a];s?r[a]={data:s.data.clone(),pixelRatio:s.pixelRatio,sdf:s.sdf,version:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,hasRenderCallback:Boolean(s.userImage&&s.userImage.render)}:t.warnOnce('Image "'+a+'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.')}i(null,r)},i.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},i.prototype.getPattern=function(e){var i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{var n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},o=new t.ImagePosition(n,r);this.patterns[e]={bin:n,position:o}}return this._updatePatternAtlas(),this.patterns[e].position},i.prototype.bind=function(e){var i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)},i.prototype._updatePatternAtlas=function(){var e=[];for(var i in this.patterns)e.push(this.patterns[i].bin);var r=t.potpack(e),n=r.w,o=r.h,a=this.atlasImage;for(var s in a.resize({width:n||1,height:o||1}),this.patterns){var l=this.patterns[s].bin,u=l.x+1,c=l.y+1,h=this.images[s].data,p=h.width,d=h.height;t.RGBAImage.copy(h,a,{x:0,y:0},{x:u,y:c},{width:p,height:d}),t.RGBAImage.copy(h,a,{x:0,y:d-1},{x:u,y:c-1},{width:p,height:1}),t.RGBAImage.copy(h,a,{x:0,y:0},{x:u,y:c+d},{width:p,height:1}),t.RGBAImage.copy(h,a,{x:p-1,y:0},{x:u-1,y:c},{width:1,height:d}),t.RGBAImage.copy(h,a,{x:0,y:0},{x:u+p,y:c},{width:1,height:d})}this.dirty=!0},i.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},i.prototype.dispatchRenderCallbacks=function(t){for(var e=0,i=t;e<i.length;e+=1){var r=i[e];if(!this.callbackDispatchedThisFrame[r]){this.callbackDispatchedThisFrame[r]=!0;var n=this.images[r];h(n)&&this.updateImage(r,n)}}},i}(t.Evented),d=y,f=y,m=1e20;function y(t,e,i,r,n,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=r||.25,this.fontFamily=n||"sans-serif",this.fontWeight=o||"normal",this.radius=i||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function _(t,e,i,r,n,o,a){for(var s=0;s<e;s++){for(var l=0;l<i;l++)r[l]=t[l*e+s];for(v(r,n,o,a,i),l=0;l<i;l++)t[l*e+s]=n[l]}for(l=0;l<i;l++){for(s=0;s<e;s++)r[s]=t[l*e+s];for(v(r,n,o,a,e),s=0;s<e;s++)t[l*e+s]=Math.sqrt(n[s])}}function v(t,e,i,r,n){i[0]=0,r[0]=-m,r[1]=+m;for(var o=1,a=0;o<n;o++){for(var s=(t[o]+o*o-(t[i[a]]+i[a]*i[a]))/(2*o-2*i[a]);s<=r[a];)a--,s=(t[o]+o*o-(t[i[a]]+i[a]*i[a]))/(2*o-2*i[a]);i[++a]=o,r[a]=s,r[a+1]=+m}for(o=0,a=0;o<n;o++){for(;r[a+1]<o;)a++;e[o]=(o-i[a])*(o-i[a])+t[i[a]]}}y.prototype.draw=function(t){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(t,this.buffer,this.middle);for(var e=this.ctx.getImageData(0,0,this.size,this.size),i=new Uint8ClampedArray(this.size*this.size),r=0;r<this.size*this.size;r++){var n=e.data[4*r+3]/255;this.gridOuter[r]=1===n?0:0===n?m:Math.pow(Math.max(0,.5-n),2),this.gridInner[r]=1===n?m:0===n?0:Math.pow(Math.max(0,n-.5),2)}for(_(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),_(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),r=0;r<this.size*this.size;r++)i[r]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[r]-this.gridInner[r])/this.radius+this.cutoff))));return i},d.default=f;var g=function(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}};g.prototype.setURL=function(t){this.url=t},g.prototype.getGlyphs=function(e,i){var r=this,n=[];for(var o in e)for(var a=0,s=e[o];a<s.length;a+=1)n.push({stack:o,id:s[a]});t.asyncAll(n,(function(t,e){var i=t.stack,n=t.id,o=r.entries[i];o||(o=r.entries[i]={glyphs:{},requests:{},ranges:{}});var a=o.glyphs[n];if(void 0===a){if(a=r._tinySDF(o,i,n))return o.glyphs[n]=a,void e(null,{stack:i,id:n,glyph:a});var s=Math.floor(n/256);if(256*s>65535)e(new Error("glyphs > 65535 not supported"));else if(o.ranges[s])e(null,{stack:i,id:n,glyph:a});else{var l=o.requests[s];l||(l=o.requests[s]=[],g.loadGlyphRange(i,s,r.url,r.requestManager,(function(t,e){if(e){for(var i in e)r._doesCharSupportLocalGlyph(+i)||(o.glyphs[+i]=e[+i]);o.ranges[s]=!0}for(var n=0,a=l;n<a.length;n+=1)(0,a[n])(t,e);delete o.requests[s]}))),l.push((function(t,r){t?e(t):r&&e(null,{stack:i,id:n,glyph:r[n]||null})}))}}else e(null,{stack:i,id:n,glyph:a})}),(function(t,e){if(t)i(t);else if(e){for(var r={},n=0,o=e;n<o.length;n+=1){var a=o[n],s=a.stack,l=a.id,u=a.glyph;(r[s]||(r[s]={}))[l]=u&&{id:u.id,bitmap:u.bitmap.clone(),metrics:u.metrics}}i(null,r)}}))},g.prototype._doesCharSupportLocalGlyph=function(e){return!!this.localIdeographFontFamily&&(t.isChar["CJK Unified Ideographs"](e)||t.isChar["Hangul Syllables"](e)||t.isChar.Hiragana(e)||t.isChar.Katakana(e))},g.prototype._tinySDF=function(e,i,r){var n=this.localIdeographFontFamily;if(n&&this._doesCharSupportLocalGlyph(r)){var o=e.tinySDF;if(!o){var a="400";/bold/i.test(i)?a="900":/medium/i.test(i)?a="500":/light/i.test(i)&&(a="200"),o=e.tinySDF=new g.TinySDF(24,3,8,.25,n,a)}return{id:r,bitmap:new t.AlphaImage({width:30,height:30},o.draw(String.fromCharCode(r))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},g.loadGlyphRange=function(e,i,r,n,o){var a=256*i,s=a+255,l=n.transformRequest(n.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",a+"-"+s),t.ResourceType.Glyphs);t.getArrayBuffer(l,(function(e,i){if(e)o(e);else if(i){for(var r={},n=0,a=t.parseGlyphPBF(i);n<a.length;n+=1){var s=a[n];r[s.id]=s}o(null,r)}}))},g.TinySDF=d;var x=function(){this.specification=t.styleSpec.light.position};x.prototype.possiblyEvaluate=function(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))},x.prototype.interpolate=function(e,i,r){return{x:t.number(e.x,i.x,r),y:t.number(e.y,i.y,r),z:t.number(e.z,i.z,r)}};var b=new t.Properties({anchor:new t.DataConstantProperty(t.styleSpec.light.anchor),position:new x,color:new t.DataConstantProperty(t.styleSpec.light.color),intensity:new t.DataConstantProperty(t.styleSpec.light.intensity)}),w=function(e){function i(i){e.call(this),this._transitionable=new t.Transitionable(b),this.setLight(i),this._transitioning=this._transitionable.untransitioned()}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.getLight=function(){return this._transitionable.serialize()},i.prototype.setLight=function(e,i){if(void 0===i&&(i={}),!this._validate(t.validateLight,e,i))for(var r in e){var n=e[r];t.endsWith(r,"-transition")?this._transitionable.setTransition(r.slice(0,-11),n):this._transitionable.setValue(r,n)}},i.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},i.prototype.hasTransition=function(){return this._transitioning.hasTransition()},i.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},i.prototype._validate=function(e,i,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.styleSpec})))},i}(t.Evented),E=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};E.prototype.getDash=function(t,e){var i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]},E.prototype.getDashRanges=function(t,e,i){var r=[],n=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,a=!0;r.push({left:n,right:o,isDash:a,zeroLength:0===t[0]});for(var s=t[0],l=1;l<t.length;l++){var u=t[l];r.push({left:n=s*i,right:o=(s+=u)*i,isDash:a=!a,zeroLength:0===u})}return r},E.prototype.addRoundDash=function(t,e,i){for(var r=e/2,n=-i;n<=i;n++)for(var o=this.width*(this.nextRow+i+n),a=0,s=t[a],l=0;l<this.width;l++){l/s.right>1&&(s=t[++a]);var u=Math.abs(l-s.left),c=Math.abs(l-s.right),h=Math.min(u,c),p=void 0,d=n/i*(r+1);if(s.isDash){var f=r-Math.abs(d);p=Math.sqrt(h*h+f*f)}else p=r-Math.sqrt(h*h+d*d);this.data[o+l]=Math.max(0,Math.min(255,p+128))}},E.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r&&r.isDash===i.isDash&&(r.left=i.left,t.splice(e,1))}var n=t[0],o=t[t.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);for(var a=this.width*this.nextRow,s=0,l=t[s],u=0;u<this.width;u++){u/l.right>1&&(l=t[++s]);var c=Math.abs(u-l.left),h=Math.abs(u-l.right),p=Math.min(c,h);this.data[a+u]=Math.max(0,Math.min(255,(l.isDash?p:-p)+128))}},E.prototype.addDash=function(e,i){var r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a<e.length;a++)o+=e[a];if(0!==o){var s=this.width/o,l=this.getDashRanges(e,this.width,s);i?this.addRoundDash(l,s,r):this.addRegularDash(l)}var u={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=n,this.dirty=!0,u},E.prototype.bind=function(t){var e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))};var I=function e(i,r){this.workerPool=i,this.actors=[],this.currentActor=0,this.id=t.uniqueId();for(var n=this.workerPool.acquire(this.id),o=0;o<n.length;o++){var a=new e.Actor(n[o],r,this.id);a.name="Worker "+o,this.actors.push(a)}};function S(e,i,r){var n=function(n,o){if(n)return r(n);if(o){var a=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map((function(t){return t.id}))),a.tiles=i.canonicalizeTileset(a,e.url),r(null,a)}};return e.url?t.getJSON(i.transformRequest(i.normalizeSourceURL(e.url),t.ResourceType.Source),n):t.browser.frame((function(){return n(null,e)}))}I.prototype.broadcast=function(e,i,r){t.asyncAll(this.actors,(function(t,r){t.send(e,i,r)}),r=r||function(){})},I.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},I.prototype.remove=function(){this.actors.forEach((function(t){t.remove()})),this.actors=[],this.workerPool.release(this.id)},I.Actor=t.Actor;var T=function(e,i,r){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=r||24};T.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},T.prototype.contains=function(e){var i=Math.pow(2,e.z),r=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),n=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=r&&e.x<o&&e.y>=n&&e.y<a};var A=function(e){function i(i,r,n,o){if(e.call(this),this.id=i,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(r,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=S(this._options,this.map._requestManager,(function(i,r){e._tileJSONRequest=null,e._loaded=!0,i?e.fire(new t.ErrorEvent(i)):r&&(t.extend(e,r),r.bounds&&(e.tileBounds=new T(r.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(r.tiles,e.map._requestManager._customAccessToken),t.postMapLoadEvent(r.tiles,e.map._getMapId(),e.map._requestManager._skuToken,e.map._requestManager._customAccessToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},i.prototype.loaded=function(){return this._loaded},i.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.setSourceProperty=function(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},i.prototype.setTiles=function(t){var e=this;return this.setSourceProperty((function(){e._options.tiles=t})),this},i.prototype.setUrl=function(t){var e=this;return this.setSourceProperty((function(){e.url=t,e._options.url=t})),this},i.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},i.prototype.serialize=function(){return t.extend({},this._options)},i.prototype.loadTile=function(e,i){var r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(r,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function o(r,n){return delete e.request,e.aborted?i(null):r&&404!==r.status?i(r):(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}n.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",n,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",n,o.bind(this)))},i.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)},i.prototype.unloadTile=function(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)},i.prototype.hasTransition=function(){return!1},i}(t.Evented),P=function(e){function i(i,r,n,o){e.call(this),this.id=i,this.dispatcher=n,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},r),t.extend(this,t.pick(r,["url","scheme","tileSize"]))}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=S(this._options,this.map._requestManager,(function(i,r){e._tileJSONRequest=null,e._loaded=!0,i?e.fire(new t.ErrorEvent(i)):r&&(t.extend(e,r),r.bounds&&(e.tileBounds=new T(r.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(r.tiles),t.postMapLoadEvent(r.tiles,e.map._getMapId(),e.map._requestManager._skuToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},i.prototype.loaded=function(){return this._loaded},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},i.prototype.serialize=function(){return t.extend({},this._options)},i.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},i.prototype.loadTile=function(e,i){var r=this,n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),(function(n,o){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(o){r.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=r.map.painter.context,s=a.gl;e.texture=r.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.Texture(a,o,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(r.dispatcher),i(null)}}))},i.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},i.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()},i.prototype.hasTransition=function(){return!1},i}(t.Evented),M=function(e){function i(i,r,n,o){e.call(this,i,r,n,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},i.prototype.loadTile=function(e,i){var r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function n(t,r){t&&(e.state="errored",i(t)),r&&(e.dem=r,e.needsHillshadePrepare=!0,e.state="loaded",i(null))}e.request=t.getImage(this.map._requestManager.transformRequest(r,t.ResourceType.Tile),function(r,o){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(r)e.state="errored",i(r);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap&&t.offscreenCanvasSupported()?o:t.browser.getImageData(o,1),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:a,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",s,n.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)},i.prototype._getNeighboringTiles=function(e){var i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?e.wrap-1:e.wrap,a=(i.x+1+r)%r,s=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l},i.prototype.unloadTile=function(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})},i}(P),C=function(e){function i(i,r,n,o){e.call(this),this.id=i,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(o),this._data=r.data,this._options=t.extend({},r),this._collectResourceTiming=r.collectResourceTiming,this._resourceTiming=[],void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*a,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?Math.min(r.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:t.EXTENT,radius:(r.clusterRadius||50)*a,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(i){if(i)e.fire(new t.ErrorEvent(i));else{var r={dataType:"source",sourceDataType:"metadata"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(r.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",r))}}))},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.setData=function(e){var i=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)i.fire(new t.ErrorEvent(e));else{var r={dataType:"source",sourceDataType:"content"};i._collectResourceTiming&&i._resourceTiming&&i._resourceTiming.length>0&&(r.resourceTiming=i._resourceTiming,i._resourceTiming=[]),i.fire(new t.Event("data",r))}})),this},i.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},i.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},i.prototype.getClusterLeaves=function(t,e,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},r),this},i.prototype._updateWorkerData=function(e){var i=this;this._loaded=!1;var r=t.extend({},this.workerOptions),n=this._data;"string"==typeof n?(r.request=this.map._requestManager.transformRequest(t.browser.resolveURL(n),t.ResourceType.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(n),this.actor.send(this.type+".loadData",r,(function(t,n){i._removed||n&&n.abandoned||(i._loaded=!0,n&&n.resourceTiming&&n.resourceTiming[i.id]&&(i._resourceTiming=n.resourceTiming[i.id].slice(0)),i.actor.send(i.type+".coalesce",{source:r.source},null),e(t))}))},i.prototype.loaded=function(){return this._loaded},i.prototype.loadTile=function(e,i){var r=this,n=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(n,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,o){return delete e.request,e.unloadVectorData(),e.aborted?i(null):t?i(t):(e.loadVectorData(o,r.map.painter,"reloadTile"===n),i(null))}))},i.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},i.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},i.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},i.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},i.prototype.hasTransition=function(){return!1},i}(t.Evented),z=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),k=function(e){function i(t,i,r,n){e.call(this),this.id=t,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=i}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(e,i){var r=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(n,o){r._loaded=!0,n?r.fire(new t.ErrorEvent(n)):o&&(r.image=o,e&&(r.coordinates=e),i&&i(),r._finishLoading())}))},i.prototype.loaded=function(){return this._loaded},i.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},i.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},i.prototype.onAdd=function(t){this.map=t,this.load()},i.prototype.setCoordinates=function(e){var i=this;this.coordinates=e;var r=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var i=1/0,r=1/0,n=-1/0,o=-1/0,a=0,s=e;a<s.length;a+=1){var l=s[a];i=Math.min(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.x),o=Math.max(o,l.y)}var u=Math.max(n-i,o-r),c=Math.max(0,Math.floor(-Math.log(u)/Math.LN2)),h=Math.pow(2,c);return new t.CanonicalTileID(c,Math.floor((i+n)/2*h),Math.floor((r+o)/2*h))}(r),this.minzoom=this.maxzoom=this.tileID.z;var n=r.map((function(t){return i.tileID.getTilePoint(t)._round()}));return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(n[2].x,n[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this},i.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,i=e.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this.tiles){var n=this.tiles[r];"loaded"!==n.state&&(n.state="loaded",n.texture=this.texture)}}},i.prototype.loadTile=function(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))},i.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},i.prototype.hasTransition=function(){return!1},i}(t.Evented),L=function(e){function i(t,i,r,n){e.call(this,t,i,r,n),this.roundZoom=!0,this.type="video",this.options=i}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){var e=this;this._loaded=!1;var i=this.options;this.urls=[];for(var r=0,n=i.urls;r<n.length;r+=1)this.urls.push(this.map._requestManager.transformRequest(n[r],t.ResourceType.Source).url);t.getVideo(this.urls,(function(i,r){e._loaded=!0,i?e.fire(new t.ErrorEvent(i)):r&&(e.video=r,e.video.loop=!0,e.video.setAttribute("playsinline",""),e.video.addEventListener("playing",(function(){e.map.triggerRepaint()})),e.map&&e.video.play(),e._finishLoading())}))},i.prototype.pause=function(){this.video&&this.video.pause()},i.prototype.play=function(){this.video&&this.video.play()},i.prototype.seek=function(e){if(this.video){var i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+i.start(0)+" and "+i.end(0)+"-second mark."))):this.video.currentTime=e}},i.prototype.getVideo=function(){return this.video},i.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},i.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,i=e.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this.tiles){var n=this.tiles[r];"loaded"!==n.state&&(n.state="loaded",n.texture=this.texture)}}},i.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this.video&&!this.video.paused},i}(k),D=function(e){function i(i,r,n,o){e.call(this,i,r,n,o),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},i.prototype.getCanvas=function(){return this.canvas},i.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},i.prototype.onRemove=function(){this.pause()},i.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var i=this.map.painter.context,r=i.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(i,this.canvas,r.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[n];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},i.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this._playing},i.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var i=e[t];if(isNaN(i)||i<=0)return!0}return!1},i}(k),R={vector:A,raster:P,"raster-dem":M,geojson:C,video:L,image:k,canvas:D};function B(e,i){var r=t.identity([]);return t.translate(r,r,[1,1,0]),t.scale(r,r,[.5*e.width,.5*e.height,1]),t.multiply(r,r,e.calculatePosMatrix(i.toUnwrapped()))}function F(t,e,i,r,n,o){var a=function(t,e,i){if(t)for(var r=0,n=t;r<n.length;r+=1){var o=e[n[r]];if(o&&o.source===i&&"fill-extrusion"===o.type)return!0}else for(var a in e){var s=e[a];if(s.source===i&&"fill-extrusion"===s.type)return!0}return!1}(n&&n.layers,e,t.id),s=o.maxPitchScaleFactor(),l=t.tilesIn(r,s,a);l.sort(O);for(var u=[],c=0,h=l;c<h.length;c+=1){var p=h[c];u.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(e,i,t._state,p.queryGeometry,p.cameraQueryGeometry,p.scale,n,o,s,B(t.transform,p.tileID))})}var d=function(t){for(var e={},i={},r=0,n=t;r<n.length;r+=1){var o=n[r],a=o.queryResults,s=o.wrappedTileID,l=i[s]=i[s]||{};for(var u in a)for(var c=a[u],h=l[u]=l[u]||{},p=e[u]=e[u]||[],d=0,f=c;d<f.length;d+=1){var m=f[d];h[m.featureIndex]||(h[m.featureIndex]=!0,p.push(m))}}return e}(u);for(var f in d)d[f].forEach((function(e){var i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}));return d}function O(t,e){var i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}var U=function(t,e){this.max=t,this.onRemove=e,this.reset()};U.prototype.reset=function(){for(var t in this.data)for(var e=0,i=this.data[t];e<i.length;e+=1){var r=i[e];r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value)}return this.data={},this.order=[],this},U.prototype.add=function(t,e,i){var r=this,n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);var o={value:e,timeout:void 0};if(void 0!==i&&(o.timeout=setTimeout((function(){r.remove(t,o)}),i)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},U.prototype.has=function(t){return t.wrapped().key in this.data},U.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},U.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},U.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},U.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},U.prototype.remove=function(t,e){if(!this.has(t))return this;var i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this},U.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},U.prototype.filter=function(t){var e=[];for(var i in this.data)for(var r=0,n=this.data[i];r<n.length;r+=1){var o=n[r];t(o.value)||e.push(o)}for(var a=0,s=e;a<s.length;a+=1){var l=s[a];this.remove(l.value.tileID,l)}};var N=function(t,e,i){this.context=t;var r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};N.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},N.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},N.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var V={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},j=function(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;var n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};j.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},j.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},j.prototype.enableAttributes=function(t,e){for(var i=0;i<this.attributes.length;i++){var r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}},j.prototype.setVertexAttribPointers=function(t,e,i){for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[V[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}},j.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var q=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};q.prototype.get=function(){return this.current},q.prototype.set=function(t){},q.prototype.getDefault=function(){return this.default},q.prototype.setDefault=function(){this.set(this.default)};var G=function(e){function i(){e.apply(this,arguments)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.getDefault=function(){return t.Color.transparent},i.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},i}(q),Z=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 1},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)},e}(q),W=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)},e}(q),H=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[!0,!0,!0,!0]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(q),X=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)},e}(q),K=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 255},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)},e}(q),J=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},e.prototype.set=function(t){var e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)},e}(q),Y=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)},e}(q),Q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}},e}(q),$=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[0,1]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)},e}(q),tt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},e}(q),et=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.LESS},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)},e}(q),it=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}},e}(q),rt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.ONE,t.ZERO]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)},e}(q),nt=function(e){function i(){e.apply(this,arguments)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.getDefault=function(){return t.Color.transparent},i.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},i}(q),ot=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.FUNC_ADD},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)},e}(q),at=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}},e}(q),st=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.BACK},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)},e}(q),lt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.CCW},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)},e}(q),ut=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)},e}(q),ct=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.TEXTURE0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)},e}(q),ht=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(q),pt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},e}(q),dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(q),ft=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}},e}(q),mt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},e}(q),yt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){var e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1},e}(q),_t=function(t){function e(e){t.call(this,e),this.vao=e.extVertexArrayObject}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)},e}(q),vt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 4},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},e}(q),gt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},e}(q),xt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},e}(q),bt=function(t){function e(e,i){t.call(this,e),this.context=e,this.parent=i}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e}(q),wt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.setDirty=function(){this.dirty=!0},e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e}(bt),Et=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(bt),It=function(t,e,i,r){this.context=t,this.width=e,this.height=i;var n=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new wt(t,n),r&&(this.depthAttachment=new Et(t,n))};It.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){var i=this.depthAttachment.get();i&&t.deleteRenderbuffer(i)}t.deleteFramebuffer(this.framebuffer)};var St=function(t,e,i){this.func=t,this.mask=e,this.range=i};St.ReadOnly=!1,St.ReadWrite=!0,St.disabled=new St(519,St.ReadOnly,[0,1]);var Tt=function(t,e,i,r,n,o){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o};Tt.disabled=new Tt({func:519,mask:0},0,0,7680,7680,7680);var At=function(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i};At.disabled=new At(At.Replace=[1,0],t.Color.transparent,[!1,!1,!1,!1]),At.unblended=new At(At.Replace,t.Color.transparent,[!0,!0,!0,!0]),At.alphaBlended=new At([1,771],t.Color.transparent,[!0,!0,!0,!0]);var Pt=function(t,e,i){this.enable=t,this.mode=e,this.frontFace=i};Pt.disabled=new Pt(!1,1029,2305),Pt.backCCW=new Pt(!0,1029,2305);var Mt=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new G(this),this.clearDepth=new Z(this),this.clearStencil=new W(this),this.colorMask=new H(this),this.depthMask=new X(this),this.stencilMask=new K(this),this.stencilFunc=new J(this),this.stencilOp=new Y(this),this.stencilTest=new Q(this),this.depthRange=new $(this),this.depthTest=new tt(this),this.depthFunc=new et(this),this.blend=new it(this),this.blendFunc=new rt(this),this.blendColor=new nt(this),this.blendEquation=new ot(this),this.cullFace=new at(this),this.cullFaceSide=new st(this),this.frontFace=new lt(this),this.program=new ut(this),this.activeTexture=new ct(this),this.viewport=new ht(this),this.bindFramebuffer=new pt(this),this.bindRenderbuffer=new dt(this),this.bindTexture=new ft(this),this.bindVertexBuffer=new mt(this),this.bindElementBuffer=new yt(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new _t(this),this.pixelStoreUnpack=new vt(this),this.pixelStoreUnpackPremultiplyAlpha=new gt(this),this.pixelStoreUnpackFlipY=new xt(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)};Mt.prototype.setDefault=function(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()},Mt.prototype.setDirty=function(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},Mt.prototype.createIndexBuffer=function(t,e){return new N(this,t,e)},Mt.prototype.createVertexBuffer=function(t,e,i){return new j(this,t,e,i)},Mt.prototype.createRenderbuffer=function(t,e,i){var r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n},Mt.prototype.createFramebuffer=function(t,e,i){return new It(this,t,e,i)},Mt.prototype.clear=function(t){var e=t.color,i=t.depth,r=this.gl,n=0;e&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),r.clear(n)},Mt.prototype.setCullFace=function(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))},Mt.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},Mt.prototype.setStencilMode=function(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},Mt.prototype.setColorMode=function(e){t.deepEqual(e.blendFunction,At.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},Mt.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Ct=function(e){function i(i,r,n){var o=this;e.call(this),this.id=i,this.dispatcher=n,this.on("data",(function(t){"source"===t.dataType&&"metadata"===t.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),this.on("error",(function(){o._sourceErrored=!0})),this._source=function(e,i,r,n){var o=new R[i.type](e,i,r,n);if(o.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+o.id);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(i,r,n,this),this._tiles={},this._cache=new U(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new t.SourceFeatureState}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)},i.prototype.onRemove=function(t){this._source&&this._source.onRemove&&this._source.onRemove(t)},i.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},i.prototype.getSource=function(){return this._source},i.prototype.pause=function(){this._paused=!0},i.prototype.resume=function(){if(this._paused){var t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}},i.prototype._loadTile=function(t,e){return this._source.loadTile(t,e)},i.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,(function(){}))},i.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,(function(){}))},i.prototype.serialize=function(){return this._source.serialize()},i.prototype.prepare=function(t){for(var e in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}},i.prototype.getIds=function(){return t.values(this._tiles).map((function(t){return t.tileID})).sort(zt).map((function(t){return t.key}))},i.prototype.getRenderableIds=function(e){var i=this,r=[];for(var n in this._tiles)this._isIdRenderable(n,e)&&r.push(this._tiles[n]);return e?r.sort((function(e,r){var n=e.tileID,o=r.tileID,a=new t.Point(n.canonical.x,n.canonical.y)._rotate(i.transform.angle),s=new t.Point(o.canonical.x,o.canonical.y)._rotate(i.transform.angle);return n.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x})).map((function(t){return t.tileID.key})):r.map((function(t){return t.tileID})).sort(zt).map((function(t){return t.key}))},i.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},i.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},i.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var t in this._cache.reset(),this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")},i.prototype._reloadTile=function(t,e){var i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))},i.prototype._tileLoaded=function(e,i,r,n){if(n)return e.state="errored",void(404!==n.status?this._source.fire(new t.ErrorEvent(n,{tile:e})):this.update(this.transform));e.timeAdded=t.browser.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))},i.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),i=0;i<e.length;i++){var r=e[i];if(t.neighboringTiles&&t.neighboringTiles[r]){var n=this.getTileByID(r);o(t,n),o(n,t)}}function o(t,e){t.needsHillshadePrepare=!0;var i=e.tileID.canonical.x-t.tileID.canonical.x,r=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},i.prototype.getTile=function(t){return this.getTileByID(t.key)},i.prototype.getTileByID=function(t){return this._tiles[t]},i.prototype._retainLoadedChildren=function(t,e,i,r){for(var n in this._tiles){var o=this._tiles[n];if(!(r[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)){for(var a=o.tileID;o&&o.tileID.overscaledZ>e+1;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[s.key])&&o.hasData()&&(a=s)}for(var l=a;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){r[a.key]=a;break}}}},i.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(var r=t.overscaledZ-1;r>=e;r--){var n=t.scaledTo(r),o=this._getLoadedTile(n);if(o)return o}},i.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},i.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,r=Math.floor(e*i*5),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},i.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var i={};for(var r in this._tiles){var n=this._tiles[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),i[n.tileID.key]=n}for(var o in this._tiles=i,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}},i.prototype.update=function(e){var r=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var n;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(n=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(n=n.filter((function(t){return r._source.hasTile(t)})))):n=[];var o=e.coveringZoomLevel(this._source),a=Math.max(o-i.maxOverzooming,this._source.minzoom),s=Math.max(o+i.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(n,o);if(kt(this._source.type)){for(var u={},c={},h=0,p=Object.keys(l);h<p.length;h+=1){var d=p[h],f=l[d],m=this._tiles[d];if(m&&!(m.fadeEndTime&&m.fadeEndTime<=t.browser.now())){var y=this.findLoadedParent(f,a);y&&(this._addTile(y.tileID),u[y.tileID.key]=y.tileID),c[d]=f}}for(var _ in this._retainLoadedChildren(c,o,s,l),u)l[_]||(this._coveredTiles[_]=!0,l[_]=u[_])}for(var v in l)this._tiles[v].clearFadeHold();for(var g=0,x=t.keysDifference(this._tiles,l);g<x.length;g+=1){var b=x[g],w=this._tiles[b];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}},i.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)},i.prototype._updateRetainedTiles=function(t,e){for(var r={},n={},o=Math.max(e-i.maxOverzooming,this._source.minzoom),a=Math.max(e+i.maxUnderzooming,this._source.minzoom),s={},l=0,u=t;l<u.length;l+=1){var c=u[l],h=this._addTile(c);r[c.key]=c,h.hasData()||e<this._source.maxzoom&&(s[c.key]=c)}this._retainLoadedChildren(s,e,a,r);for(var p=0,d=t;p<d.length;p+=1){var f=d[p],m=this._tiles[f.key];if(!m.hasData()){if(e+1>this._source.maxzoom){var y=f.children(this._source.maxzoom)[0],_=this.getTile(y);if(_&&_.hasData()){r[y.key]=y;continue}}else{var v=f.children(this._source.maxzoom);if(r[v[0].key]&&r[v[1].key]&&r[v[2].key]&&r[v[3].key])continue}for(var g=m.wasRequested(),x=f.overscaledZ-1;x>=o;--x){var b=f.scaledTo(x);if(n[b.key])break;if(n[b.key]=!0,!(m=this.getTile(b))&&g&&(m=this._addTile(b)),m&&(r[b.key]=b,g=m.wasRequested(),m.hasData()))break}}}return r},i.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],i=void 0,r=this._tiles[t].tileID;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);var n=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(n))break;r=n}for(var o=0,a=e;o<a.length;o+=1)this._loadedParentTiles[a[o]]=i}},i.prototype._addTile=function(e){var i=this._tiles[e.key];if(i)return i;(i=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));var r=Boolean(i);return r||(i=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i?(i.uses++,this._tiles[e.key]=i,r||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null},i.prototype._setTileReloadTimer=function(t,e){var i=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout((function(){i._reloadTile(t,"expired"),delete i._timers[t]}),r))},i.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},i.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},i.prototype.tilesIn=function(e,i,r){var n=this,o=[],a=this.transform;if(!a)return o;for(var s=r?a.getCameraQueryGeometry(e):e,l=e.map((function(t){return a.pointCoordinate(t)})),u=s.map((function(t){return a.pointCoordinate(t)})),c=this.getIds(),h=1/0,p=1/0,d=-1/0,f=-1/0,m=0,y=u;m<y.length;m+=1){var _=y[m];h=Math.min(h,_.x),p=Math.min(p,_.y),d=Math.max(d,_.x),f=Math.max(f,_.y)}for(var v=function(e){var r=n._tiles[c[e]];if(!r.holdingForFade()){var s=r.tileID,m=Math.pow(2,a.zoom-r.tileID.overscaledZ),y=i*r.queryPadding*t.EXTENT/r.tileSize/m,_=[s.getTilePoint(new t.MercatorCoordinate(h,p)),s.getTilePoint(new t.MercatorCoordinate(d,f))];if(_[0].x-y<t.EXTENT&&_[0].y-y<t.EXTENT&&_[1].x+y>=0&&_[1].y+y>=0){var v=l.map((function(t){return s.getTilePoint(t)})),g=u.map((function(t){return s.getTilePoint(t)}));o.push({tile:r,tileID:s,queryGeometry:v,cameraQueryGeometry:g,scale:m})}}},g=0;g<c.length;g++)v(g);return o},i.prototype.getVisibleCoordinates=function(t){for(var e=this,i=this.getRenderableIds(t).map((function(t){return e._tiles[t].tileID})),r=0,n=i;r<n.length;r+=1){var o=n[r];o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped())}return i},i.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(kt(this._source.type))for(var e in this._tiles){var i=this._tiles[e];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=t.browser.now())return!0}return!1},i.prototype.setFeatureState=function(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)},i.prototype.removeFeatureState=function(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)},i.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},i.prototype.setDependencies=function(t,e,i){var r=this._tiles[t];r&&r.setDependencies(e,i)},i.prototype.reloadTilesForDependencies=function(t,e){for(var i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((function(i){return!i.hasDependency(t,e)}))},i}(t.Evented);function zt(t,e){var i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function kt(t){return"raster"===t||"image"===t||"video"===t}function Lt(){return new t.window.Worker(Kn.workerUrl)}Ct.maxOverzooming=10,Ct.maxUnderzooming=3;var Dt="mapboxgl_preloaded_worker_pool",Rt=function(){this.active={}};Rt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<Rt.workerCount;)this.workers.push(new Lt);return this.active[t]=!0,this.workers.slice()},Rt.prototype.release=function(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((function(t){t.terminate()})),this.workers=null)},Rt.prototype.isPreloaded=function(){return!!this.active[Dt]},Rt.prototype.numActive=function(){return Object.keys(this.active).length};var Bt,Ft=Math.floor(t.browser.hardwareConcurrency/2);function Ot(){return Bt||(Bt=new Rt),Bt}function Ut(e,i){var r={};for(var n in e)"ref"!==n&&(r[n]=e[n]);return t.refProperties.forEach((function(t){t in i&&(r[t]=i[t])})),r}function Nt(t){t=t.slice();for(var e=Object.create(null),i=0;i<t.length;i++)e[t[i].id]=t[i];for(var r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=Ut(t[r],e[t[r].ref]));return t}Rt.workerCount=Math.max(Math.min(Ft,6),1);var Vt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function jt(t,e,i){i.push({command:Vt.addSource,args:[t,e[t]]})}function qt(t,e,i){e.push({command:Vt.removeSource,args:[t]}),i[t]=!0}function Gt(t,e,i,r){qt(t,i,r),jt(t,e,i)}function Zt(e,i,r){var n;for(n in e[r])if(e[r].hasOwnProperty(n)&&"data"!==n&&!t.deepEqual(e[r][n],i[r][n]))return!1;for(n in i[r])if(i[r].hasOwnProperty(n)&&"data"!==n&&!t.deepEqual(e[r][n],i[r][n]))return!1;return!0}function Wt(e,i,r,n,o,a){var s;for(s in i=i||{},e=e||{})e.hasOwnProperty(s)&&(t.deepEqual(e[s],i[s])||r.push({command:a,args:[n,s,i[s],o]}));for(s in i)i.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.deepEqual(e[s],i[s])||r.push({command:a,args:[n,s,i[s],o]}))}function Ht(t){return t.id}function Xt(t,e){return t[e.id]=e,t}var Kt=function(t,e){this.reset(t,e)};Kt.prototype.reset=function(t,e){this.points=t||[],this._distances=[0];for(var i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding},Kt.prototype.lerp=function(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);for(var i=1,r=this._distances[i],n=e*this.paddedLength+this.padding;r<n&&i<this._distances.length;)r=this._distances[++i];var o=i-1,a=this._distances[o],s=r-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))};var Jt=function(t,e,i){var r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(var o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0};function Yt(e,i,r,n,o){var a=t.create();return i?(t.scale(a,a,[1/o,1/o,1]),r||t.rotateZ(a,a,n.angle)):t.multiply(a,n.labelPlaneMatrix,e),a}function Qt(e,i,r,n,o){if(i){var a=t.clone(e);return t.scale(a,a,[o,o,1]),r||t.rotateZ(a,a,-n.angle),a}return n.glCoordMatrix}function $t(e,i){var r=[e.x,e.y,0,1];ce(r,r,i);var n=r[3];return{point:new t.Point(r[0]/n,r[1]/n),signedDistanceFromCamera:n}}function te(t,e){return.5+t/e*.5}function ee(t,e){var i=t[0]/t[3],r=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&r>=-e[1]&&r<=e[1]}function ie(e,i,r,n,o,a,s,l){var u=n?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,r.transform.zoom),h=[256/r.width*2+1,256/r.height*2+1],p=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var d=e.lineVertexArray,f=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=r.transform.width/r.transform.height,y=!1,_=0;_<f.length;_++){var v=f.get(_);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!y)ue(v.numGlyphs,p);else{y=!1;var g=[v.anchorX,v.anchorY,0,1];if(t.transformMat4(g,g,i),ee(g,h)){var x=te(r.transform.cameraToCenterDistance,g[3]),b=t.evaluateSizeForFeature(u,c,v),w=s?b/x:b*x,E=new t.Point(v.anchorX,v.anchorY),I=$t(E,o).point,S={},T=oe(v,w,!1,l,i,o,a,e.glyphOffsetArray,d,p,I,E,S,m);y=T.useVertical,(T.notEnoughRoom||y||T.needsFlipping&&oe(v,w,!0,l,i,o,a,e.glyphOffsetArray,d,p,I,E,S,m).notEnoughRoom)&&ue(v.numGlyphs,p)}else ue(v.numGlyphs,p)}}n?e.text.dynamicLayoutVertexBuffer.updateData(p):e.icon.dynamicLayoutVertexBuffer.updateData(p)}function re(t,e,i,r,n,o,a,s,l,u,c){var h=s.glyphStartIndex+s.numGlyphs,p=s.lineStartIndex,d=s.lineStartIndex+s.lineLength,f=e.getoffsetX(s.glyphStartIndex),m=e.getoffsetX(h-1),y=se(t*f,i,r,n,o,a,s.segment,p,d,l,u,c);if(!y)return null;var _=se(t*m,i,r,n,o,a,s.segment,p,d,l,u,c);return _?{first:y,last:_}:null}function ne(e,i,r,n){return e===t.WritingMode.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function oe(e,i,r,n,o,a,s,l,u,c,h,p,d,f){var m,y=i/24,_=e.lineOffsetX*y,v=e.lineOffsetY*y;if(e.numGlyphs>1){var g=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=re(y,l,_,v,r,h,p,e,u,a,d);if(!w)return{notEnoughRoom:!0};var E=$t(w.first.point,s).point,I=$t(w.last.point,s).point;if(n&&!r){var S=ne(e.writingMode,E,I,f);if(S)return S}m=[w.first];for(var T=e.glyphStartIndex+1;T<g-1;T++)m.push(se(y*l.getoffsetX(T),_,v,r,h,p,e.segment,x,b,u,a,d));m.push(w.last)}else{if(n&&!r){var A=$t(p,o).point,P=e.lineStartIndex+e.segment+1,M=new t.Point(u.getx(P),u.gety(P)),C=$t(M,o),z=C.signedDistanceFromCamera>0?C.point:ae(p,M,A,1,o),k=ne(e.writingMode,A,z,f);if(k)return k}var L=se(y*l.getoffsetX(e.glyphStartIndex),_,v,r,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,d);if(!L)return{notEnoughRoom:!0};m=[L]}for(var D=0,R=m;D<R.length;D+=1){var B=R[D];t.addDynamicAttributes(c,B.point,B.angle)}return{}}function ae(t,e,i,r,n){var o=$t(t.add(t.sub(e)._unit()),n).point,a=i.sub(o);return i.add(a._mult(r/a.mag()))}function se(e,i,r,n,o,a,s,l,u,c,h,p){var d=n?e-i:e+i,f=d>0?1:-1,m=0;n&&(f*=-1,m=Math.PI),f<0&&(m+=Math.PI);for(var y=f>0?l+s:l+s+1,_=o,v=o,g=0,x=0,b=Math.abs(d),w=[];g+x<=b;){if((y+=f)<l||y>=u)return null;if(v=_,w.push(_),void 0===(_=p[y])){var E=new t.Point(c.getx(y),c.gety(y)),I=$t(E,h);if(I.signedDistanceFromCamera>0)_=p[y]=I.point;else{var S=y-f;_=ae(0===g?a:new t.Point(c.getx(S),c.gety(S)),E,v,b-g+1,h)}}g+=x,x=v.dist(_)}var T=(b-g)/x,A=_.sub(v),P=A.mult(T)._add(v);P._add(A._unit()._perp()._mult(r*f));var M=m+Math.atan2(_.y-v.y,_.x-v.x);return w.push(P),{point:P,angle:M,path:w}}Jt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Jt.prototype.insert=function(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},Jt.prototype.insertCircle=function(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)},Jt.prototype._insertBoxCell=function(t,e,i,r,n,o){this.boxCells[n].push(o)},Jt.prototype._insertCircleCell=function(t,e,i,r,n,o){this.circleCells[n].push(o)},Jt.prototype._query=function(t,e,i,r,n,o){if(i<0||t>this.width||r<0||e>this.height)return!n&&[];var a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(var s=0;s<this.boxKeys.length;s++)a.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var l=0;l<this.circleKeys.length;l++){var u=this.circles[3*l],c=this.circles[3*l+1],h=this.circles[3*l+2];a.push({key:this.circleKeys[l],x1:u-h,y1:c-h,x2:u+h,y2:c+h})}return o?a.filter(o):a}return this._forEachCell(t,e,i,r,this._queryCell,a,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?a.length>0:a},Jt.prototype._queryCircle=function(t,e,i,r,n){var o=t-i,a=t+i,s=e-i,l=e+i;if(a<0||o>this.width||l<0||s>this.height)return!r&&[];var u=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,u,{hitTest:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),r?u.length>0:u},Jt.prototype.query=function(t,e,i,r,n){return this._query(t,e,i,r,!1,n)},Jt.prototype.hitTest=function(t,e,i,r,n){return this._query(t,e,i,r,!0,n)},Jt.prototype.hitTestCircle=function(t,e,i,r){return this._queryCircle(t,e,i,!0,r)},Jt.prototype._queryCell=function(t,e,i,r,n,o,a,s){var l=a.seenUids,u=this.boxCells[n];if(null!==u)for(var c=this.bboxes,h=0,p=u;h<p.length;h+=1){var d=p[h];if(!l.box[d]){l.box[d]=!0;var f=4*d;if(t<=c[f+2]&&e<=c[f+3]&&i>=c[f+0]&&r>=c[f+1]&&(!s||s(this.boxKeys[d]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[d],x1:c[f],y1:c[f+1],x2:c[f+2],y2:c[f+3]})}}}var m=this.circleCells[n];if(null!==m)for(var y=this.circles,_=0,v=m;_<v.length;_+=1){var g=v[_];if(!l.circle[g]){l.circle[g]=!0;var x=3*g;if(this._circleAndRectCollide(y[x],y[x+1],y[x+2],t,e,i,r)&&(!s||s(this.circleKeys[g]))){if(a.hitTest)return o.push(!0),!0;var b=y[x],w=y[x+1],E=y[x+2];o.push({key:this.circleKeys[g],x1:b-E,y1:w-E,x2:b+E,y2:w+E})}}}},Jt.prototype._queryCellCircle=function(t,e,i,r,n,o,a,s){var l=a.circle,u=a.seenUids,c=this.boxCells[n];if(null!==c)for(var h=this.bboxes,p=0,d=c;p<d.length;p+=1){var f=d[p];if(!u.box[f]){u.box[f]=!0;var m=4*f;if(this._circleAndRectCollide(l.x,l.y,l.radius,h[m+0],h[m+1],h[m+2],h[m+3])&&(!s||s(this.boxKeys[f])))return o.push(!0),!0}}var y=this.circleCells[n];if(null!==y)for(var _=this.circles,v=0,g=y;v<g.length;v+=1){var x=g[v];if(!u.circle[x]){u.circle[x]=!0;var b=3*x;if(this._circlesCollide(_[b],_[b+1],_[b+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[x])))return o.push(!0),!0}}},Jt.prototype._forEachCell=function(t,e,i,r,n,o,a,s){for(var l=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),c=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r),p=l;p<=c;p++)for(var d=u;d<=h;d++)if(n.call(this,t,e,i,r,this.xCellCount*d+p,o,a,s))return},Jt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},Jt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},Jt.prototype._circlesCollide=function(t,e,i,r,n,o){var a=r-t,s=n-e,l=i+o;return l*l>a*a+s*s},Jt.prototype._circleAndRectCollide=function(t,e,i,r,n,o,a){var s=(o-r)/2,l=Math.abs(t-(r+s));if(l>s+i)return!1;var u=(a-n)/2,c=Math.abs(e-(n+u));if(c>u+i)return!1;if(l<=s||c<=u)return!0;var h=l-s,p=c-u;return h*h+p*p<=i*i};var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ue(t,e){for(var i=0;i<t;i++){var r=e.length;e.resize(r+4),e.float32.set(le,3*r)}}function ce(t,e,i){var r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}var he=function(t,e,i){void 0===e&&(e=new Jt(t.width+200,t.height+200,25)),void 0===i&&(i=new Jt(t.width+200,t.height+200,25)),this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200};function pe(e,i,r){return i*(t.EXTENT/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}he.prototype.placeCollisionBox=function(t,e,i,r,n){var o=this.projectAndGetPerspectiveRatio(r,t.anchorPointX,t.anchorPointY),a=i*o.perspectiveRatio,s=t.x1*a+o.point.x,l=t.y1*a+o.point.y,u=t.x2*a+o.point.x,c=t.y2*a+o.point.y;return!this.isInsideGrid(s,l,u,c)||!e&&this.grid.hitTest(s,l,u,c,n)?{box:[],offscreen:!1}:{box:[s,l,u,c],offscreen:this.isOffscreen(s,l,u,c)}},he.prototype.placeCollisionCircles=function(e,i,r,n,o,a,s,l,u,c,h,p,d){var f=[],m=new t.Point(i.anchorX,i.anchorY),y=$t(m,a),_=te(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),v=(c?o/_:o*_)/t.ONE_EM,g=$t(m,s).point,x=re(v,n,i.lineOffsetX*v,i.lineOffsetY*v,!1,g,m,i,r,s,{}),b=!1,w=!1,E=!0;if(x){for(var I=.5*p*_+d,S=new t.Point(-100,-100),T=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),A=new Kt,P=x.first,M=x.last,C=[],z=P.path.length-1;z>=1;z--)C.push(P.path[z]);for(var k=1;k<M.path.length;k++)C.push(M.path[k]);var L=2.5*I;if(l){var D=C.map((function(t){return $t(t,l)}));C=D.some((function(t){return t.signedDistanceFromCamera<=0}))?[]:D.map((function(t){return t.point}))}var R=[];if(C.length>0){for(var B=C[0].clone(),F=C[0].clone(),O=1;O<C.length;O++)B.x=Math.min(B.x,C[O].x),B.y=Math.min(B.y,C[O].y),F.x=Math.max(F.x,C[O].x),F.y=Math.max(F.y,C[O].y);R=B.x>=S.x&&F.x<=T.x&&B.y>=S.y&&F.y<=T.y?[C]:F.x<S.x||B.x>T.x||F.y<S.y||B.y>T.y?[]:t.clipLine([C],S.x,S.y,T.x,T.y)}for(var U=0,N=R;U<N.length;U+=1){var V;A.reset(N[U],.25*I),V=A.length<=.5*I?1:Math.ceil(A.paddedLength/L)+1;for(var j=0;j<V;j++){var q=j/Math.max(V-1,1),G=A.lerp(q),Z=G.x+100,W=G.y+100;f.push(Z,W,I,0);var H=Z-I,X=W-I,K=Z+I,J=W+I;if(E=E&&this.isOffscreen(H,X,K,J),w=w||this.isInsideGrid(H,X,K,J),!e&&this.grid.hitTestCircle(Z,W,I,h)&&(b=!0,!u))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!u&&b||!w?[]:f,offscreen:E,collisionDetected:b}},he.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var i=[],r=1/0,n=1/0,o=-1/0,a=-1/0,s=0,l=e;s<l.length;s+=1){var u=l[s],c=new t.Point(u.x+100,u.y+100);r=Math.min(r,c.x),n=Math.min(n,c.y),o=Math.max(o,c.x),a=Math.max(a,c.y),i.push(c)}for(var h={},p={},d=0,f=this.grid.query(r,n,o,a).concat(this.ignoredGrid.query(r,n,o,a));d<f.length;d+=1){var m=f[d],y=m.key;if(void 0===h[y.bucketInstanceId]&&(h[y.bucketInstanceId]={}),!h[y.bucketInstanceId][y.featureIndex]){var _=[new t.Point(m.x1,m.y1),new t.Point(m.x2,m.y1),new t.Point(m.x2,m.y2),new t.Point(m.x1,m.y2)];t.polygonIntersectsPolygon(i,_)&&(h[y.bucketInstanceId][y.featureIndex]=!0,void 0===p[y.bucketInstanceId]&&(p[y.bucketInstanceId]=[]),p[y.bucketInstanceId].push(y.featureIndex))}}return p},he.prototype.insertCollisionBox=function(t,e,i,r,n){(e?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:n},t[0],t[1],t[2],t[3])},he.prototype.insertCollisionCircles=function(t,e,i,r,n){for(var o=e?this.ignoredGrid:this.grid,a={bucketInstanceId:i,featureIndex:r,collisionGroupID:n},s=0;s<t.length;s+=4)o.insertCircle(a,t[s],t[s+1],t[s+2])},he.prototype.projectAndGetPerspectiveRatio=function(e,i,r){var n=[i,r,0,1];return ce(n,n,e),{point:new t.Point((n[0]/n[3]+1)/2*this.transform.width+100,(-n[1]/n[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/n[3]*.5}},he.prototype.isOffscreen=function(t,e,i,r){return i<100||t>=this.screenRightBoundary||r<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary},he.prototype.getViewportMatrix=function(){var e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e};var de=function(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i};de.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var fe=function(t,e,i,r,n){this.text=new de(t?t.text:null,e,i,n),this.icon=new de(t?t.icon:null,e,r,n)};fe.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var me=function(t,e,i){this.text=t,this.icon=e,this.skipFade=i},ye=function(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]},_e=function(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n},ve=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};function ge(e,i,r,n,o){var a=t.getAnchorAlignment(e),s=-(a.horizontalAlign-.5)*i,l=-(a.verticalAlign-.5)*r,u=t.evaluateVariableOffset(e,n);return new t.Point(s+u[0]*o,l+u[1]*o)}function xe(e,i,r,n,o,a){var s=e.x1,l=e.x2,u=e.y1,c=e.y2,h=e.anchorPointX,p=e.anchorPointY,d=new t.Point(i,r);return n&&d._rotate(o?a:-a),{x1:s+d.x,y1:u+d.y,x2:l+d.x,y2:c+d.y,anchorPointX:h,anchorPointY:p}}ve.prototype.get=function(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){var e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:function(t){return t.collisionGroupID===e}}}return this.collisionGroups[t]};var be=function(t,e,i,r){this.transform=t.clone(),this.collisionIndex=new he(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new ve(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}};function we(t,e,i,r,n){t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0)}be.prototype.getBucketParts=function(e,i,r,n){var o=r.getBucket(i),a=r.latestFeatureIndex;if(o&&a&&i.id===o.layerIds[0]){var s=r.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/t.EXTENT,h=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),f=pe(r,1,this.transform.zoom),m=Yt(h,p,d,this.transform,f),y=null;if(p){var _=Qt(h,p,d,this.transform,f);y=t.multiply([],this.transform.labelPlaneMatrix,_)}this.retainedQueryData[o.bucketInstanceId]=new _e(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);var v={bucket:o,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:y,scale:u,textPixelRatio:c,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(var g=0,x=o.sortKeyRanges;g<x.length;g+=1){var b=x[g];e.push({sortKey:b.sortKey,symbolInstanceStart:b.symbolInstanceStart,symbolInstanceEnd:b.symbolInstanceEnd,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}},be.prototype.attemptAnchorPlacement=function(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f){var m,y=[h.textOffset0,h.textOffset1],_=ge(t,i,r,y,n),v=this.collisionIndex.placeCollisionBox(xe(e,_.x,_.y,o,a,this.transform.angle),c,s,l,u.predicate);if(!f||0!==this.collisionIndex.placeCollisionBox(xe(f,_.x,_.y,o,a,this.transform.angle),c,s,l,u.predicate).box.length)return v.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(m=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:y,width:i,height:r,anchor:t,textBoxScale:n,prevAnchor:m},this.markUsedJustification(p,t,h,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,h),this.placedOrientations[h.crossTileID]=d),{shift:_,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,i,r){var n=this,o=e.parameters,a=o.bucket,s=o.layout,l=o.posMatrix,u=o.textLabelPlaneMatrix,c=o.labelToScreenMatrix,h=o.textPixelRatio,p=o.holdingForFade,d=o.collisionBoxArray,f=o.partiallyEvaluatedTextSize,m=o.collisionGroup,y=s.get("text-optional"),_=s.get("icon-optional"),v=s.get("text-allow-overlap"),g=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),E="viewport-y"===s.get("symbol-z-order"),I=v&&(g||!a.hasIconData()||_),S=g&&(v||!a.hasTextData()||y);!a.collisionArrays&&d&&a.deserializeCollisionBoxes(d);var T=function(e,o){if(!i[e.crossTileID])if(p)n.placements[e.crossTileID]=new me(!1,!1,!1);else{var d,E=!1,T=!1,A=!0,P=null,M={box:null,offscreen:null},C={box:null,offscreen:null},z=null,k=null,L=0,D=0,R=0;o.textFeatureIndex?L=o.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),o.verticalTextFeatureIndex&&(D=o.verticalTextFeatureIndex);var B=o.textBox;if(B){var F=function(i){var r=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!i&&n.prevPlacement){var o=n.prevPlacement.placedOrientations[e.crossTileID];o&&(n.placedOrientations[e.crossTileID]=o,n.markUsedOrientation(a,r=o,e))}return r},O=function(i,r){if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&o.verticalTextBox)for(var n=0,s=a.writingModes;n<s.length&&(s[n]===t.WritingMode.vertical?(M=r(),C=M):M=i(),!(M&&M.box&&M.box.length));n+=1);else M=i()};if(s.get("text-variable-anchor")){var U=s.get("text-variable-anchor");if(n.prevPlacement&&n.prevPlacement.variableOffsets[e.crossTileID]){var N=n.prevPlacement.variableOffsets[e.crossTileID];U.indexOf(N.anchor)>0&&(U=U.filter((function(t){return t!==N.anchor}))).unshift(N.anchor)}var V=function(t,i,r){for(var o=t.x2-t.x1,s=t.y2-t.y1,u=e.textBoxScale,c=w&&!g?i:null,p={box:[],offscreen:!1},d=v?2*U.length:U.length,f=0;f<d;++f){var y=n.attemptAnchorPlacement(U[f%U.length],t,o,s,u,x,b,h,l,m,f>=U.length,e,a,r,c);if(y&&(p=y.placedGlyphBoxes)&&p.box&&p.box.length){E=!0,P=y.shift;break}}return p};O((function(){return V(B,o.iconBox,t.WritingMode.horizontal)}),(function(){var i=o.verticalTextBox;return a.allowVerticalPlacement&&!(M&&M.box&&M.box.length)&&e.numVerticalGlyphVertices>0&&i?V(i,o.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),M&&(E=M.box,A=M.offscreen);var j=F(M&&M.box);if(!E&&n.prevPlacement){var q=n.prevPlacement.variableOffsets[e.crossTileID];q&&(n.variableOffsets[e.crossTileID]=q,n.markUsedJustification(a,q.anchor,e,j))}}else{var G=function(t,i){var r=n.collisionIndex.placeCollisionBox(t,v,h,l,m.predicate);return r&&r.box&&r.box.length&&(n.markUsedOrientation(a,i,e),n.placedOrientations[e.crossTileID]=i),r};O((function(){return G(B,t.WritingMode.horizontal)}),(function(){var i=o.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?G(i,t.WritingMode.vertical):{box:null,offscreen:null}})),F(M&&M.box&&M.box.length)}}if(E=(d=M)&&d.box&&d.box.length>0,A=d&&d.offscreen,e.useRuntimeCollisionCircles){var Z=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),W=t.evaluateSizeForFeature(a.textSizeData,f,Z),H=s.get("text-padding");z=n.collisionIndex.placeCollisionCircles(v,Z,a.lineVertexArray,a.glyphOffsetArray,W,l,u,c,r,b,m.predicate,e.collisionCircleDiameter,H),E=v||z.circles.length>0&&!z.collisionDetected,A=A&&z.offscreen}if(o.iconFeatureIndex&&(R=o.iconFeatureIndex),o.iconBox){var X=function(t){var e=w&&P?xe(t,P.x,P.y,x,b,n.transform.angle):t;return n.collisionIndex.placeCollisionBox(e,g,h,l,m.predicate)};T=C&&C.box&&C.box.length&&o.verticalIconBox?(k=X(o.verticalIconBox)).box.length>0:(k=X(o.iconBox)).box.length>0,A=A&&k.offscreen}var K=y||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,J=_||0===e.numIconVertices;if(K||J?J?K||(T=T&&E):E=T&&E:T=E=T&&E,E&&d&&d.box&&n.collisionIndex.insertCollisionBox(d.box,s.get("text-ignore-placement"),a.bucketInstanceId,C&&C.box&&D?D:L,m.ID),T&&k&&n.collisionIndex.insertCollisionBox(k.box,s.get("icon-ignore-placement"),a.bucketInstanceId,R,m.ID),z&&(E&&n.collisionIndex.insertCollisionCircles(z.circles,s.get("text-ignore-placement"),a.bucketInstanceId,L,m.ID),r)){var Y=a.bucketInstanceId,Q=n.collisionCircleArrays[Y];void 0===Q&&(Q=n.collisionCircleArrays[Y]=new ye);for(var $=0;$<z.circles.length;$+=4)Q.circles.push(z.circles[$+0]),Q.circles.push(z.circles[$+1]),Q.circles.push(z.circles[$+2]),Q.circles.push(z.collisionDetected?1:0)}n.placements[e.crossTileID]=new me(E||I,T||S,A||a.justReloaded),i[e.crossTileID]=!0}};if(E)for(var A=a.getSortedSymbolIndexes(this.transform.angle),P=A.length-1;P>=0;--P){var M=A[P];T(a.symbolInstances.get(M),a.collisionArrays[M])}else for(var C=e.symbolInstanceStart;C<e.symbolInstanceEnd;C++)T(a.symbolInstances.get(C),a.collisionArrays[C]);if(r&&a.bucketInstanceId in this.collisionCircleArrays){var z=this.collisionCircleArrays[a.bucketInstanceId];t.invert(z.invProjMatrix,l),z.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1},be.prototype.markUsedJustification=function(e,i,r,n){var o;o=n===t.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];for(var a=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];a<s.length;a+=1){var l=s[a];l>=0&&(e.text.placedSymbolArray.get(l).crossTileID=o>=0&&l!==o?0:r.crossTileID)}},be.prototype.markUsedOrientation=function(e,i,r){for(var n=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,a=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];a<s.length;a+=1)e.text.placedSymbolArray.get(s[a]).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)},be.prototype.commit=function(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;var e=this.prevPlacement,i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;var r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(var s in this.placements){var l=this.placements[s],u=n[s];u?(this.opacities[s]=new fe(u,r,l.text,l.icon),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new fe(null,r,l.text,l.icon,l.skipFade),i=i||l.text||l.icon)}for(var c in n){var h=n[c];if(!this.opacities[c]){var p=new fe(h,r,!1,!1);p.isHidden()||(this.opacities[c]=p,i=i||h.text.placed||h.icon.placed)}}for(var d in o)this.variableOffsets[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.variableOffsets[d]=o[d]);for(var f in a)this.placedOrientations[f]||!this.opacities[f]||this.opacities[f].isHidden()||(this.placedOrientations[f]=a[f]);i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},be.prototype.updateLayerOpacities=function(t,e){for(var i={},r=0,n=e;r<n.length;r+=1){var o=n[r],a=o.getBucket(t);a&&o.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,i,o.collisionBoxArray)}},be.prototype.updateBucketOpacities=function(e,i,r){var n=this;e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();var o=e.layers[0].layout,a=new fe(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),u=o.get("text-variable-anchor"),c="map"===o.get("text-rotation-alignment"),h="map"===o.get("text-pitch-alignment"),p="none"!==o.get("icon-text-fit"),d=new fe(null,0,s&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);for(var f=function(t,e,i){for(var r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i)},m=function(r){var o=e.symbolInstances.get(r),s=o.numHorizontalGlyphVertices,l=o.numVerticalGlyphVertices,m=o.crossTileID,y=n.opacities[m];i[m]?y=a:y||(n.opacities[m]=y=d),i[m]=!0;var _=o.numIconVertices>0,v=n.placedOrientations[o.crossTileID],g=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=Ce(y.text);f(e.text,s,g?ze:b),f(e.text,l,x?ze:b);var w=y.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||g?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var E=n.variableOffsets[o.crossTileID];E&&n.markUsedJustification(e,E.anchor,o,v);var I=n.placedOrientations[o.crossTileID];I&&(n.markUsedJustification(e,"left",o,I),n.markUsedOrientation(e,I,o))}if(_){var S=Ce(y.icon),T=!(p&&o.verticalPlacedIconSymbolIndex&&g);o.placedIconSymbolIndex>=0&&(f(e.icon,o.numIconVertices,T?S:ze),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=y.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(f(e.icon,o.numVerticalIconVertices,T?ze:S),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var A=e.collisionArrays[r];if(A){var P=new t.Point(0,0);if(A.textBox||A.verticalTextBox){var M=!0;if(u){var C=n.variableOffsets[m];C?(P=ge(C.anchor,C.width,C.height,C.textOffset,C.textBoxScale),c&&P._rotate(h?n.transform.angle:-n.transform.angle)):M=!1}A.textBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!M||g,P.x,P.y),A.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!M||x,P.x,P.y)}var z=Boolean(!x&&A.verticalIconBox);A.iconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,z,p?P.x:0,p?P.y:0),A.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!z,p?P.x:0,p?P.y:0)}}},y=0;y<e.symbolInstances.length;y++)m(y);if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){var _=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=_.invProjMatrix,e.placementViewportMatrix=_.viewportMatrix,e.collisionCircleArray=_.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}},be.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},be.prototype.zoomAdjustment=function(t){return Math.max(0,(this.transform.zoom-t)/1.5)},be.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},be.prototype.stillRecent=function(t,e){var i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t},be.prototype.setStale=function(){this.stale=!0};var Ee=Math.pow(2,25),Ie=Math.pow(2,24),Se=Math.pow(2,17),Te=Math.pow(2,16),Ae=Math.pow(2,9),Pe=Math.pow(2,8),Me=Math.pow(2,1);function Ce(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Ee+e*Ie+i*Se+e*Te+i*Ae+e*Pe+i*Me+e}var ze=0,ke=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};ke.prototype.continuePlacement=function(t,e,i,r,n){for(var o=this._bucketParts;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((function(t,e){return t.sortKey-e.sortKey})));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1};var Le=function(t,e,i,r,n,o,a){this.placement=new be(t,n,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=r,this._done=!1};Le.prototype.isDone=function(){return this._done},Le.prototype.continuePlacement=function(e,i,r){for(var n=this,o=t.browser.now(),a=function(){var e=t.browser.now()-o;return!n._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=i[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new ke(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Le.prototype.commit=function(t){return this.placement.commit(t),this.placement};var De=512/t.EXTENT/2,Re=function(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(var r=0;r<e.length;r++){var n=e.get(r),o=n.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:n.crossTileID,coord:this.getScaledCoordinates(n,t)})}};Re.prototype.getScaledCoordinates=function(e,i){var r=De/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*t.EXTENT+e.anchorX)*r),y:Math.floor((i.canonical.y*t.EXTENT+e.anchorY)*r)}},Re.prototype.findMatches=function(t,e,i){for(var r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z),n=0;n<t.length;n++){var o=t.get(n);if(!o.crossTileID){var a=this.indexedSymbolInstances[o.key];if(a)for(var s=this.getScaledCoordinates(o,e),l=0,u=a;l<u.length;l+=1){var c=u[l];if(Math.abs(c.coord.x-s.x)<=r&&Math.abs(c.coord.y-s.y)<=r&&!i[c.crossTileID]){i[c.crossTileID]=!0,o.crossTileID=c.crossTileID;break}}}}};var Be=function(){this.maxCrossTileID=0};Be.prototype.generate=function(){return++this.maxCrossTileID};var Fe=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};Fe.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var i in this.indexes){var r=this.indexes[i],n={};for(var o in r){var a=r[o];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),n[a.tileID.key]=a}this.indexes[i]=n}this.lng=t},Fe.prototype.addBucket=function(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(var r=0;r<e.symbolInstances.length;r++)e.symbolInstances.get(r).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});var n=this.usedCrossTileIDs[t.overscaledZ];for(var o in this.indexes){var a=this.indexes[o];if(Number(o)>t.overscaledZ)for(var s in a){var l=a[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,n)}else{var u=a[t.scaledTo(Number(o)).key];u&&u.findMatches(e.symbolInstances,t,n)}}for(var c=0;c<e.symbolInstances.length;c++){var h=e.symbolInstances.get(c);h.crossTileID||(h.crossTileID=i.generate(),n[h.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Re(t,e.symbolInstances,e.bucketInstanceId),!0},Fe.prototype.removeBucketCrossTileIDs=function(t,e){for(var i in e.indexedSymbolInstances)for(var r=0,n=e.indexedSymbolInstances[i];r<n.length;r+=1)delete this.usedCrossTileIDs[t][n[r].crossTileID]},Fe.prototype.removeStaleBuckets=function(t){var e=!1;for(var i in this.indexes){var r=this.indexes[i];for(var n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e};var Oe=function(){this.layerIndexes={},this.crossTileIDs=new Be,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Oe.prototype.addLayer=function(t,e,i){var r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new Fe);var n=!1,o={};r.handleWrapJump(i);for(var a=0,s=e;a<s.length;a+=1){var l=s[a],u=l.getBucket(t);u&&t.id===u.layerIds[0]&&(u.bucketInstanceId||(u.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(l.tileID,u,this.crossTileIDs)&&(n=!0),o[u.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(n=!0),n},Oe.prototype.pruneUnusedLayers=function(t){var e={};for(var i in t.forEach((function(t){e[t]=!0})),this.layerIndexes)e[i]||delete this.layerIndexes[i]};var Ue=function(e,i){return t.emitValidationErrors(e,i&&i.filter((function(t){return"source.canvas"!==t.identifier})))},Ne=t.pick(Vt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Ve=t.pick(Vt,["setCenter","setZoom","setBearing","setPitch"]),je=function(){var e={},i=t.styleSpec.$version;for(var r in t.styleSpec.$root){var n,o=t.styleSpec.$root[r];o.required&&null!=(n="version"===r?i:"array"===o.type?[]:{})&&(e[r]=n)}return e}(),qe=function(e){function i(r,n){var o=this;void 0===n&&(n={}),e.call(this),this.map=r,this.dispatcher=new I(Ot(),this),this.imageManager=new p,this.imageManager.setEventedParent(this),this.glyphManager=new g(r._requestManager,n.localIdeographFontFamily),this.lineAtlas=new E(256,512),this.crossTileSymbolIndex=new Oe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());var a=this;this._rtlTextPluginCallback=i.registerForPluginStateChange((function(e){a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(function(e,i){if(t.triggerPluginCompletionEvent(e),i&&i.every((function(t){return t})))for(var r in a.sourceCaches)a.sourceCaches[r].reload()}))})),this.on("data",(function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=o.sourceCaches[t.sourceId];if(e){var i=e.getSource();if(i&&i.vectorLayerIds)for(var r in o._layers){var n=o._layers[r];n.source===i.id&&o._validateLayer(n)}}}}))}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.loadURL=function(e,i){var r=this;void 0===i&&(i={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var n="boolean"==typeof i.validate?i.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,i.accessToken);var o=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(o,(function(e,i){r._request=null,e?r.fire(new t.ErrorEvent(e)):i&&r._load(i,n)}))},i.prototype.loadJSON=function(e,i){var r=this;void 0===i&&(i={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((function(){r._request=null,r._load(e,!1!==i.validate)}))},i.prototype.loadEmpty=function(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(je,!1)},i.prototype._load=function(e,i){if(!i||!Ue(this,t.validateStyle(e))){for(var r in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(r,e.sources[r],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var n=Nt(this.stylesheet.layers);this._order=n.map((function(t){return t.id})),this._layers={},this._serializedLayers={};for(var o=0,a=n;o<a.length;o+=1){var s=a[o];(s=t.createStyleLayer(s)).setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=s,this._serializedLayers[s.id]=s.serialize()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new w(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}},i.prototype._loadSprite=function(e){var i=this;this._spriteRequest=function(e,i,r){var n,o,a,s=t.browser.devicePixelRatio>1?"@2x":"",l=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,a||(a=t,n=e,c())})),u=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){u=null,a||(a=t,o=e,c())}));function c(){if(a)r(a);else if(n&&o){var e=t.browser.getImageData(o),i={};for(var s in n){var l=n[s],u=l.width,c=l.height,h=l.x,p=l.y,d=l.sdf,f=l.pixelRatio,m=l.stretchX,y=l.stretchY,_=l.content,v=new t.RGBAImage({width:u,height:c});t.RGBAImage.copy(e,v,{x:h,y:p},{x:0,y:0},{width:u,height:c}),i[s]={data:v,pixelRatio:f,sdf:d,stretchX:m,stretchY:y,content:_}}r(null,i)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(e,this.map._requestManager,(function(e,r){if(i._spriteRequest=null,e)i.fire(new t.ErrorEvent(e));else if(r)for(var n in r)i.imageManager.addImage(n,r[n]);i.imageManager.setLoaded(!0),i._availableImages=i.imageManager.listImages(),i.dispatcher.broadcast("setImages",i._availableImages),i.fire(new t.Event("data",{dataType:"style"}))}))},i.prototype._validateLayer=function(e){var i=this.sourceCaches[e.source];if(i){var r=e.sourceLayer;if(r){var n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+r+'" does not exist on source "'+n.id+'" as specified by style layer "'+e.id+'"')))}}},i.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},i.prototype._serializeLayers=function(t){for(var e=[],i=0,r=t;i<r.length;i+=1){var n=this._layers[r[i]];"custom"!==n.type&&e.push(n.serialize())}return e},i.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(var e in this._layers)if(this._layers[e].hasTransition())return!0;return!1},i.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},i.prototype.update=function(e){if(this._loaded){var i=this._changed;if(this._changed){var r=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);for(var o in(r.length||n.length)&&this._updateWorkerLayers(r,n),this._updatedSources){var a=this._updatedSources[o];"reload"===a?this._reloadSource(o):"clear"===a&&this._clearSource(o)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}var l={};for(var u in this.sourceCaches){var c=this.sourceCaches[u];l[u]=c.used,c.used=!1}for(var h=0,p=this._order;h<p.length;h+=1){var d=this._layers[p[h]];d.recalculate(e,this._availableImages),!d.isHidden(e.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(var f in l){var m=this.sourceCaches[f];l[f]!==m.used&&m.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:f}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}))}},i.prototype._updateTilesForChangedImages=function(){var t=Object.keys(this._changedImages);if(t.length){for(var e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}},i.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},i.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},i.prototype.setState=function(e){var i=this;if(this._checkLoaded(),Ue(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=Nt(e.layers);var r=function(e,i){if(!e)return[{command:Vt.setStyle,args:[i]}];var r=[];try{if(!t.deepEqual(e.version,i.version))return[{command:Vt.setStyle,args:[i]}];t.deepEqual(e.center,i.center)||r.push({command:Vt.setCenter,args:[i.center]}),t.deepEqual(e.zoom,i.zoom)||r.push({command:Vt.setZoom,args:[i.zoom]}),t.deepEqual(e.bearing,i.bearing)||r.push({command:Vt.setBearing,args:[i.bearing]}),t.deepEqual(e.pitch,i.pitch)||r.push({command:Vt.setPitch,args:[i.pitch]}),t.deepEqual(e.sprite,i.sprite)||r.push({command:Vt.setSprite,args:[i.sprite]}),t.deepEqual(e.glyphs,i.glyphs)||r.push({command:Vt.setGlyphs,args:[i.glyphs]}),t.deepEqual(e.transition,i.transition)||r.push({command:Vt.setTransition,args:[i.transition]}),t.deepEqual(e.light,i.light)||r.push({command:Vt.setLight,args:[i.light]});var n={},o=[];!function(e,i,r,n){var o;for(o in i=i||{},e=e||{})e.hasOwnProperty(o)&&(i.hasOwnProperty(o)||qt(o,r,n));for(o in i)i.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.deepEqual(e[o],i[o])||("geojson"===e[o].type&&"geojson"===i[o].type&&Zt(e,i,o)?r.push({command:Vt.setGeoJSONSourceData,args:[o,i[o].data]}):Gt(o,i,r,n)):jt(o,i,r))}(e.sources,i.sources,o,n);var a=[];e.layers&&e.layers.forEach((function(t){n[t.source]?r.push({command:Vt.removeLayer,args:[t.id]}):a.push(t)})),r=r.concat(o),function(e,i,r){i=i||[];var n,o,a,s,l,u,c,h=(e=e||[]).map(Ht),p=i.map(Ht),d=e.reduce(Xt,{}),f=i.reduce(Xt,{}),m=h.slice(),y=Object.create(null);for(n=0,o=0;n<h.length;n++)f.hasOwnProperty(a=h[n])?o++:(r.push({command:Vt.removeLayer,args:[a]}),m.splice(m.indexOf(a,o),1));for(n=0,o=0;n<p.length;n++)m[m.length-1-n]!==(a=p[p.length-1-n])&&(d.hasOwnProperty(a)?(r.push({command:Vt.removeLayer,args:[a]}),m.splice(m.lastIndexOf(a,m.length-o),1)):o++,r.push({command:Vt.addLayer,args:[f[a],u=m[m.length-n]]}),m.splice(m.length-n,0,a),y[a]=!0);for(n=0;n<p.length;n++)if(s=d[a=p[n]],l=f[a],!y[a]&&!t.deepEqual(s,l))if(t.deepEqual(s.source,l.source)&&t.deepEqual(s["source-layer"],l["source-layer"])&&t.deepEqual(s.type,l.type)){for(c in Wt(s.layout,l.layout,r,a,null,Vt.setLayoutProperty),Wt(s.paint,l.paint,r,a,null,Vt.setPaintProperty),t.deepEqual(s.filter,l.filter)||r.push({command:Vt.setFilter,args:[a,l.filter]}),t.deepEqual(s.minzoom,l.minzoom)&&t.deepEqual(s.maxzoom,l.maxzoom)||r.push({command:Vt.setLayerZoomRange,args:[a,l.minzoom,l.maxzoom]}),s)s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Wt(s[c],l[c],r,a,c.slice(6),Vt.setPaintProperty):t.deepEqual(s[c],l[c])||r.push({command:Vt.setLayerProperty,args:[a,c,l[c]]}));for(c in l)l.hasOwnProperty(c)&&!s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Wt(s[c],l[c],r,a,c.slice(6),Vt.setPaintProperty):t.deepEqual(s[c],l[c])||r.push({command:Vt.setLayerProperty,args:[a,c,l[c]]}))}else r.push({command:Vt.removeLayer,args:[a]}),u=m[m.lastIndexOf(a)+1],r.push({command:Vt.addLayer,args:[l,u]})}(a,i.layers,r)}catch(Jn){console.warn("Unable to compute style diff:",Jn),r=[{command:Vt.setStyle,args:[i]}]}return r}(this.serialize(),e).filter((function(t){return!(t.command in Ve)}));if(0===r.length)return!1;var n=r.filter((function(t){return!(t.command in Ne)}));if(n.length>0)throw new Error("Unimplemented: "+n.map((function(t){return t.command})).join(", ")+".");return r.forEach((function(t){"setTransition"!==t.command&&i[t.command].apply(i,t.args)})),this.stylesheet=e,!0},i.prototype.addImage=function(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,i),this._afterImageUpdated(e)},i.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},i.prototype.getImage=function(t){return this.imageManager.getImage(t)},i.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e)},i.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))},i.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},i.prototype.addSource=function(e,i,r){var n=this;if(void 0===r&&(r={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(i).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,i,null,r))){this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Ct(e,i,this.dispatcher);o.style=this,o.setEventedParent(this,(function(){return{isSourceLoaded:n.loaded(),source:o.serialize(),sourceId:e}})),o.onAdd(this.map),this._changed=!0}},i.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+i+'" is using it.')));var r=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],r.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.clearTiles(),r.onRemove&&r.onRemove(this.map),this._changed=!0},i.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},i.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},i.prototype.addLayer=function(e,i,r){void 0===r&&(r={}),this._checkLoaded();var n=e.id;if(this.getLayer(n))this.fire(new t.ErrorEvent(new Error('Layer with id "'+n+'" already exists on this map')));else{var o;if("custom"===e.type){if(Ue(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(n,e.source),e=t.clone$1(e),e=t.extend(e,{source:n})),this._validate(t.validateStyle.layer,"layers."+n,e,{arrayIndex:-1},r))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[o.id]=o.serialize()}var a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.')));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){var s=this._removedLayers[n];delete this._removedLayers[n],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}},i.prototype.moveLayer=function(e,i){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==i){var r=this._order.indexOf(e);this._order.splice(r,1);var n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.'))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},i.prototype.removeLayer=function(e){this._checkLoaded();var i=this._layers[e];if(i){i.setEventedParent(null);var r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},i.prototype.getLayer=function(t){return this._layers[t]},i.prototype.hasLayer=function(t){return t in this._layers},i.prototype.setLayerZoomRange=function(e,i,r){this._checkLoaded();var n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},i.prototype.setFilter=function(e,i,r){void 0===r&&(r={}),this._checkLoaded();var n=this.getLayer(e);if(n){if(!t.deepEqual(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,"layers."+n.id+".filter",i,null,r)||(n.filter=t.clone$1(i),this._updateLayer(n)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},i.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},i.prototype.setLayoutProperty=function(e,i,r,n){void 0===n&&(n={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,n),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},i.prototype.getLayoutProperty=function(e,i){var r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},i.prototype.setPaintProperty=function(e,i,r,n){void 0===n&&(n={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(i),r)||(o.setPaintProperty(i,r,n)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},i.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},i.prototype.setFeatureState=function(e,i){this._checkLoaded();var r=e.source,n=e.sourceLayer,o=this.sourceCaches[r];if(void 0!==o){var a=o.getSource().type;"geojson"===a&&n?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},i.prototype.removeFeatureState=function(e,i){this._checkLoaded();var r=e.source,n=this.sourceCaches[r];if(void 0!==n){var o=n.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},i.prototype.getFeatureState=function(e){this._checkLoaded();var i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(void 0!==n){if("vector"!==n.getSource().type||r)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+i+"' does not exist in the map's style.")))},i.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},i.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},i.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},i.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,i=function(t){return"fill-extrusion"===e._layers[t].type},r={},n=[],o=this._order.length-1;o>=0;o--){var a=this._order[o];if(i(a)){r[a]=o;for(var s=0,l=t;s<l.length;s+=1){var u=l[s][a];if(u)for(var c=0,h=u;c<h.length;c+=1)n.push(h[c])}}}n.sort((function(t,e){return e.intersectionZ-t.intersectionZ}));for(var p=[],d=this._order.length-1;d>=0;d--){var f=this._order[d];if(i(f))for(var m=n.length-1;m>=0;m--){var y=n[m].feature;if(r[y.layer.id]<d)break;p.push(y),n.pop()}else for(var _=0,v=t;_<v.length;_+=1){var g=v[_][f];if(g)for(var x=0,b=g;x<b.length;x+=1)p.push(b[x].feature)}}return p},i.prototype.queryRenderedFeatures=function(e,i,r){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);var n={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var o=0,a=i.layers;o<a.length;o+=1){var s=a[o],l=this._layers[s];if(!l)return this.fire(new t.ErrorEvent(new Error("The layer '"+s+"' does not exist in the map's style and cannot be queried for features."))),[];n[l.source]=!0}}var u=[];for(var c in i.availableImages=this._availableImages,this.sourceCaches)i.layers&&!n[c]||u.push(F(this.sourceCaches[c],this._layers,this._serializedLayers,e,i,r));return this.placement&&u.push(function(t,e,i,r,n,o,a){for(var s={},l=o.queryRenderedSymbols(r),u=[],c=0,h=Object.keys(l).map(Number);c<h.length;c+=1)u.push(a[h[c]]);u.sort(O);for(var p=function(){var i=f[d],r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(var o in r){var a=s[o]=s[o]||[],u=r[o];u.sort((function(t,e){var r=i.featureSortOrder;if(r){var n=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-n}return e.featureIndex-t.featureIndex}));for(var c=0,h=u;c<h.length;c+=1)a.push(h[c])}},d=0,f=u;d<f.length;d+=1)p();var m=function(e){s[e].forEach((function(r){var n=r.feature,o=i[t[e].source].getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o}))};for(var y in s)m(y);return s}(this._layers,this._serializedLayers,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)},i.prototype.querySourceFeatures=function(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);var r=this.sourceCaches[e];return r?function(t,e){for(var i=t.getRenderableIds().map((function(e){return t.getTileByID(e)})),r=[],n={},o=0;o<i.length;o++){var a=i[o],s=a.tileID.canonical.key;n[s]||(n[s]=!0,a.querySourceFeatures(r,e))}return r}(r,i):[]},i.prototype.addSourceType=function(t,e,r){return i.getSourceType(t)?r(new Error('A source type called "'+t+'" already exists.')):(i.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},r):r(null,null))},i.prototype.getLight=function(){return this.light.getLight()},i.prototype.setLight=function(e,i){void 0===i&&(i={}),this._checkLoaded();var r=this.light.getLight(),n=!1;for(var o in e)if(!t.deepEqual(e[o],r[o])){n=!0;break}if(n){var a={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(a)}},i.prototype._validate=function(e,i,r,n,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&Ue(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:r,styleSpec:t.styleSpec},n)))},i.prototype._remove=function(){for(var e in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[e].setEventedParent(null);for(var i in this.sourceCaches)this.sourceCaches[i].clearTiles(),this.sourceCaches[i].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},i.prototype._clearSource=function(t){this.sourceCaches[t].clearTiles()},i.prototype._reloadSource=function(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()},i.prototype._updateSources=function(t){for(var e in this.sourceCaches)this.sourceCaches[e].update(t)},i.prototype._generateCollisionBoxes=function(){for(var t in this.sourceCaches)this._reloadSource(t)},i.prototype._updatePlacement=function(e,i,r,n,o){void 0===o&&(o=!1);for(var a=!1,s=!1,l={},u=0,c=this._order;u<c.length;u+=1){var h=this._layers[c[u]];if("symbol"===h.type){if(!l[h.source]){var p=this.sourceCaches[h.source];l[h.source]=p.getRenderableIds(!0).map((function(t){return p.getTileByID(t)})).sort((function(t,e){return e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)}))}var d=this.crossTileSymbolIndex.addLayer(h,l[h.source],e.center.lng);a=a||d}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Le(e,this._order,o,i,r,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(var f=0,m=this._order;f<m.length;f+=1){var y=this._layers[m[f]];"symbol"===y.type&&this.placement.updateLayerOpacities(y,l[y.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())},i.prototype._releaseSymbolFadeTiles=function(){for(var t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()},i.prototype.getImages=function(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();var r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,e.icons)},i.prototype.getGlyphs=function(t,e,i){this.glyphManager.getGlyphs(e.stacks,i)},i.prototype.getResource=function(e,i,r){return t.makeRequest(i,r)},i}(t.Evented);qe.getSourceType=function(t){return R[t]},qe.setSourceType=function(t,e){R[t]=e},qe.registerForPluginStateChange=t.registerForPluginStateChange;var Ge=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ze=_i("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),We=_i("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),He=_i("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),Xe=_i("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),Ke=_i("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Je=_i("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),Ye=_i("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),Qe=_i("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),$e=_i("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),ti=_i("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),ei=_i("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),ii=_i("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ri=_i("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ni=_i("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),oi=_i("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),ai=_i("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),si=_i("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),li=_i("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),ui=_i("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),ci=_i("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),hi=_i("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),pi=_i("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),di=_i("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),fi=_i("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),mi=_i("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),yi=_i("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function _i(t,e){var i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:t=t.replace(i,(function(t,e,i,r,n){return s[n]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+n+"\nvarying "+i+" "+r+" "+n+";\n#else\nuniform "+i+" "+r+" u_"+n+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+n+"\n "+i+" "+r+" "+n+" = u_"+n+";\n#endif\n"})),vertexSource:e=e.replace(i,(function(t,e,i,r,n){var o="float"===r?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+n+"\nuniform lowp float u_"+n+"_t;\nattribute "+i+" "+o+" a_"+n+";\nvarying "+i+" "+r+" "+n+";\n#else\nuniform "+i+" "+r+" u_"+n+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+n+"\n "+n+" = a_"+n+";\n#else\n "+i+" "+r+" "+n+" = u_"+n+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+n+"\n "+n+" = unpack_mix_"+a+"(a_"+n+", u_"+n+"_t);\n#else\n "+i+" "+r+" "+n+" = u_"+n+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+n+"\nuniform lowp float u_"+n+"_t;\nattribute "+i+" "+o+" a_"+n+";\n#else\nuniform "+i+" "+r+" u_"+n+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+n+"\n "+i+" "+r+" "+n+" = a_"+n+";\n#else\n "+i+" "+r+" "+n+" = u_"+n+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+n+"\n "+i+" "+r+" "+n+" = unpack_mix_"+a+"(a_"+n+", u_"+n+"_t);\n#else\n "+i+" "+r+" "+n+" = u_"+n+";\n#endif\n"})),staticAttributes:r,staticUniforms:a}}var vi=Object.freeze({__proto__:null,prelude:Ze,background:We,backgroundPattern:He,circle:Xe,clippingMask:Ke,heatmap:Je,heatmapTexture:Ye,collisionBox:Qe,collisionCircle:$e,debug:ti,fill:ei,fillOutline:ii,fillOutlinePattern:ri,fillPattern:ni,fillExtrusion:oi,fillExtrusionPattern:ai,hillshadePrepare:si,hillshade:li,line:ui,lineGradient:ci,linePattern:hi,lineSDF:pi,raster:di,symbolIcon:fi,symbolSDF:mi,symbolTextAndIcon:yi}),gi=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function xi(t){for(var e=[],i=0;i<t.length;i++)if(null!==t[i]){var r=t[i].split(" ");e.push(r.pop())}return e}gi.prototype.bind=function(t,e,i,r,n,o,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==r.length,u=0;!l&&u<r.length;u++)this.boundPaintVertexBuffers[u]!==r[u]&&(l=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===i&&!l&&this.boundIndexBuffer===n&&this.boundVertexOffset===o&&this.boundDynamicVertexBuffer===a&&this.boundDynamicVertexBuffer2===s?(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind()):this.freshBind(e,i,r,n,o,a,s)},gi.prototype.freshBind=function(t,e,i,r,n,o,a){var s,l=t.numAttributes,u=this.context,c=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=u.currentNumAttributes||0;for(var h=l;h<s;h++)c.disableVertexAttribArray(h)}e.enableAttributes(c,t);for(var p=0,d=i;p<d.length;p+=1)d[p].enableAttributes(c,t);o&&o.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,n);for(var f=0,m=i;f<m.length;f+=1){var y=m[f];y.bind(),y.setVertexAttribPointers(c,t,n)}o&&(o.bind(),o.setVertexAttribPointers(c,t,n)),r&&r.bind(),a&&(a.bind(),a.setVertexAttribPointers(c,t,n)),u.currentNumAttributes=l},gi.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var bi=function(t,e,i,r,n,o){var a=t.gl;this.program=a.createProgram();for(var s=xi(i.staticAttributes),l=r?r.getBinderAttributes():[],u=s.concat(l),c=i.staticUniforms?xi(i.staticUniforms):[],h=r?r.getBinderUniforms():[],p=[],d=0,f=c.concat(h);d<f.length;d+=1){var m=f[d];p.indexOf(m)<0&&p.push(m)}var y=r?r.defines():[];o&&y.push("#define OVERDRAW_INSPECTOR;");var _=y.concat(Ze.fragmentSource,i.fragmentSource).join("\n"),v=y.concat(Ze.vertexSource,i.vertexSource).join("\n"),g=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(g,_),a.compileShader(g),a.attachShader(this.program,g);var x=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(x,v),a.compileShader(x),a.attachShader(this.program,x),this.attributes={};var b={};this.numAttributes=u.length;for(var w=0;w<this.numAttributes;w++)u[w]&&(a.bindAttribLocation(this.program,w,u[w]),this.attributes[u[w]]=w);a.linkProgram(this.program),a.deleteShader(x),a.deleteShader(g);for(var E=0;E<p.length;E++){var I=p[E];if(I&&!b[I]){var S=a.getUniformLocation(this.program,I);S&&(b[I]=S)}}this.fixedUniforms=n(t,b),this.binderUniforms=r?r.getUniforms(t,b):[]}}};function wi(t,e,i){var r=1/pe(i,1,e.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/n,a=o*(i.tileID.canonical.x+i.tileID.wrap*n),s=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}bi.prototype.draw=function(t,e,i,r,n,o,a,s,l,u,c,h,p,d,f,m){var y,_=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[v].set(a[v]);d&&d.setUniforms(t,this.binderUniforms,h,{zoom:p});for(var g=(y={},y[_.LINES]=2,y[_.TRIANGLES]=3,y[_.LINE_STRIP]=1,y)[e],x=0,b=c.get();x<b.length;x+=1){var w=b[x],E=w.vaos||(w.vaos={});(E[s]||(E[s]=new gi)).bind(t,this,l,d?d.getPaintVertexBuffers():[],u,w.vertexOffset,f,m),_.drawElements(e,w.primitiveLength*g,_.UNSIGNED_SHORT,w.primitiveOffset*g*2)}}};var Ei=function(e,i,r,n){var o=i.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.create$1();"viewport"===o.properties.get("anchor")&&t.fromRotation(l,-i.transform.angle),t.transformMat3(s,s,l);var u=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+r,u_opacity:n}},Ii=function(e,i,r,n,o,a,s){return t.extend(Ei(e,i,r,n),wi(a,i,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8})},Si=function(t){return{u_matrix:t}},Ti=function(e,i,r,n){return t.extend(Si(e),wi(r,i,n))},Ai=function(t,e){return{u_matrix:t,u_world:e}},Pi=function(e,i,r,n,o){return t.extend(Ti(e,i,r,n),{u_world:o})},Mi=function(e,i,r,n){var o,a,s=e.transform;if("map"===n.paint.get("circle-pitch-alignment")){var l=pe(r,1,s.zoom);o=!0,a=[l,l]}else o=!1,a=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===n.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(i.posMatrix,r,n.paint.get("circle-translate"),n.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:a}},Ci=function(t,e,i){var r=pe(i,1,e.zoom),n=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[e.pixelsToGLUnits[0]/(r*n),e.pixelsToGLUnits[1]/(r*n)],u_overscale_factor:o}},zi=function(t,e,i){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:i.cameraToCenterDistance,u_viewport_size:[i.width,i.height]}},ki=function(t,e,i){return void 0===i&&(i=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}},Li=function(t){return{u_matrix:t}},Di=function(t,e,i,r){return{u_matrix:t,u_extrude_scale:pe(e,1,i),u_intensity:r}},Ri=function(e,i,r){var n=e.transform;return{u_matrix:Ni(e,i,r),u_ratio:1/pe(i,1,n.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Bi=function(e,i,r,n){return t.extend(Ri(e,i,r),{u_image:0,u_image_height:n})},Fi=function(e,i,r,n){var o=e.transform,a=Ui(i,o);return{u_matrix:Ni(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:1/pe(i,1,o.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[a,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Oi=function(e,i,r,n,o){var a=e.lineAtlas,s=Ui(i,e.transform),l="round"===r.layout.get("line-cap"),u=a.getDash(n.from,l),c=a.getDash(n.to,l),h=u.width*o.fromScale,p=c.width*o.toScale;return t.extend(Ri(e,i,r),{u_patternscale_a:[s/h,-u.height/2],u_patternscale_b:[s/p,-c.height/2],u_sdfgamma:a.width/(256*Math.min(h,p)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:c.y,u_mix:o.t})};function Ui(t,e){return 1/pe(t,1,e.tileZoom)}function Ni(t,e,i){return t.translatePosMatrix(e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}var Vi=function(t,e,i,r,n){return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(a=n.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=n.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:ji(n.paint.get("raster-hue-rotate"))};var o,a};function ji(t){t*=Math.PI/180;var e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}var qi,Gi=function(t,e,i,r,n,o,a,s,l,u){var c=n.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:c.width/c.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:u,u_texture:0}},Zi=function(e,i,r,n,o,a,s,l,u,c,h){var p=o.transform;return t.extend(Gi(e,i,r,n,o,a,s,l,u,c),{u_gamma_scale:n?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+h})},Wi=function(e,i,r,n,o,a,s,l,u,c){return t.extend(Zi(e,i,r,n,o,a,s,l,!0,u,!0),{u_texsize_icon:c,u_texture_icon:1})},Hi=function(t,e,i){return{u_matrix:t,u_opacity:e,u_color:i}},Xi=function(e,i,r,n,o,a){return t.extend((s=n,l=a,c=o,h=(u=r).imageManager.getPattern(s.from.toString()),p=u.imageManager.getPattern(s.to.toString()),d=u.imageManager.getPixelSize(),f=d.width,m=d.height,y=Math.pow(2,c.tileID.overscaledZ),_=c.tileSize*Math.pow(2,u.transform.tileZoom)/y,v=_*(c.tileID.canonical.x+c.tileID.wrap*y),g=_*c.tileID.canonical.y,{u_image:0,u_pattern_tl_a:h.tl,u_pattern_br_a:h.br,u_pattern_tl_b:p.tl,u_pattern_br_b:p.br,u_texsize:[f,m],u_mix:l.t,u_pattern_size_a:h.displaySize,u_pattern_size_b:p.displaySize,u_scale_a:l.fromScale,u_scale_b:l.toScale,u_tile_units_to_pixels:1/pe(c,1,u.transform.tileZoom),u_pixel_coord_upper:[v>>16,g>>16],u_pixel_coord_lower:[65535&v,65535&g]}),{u_matrix:e,u_opacity:i});var s,l,u,c,h,p,d,f,m,y,_,v,g},Ki={fillExtrusion:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}},fillExtrusionPattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}},fill:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},fillPattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},fillOutline:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}},fillOutlinePattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},circle:function(e,i){return{u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},collisionBox:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}},collisionCircle:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}},debug:function(e,i){return{u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}},clippingMask:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmap:function(e,i){return{u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmapTexture:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}},hillshade:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}},hillshadePrepare:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}},line:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}},lineGradient:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}},linePattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},lineSDF:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}},raster:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}},symbolIcon:function(e,i){return{u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}},symbolSDF:function(e,i){return{u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},symbolTextAndIcon:function(e,i){return{u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},background:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}},backgroundPattern:function(e,i){return{u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}}};function Ji(e,i,r,n,o,a,s){for(var l=e.context,u=l.gl,c=e.useProgram("collisionBox"),h=[],p=0,d=0,f=0;f<n.length;f++){var m=n[f],y=i.getTile(m),_=y.getBucket(r);if(_){var v=m.posMatrix;0===o[0]&&0===o[1]||(v=e.translatePosMatrix(m.posMatrix,y,o,a));var g=s?_.textCollisionBox:_.iconCollisionBox,x=_.collisionCircleArray;if(x.length>0){var b=t.create(),w=v;t.mul(b,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,_.placementViewportMatrix),h.push({circleArray:x,circleOffset:d,transform:w,invTransform:b}),d=p+=x.length/4}g&&c.draw(l,u.LINES,St.disabled,Tt.disabled,e.colorModeForRenderPass(),Pt.disabled,Ci(v,e.transform,y),r.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,null,e.transform.zoom,null,null,g.collisionVertexBuffer)}}if(s&&h.length){var E=e.useProgram("collisionCircle"),I=new t.StructArrayLayout2f1f2i16;I.resize(4*p),I._trim();for(var S=0,T=0,A=h;T<A.length;T+=1)for(var P=A[T],M=0;M<P.circleArray.length/4;M++){var C=4*M,z=P.circleArray[C+0],k=P.circleArray[C+1],L=P.circleArray[C+2],D=P.circleArray[C+3];I.emplace(S++,z,k,L,D,0),I.emplace(S++,z,k,L,D,1),I.emplace(S++,z,k,L,D,2),I.emplace(S++,z,k,L,D,3)}(!qi||qi.length<2*p)&&(qi=function(e){var i=2*e,r=new t.StructArrayLayout3ui6;r.resize(i),r._trim();for(var n=0;n<i;n++){var o=6*n;r.uint16[o+0]=4*n+0,r.uint16[o+1]=4*n+1,r.uint16[o+2]=4*n+2,r.uint16[o+3]=4*n+2,r.uint16[o+4]=4*n+3,r.uint16[o+5]=4*n+0}return r}(p));for(var R=l.createIndexBuffer(qi,!0),B=l.createVertexBuffer(I,t.collisionCircleLayout.members,!0),F=0,O=h;F<O.length;F+=1){var U=O[F],N=zi(U.transform,U.invTransform,e.transform);E.draw(l,u.TRIANGLES,St.disabled,Tt.disabled,e.colorModeForRenderPass(),Pt.disabled,N,r.id,B,R,t.SegmentVector.simpleSegment(0,2*U.circleOffset,U.circleArray.length,U.circleArray.length/2),null,e.transform.zoom,null,null,null)}B.destroy(),R.destroy()}}var Yi=t.identity(new Float32Array(16));function Qi(e,i,r,n,o,a){var s=t.getAnchorAlignment(e),l=-(s.horizontalAlign-.5)*i,u=-(s.verticalAlign-.5)*r,c=t.evaluateVariableOffset(e,n);return new t.Point((l/o+c[0])*a,(u/o+c[1])*a)}function $i(e,i,r,n,o,a,s,l,u,c,h){var p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,m={};d.clear();for(var y=0;y<p.length;y++){var _=p.get(y),v=_.hidden||!_.crossTileID||e.allowVerticalPlacement&&!_.placedOrientation?null:n[_.crossTileID];if(v){var g=new t.Point(_.anchorX,_.anchorY),x=$t(g,r?l:s),b=te(a.cameraToCenterDistance,x.signedDistanceFromCamera),w=o.evaluateSizeForFeature(e.textSizeData,c,_)*b/t.ONE_EM;r&&(w*=e.tilePixelRatio/u);for(var E=Qi(v.anchor,v.width,v.height,v.textOffset,v.textBoxScale,w),I=r?$t(g.add(E),s).point:x.point.add(i?E.rotate(-a.angle):E),S=e.allowVerticalPlacement&&_.placedOrientation===t.WritingMode.vertical?Math.PI/2:0,T=0;T<_.numGlyphs;T++)t.addDynamicAttributes(d,I,S);h&&_.associatedIconIndex>=0&&(m[_.associatedIconIndex]={shiftedAnchor:I,angle:S})}else ue(_.numGlyphs,d)}if(h){f.clear();for(var A=e.icon.placedSymbolArray,P=0;P<A.length;P++){var M=A.get(P);if(M.hidden)ue(M.numGlyphs,f);else{var C=m[P];if(C)for(var z=0;z<M.numGlyphs;z++)t.addDynamicAttributes(f,C.shiftedAnchor,C.angle);else ue(M.numGlyphs,f)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function tr(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function er(e,i,r,n,o,a,s,l,u,c,h,p){for(var d=e.context,f=d.gl,m=e.transform,y="map"===l,_="map"===u,v=y&&"point"!==r.layout.get("symbol-placement"),g=y&&!_&&!v,x=void 0!==r.layout.get("symbol-sort-key").constantOr(1),b=!1,w=e.depthModeForSublayer(0,St.ReadOnly),E=r.layout.get("text-variable-anchor"),I=[],S=0,T=n;S<T.length;S+=1){var A=T[S],P=i.getTile(A),M=P.getBucket(r);if(M){var C=o?M.text:M.icon;if(C&&C.segments.get().length){var z=C.programConfigurations.get(r.id),k=o||M.sdfIcons,L=o?M.textSizeData:M.iconSizeData,D=_||0!==m.pitch,R=e.useProgram(tr(k,o,M),z),B=t.evaluateSizeForZoom(L,m.zoom),F=void 0,O=[0,0],U=void 0,N=void 0,V=null,j=void 0;if(o)U=P.glyphAtlasTexture,N=f.LINEAR,F=P.glyphAtlasTexture.size,M.iconsInText&&(O=P.imageAtlasTexture.size,V=P.imageAtlasTexture,j=D||e.options.rotating||e.options.zooming||"composite"===L.kind||"camera"===L.kind?f.LINEAR:f.NEAREST);else{var q=1!==r.layout.get("icon-size").constantOr(0)||M.iconsNeedLinear;U=P.imageAtlasTexture,N=k||e.options.rotating||e.options.zooming||q||D?f.LINEAR:f.NEAREST,F=P.imageAtlasTexture.size}var G=pe(P,1,e.transform.zoom),Z=Yt(A.posMatrix,_,y,e.transform,G),W=Qt(A.posMatrix,_,y,e.transform,G),H=E&&M.hasTextData(),X="none"!==r.layout.get("icon-text-fit")&&H&&M.hasIconData();v&&ie(M,A.posMatrix,e,o,Z,W,_,c);var K=e.translatePosMatrix(A.posMatrix,P,a,s),J=v||o&&E||X?Yi:Z,Y=e.translatePosMatrix(W,P,a,s,!0),Q=k&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),$={program:R,buffers:C,uniformValues:k?M.iconsInText?Wi(L.kind,B,g,_,e,K,J,Y,F,O):Zi(L.kind,B,g,_,e,K,J,Y,o,F,!0):Gi(L.kind,B,g,_,e,K,J,Y,o,F),atlasTexture:U,atlasTextureIcon:V,atlasInterpolation:N,atlasInterpolationIcon:j,isSDF:k,hasHalo:Q};if(x&&M.canOverlap){b=!0;for(var tt=0,et=C.segments.get();tt<et.length;tt+=1){var it=et[tt];I.push({segments:new t.SegmentVector([it]),sortKey:it.sortKey,state:$})}}else I.push({segments:C.segments,sortKey:0,state:$})}}}b&&I.sort((function(t,e){return t.sortKey-e.sortKey}));for(var rt=0,nt=I;rt<nt.length;rt+=1){var ot=nt[rt],at=ot.state;if(d.activeTexture.set(f.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,f.CLAMP_TO_EDGE),at.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),at.isSDF){var st=at.uniformValues;at.hasHalo&&(st.u_is_halo=1,ir(at.buffers,ot.segments,r,e,at.program,w,h,p,st)),st.u_is_halo=0}ir(at.buffers,ot.segments,r,e,at.program,w,h,p,at.uniformValues)}}function ir(t,e,i,r,n,o,a,s,l){var u=r.context;n.draw(u,u.gl.TRIANGLES,o,a,s,Pt.disabled,l,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function rr(t,e,i,r,n,o,a){var s,l,u,c,h,p=t.context.gl,d=i.paint.get("fill-pattern"),f=d&&d.constantOr(1),m=i.getCrossfadeParameters();a?(l=f&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",s=p.LINES):(l=f?"fillPattern":"fill",s=p.TRIANGLES);for(var y=0,_=r;y<_.length;y+=1){var v=_[y],g=e.getTile(v);if(!f||g.patternsLoaded()){var x=g.getBucket(i);if(x){var b=x.programConfigurations.get(i.id),w=t.useProgram(l,b);f&&(t.context.activeTexture.set(p.TEXTURE0),g.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),b.updatePaintBuffers(m));var E=d.constantOr(null);if(E&&g.imageAtlas){var I=g.imageAtlas,S=I.patternPositions[E.to.toString()],T=I.patternPositions[E.from.toString()];S&&T&&b.setConstantPatternPositions(S,T)}var A=t.translatePosMatrix(v.posMatrix,g,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(a){c=x.indexBuffer2,h=x.segments2;var P=[p.drawingBufferWidth,p.drawingBufferHeight];u="fillOutlinePattern"===l&&f?Pi(A,t,m,g,P):Ai(A,P)}else c=x.indexBuffer,h=x.segments,u=f?Ti(A,t,m,g):Si(A);w.draw(t.context,s,n,t.stencilModeForClipping(v),o,Pt.disabled,u,i.id,x.layoutVertexBuffer,c,h,i.paint,t.transform.zoom,b)}}}}function nr(t,e,i,r,n,o,a){for(var s=t.context,l=s.gl,u=i.paint.get("fill-extrusion-pattern"),c=u.constantOr(1),h=i.getCrossfadeParameters(),p=i.paint.get("fill-extrusion-opacity"),d=0,f=r;d<f.length;d+=1){var m=f[d],y=e.getTile(m),_=y.getBucket(i);if(_){var v=_.programConfigurations.get(i.id),g=t.useProgram(c?"fillExtrusionPattern":"fillExtrusion",v);c&&(t.context.activeTexture.set(l.TEXTURE0),y.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),v.updatePaintBuffers(h));var x=u.constantOr(null);if(x&&y.imageAtlas){var b=y.imageAtlas,w=b.patternPositions[x.to.toString()],E=b.patternPositions[x.from.toString()];w&&E&&v.setConstantPatternPositions(w,E)}var I=t.translatePosMatrix(m.posMatrix,y,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),S=i.paint.get("fill-extrusion-vertical-gradient"),T=c?Ii(I,t,S,p,m,h,y):Ei(I,t,S,p);g.draw(s,s.gl.TRIANGLES,n,o,a,Pt.backCCW,T,i.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,i.paint,t.transform.zoom,v)}}}function or(e,i,r,n,o,a){var s=e.context,l=s.gl,u=i.fbo;if(u){var c=e.useProgram("hillshade");s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,u.colorAttachment.get());var h=function(e,i,r){var n=r.paint.get("hillshade-shadow-color"),o=r.paint.get("hillshade-highlight-color"),a=r.paint.get("hillshade-accent-color"),s=r.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===r.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);var l,u,c,h=!e.options.moving;return{u_matrix:e.transform.calculatePosMatrix(i.tileID.toUnwrapped(),h),u_image:0,u_latrange:(l=i.tileID,u=Math.pow(2,l.canonical.z),c=l.canonical.y,[new t.MercatorCoordinate(0,c/u).toLngLat().lat,new t.MercatorCoordinate(0,(c+1)/u).toLngLat().lat]),u_light:[r.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:o,u_accent:a}}(e,i,r);c.draw(s,l.TRIANGLES,n,o,a,Pt.disabled,h,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function ar(e,i,r,n,o,a){var s,l,u,c,h=e.context,p=h.gl,d=i.dem;if(d&&d.data){var f=d.dim,m=d.stride,y=d.getPixels();if(h.activeTexture.set(p.TEXTURE1),h.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(m),i.demTexture){var _=i.demTexture;_.update(y,{premultiply:!1}),_.bind(p.NEAREST,p.CLAMP_TO_EDGE)}else i.demTexture=new t.Texture(h,y,p.RGBA,{premultiply:!1}),i.demTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE);h.activeTexture.set(p.TEXTURE0);var v=i.fbo;if(!v){var g=new t.Texture(h,{width:f,height:f,data:null},p.RGBA);g.bind(p.LINEAR,p.CLAMP_TO_EDGE),(v=i.fbo=h.createFramebuffer(f,f,!0)).colorAttachment.set(g.texture)}h.bindFramebuffer.set(v.framebuffer),h.viewport.set([0,0,f,f]),e.useProgram("hillshadePrepare").draw(h,p.TRIANGLES,n,o,a,Pt.disabled,(s=i.tileID,u=(l=d).stride,c=t.create(),t.ortho(c,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(c,c,[0,-t.EXTENT,0]),{u_matrix:c,u_image:1,u_dimension:[u,u],u_zoom:s.overscaledZ,u_unpack:l.getUnpackVector()}),r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function sr(e,i,r,n,o){var a=n.paint.get("raster-fade-duration");if(a>0){var s=t.browser.now(),l=(s-e.timeAdded)/a,u=i?(s-i.timeAdded)/a:-1,c=r.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),d=p&&e.refreshedUponExpiration?1:t.clamp(p?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}var lr=new t.Color(1,0,0,1),ur=new t.Color(0,1,0,1),cr=new t.Color(0,0,1,1),hr=new t.Color(1,0,1,1),pr=new t.Color(0,1,1,1);function dr(t,e,i,r){mr(t,0,e+i/2,t.transform.width,i,r)}function fr(t,e,i,r){mr(t,e-i/2,0,i,t.transform.height,r)}function mr(e,i,r,n,o,a){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.browser.devicePixelRatio,r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}function yr(e,i,r){var n=e.context,o=n.gl,a=r.posMatrix,s=e.useProgram("debug"),l=St.disabled,u=Tt.disabled,c=e.colorModeForRenderPass();n.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(n,o.LINE_STRIP,l,u,c,Pt.disabled,ki(a,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var h=i.getTileByID(r.key).latestRawTileData,p=Math.floor((h&&h.byteLength||0)/1024),d=i.getTile(r).tileSize,f=512/Math.min(d,512)*(r.overscaledZ/e.transform.zoom)*.5,m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=" => "+r.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var i=t.debugOverlayCanvas,r=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,m+" "+p+"kb"),s.draw(n,o.TRIANGLES,l,u,At.alphaBlended,Pt.disabled,ki(a,t.Color.transparent,f),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var _r={symbol:function(e,i,r,n,o){if("translucent"===e.renderPass){var a=Tt.disabled,s=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(e,i,r,n,o,a,s){for(var l=i.transform,u="map"===o,c="map"===a,h=0,p=e;h<p.length;h+=1){var d=p[h],f=n.getTile(d),m=f.getBucket(r);if(m&&m.text&&m.text.segments.get().length){var y=t.evaluateSizeForZoom(m.textSizeData,l.zoom),_=pe(f,1,i.transform.zoom),v=Yt(d.posMatrix,c,u,i.transform,_),g="none"!==r.layout.get("icon-text-fit")&&m.hasIconData();if(y){var x=Math.pow(2,l.zoom-f.tileID.overscaledZ);$i(m,u,c,s,t.symbolSize,l,v,d.posMatrix,x,y,g)}}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&er(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),a,s),0!==r.paint.get("text-opacity").constantOr(1)&&er(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),a,s),i.map.showCollisionBoxes&&(Ji(e,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),Ji(e,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}},circle:function(e,i,r,n){if("translucent"===e.renderPass){var o=r.paint.get("circle-opacity"),a=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1);if(0!==o.constantOr(1)||0!==a.constantOr(1)&&0!==s.constantOr(1)){for(var u=e.context,c=u.gl,h=e.depthModeForSublayer(0,St.ReadOnly),p=Tt.disabled,d=e.colorModeForRenderPass(),f=[],m=0;m<n.length;m++){var y=n[m],_=i.getTile(y),v=_.getBucket(r);if(v){var g=v.programConfigurations.get(r.id),x={programConfiguration:g,program:e.useProgram("circle",g),layoutVertexBuffer:v.layoutVertexBuffer,indexBuffer:v.indexBuffer,uniformValues:Mi(e,y,_,r)};if(l)for(var b=0,w=v.segments.get();b<w.length;b+=1){var E=w[b];f.push({segments:new t.SegmentVector([E]),sortKey:E.sortKey,state:x})}else f.push({segments:v.segments,sortKey:0,state:x})}}l&&f.sort((function(t,e){return t.sortKey-e.sortKey}));for(var I=0,S=f;I<S.length;I+=1){var T=S[I],A=T.state;A.program.draw(u,c.TRIANGLES,h,p,d,Pt.disabled,A.uniformValues,r.id,A.layoutVertexBuffer,A.indexBuffer,T.segments,r.paint,e.transform.zoom,A.programConfiguration)}}}},heatmap:function(e,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var o=e.context,a=o.gl,s=Tt.disabled,l=new At([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){var r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var n,o,a,s,l,u=i.heatmapFbo;if(u)r.bindTexture(r.TEXTURE_2D,u.colorAttachment.get()),t.bindFramebuffer.set(u.framebuffer);else{var c=r.createTexture();r.bindTexture(r.TEXTURE_2D,c),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),u=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),o=e,a=c,s=u,(l=(n=t).gl).texImage2D(l.TEXTURE_2D,0,l.RGBA,o.width/4,o.height/4,0,l.RGBA,n.extRenderToTextureHalfFloat?n.extTextureHalfFloat.HALF_FLOAT_OES:l.UNSIGNED_BYTE,null),s.colorAttachment.set(a)}}(o,e,r),o.clear({color:t.Color.transparent});for(var u=0;u<n.length;u++){var c=n[u];if(!i.hasRenderableParent(c)){var h=i.getTile(c),p=h.getBucket(r);if(p){var d=p.programConfigurations.get(r.id);e.useProgram("heatmap",d).draw(o,a.TRIANGLES,St.disabled,s,l,Pt.disabled,Di(c.posMatrix,h,e.transform.zoom,r.paint.get("heatmap-intensity")),r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,r.paint,e.transform.zoom,d)}}}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){var r=e.context,n=r.gl,o=i.heatmapFbo;if(o){r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);var a=i.colorRampTexture;a||(a=i.colorRampTexture=new t.Texture(r,i.colorRamp,n.RGBA)),a.bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,St.disabled,Tt.disabled,e.colorModeForRenderPass(),Pt.disabled,function(e,i){var r=t.create();t.ortho(r,0,e.width,e.height,0,0,1);var n=e.context.gl;return{u_matrix:r,u_world:[n.drawingBufferWidth,n.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}}(e,i),i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}}(e,r))},line:function(e,i,r,n){if("translucent"===e.renderPass){var o=r.paint.get("line-opacity"),a=r.paint.get("line-width");if(0!==o.constantOr(1)&&0!==a.constantOr(1))for(var s=e.depthModeForSublayer(0,St.ReadOnly),l=e.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),c=r.paint.get("line-pattern"),h=c.constantOr(1),p=r.paint.get("line-gradient"),d=r.getCrossfadeParameters(),f=h?"linePattern":u?"lineSDF":p?"lineGradient":"line",m=e.context,y=m.gl,_=!0,v=0,g=n;v<g.length;v+=1){var x=g[v],b=i.getTile(x);if(!h||b.patternsLoaded()){var w=b.getBucket(r);if(w){var E=w.programConfigurations.get(r.id),I=e.context.program.get(),S=e.useProgram(f,E),T=_||S.program!==I,A=c.constantOr(null);if(A&&b.imageAtlas){var P=b.imageAtlas,M=P.patternPositions[A.to.toString()],C=P.patternPositions[A.from.toString()];M&&C&&E.setConstantPatternPositions(M,C)}var z=h?Fi(e,b,r,d):u?Oi(e,b,r,u,d):p?Bi(e,b,r,w.lineClipsArray.length):Ri(e,b,r);if(h)m.activeTexture.set(y.TEXTURE0),b.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),E.updatePaintBuffers(d);else if(u&&(T||e.lineAtlas.dirty))m.activeTexture.set(y.TEXTURE0),e.lineAtlas.bind(m);else if(p){var k=w.gradients[r.id],L=k.texture;if(r.gradientVersion!==k.version){var D=256;if(r.stepInterpolant){var R=i.getSource().maxzoom,B=x.canonical.z===R?Math.ceil(1<<e.transform.maxZoom-x.canonical.z):1;D=t.clamp(t.nextPowerOfTwo(w.maxLineLength/t.EXTENT*1024*B),256,m.maxTextureSize)}k.gradient=t.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:D,image:k.gradient||void 0,clips:w.lineClipsArray}),k.texture?k.texture.update(k.gradient):k.texture=new t.Texture(m,k.gradient,y.RGBA),k.version=r.gradientVersion,L=k.texture}m.activeTexture.set(y.TEXTURE0),L.bind(r.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}S.draw(m,y.TRIANGLES,s,e.stencilModeForClipping(x),l,Pt.disabled,z,r.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,r.paint,e.transform.zoom,E,w.layoutVertexBuffer2),_=!1}}}}},fill:function(e,i,r,n){var o=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===u){var c=e.depthModeForSublayer(1,"opaque"===e.renderPass?St.ReadWrite:St.ReadOnly);rr(e,i,r,n,c,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){var h=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,St.ReadOnly);rr(e,i,r,n,h,s,!0)}}},"fill-extrusion":function(t,e,i,r){var n=i.paint.get("fill-extrusion-opacity");if(0!==n&&"translucent"===t.renderPass){var o=new St(t.context.gl.LEQUAL,St.ReadWrite,t.depthRangeFor3D);if(1!==n||i.paint.get("fill-extrusion-pattern").constantOr(1))nr(t,e,i,r,o,Tt.disabled,At.disabled),nr(t,e,i,r,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{var a=t.colorModeForRenderPass();nr(t,e,i,r,o,Tt.disabled,a)}}},hillshade:function(t,e,i,r){if("offscreen"===t.renderPass||"translucent"===t.renderPass){for(var n=t.context,o=t.depthModeForSublayer(0,St.ReadOnly),a=t.colorModeForRenderPass(),s="translucent"===t.renderPass?t.stencilConfigForOverlap(r):[{},r],l=s[0],u=0,c=s[1];u<c.length;u+=1){var h=c[u],p=e.getTile(h);p.needsHillshadePrepare&&"offscreen"===t.renderPass?ar(t,p,i,o,Tt.disabled,a):"translucent"===t.renderPass&&or(t,p,i,o,l[h.overscaledZ],a)}n.viewport.set([0,0,t.width,t.height])}},raster:function(t,e,i,r){if("translucent"===t.renderPass&&0!==i.paint.get("raster-opacity")&&r.length)for(var n=t.context,o=n.gl,a=e.getSource(),s=t.useProgram("raster"),l=t.colorModeForRenderPass(),u=a instanceof k?[{},r]:t.stencilConfigForOverlap(r),c=u[0],h=u[1],p=h[h.length-1].overscaledZ,d=!t.options.moving,f=0,m=h;f<m.length;f+=1){var y=m[f],_=t.depthModeForSublayer(y.overscaledZ-p,1===i.paint.get("raster-opacity")?St.ReadWrite:St.ReadOnly,o.LESS),v=e.getTile(y),g=t.transform.calculatePosMatrix(y.toUnwrapped(),d);v.registerFadeDuration(i.paint.get("raster-fade-duration"));var x=e.findLoadedParent(y,0),b=sr(v,x,e,i,t.transform),w=void 0,E=void 0,I="nearest"===i.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;n.activeTexture.set(o.TEXTURE0),v.texture.bind(I,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(I,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,x.tileID.overscaledZ-v.tileID.overscaledZ),E=[v.tileID.canonical.x*w%1,v.tileID.canonical.y*w%1]):v.texture.bind(I,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);var S=Vi(g,E||[0,0],w||1,b,i);a instanceof k?s.draw(n,o.TRIANGLES,_,Tt.disabled,l,Pt.disabled,S,i.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(n,o.TRIANGLES,_,c[y.overscaledZ],l,Pt.disabled,S,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,i){var r=i.paint.get("background-color"),n=i.paint.get("background-opacity");if(0!==n){var o=t.context,a=o.gl,s=t.transform,l=s.tileSize,u=i.paint.get("background-pattern");if(!t.isPatternMissing(u)){var c=!u&&1===r.a&&1===n&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===c){var h=Tt.disabled,p=t.depthModeForSublayer(0,"opaque"===c?St.ReadWrite:St.ReadOnly),d=t.colorModeForRenderPass(),f=t.useProgram(u?"backgroundPattern":"background"),m=s.coveringTiles({tileSize:l});u&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));for(var y=i.getCrossfadeParameters(),_=0,v=m;_<v.length;_+=1){var g=v[_],x=t.transform.calculatePosMatrix(g.toUnwrapped()),b=u?Xi(x,n,t,u,{tileID:g,tileSize:l},y):Hi(x,n,r);f.draw(o,a.TRIANGLES,p,h,d,Pt.disabled,b,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}}}},debug:function(t,e,i){for(var r=0;r<i.length;r++)yr(t,e,i[r])},custom:function(t,e,i){var r=t.context,n=i.implementation;if("offscreen"===t.renderPass){var o=n.prerender;o&&(t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),o.call(n,r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),r.setStencilMode(Tt.disabled);var a="3d"===n.renderingMode?new St(t.context.gl.LEQUAL,St.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,St.ReadOnly);r.setDepthMode(a),n.render(r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState(),r.bindFramebuffer.set(null)}}},vr=function(t,e){this.context=new Mt(t),this.transform=e,this._tileTextures={},this.setup(),this.numSublayers=Ct.maxUnderzooming+Ct.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Oe,this.gpuTimers={}};vr.prototype.resize=function(e,i){if(this.width=e*t.browser.devicePixelRatio,this.height=i*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var r=0,n=this.style._order;r<n.length;r+=1)this.style._layers[n[r]].resize()},vr.prototype.setup=function(){var e=this.context,i=new t.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,Ge.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var r=new t.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(r,Ge.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);var n=new t.StructArrayLayout4i8;n.emplaceBack(0,0,0,0),n.emplaceBack(t.EXTENT,0,t.EXTENT,0),n.emplaceBack(0,t.EXTENT,0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(n,z.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);var o=new t.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,Ge.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);var a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);var s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new t.Texture(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);var l=this.context.gl;this.stencilClearMode=new Tt({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)},vr.prototype.clearStencil=function(){var e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var r=t.create();t.ortho(r,0,this.width,this.height,0,0,1),t.scale(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,St.disabled,this.stencilClearMode,At.disabled,Pt.disabled,Li(r),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},vr.prototype._renderTileClippingMasks=function(t,e){if(this.currentStencilSource!==t.source&&t.isTileClipped()&&e&&e.length){this.currentStencilSource=t.source;var i=this.context,r=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(At.disabled),i.setDepthMode(St.disabled);var n=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var o=0,a=e;o<a.length;o+=1){var s=a[o],l=this._tileClippingMaskIDs[s.key]=this.nextStencilID++;n.draw(i,r.TRIANGLES,St.disabled,new Tt({func:r.ALWAYS,mask:0},l,255,r.KEEP,r.KEEP,r.REPLACE),At.disabled,Pt.disabled,Li(s.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},vr.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Tt({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},vr.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Tt({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},vr.prototype.stencilConfigForOverlap=function(t){var e,i=this.context.gl,r=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),n=r[r.length-1].overscaledZ,o=r[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();for(var a={},s=0;s<o;s++)a[s+n]=new Tt({func:i.GEQUAL,mask:255},s+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=o,[a,r]}return[(e={},e[n]=Tt.disabled,e),r]},vr.prototype.colorModeForRenderPass=function(){var e=this.context.gl;return this._showOverdrawInspector?new At([e.CONSTANT_COLOR,e.ONE],new t.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?At.unblended:At.alphaBlended},vr.prototype.depthModeForSublayer=function(t,e,i){if(!this.opaquePassEnabledForLayer())return St.disabled;var r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new St(i||this.context.gl.LEQUAL,e,[r,r])},vr.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},vr.prototype.render=function(e,i){var r=this;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();var n=this.style._order,o=this.style.sourceCaches;for(var a in o){var s=o[a];s.used&&s.prepare(this.context)}var l,u,c={},h={},p={};for(var d in o){var f=o[d];c[d]=f.getVisibleCoordinates(),h[d]=c[d].slice().reverse(),p[d]=f.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var m=0;m<n.length;m++)if(this.style._layers[n[m]].is3D()){this.opaquePassCutoff=m;break}this.renderPass="offscreen";for(var y=0,_=n;y<_.length;y+=1){var v=this.style._layers[_[y]];if(v.hasOffscreenPass()&&!v.isHidden(this.transform.zoom)){var g=h[v.source];("custom"===v.type||g.length)&&this.renderLayer(this,o[v.source],v,g)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){var x=this.style._layers[n[this.currentLayer]],b=o[x.source],w=c[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){var E=this.style._layers[n[this.currentLayer]],I=o[E.source],S=("symbol"===E.type?p:h)[E.source];this._renderTileClippingMasks(E,c[E.source]),this.renderLayer(this,I,E,S)}this.options.showTileBoundaries&&(t.values(this.style._layers).forEach((function(t){t.source&&!t.isHidden(r.transform.zoom)&&(t.source!==(u&&u.id)&&(u=r.style.sourceCaches[t.source]),(!l||l.getSource().maxzoom<u.getSource().maxzoom)&&(l=u))})),l&&_r.debug(this,l,l.getVisibleCoordinates())),this.options.showPadding&&function(t){var e=t.transform.padding;dr(t,t.transform.height-(e.top||0),3,lr),dr(t,e.bottom||0,3,ur),fr(t,e.left||0,3,cr),fr(t,t.transform.width-(e.right||0),3,hr);var i,r,n,o,a=t.transform.centerPoint;i=t,r=a.x,n=t.transform.height-a.y,mr(i,r-1,n-10,2,20,o=pr),mr(i,r-10,n-1,20,2,o)}(this),this.context.setDefault()},vr.prototype.renderLayer=function(t,e,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||r.length)&&(this.id=i.id,this.gpuTimingStart(i),_r[i.type](t,e,i,r,this.style.placement.variableOffsets),this.gpuTimingEnd())},vr.prototype.gpuTimingStart=function(t){if(this.options.gpuTiming){var e=this.context.extTimerQuery,i=this.gpuTimers[t.id];i||(i=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),i.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,i.query)}},vr.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}},vr.prototype.collectGpuTimers=function(){var t=this.gpuTimers;return this.gpuTimers={},t},vr.prototype.queryGpuTimers=function(t){var e={};for(var i in t){var r=t[i],n=this.context.extTimerQuery,o=n.getQueryObjectEXT(r.query,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(r.query),e[i]=o}return e},vr.prototype.translatePosMatrix=function(e,i,r,n,o){if(!r[0]&&!r[1])return e;var a=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(a){var s=Math.sin(a),l=Math.cos(a);r=[r[0]*l-r[1]*s,r[0]*s+r[1]*l]}var u=[o?r[0]:pe(i,r[0],this.transform.zoom),o?r[1]:pe(i,r[1],this.transform.zoom),0],c=new Float32Array(16);return t.translate(c,e,u),c},vr.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},vr.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},vr.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i},vr.prototype.useProgram=function(t,e){this.cache=this.cache||{};var i=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[i]||(this.cache[i]=new bi(this.context,t,vi[t],e,Ki[t],this._showOverdrawInspector)),this.cache[i]},vr.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},vr.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},vr.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},vr.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var gr=function(t,e){this.points=t,this.planes=e};gr.fromInvProjectionMatrix=function(e,i,r){var n=Math.pow(2,r),o=[[-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((function(i){return t.transformMat4([],i,e)})).map((function(e){return t.scale$1([],e,1/e[3]/i*n)})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var i=t.sub([],o[e[0]],o[e[1]]),r=t.sub([],o[e[2]],o[e[1]]),n=t.normalize([],t.cross([],i,r)),a=-t.dot(n,o[e[1]]);return n.concat(a)}));return new gr(o,a)};var xr=function(e,i){this.min=e,this.max=i,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};xr.prototype.quadrant=function(e){for(var i=[e%2==0,e<2],r=t.clone$2(this.min),n=t.clone$2(this.max),o=0;o<i.length;o++)r[o]=i[o]?this.min[o]:this.center[o],n[o]=i[o]?this.center[o]:this.max[o];return n[2]=this.max[2],new xr(r,n)},xr.prototype.distanceX=function(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]},xr.prototype.distanceY=function(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]},xr.prototype.intersects=function(e){for(var i=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],r=!0,n=0;n<e.planes.length;n++){for(var o=e.planes[n],a=0,s=0;s<i.length;s++)a+=t.dot$1(o,i[s])>=0;if(0===a)return 0;a!==i.length&&(r=!1)}if(r)return 2;for(var l=0;l<3;l++){for(var u=Number.MAX_VALUE,c=-Number.MAX_VALUE,h=0;h<e.points.length;h++){var p=e.points[h][l]-this.min[l];u=Math.min(u,p),c=Math.max(c,p)}if(c<0||u>this.max[l]-this.min[l])return 0}return 1};var br=function(t,e,i,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r};br.prototype.interpolate=function(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,r)),this},br.prototype.getCenter=function(e,i){var r=t.clamp((this.left+e-this.right)/2,0,e),n=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.Point(r,n)},br.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},br.prototype.clone=function(){return new br(this.top,this.bottom,this.left,this.right)},br.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var wr=function(e,i,r,n,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==r?0:r,this._maxPitch=null==n?60:n,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new br,this._posMatrixCache={},this._alignedPosMatrixCache={}},Er={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};wr.prototype.clone=function(){var t=new wr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},Er.minZoom.get=function(){return this._minZoom},Er.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Er.maxZoom.get=function(){return this._maxZoom},Er.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Er.minPitch.get=function(){return this._minPitch},Er.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Er.maxPitch.get=function(){return this._maxPitch},Er.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Er.renderWorldCopies.get=function(){return this._renderWorldCopies},Er.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Er.worldSize.get=function(){return this.tileSize*this.scale},Er.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Er.size.get=function(){return new t.Point(this.width,this.height)},Er.bearing.get=function(){return-this.angle/Math.PI*180},Er.bearing.set=function(e){var i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Er.pitch.get=function(){return this._pitch/Math.PI*180},Er.pitch.set=function(e){var i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())},Er.fov.get=function(){return this._fov/Math.PI*180},Er.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Er.zoom.get=function(){return this._zoom},Er.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},Er.center.get=function(){return this._center},Er.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Er.padding.get=function(){return this._edgeInsets.toJSON()},Er.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Er.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},wr.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},wr.prototype.interpolatePadding=function(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()},wr.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},wr.prototype.getVisibleUnwrappedCoordinates=function(e){var i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var r=this.pointCoordinate(new t.Point(0,0)),n=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(r.x,n.x,o.x,a.x)),l=Math.floor(Math.max(r.x,n.x,o.x,a.x)),u=s-1;u<=l+1;u++)0!==u&&i.push(new t.UnwrappedTileID(u,e));return i},wr.prototype.coveringTiles=function(e){var i=this.coveringZoomLevel(e),r=i;if(void 0!==e.minzoom&&i<e.minzoom)return[];void 0!==e.maxzoom&&i>e.maxzoom&&(i=e.maxzoom);var n=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,i),a=[o*n.x,o*n.y,0],s=gr.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=i);var u=function(t){return{aabb:new xr([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},c=[],h=[],p=i,d=e.reparseOverscaled?r:i;if(this._renderWorldCopies)for(var f=1;f<=3;f++)c.push(u(-f)),c.push(u(f));for(c.push(u(0));c.length>0;){var m=c.pop(),y=m.x,_=m.y,v=m.fullyVisible;if(!v){var g=m.aabb.intersects(s);if(0===g)continue;v=2===g}var x=m.aabb.distanceX(a),b=m.aabb.distanceY(a),w=Math.max(Math.abs(x),Math.abs(b));if(m.zoom===p||w>3+(1<<p-m.zoom)-2&&m.zoom>=l)h.push({tileID:new t.OverscaledTileID(m.zoom===p?d:m.zoom,m.wrap,m.zoom,y,_),distanceSq:t.sqrLen([a[0]-.5-y,a[1]-.5-_])});else for(var E=0;E<4;E++){var I=(y<<1)+E%2,S=(_<<1)+(E>>1);c.push({aabb:m.aabb.quadrant(E),zoom:m.zoom+1,x:I,y:S,wrap:m.wrap,fullyVisible:v})}}return h.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},wr.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Er.unmodified.get=function(){return this._unmodified},wr.prototype.zoomScale=function(t){return Math.pow(2,t)},wr.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},wr.prototype.project=function(e){var i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)},wr.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Er.point.get=function(){return this.project(this.center)},wr.prototype.setLocationAtPoint=function(e,i){var r=this.pointCoordinate(i),n=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(r.x-n.x),o.y-(r.y-n.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},wr.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},wr.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},wr.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},wr.prototype.coordinateLocation=function(t){return t.toLngLat()},wr.prototype.pointCoordinate=function(e){var i=[e.x,e.y,0,1],r=[e.x,e.y,1,1];t.transformMat4(i,i,this.pixelMatrixInverse),t.transformMat4(r,r,this.pixelMatrixInverse);var n=i[3],o=r[3],a=i[1]/n,s=r[1]/o,l=i[2]/n,u=r[2]/o,c=l===u?0:(0-l)/(u-l);return new t.MercatorCoordinate(t.number(i[0]/n,r[0]/o,c)/this.worldSize,t.number(a,s,c)/this.worldSize)},wr.prototype.coordinatePoint=function(e){var i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix),new t.Point(i[0]/i[3],i[1]/i[3])},wr.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},wr.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},wr.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},wr.prototype.calculatePosMatrix=function(e,i){void 0===i&&(i=!1);var r=e.key,n=i?this._alignedPosMatrixCache:this._posMatrixCache;if(n[r])return n[r];var o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*a,o.y*a,0]),t.scale(l,l,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),n[r]=new Float32Array(l),n[r]},wr.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},wr.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,i,r,n,o=-90,a=90,s=-180,l=180,u=this.size,c=this._unmodified;if(this.latRange){var h=this.latRange;o=t.mercatorYfromLat(h[1])*this.worldSize,e=(a=t.mercatorYfromLat(h[0])*this.worldSize)-o<u.y?u.y/(a-o):0}if(this.lngRange){var p=this.lngRange;s=t.mercatorXfromLng(p[0])*this.worldSize,i=(l=t.mercatorXfromLng(p[1])*this.worldSize)-s<u.x?u.x/(l-s):0}var d=this.point,f=Math.max(i||0,e||0);if(f)return this.center=this.unproject(new t.Point(i?(l+s)/2:d.x,e?(a+o)/2:d.y)),this.zoom+=this.scaleZoom(f),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var m=d.y,y=u.y/2;m-y<o&&(n=o+y),m+y>a&&(n=a-y)}if(this.lngRange){var _=d.x,v=u.x/2;_-v<s&&(r=s+v),_+v>l&&(r=l-v)}void 0===r&&void 0===n||(this.center=this.unproject(new t.Point(void 0!==r?r:d.x,void 0!==n?n:d.y))),this._unmodified=c,this._constraining=!1}},wr.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var i=Math.PI/2+this._pitch,r=this._fov*(.5+e.y/this.height),n=Math.sin(r)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-i-r,.01,Math.PI-.01)),o=this.point,a=o.x,s=o.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*n+this.cameraToCenterDistance),u=this.height/50,c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,u,l),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-a,-s,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=c,this.invProjMatrix=t.invert([],this.projMatrix);var h=this.width%2/2,p=this.height%2/2,d=Math.cos(this.angle),f=Math.sin(this.angle),m=a-Math.round(a)+d*h+f*p,y=s-Math.round(s)+d*p+f*h,_=new Float64Array(c);if(t.translate(_,_,[m>.5?m-1:m,y>.5?y-1:y,0]),this.alignedProjMatrix=_,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(c=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}},wr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance},wr.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},wr.prototype.getCameraQueryGeometry=function(e){var i=this.getCameraPoint();if(1===e.length)return[e[0],i];for(var r=i.x,n=i.y,o=i.x,a=i.y,s=0,l=e;s<l.length;s+=1){var u=l[s];r=Math.min(r,u.x),n=Math.min(n,u.y),o=Math.max(o,u.x),a=Math.max(a,u.y)}return[new t.Point(r,n),new t.Point(o,n),new t.Point(o,a),new t.Point(r,a),new t.Point(r,n)]},Object.defineProperties(wr.prototype,Er);var Ir=function(e){var i,r,n,o;this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(i=this._updateHashUnthrottled.bind(this),r=!1,n=null,o=function(){n=null,r&&(i(),n=setTimeout(o,300),r=!1)},function(){return r=!0,n||o(),n})};Ir.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Ir.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Ir.prototype.getHashString=function(e){var i=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),a=Math.round(i.lng*o)/o,s=Math.round(i.lat*o)/o,l=this._map.getBearing(),u=this._map.getPitch(),c="";if(c+=e?"/"+a+"/"+s+"/"+r:r+"/"+s+"/"+a,(l||u)&&(c+="/"+Math.round(10*l)/10),u&&(c+="/"+Math.round(u)),this._hashName){var h=this._hashName,p=!1,d=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===h?(p=!0,e+"="+c):t})).filter((function(t){return t}));return p||d.push(h+"="+c),"#"+d.join("&")}return"#"+c},Ir.prototype._getCurrentHash=function(){var e,i=this,r=t.window.location.hash.replace("#","");return this._hashName?(r.split("&").map((function(t){return t.split("=")})).forEach((function(t){t[0]===i._hashName&&(e=t)})),(e&&e[1]||"").split("/")):r.split("/")},Ir.prototype._onHashChange=function(){var t=this._getCurrentHash();if(t.length>=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},Ir.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,e)}catch(Jn){}};var Sr={linearity:.3,easing:t.bezier(0,0,.3,1)},Tr=t.extend({deceleration:2500,maxSpeed:1400},Sr),Ar=t.extend({deceleration:20,maxSpeed:1400},Sr),Pr=t.extend({deceleration:1e3,maxSpeed:360},Sr),Mr=t.extend({deceleration:1e3,maxSpeed:90},Sr),Cr=function(t){this._map=t,this.clear()};function zr(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function kr(e,i,r){var n=r.maxSpeed,o=r.linearity,a=r.deceleration,s=t.clamp(e*o/(i/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}Cr.prototype.clear=function(){this._inertiaBuffer=[]},Cr.prototype.record=function(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})},Cr.prototype._drainInertiaBuffer=function(){for(var e=this._inertiaBuffer,i=t.browser.now();e.length>0&&i-e[0].time>160;)e.shift()},Cr.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var i={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},r=0,n=this._inertiaBuffer;r<n.length;r+=1){var o=n[r].settings;i.zoom+=o.zoomDelta||0,i.bearing+=o.bearingDelta||0,i.pitch+=o.pitchDelta||0,o.panDelta&&i.pan._add(o.panDelta),o.around&&(i.around=o.around),o.pinchAround&&(i.pinchAround=o.pinchAround)}var a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(i.pan.mag()){var l=kr(i.pan.mag(),a,t.extend({},Tr,e||{}));s.offset=i.pan.mult(l.amount/i.pan.mag()),s.center=this._map.transform.center,zr(s,l)}if(i.zoom){var u=kr(i.zoom,a,Ar);s.zoom=this._map.transform.zoom+u.amount,zr(s,u)}if(i.bearing){var c=kr(i.bearing,a,Pr);s.bearing=this._map.transform.bearing+t.clamp(c.amount,-179,179),zr(s,c)}if(i.pitch){var h=kr(i.pitch,a,Mr);s.pitch=this._map.transform.pitch+h.amount,zr(s,h)}if(s.zoom||s.bearing){var p=void 0===i.pinchAround?i.around:i.pinchAround;s.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),t.extend(s,{noMoveStart:!0})}};var Lr=function(e){function r(r,n,o,a){void 0===a&&(a={});var s=i.mousePos(n.getCanvasContainer(),o),l=n.unproject(s);e.call(this,r,t.extend({point:s,lngLat:l,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r;var n={defaultPrevented:{configurable:!0}};return r.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(r.prototype,n),r}(t.Event),Dr=function(e){function r(r,n,o){var a="touchend"===r?o.changedTouches:o.touches,s=i.touchPos(n.getCanvasContainer(),a),l=s.map((function(t){return n.unproject(t)})),u=s.reduce((function(t,e,i,r){return t.add(e.div(r.length))}),new t.Point(0,0)),c=n.unproject(u);e.call(this,r,{points:s,point:u,lngLats:l,lngLat:c,originalEvent:o}),this._defaultPrevented=!1}e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r;var n={defaultPrevented:{configurable:!0}};return r.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(r.prototype,n),r}(t.Event),Rr=function(t){function e(e,i,r){t.call(this,e,{originalEvent:r}),this._defaultPrevented=!1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var i={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,i),e}(t.Event),Br=function(t,e){this._map=t,this._clickTolerance=e.clickTolerance};Br.prototype.reset=function(){delete this._mousedownPos},Br.prototype.wheel=function(t){return this._firePreventable(new Rr(t.type,this._map,t))},Br.prototype.mousedown=function(t,e){return this._mousedownPos=e,this._firePreventable(new Lr(t.type,this._map,t))},Br.prototype.mouseup=function(t){this._map.fire(new Lr(t.type,this._map,t))},Br.prototype.click=function(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Lr(t.type,this._map,t))},Br.prototype.dblclick=function(t){return this._firePreventable(new Lr(t.type,this._map,t))},Br.prototype.mouseover=function(t){this._map.fire(new Lr(t.type,this._map,t))},Br.prototype.mouseout=function(t){this._map.fire(new Lr(t.type,this._map,t))},Br.prototype.touchstart=function(t){return this._firePreventable(new Dr(t.type,this._map,t))},Br.prototype.touchmove=function(t){this._map.fire(new Dr(t.type,this._map,t))},Br.prototype.touchend=function(t){this._map.fire(new Dr(t.type,this._map,t))},Br.prototype.touchcancel=function(t){this._map.fire(new Dr(t.type,this._map,t))},Br.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},Br.prototype.isEnabled=function(){return!0},Br.prototype.isActive=function(){return!1},Br.prototype.enable=function(){},Br.prototype.disable=function(){};var Fr=function(t){this._map=t};Fr.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fr.prototype.mousemove=function(t){this._map.fire(new Lr(t.type,this._map,t))},Fr.prototype.mousedown=function(){this._delayContextMenu=!0},Fr.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Lr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fr.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Lr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fr.prototype.isEnabled=function(){return!0},Fr.prototype.isActive=function(){return!1},Fr.prototype.enable=function(){},Fr.prototype.disable=function(){};var Or=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Ur(t,e){for(var i={},r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}Or.prototype.isEnabled=function(){return!!this._enabled},Or.prototype.isActive=function(){return!!this._active},Or.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Or.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Or.prototype.mousedown=function(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(i.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)},Or.prototype.mousemoveWindow=function(t,e){if(this._active){var r=e;if(!(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)){var n=this._startPos;this._lastPos=r,this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var o=Math.min(n.x,r.x),a=Math.max(n.x,r.x),s=Math.min(n.y,r.y),l=Math.max(n.y,r.y);i.setTransform(this._box,"translate("+o+"px,"+s+"px)"),this._box.style.width=a-o+"px",this._box.style.height=l-s+"px"}}},Or.prototype.mouseupWindow=function(e,r){var n=this;if(this._active&&0===e.button){var o=this._startPos,a=r;if(this.reset(),i.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:function(t){return t.fitScreenCoordinates(o,a,n._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",e)}},Or.prototype.keydown=function(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))},Or.prototype.blur=function(){this.reset()},Or.prototype.reset=function(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos},Or.prototype._fireEvent=function(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))};var Nr=function(t){this.reset(),this.numTouches=t.numTouches};Nr.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},Nr.prototype.touchstart=function(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){for(var i=new t.Point(0,0),r=0,n=e;r<n.length;r+=1)i._add(n[r]);return i.div(e.length)}(i),this.touches=Ur(r,i)))},Nr.prototype.touchmove=function(t,e,i){if(!this.aborted&&this.centroid){var r=Ur(i,e);for(var n in this.touches){var o=r[n];(!o||o.dist(this.touches[n])>30)&&(this.aborted=!0)}}},Nr.prototype.touchend=function(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){var r=!this.aborted&&this.centroid;if(this.reset(),r)return r}};var Vr=function(t){this.singleTap=new Nr(t),this.numTaps=t.numTaps,this.reset()};Vr.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Vr.prototype.touchstart=function(t,e,i){this.singleTap.touchstart(t,e,i)},Vr.prototype.touchmove=function(t,e,i){this.singleTap.touchmove(t,e,i)},Vr.prototype.touchend=function(t,e,i){var r=this.singleTap.touchend(t,e,i);if(r){var n=t.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(r)<30;if(n&&o||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}};var jr=function(){this._zoomIn=new Vr({numTouches:1,numTaps:2}),this._zoomOut=new Vr({numTouches:2,numTaps:1}),this.reset()};jr.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},jr.prototype.touchstart=function(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)},jr.prototype.touchmove=function(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)},jr.prototype.touchend=function(t,e,i){var r=this,n=this._zoomIn.touchend(t,e,i),o=this._zoomOut.touchend(t,e,i);return n?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(n)},{originalEvent:t})}}):o?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(o)},{originalEvent:t})}}):void 0},jr.prototype.touchcancel=function(){this.reset()},jr.prototype.enable=function(){this._enabled=!0},jr.prototype.disable=function(){this._enabled=!1,this.reset()},jr.prototype.isEnabled=function(){return this._enabled},jr.prototype.isActive=function(){return this._active};var qr={0:1,2:2},Gr=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};Gr.prototype.blur=function(){this.reset()},Gr.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Gr.prototype._correctButton=function(t,e){return!1},Gr.prototype._move=function(t,e){return{}},Gr.prototype.mousedown=function(t,e){if(!this._lastPoint){var r=i.mouseButton(t);this._correctButton(t,r)&&(this._lastPoint=e,this._eventButton=r)}},Gr.prototype.mousemoveWindow=function(t,e){var i,r,n,o=this._lastPoint;if(o)if(t.preventDefault(),i=t,r=this._eventButton,n=qr[r],void 0===i.buttons||(i.buttons&n)!==n)this.reset();else if(this._moved||!(e.dist(o)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(o,e)},Gr.prototype.mouseupWindow=function(t){this._lastPoint&&i.mouseButton(t)===this._eventButton&&(this._moved&&i.suppressClick(),this.reset())},Gr.prototype.enable=function(){this._enabled=!0},Gr.prototype.disable=function(){this._enabled=!1,this.reset()},Gr.prototype.isEnabled=function(){return this._enabled},Gr.prototype.isActive=function(){return this._active};var Zr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.mousedown=function(e,i){t.prototype.mousedown.call(this,e,i),this._lastPoint&&(this._active=!0)},e.prototype._correctButton=function(t,e){return 0===e&&!t.ctrlKey},e.prototype._move=function(t,e){return{around:e,panDelta:e.sub(t)}},e}(Gr),Wr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var i=.8*(e.x-t.x);if(i)return this._active=!0,{bearingDelta:i}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Gr),Hr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var i=-.5*(e.y-t.y);if(i)return this._active=!0,{pitchDelta:i}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Gr),Xr=function(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()};Xr.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new t.Point(0,0)},Xr.prototype.touchstart=function(t,e,i){return this._calculateTransform(t,e,i)},Xr.prototype.touchmove=function(t,e,i){if(this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)},Xr.prototype.touchend=function(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()},Xr.prototype.touchcancel=function(){this.reset()},Xr.prototype._calculateTransform=function(e,i,r){r.length>0&&(this._active=!0);var n=Ur(r,i),o=new t.Point(0,0),a=new t.Point(0,0),s=0;for(var l in n){var u=n[l],c=this._touches[l];c&&(o._add(u),a._add(u.sub(c)),s++,n[l]=u)}if(this._touches=n,!(s<this._minTouches)&&a.mag()){var h=a.div(s);if(this._sum._add(h),!(this._sum.mag()<this._clickTolerance))return{around:o.div(s),panDelta:h}}},Xr.prototype.enable=function(){this._enabled=!0},Xr.prototype.disable=function(){this._enabled=!1,this.reset()},Xr.prototype.isEnabled=function(){return this._enabled},Xr.prototype.isActive=function(){return this._active};var Kr=function(){this.reset()};function Jr(t,e,i){for(var r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Yr(t,e){return Math.log(t/e)/Math.LN2}Kr.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Kr.prototype._start=function(t){},Kr.prototype._move=function(t,e,i){return{}},Kr.prototype.touchstart=function(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))},Kr.prototype.touchmove=function(t,e,i){if(this._firstTwoTouches){t.preventDefault();var r=this._firstTwoTouches,n=r[1],o=Jr(i,e,r[0]),a=Jr(i,e,n);if(o&&a){var s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}}},Kr.prototype.touchend=function(t,e,r){if(this._firstTwoTouches){var n=this._firstTwoTouches,o=n[1],a=Jr(r,e,n[0]),s=Jr(r,e,o);a&&s||(this._active&&i.suppressClick(),this.reset())}},Kr.prototype.touchcancel=function(){this.reset()},Kr.prototype.enable=function(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around},Kr.prototype.disable=function(){this._enabled=!1,this.reset()},Kr.prototype.isEnabled=function(){return this._enabled},Kr.prototype.isActive=function(){return this._active};var Qr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._distance,delete this._startDistance},e.prototype._start=function(t){this._startDistance=this._distance=t[0].dist(t[1])},e.prototype._move=function(t,e){var i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Yr(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Yr(this._distance,i),pinchAround:e}},e}(Kr);function $r(t,e){return 180*t.angleWith(e)/Math.PI}var tn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},e.prototype._start=function(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])},e.prototype._move=function(t,e){var i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$r(this._vector,i),pinchAround:e}},e.prototype._isBelowThreshold=function(t){this._minDiameter=Math.min(this._minDiameter,t.mag());var e=25/(Math.PI*this._minDiameter)*360,i=$r(t,this._startVector);return Math.abs(i)<e},e}(Kr);function en(t){return Math.abs(t.y)>Math.abs(t.x)}var rn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,en(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,i){var r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,i){if(void 0!==this._valid)return this._valid;var r=t.mag()>=2,n=e.mag()>=2;if(r||n){if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;var o=t.y>0==e.y>0;return en(t)&&en(e)&&o}},e}(Kr),nn={panStep:100,bearingStep:15,pitchStep:10},on=function(){var t=nn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1};function an(t){return t*(2-t)}on.prototype.blur=function(){this.reset()},on.prototype.reset=function(){this._active=!1},on.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var i=0,r=0,n=0,o=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(r=0,n=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:an,zoom:i?Math.round(l)+i*(t.shiftKey?2:1):l,bearing:s.getBearing()+r*e._bearingStep,pitch:s.getPitch()+n*e._pitchStep,offset:[-o*e._panStep,-a*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},on.prototype.enable=function(){this._enabled=!0},on.prototype.disable=function(){this._enabled=!1,this.reset()},on.prototype.isEnabled=function(){return this._enabled},on.prototype.isActive=function(){return this._active},on.prototype.disableRotation=function(){this._rotationDisabled=!0},on.prototype.enableRotation=function(){this._rotationDisabled=!1};var sn=function(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onTimeout"],this)};sn.prototype.setZoomRate=function(t){this._defaultZoomRate=t},sn.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},sn.prototype.isEnabled=function(){return!!this._enabled},sn.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},sn.prototype.isZooming=function(){return!!this._zooming},sn.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},sn.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},sn.prototype.wheel=function(e){if(this.isEnabled()){var i=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,r=t.browser.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%4.000244140625==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}},sn.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},sn.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var r=i.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(r)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},sn.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var i=this._map.transform;if(0!==this._delta){var r="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==n&&(n=1/n);var o="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(o*n))),"wheel"===this._type&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a,s="number"==typeof this._targetZoom?this._targetZoom:i.zoom,l=this._startZoom,u=this._easing,c=!1;if("wheel"===this._type&&l&&u){var h=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),p=u(h);a=t.number(l,s,p),h<1?this._frameId||(this._frameId=!0):c=!0}else a=s,c=!0;return this._active=!0,c&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!c,zoomDelta:a-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},sn.prototype._smoothOutEasing=function(e){var i=t.ease;if(this._prevEase){var r=this._prevEase,n=(t.browser.now()-r.start)/r.duration,o=r.easing(n+.01)-r.easing(n),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);i=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:i},i},sn.prototype.blur=function(){this.reset()},sn.prototype.reset=function(){this._active=!1};var ln=function(t,e){this._clickZoom=t,this._tapZoom=e};ln.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},ln.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},ln.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},ln.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var un=function(){this.reset()};un.prototype.reset=function(){this._active=!1},un.prototype.blur=function(){this.reset()},un.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(i){i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t})}}},un.prototype.enable=function(){this._enabled=!0},un.prototype.disable=function(){this._enabled=!1,this.reset()},un.prototype.isEnabled=function(){return this._enabled},un.prototype.isActive=function(){return this._active};var cn=function(){this._tap=new Vr({numTouches:1,numTaps:1}),this.reset()};cn.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},cn.prototype.touchstart=function(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))},cn.prototype.touchmove=function(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;var r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)},cn.prototype.touchend=function(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)},cn.prototype.touchcancel=function(){this.reset()},cn.prototype.enable=function(){this._enabled=!0},cn.prototype.disable=function(){this._enabled=!1,this.reset()},cn.prototype.isEnabled=function(){return this._enabled},cn.prototype.isActive=function(){return this._active};var hn=function(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i};hn.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},hn.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},hn.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},hn.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var pn=function(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i};pn.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},pn.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},pn.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},pn.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var dn=function(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0};dn.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},dn.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},dn.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},dn.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},dn.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},dn.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var fn=function(t){return t.zoom||t.drag||t.pitch||t.rotate},mn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function yn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var _n=function(e,r){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Cr(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r),t.bindAll(["handleEvent","handleWindowEvent"],this);var n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[t.window,"blur",void 0]];for(var o=0,a=this._listeners;o<a.length;o+=1){var s=a[o],l=s[0];i.addEventListener(l,s[1],l===t.window.document?this.handleWindowEvent:this.handleEvent,s[2])}};_n.prototype.destroy=function(){for(var e=0,r=this._listeners;e<r.length;e+=1){var n=r[e],o=n[0];i.removeEventListener(o,n[1],o===t.window.document?this.handleWindowEvent:this.handleEvent,n[2])}},_n.prototype._addDefaultHandlers=function(t){var e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new Br(e,t));var r=e.boxZoom=new Or(e,t);this._add("boxZoom",r);var n=new jr,o=new un;e.doubleClickZoom=new ln(o,n),this._add("tapZoom",n),this._add("clickZoom",o);var a=new cn;this._add("tapDragZoom",a);var s=e.touchPitch=new rn;this._add("touchPitch",s);var l=new Wr(t),u=new Hr(t);e.dragRotate=new pn(t,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);var c=new Zr(t),h=new Xr(t);e.dragPan=new hn(i,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);var p=new tn,d=new Qr;e.touchZoomRotate=new dn(i,d,p,a),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]);var f=e.scrollZoom=new sn(e,this);this._add("scrollZoom",f,["mousePan"]);var m=e.keyboard=new on;this._add("keyboard",m),this._add("blockableMapEvent",new Fr(e));for(var y=0,_=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];y<_.length;y+=1){var v=_[y];t.interactive&&t[v]&&e[v].enable(t[v])}},_n.prototype._add=function(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e},_n.prototype.stop=function(t){if(!this._updatingCamera){for(var e=0,i=this._handlers;e<i.length;e+=1)i[e].handler.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}},_n.prototype.isActive=function(){for(var t=0,e=this._handlers;t<e.length;t+=1)if(e[t].handler.isActive())return!0;return!1},_n.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},_n.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},_n.prototype.isMoving=function(){return Boolean(fn(this._eventsInProgress))||this.isZooming()},_n.prototype._blockedByActive=function(t,e,i){for(var r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1},_n.prototype.handleWindowEvent=function(t){this.handleEvent(t,t.type+"Window")},_n.prototype._getMapTouches=function(t){for(var e=[],i=0,r=t;i<r.length;i+=1){var n=r[i];this._el.contains(n.target)&&e.push(n)}return e},_n.prototype.handleEvent=function(t,e){this._updatingCamera=!0;for(var r="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},o={},a={},s=t.touches?this._getMapTouches(t.touches):void 0,l=s?i.touchPos(this._el,s):i.mousePos(this._el,t),u=0,c=this._handlers;u<c.length;u+=1){var h=c[u],p=h.handlerName,d=h.handler,f=h.allowed;if(d.isEnabled()){var m=void 0;this._blockedByActive(a,f,p)?d.reset():d[e||t.type]&&(m=d[e||t.type](t,l,s),this.mergeHandlerResult(n,o,m,p,r),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||d.isActive())&&(a[p]=d)}}var y={};for(var _ in this._previousActiveHandlers)a[_]||(y[_]=r);this._previousActiveHandlers=a,(Object.keys(y).length||yn(n))&&(this._changes.push([n,o,y]),this._triggerRenderFrame()),(Object.keys(a).length||yn(n))&&this._map._stop(!0),this._updatingCamera=!1;var v=n.cameraAnimation;v&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],v(this._map))},_n.prototype.mergeHandlerResult=function(e,i,r,n,o){if(r){t.extend(e,r);var a={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=a),void 0!==r.panDelta&&(i.drag=a),void 0!==r.pitchDelta&&(i.pitch=a),void 0!==r.bearingDelta&&(i.rotate=a)}},_n.prototype._applyChanges=function(){for(var e={},i={},r={},n=0,o=this._changes;n<o.length;n+=1){var a=o[n],s=a[0],l=a[1],u=a[2];s.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(s.panDelta)),s.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(e.around=s.around),void 0!==s.pinchAround&&(e.pinchAround=s.pinchAround),s.noInertia&&(e.noInertia=s.noInertia),t.extend(i,l),t.extend(r,u)}this._updateMapTransform(e,i,r),this._changes=[]},_n.prototype._updateMapTransform=function(t,e,i){var r=this._map,n=r.transform;if(!yn(t))return this._fireEvents(e,i,!0);var o=t.panDelta,a=t.zoomDelta,s=t.bearingDelta,l=t.pitchDelta,u=t.around,c=t.pinchAround;void 0!==c&&(u=c),r._stop(!0),u=u||r.transform.centerPoint;var h=n.pointLocation(o?u.sub(o):u);s&&(n.bearing+=s),l&&(n.pitch+=l),a&&(n.zoom+=a),n.setLocationAtPoint(h,u),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)},_n.prototype._fireEvents=function(e,i,r){var n=this,o=fn(this._eventsInProgress),a=fn(e),s={};for(var l in e)this._eventsInProgress[l]||(s[l+"start"]=e[l].originalEvent),this._eventsInProgress[l]=e[l];for(var u in!o&&a&&this._fireEvent("movestart",a.originalEvent),s)this._fireEvent(u,s[u]);for(var c in a&&this._fireEvent("move",a.originalEvent),e)this._fireEvent(c,e[c].originalEvent);var h,p={};for(var d in this._eventsInProgress){var f=this._eventsInProgress[d],m=f.handlerName,y=f.originalEvent;this._handlersById[m].isActive()||(delete this._eventsInProgress[d],p[d+"end"]=h=i[m]||y)}for(var _ in p)this._fireEvent(_,p[_]);var v=fn(this._eventsInProgress);if(r&&(o||a)&&!v){this._updatingCamera=!0;var g=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),x=function(t){return 0!==t&&-n._bearingSnap<t&&t<n._bearingSnap};g?(x(g.bearing||this._map.getBearing())&&(g.bearing=0),this._map.easeTo(g,{originalEvent:h})):(this._map.fire(new t.Event("moveend",{originalEvent:h})),x(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},_n.prototype._fireEvent=function(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))},_n.prototype._requestFrame=function(){var t=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(e){delete t._frameId,t.handleEvent(new mn("renderFrame",{timeStamp:e})),t._applyChanges()}))},_n.prototype._triggerRenderFrame=function(){void 0===this._frameId&&(this._frameId=this._requestFrame())};var vn=function(e){function i(i,r){e.call(this),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=r.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.getCenter=function(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)},i.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},i.prototype.panBy=function(e,i,r){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),r)},i.prototype.panTo=function(e,i,r){return this.easeTo(t.extend({center:e},i),r)},i.prototype.getZoom=function(){return this.transform.zoom},i.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},i.prototype.zoomTo=function(e,i,r){return this.easeTo(t.extend({zoom:e},i),r)},i.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},i.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},i.prototype.getBearing=function(){return this.transform.bearing},i.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},i.prototype.getPadding=function(){return this.transform.padding},i.prototype.setPadding=function(t,e){return this.jumpTo({padding:t},e),this},i.prototype.rotateTo=function(e,i,r){return this.easeTo(t.extend({bearing:e},i),r)},i.prototype.resetNorth=function(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this},i.prototype.resetNorthPitch=function(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this},i.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},i.prototype.getPitch=function(){return this.transform.pitch},i.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},i.prototype.cameraForBounds=function(e,i){e=t.LngLatBounds.convert(e);var r=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,i)},i.prototype._cameraForBoxAndBearing=function(e,i,r,n){var o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){var a=n.padding;n.padding={top:a,bottom:a,right:a,left:a}}n.padding=t.extend(o,n.padding);var s=this.transform,l=s.padding,u=s.project(t.LngLat.convert(e)),c=s.project(t.LngLat.convert(i)),h=u.rotate(-r*Math.PI/180),p=c.rotate(-r*Math.PI/180),d=new t.Point(Math.max(h.x,p.x),Math.max(h.y,p.y)),f=new t.Point(Math.min(h.x,p.x),Math.min(h.y,p.y)),m=d.sub(f),y=(s.width-(l.left+l.right+n.padding.left+n.padding.right))/m.x,_=(s.height-(l.top+l.bottom+n.padding.top+n.padding.bottom))/m.y;if(!(_<0||y<0)){var v=Math.min(s.scaleZoom(s.scale*Math.min(y,_)),n.maxZoom),g="number"==typeof n.offset.x?new t.Point(n.offset.x,n.offset.y):t.Point.convert(n.offset),x=new t.Point((n.padding.left-n.padding.right)/2,(n.padding.top-n.padding.bottom)/2).rotate(r*Math.PI/180),b=g.add(x).mult(s.scale/s.zoomScale(v));return{center:s.unproject(u.add(c).div(2).sub(b)),zoom:v,bearing:r}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},i.prototype.fitBounds=function(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)},i.prototype.fitScreenCoordinates=function(e,i,r,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(i)),r,n),n,o)},i.prototype._fitInternal=function(e,i,r){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this},i.prototype.jumpTo=function(e,i){this.stop();var r=this.transform,n=!1,o=!1,a=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(n=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=t.LngLat.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(o=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(a=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),n&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),o&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),a&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))},i.prototype.easeTo=function(e,i){var r=this;this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);var n=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),u="zoom"in e?+e.zoom:o,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,h="pitch"in e?+e.pitch:s,p="padding"in e?e.padding:n.padding,d=t.Point.convert(e.offset),f=n.centerPoint.add(d),m=n.pointLocation(f),y=t.LngLat.convert(e.center||m);this._normalizeCenter(y);var _,v,g=n.project(m),x=n.project(y).sub(g),b=n.zoomScale(u-o);e.around&&(_=t.LngLat.convert(e.around),v=n.locationPoint(_));var w={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||u!==o,this._rotating=this._rotating||a!==c,this._pitching=this._pitching||h!==s,this._padding=!n.isPaddingEqual(p),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,w),this._ease((function(e){if(r._zooming&&(n.zoom=t.number(o,u,e)),r._rotating&&(n.bearing=t.number(a,c,e)),r._pitching&&(n.pitch=t.number(s,h,e)),r._padding&&(n.interpolatePadding(l,p,e),f=n.centerPoint.add(d)),_)n.setLocationAtPoint(_,v);else{var m=n.zoomScale(n.zoom-o),y=u>o?Math.min(2,b):Math.max(.5,b),w=Math.pow(y,1-e),E=n.unproject(g.add(x.mult(e*w)).mult(m));n.setLocationAtPoint(n.renderWorldCopies?E.wrap():E,f)}r._fireMoveEvents(i)}),(function(t){r._afterEase(i,t)}),e),this},i.prototype._prepareEase=function(e,i,r){void 0===r&&(r={}),this._moving=!0,i||r.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.Event("pitchstart",e))},i.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},i.prototype._afterEase=function(e,i){if(!this._easeId||!i||this._easeId!==i){delete this._easeId;var r=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},i.prototype.flyTo=function(e,i){var r=this;if(!e.essential&&t.browser.prefersReducedMotion){var n=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var o=this.transform,a=this.getZoom(),s=this.getBearing(),l=this.getPitch(),u=this.getPadding(),c="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,p="pitch"in e?+e.pitch:l,d="padding"in e?e.padding:o.padding,f=o.zoomScale(c-a),m=t.Point.convert(e.offset),y=o.centerPoint.add(m),_=o.pointLocation(y),v=t.LngLat.convert(e.center||_);this._normalizeCenter(v);var g=o.project(_),x=o.project(v).sub(g),b=e.curve,w=Math.max(o.width,o.height),E=w/f,I=x.mag();if("minZoom"in e){var S=t.clamp(Math.min(e.minZoom,a,c),o.minZoom,o.maxZoom),T=w/o.zoomScale(S-a);b=Math.sqrt(T/I*2)}var A=b*b;function P(t){var e=(E*E-w*w+(t?-1:1)*A*A*I*I)/(2*(t?E:w)*A*I);return Math.log(Math.sqrt(e*e+1)-e)}function M(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}var z=P(0),k=function(t){return C(z)/C(z+b*t)},L=function(t){return w*((C(z)*(M(e=z+b*t)/C(e))-M(z))/A)/I;var e},D=(P(1)-z)/b;if(Math.abs(I)<1e-6||!isFinite(D)){if(Math.abs(w-E)<1e-6)return this.easeTo(e,i);var R=E<w?-1:1;D=Math.abs(Math.log(E/w))/b,L=function(){return 0},k=function(t){return Math.exp(R*b*t)}}return e.duration="duration"in e?+e.duration:1e3*D/("screenSpeed"in e?+e.screenSpeed/b:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=p!==l,this._padding=!o.isPaddingEqual(d),this._prepareEase(i,!1),this._ease((function(e){var n=e*D,f=1/k(n);o.zoom=1===e?c:a+o.scaleZoom(f),r._rotating&&(o.bearing=t.number(s,h,e)),r._pitching&&(o.pitch=t.number(l,p,e)),r._padding&&(o.interpolatePadding(u,d,e),y=o.centerPoint.add(m));var _=1===e?v:o.unproject(g.add(x.mult(L(n))).mult(f));o.setLocationAtPoint(o.renderWorldCopies?_.wrap():_,y),r._fireMoveEvents(i)}),(function(){return r._afterEase(i)}),e),this},i.prototype.isEasing=function(){return!!this._easeFrameId},i.prototype.stop=function(){return this._stop()},i.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,e)}if(!t){var r=this.handlers;r&&r.stop(!1)}return this},i.prototype._ease=function(e,i,r){!1===r.animate||0===r.duration?(e(1),i()):(this._easeStart=t.browser.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},i.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},i.prototype._normalizeBearing=function(e,i){e=t.wrap(e,-180,180);var r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e},i.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}},i}(t.Evented),gn=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};gn.prototype.getDefaultPosition=function(){return"bottom-right"},gn.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=i.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=i.create("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},gn.prototype.onRemove=function(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},gn.prototype._setElementTitle=function(t,e){var i=this._map._getUIString("AttributionControl."+e);t.title=i,t.setAttribute("aria-label",i)},gn.prototype._toggleAttribution=function(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},gn.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var r=i.reduce((function(t,e,r){return e.value&&(t+=e.key+"="+e.value+(r<i.length-1?"&":"")),t}),"?");e.href=t.config.FEEDBACK_URL+"/"+r+(this._map._hash?this._map._hash.getHashString(!0):""),e.rel="noopener nofollow",this._setElementTitle(e,"MapFeedback")}},gn.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())},gn.prototype._updateAttributions=function(){if(this._map.style){var t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((function(t){return"string"!=typeof t?"":t}))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){var e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}var i=this._map.style.sourceCaches;for(var r in i){var n=i[r];if(n.used){var o=n.getSource();o.attribution&&t.indexOf(o.attribution)<0&&t.push(o.attribution)}}t.sort((function(t,e){return t.length-e.length}));var a=(t=t.filter((function(e,i){for(var r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}))).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},gn.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")};var xn=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};xn.prototype.onAdd=function(t){this._map=t,this._container=i.create("div","mapboxgl-ctrl");var e=i.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},xn.prototype.onRemove=function(){i.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},xn.prototype.getDefaultPosition=function(){return"bottom-left"},xn.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},xn.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},xn.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var bn=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};bn.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},bn.prototype.remove=function(t){for(var e=this._currentlyRunning,i=0,r=e?this._queue.concat(e):this._queue;i<r.length;i+=1){var n=r[i];if(n.id===t)return void(n.cancelled=!0)}},bn.prototype.run=function(t){void 0===t&&(t=0);var e=this._currentlyRunning=this._queue;this._queue=[];for(var i=0,r=e;i<r.length;i+=1){var n=r[i];if(!n.cancelled&&(n.callback(t),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},bn.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var wn={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},En=t.window.HTMLImageElement,In=t.window.HTMLElement,Sn=t.window.ImageBitmap,Tn={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},An=function(r){function n(e){var i=this;if(null!=(e=t.extend({},Tn,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var n=new wr(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(r.call(this,n,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new bn,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},wn,e.locale),this._clickTolerance=e.clickTolerance,this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof In))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return i._update(!1)})),this.on("moveend",(function(){return i._update(!1)})),this.on("zoom",(function(){return i._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new _n(this,e),this._hash=e.hash&&new Ir("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new gn({customAttribution:e.customAttribution})),this.addControl(new xn,e.logoPosition),this.on("style.load",(function(){i.transform.unmodified&&i.jumpTo(i.style.stylesheet)})),this.on("data",(function(e){i._update("style"===e.dataType),i.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){i.fire(new t.Event(e.dataType+"dataloading",e))}))}r&&(n.__proto__=r),(n.prototype=Object.create(r&&r.prototype)).constructor=n;var o={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return n.prototype._getMapId=function(){return this._mapId},n.prototype.addControl=function(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var r=e.onAdd(this);this._controls.push(e);var n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this},n.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this},n.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},n.prototype.resize=function(e){var i=this._containerDimensions(),r=i[0],n=i[1];if(r===this.transform.width&&n===this.transform.height)return this;this._resizeCanvas(r,n),this.transform.resize(r,n),this.painter.resize(r,n);var o=!this._moving;return o&&this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this},n.prototype.getBounds=function(){return this.transform.getBounds()},n.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},n.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},n.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")},n.prototype.getMinZoom=function(){return this.transform.minZoom},n.prototype.setMaxZoom=function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},n.prototype.getMaxZoom=function(){return this.transform.maxZoom},n.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},n.prototype.getMinPitch=function(){return this.transform.minPitch},n.prototype.setMaxPitch=function(t){if((t=null==t?60:t)>60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},n.prototype.getMaxPitch=function(){return this.transform.maxPitch},n.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},n.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},n.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},n.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},n.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},n.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},n.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},n.prototype._createDelegatedListener=function(t,e,i){var r,n=this;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:i,delegates:{mousemove:function(r){var a=n.getLayer(e)?n.queryRenderedFeatures(r.point,{layers:[e]}):[];a.length?o||(o=!0,i.call(n,new Lr(t,n,r.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:i,delegates:{mousemove:function(r){(n.getLayer(e)?n.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,i.call(n,new Lr(t,n,r.originalEvent)))},mouseout:function(e){a&&(a=!1,i.call(n,new Lr(t,n,e.originalEvent)))}}}}return{layer:e,listener:i,delegates:(r={},r[t]=function(t){var r=n.getLayer(e)?n.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,i.call(n,t),delete t.features)},r)}},n.prototype.on=function(t,e,i){if(void 0===i)return r.prototype.on.call(this,t,e);var n=this._createDelegatedListener(t,e,i);for(var o in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n),n.delegates)this.on(o,n.delegates[o]);return this},n.prototype.once=function(t,e,i){if(void 0===i)return r.prototype.once.call(this,t,e);var n=this._createDelegatedListener(t,e,i);for(var o in n.delegates)this.once(o,n.delegates[o]);return this},n.prototype.off=function(t,e,i){var n=this;return void 0===i?r.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(r){for(var o=r[t],a=0;a<o.length;a++){var s=o[a];if(s.layer===e&&s.listener===i){for(var l in s.delegates)n.off(l,s.delegates[l]);return o.splice(a,1),n}}}(this._delegatedListeners),this)},n.prototype.queryRenderedFeatures=function(e,i){if(!this.style)return[];var r;if(void 0!==i||void 0===e||e instanceof t.Point||Array.isArray(e)||(i=e,e=void 0),i=i||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.Point||"number"==typeof e[0])r=[t.Point.convert(e)];else{var n=t.Point.convert(e[0]),o=t.Point.convert(e[1]);r=[n,new t.Point(o.x,n.y),o,new t.Point(n.x,o.y),n]}return this.style.queryRenderedFeatures(r,i,this.transform)},n.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},n.prototype.setStyle=function(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))},n.prototype._getUIString=function(t){var e=this._locale[t];if(null==e)throw new Error("Missing UI string '"+t+"'");return e},n.prototype._updateStyle=function(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new qe(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)},n.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new qe(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},n.prototype._diffStyle=function(e,i){var r=this;if("string"==typeof e){var n=this._requestManager.normalizeStyleURL(e),o=this._requestManager.transformRequest(n,t.ResourceType.Style);t.getJSON(o,(function(e,n){e?r.fire(new t.ErrorEvent(e)):n&&r._updateDiff(n,i)}))}else"object"==typeof e&&this._updateDiff(e,i)},n.prototype._updateDiff=function(e,i){try{this.style.setState(e)&&this._update(!0)}catch(r){t.warnOnce("Unable to perform style diff: "+(r.message||r.error||r)+". Rebuilding the style from scratch."),this._updateStyle(e,i)}},n.prototype.getStyle=function(){if(this.style)return this.style.serialize()},n.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},n.prototype.addSource=function(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)},n.prototype.isSourceLoaded=function(e){var i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},n.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var i=t[e]._tiles;for(var r in i){var n=i[r];if("loaded"!==n.state&&"errored"!==n.state)return!1}}return!0},n.prototype.addSourceType=function(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)},n.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0)},n.prototype.getSource=function(t){return this.style.getSource(t)},n.prototype.addImage=function(e,i,r){void 0===r&&(r={});var n=r.pixelRatio;void 0===n&&(n=1);var o=r.sdf;void 0===o&&(o=!1);var a=r.stretchX,s=r.stretchY,l=r.content;if(this._lazyInitEmptyStyle(),i instanceof En||Sn&&i instanceof Sn){var u=t.browser.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:u.width,height:u.height},u.data),pixelRatio:n,stretchX:a,stretchY:s,content:l,sdf:o,version:0})}else{if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));var c=i;this.style.addImage(e,{data:new t.RGBAImage({width:i.width,height:i.height},new Uint8Array(i.data)),pixelRatio:n,stretchX:a,stretchY:s,content:l,sdf:o,version:0,userImage:c}),c.onAdd&&c.onAdd(this,e)}},n.prototype.updateImage=function(e,i){var r=this.style.getImage(e);if(!r)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var n=i instanceof En||Sn&&i instanceof Sn?t.browser.getImageData(i):i,o=n.width,a=n.height,s=n.data;return void 0===o||void 0===a?this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):o!==r.data.width||a!==r.data.height?this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(r.data.replace(s,!(i instanceof En||Sn&&i instanceof Sn)),void this.style.updateImage(e,r))},n.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},n.prototype.removeImage=function(t){this.style.removeImage(t)},n.prototype.loadImage=function(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),i)},n.prototype.listImages=function(){return this.style.listImages()},n.prototype.addLayer=function(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)},n.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},n.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0)},n.prototype.getLayer=function(t){return this.style.getLayer(t)},n.prototype.setLayerZoomRange=function(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)},n.prototype.setFilter=function(t,e,i){return void 0===i&&(i={}),this.style.setFilter(t,e,i),this._update(!0)},n.prototype.getFilter=function(t){return this.style.getFilter(t)},n.prototype.setPaintProperty=function(t,e,i,r){return void 0===r&&(r={}),this.style.setPaintProperty(t,e,i,r),this._update(!0)},n.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},n.prototype.setLayoutProperty=function(t,e,i,r){return void 0===r&&(r={}),this.style.setLayoutProperty(t,e,i,r),this._update(!0)},n.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},n.prototype.setLight=function(t,e){return void 0===e&&(e={}),this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)},n.prototype.getLight=function(){return this.style.getLight()},n.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},n.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},n.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},n.prototype.getContainer=function(){return this._container},n.prototype.getCanvasContainer=function(){return this._canvasContainer},n.prototype.getCanvas=function(){return this._canvas},n.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]},n.prototype._detectMissingCSS=function(){"rgb(250, 128, 114)"!==t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&t.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")},n.prototype._setupContainer=function(){var t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=i.create("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();var e=this._canvasContainer=i.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=i.create("canvas","mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var r=this._containerDimensions();this._resizeCanvas(r[0],r[1]);var n=this._controlContainer=i.create("div","mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((function(t){o[t]=i.create("div","mapboxgl-ctrl-"+t,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)},n.prototype._resizeCanvas=function(e,i){var r=t.browser.devicePixelRatio||1;this._canvas.width=r*e,this._canvas.height=r*i,this._canvas.style.width=e+"px",this._canvas.style.height=i+"px"},n.prototype._setupPainter=function(){var i=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl",i)||this._canvas.getContext("experimental-webgl",i);r?(this.painter=new vr(r,this.transform),t.webpSupported.testSupport(r)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},n.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},n.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},n.prototype._onMapScroll=function(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},n.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},n.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},n.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},n.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},n.prototype._render=function(e){var i,r=this,n=0,o=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,i),n=t.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),!this._removed){var a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var s=this.transform.zoom,l=t.browser.now();this.style.zoomHistory.update(s,l);var u=new t.EvaluationParameters(s,{now:l,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=u.crossFadingFactor();1===c&&c===this._crossFadingFactor||(a=!0,this._crossFadingFactor=c),this.style.update(u)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var h=t.browser.now()-n;o.endQueryEXT(o.TIME_ELAPSED_EXT,i),setTimeout((function(){var e=o.getQueryObjectEXT(i,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(i),r.fire(new t.Event("gpu-timing-frame",{cpuTime:h,gpuTime:e}))}),50)}if(this.listens("gpu-timing-layer")){var p=this.painter.collectGpuTimers();setTimeout((function(){var e=r.painter.queryGpuTimers(p);r.fire(new t.Event("gpu-timing-layer",{layerTimes:e}))}),50)}var d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0),this}},n.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,i=this._controls;e<i.length;e+=1)i[e].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("orientationchange",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));var r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),Pn(this._canvasContainer),Pn(this._controlContainer),Pn(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),this._removed=!0,this.fire(new t.Event("remove"))},n.prototype.triggerRepaint=function(){var e=this;this.style&&!this._frame&&(this._frame=t.browser.frame((function(t){e._frame=null,e._render(t)})))},n.prototype._onWindowOnline=function(){this._update()},n.prototype._onWindowResize=function(t){this._trackResize&&this.resize({originalEvent:t})._update()},o.showTileBoundaries.get=function(){return!!this._showTileBoundaries},o.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},o.showPadding.get=function(){return!!this._showPadding},o.showPadding.set=function(t){this._showPadding!==t&&(this._showPadding=t,this._update())},o.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},o.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},o.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},o.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},o.repaint.get=function(){return!!this._repaint},o.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},o.vertices.get=function(){return!!this._vertices},o.vertices.set=function(t){this._vertices=t,this._update()},n.prototype._setCacheLimits=function(e,i){t.setCacheLimits(e,i)},o.version.get=function(){return t.version},Object.defineProperties(n.prototype,o),n}(vn);function Pn(t){t.parentNode&&t.parentNode.removeChild(t)}var Mn={showCompass:!0,showZoom:!0,visualizePitch:!1},Cn=function(e){var r=this;this.options=t.extend({},Mn,e),this._container=i.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(function(t){return r._map.zoomIn({},{originalEvent:t})})),i.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(function(t){return r._map.zoomOut({},{originalEvent:t})})),i.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(function(t){r.options.visualizePitch?r._map.resetNorthPitch({},{originalEvent:t}):r._map.resetNorth({},{originalEvent:t})})),this._compassIcon=i.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};Cn.prototype._updateZoomButtons=function(){var t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},Cn.prototype._rotateCompassArrow=function(){var t=this.options.visualizePitch?"scale("+1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)+") rotateX("+this._map.transform.pitch+"deg) rotateZ("+this._map.transform.angle*(180/Math.PI)+"deg)":"rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassIcon.style.transform=t},Cn.prototype.onAdd=function(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new zn(this._map,this._compass,this.options.visualizePitch)),this._container},Cn.prototype.onRemove=function(){i.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map},Cn.prototype._createButton=function(t,e){var r=i.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r},Cn.prototype._setButtonTitle=function(t,e){var i=this._map._getUIString("NavigationControl."+e);t.title=i,t.setAttribute("aria-label",i)};var zn=function(e,r,n){void 0===n&&(n=!1),this._clickTolerance=10,this.element=r,this.mouseRotate=new Wr({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,n&&(this.mousePitch=new Hr({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener(r,"mousedown",this.mousedown),i.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),i.addEventListener(r,"touchmove",this.touchmove),i.addEventListener(r,"touchend",this.touchend),i.addEventListener(r,"touchcancel",this.reset)};function kn(e,i,r){if(e=new t.LngLat(e.lng,e.lat),i){var n=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=r.locationPoint(e).distSqr(i);r.locationPoint(n).distSqr(i)<a?e=n:r.locationPoint(o).distSqr(i)<a&&(e=o)}for(;Math.abs(e.lng-r.center.lng)>180;){var s=r.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=r.width&&s.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}zn.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),i.disableDrag()},zn.prototype.move=function(t,e){var i=this.map,r=this.mouseRotate.mousemoveWindow(t,e);if(r&&r.bearingDelta&&i.setBearing(i.getBearing()+r.bearingDelta),this.mousePitch){var n=this.mousePitch.mousemoveWindow(t,e);n&&n.pitchDelta&&i.setPitch(i.getPitch()+n.pitchDelta)}},zn.prototype.off=function(){var t=this.element;i.removeEventListener(t,"mousedown",this.mousedown),i.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(t,"touchmove",this.touchmove),i.removeEventListener(t,"touchend",this.touchend),i.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},zn.prototype.offTemp=function(){i.enableDrag(),i.removeEventListener(t.window,"mousemove",this.mousemove),i.removeEventListener(t.window,"mouseup",this.mouseup)},zn.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),i.mousePos(this.element,e)),i.addEventListener(t.window,"mousemove",this.mousemove),i.addEventListener(t.window,"mouseup",this.mouseup)},zn.prototype.mousemove=function(t){this.move(t,i.mousePos(this.element,t))},zn.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},zn.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},zn.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},zn.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},zn.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var Ln={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Dn(t,e,i){var r=t.classList;for(var n in Ln)r.remove("mapboxgl-"+i+"-anchor-"+n);r.add("mapboxgl-"+i+"-anchor-"+e)}var Rn,Bn=function(e){function r(r,n){if(e.call(this),(r instanceof t.window.HTMLElement||n)&&(r=t.extend({element:r},n)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&"auto"!==r.pitchAlignment?r.pitchAlignment:this._rotationAlignment,r&&r.element)this._element=r.element,this._offset=t.Point.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=i.create("div"),this._element.setAttribute("aria-label","Map marker");var o=i.createNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height","41px"),o.setAttributeNS(null,"width","27px"),o.setAttributeNS(null,"viewBox","0 0 27 41");var a=i.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");var s=i.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");var l=i.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");for(var u=0,c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];u<c.length;u+=1){var h=c[u],p=i.createNS("http://www.w3.org/2000/svg","ellipse");p.setAttributeNS(null,"opacity","0.04"),p.setAttributeNS(null,"cx","10.5"),p.setAttributeNS(null,"cy","5.80029008"),p.setAttributeNS(null,"rx",h.rx),p.setAttributeNS(null,"ry",h.ry),l.appendChild(p)}var d=i.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"fill",this._color);var f=i.createNS("http://www.w3.org/2000/svg","path");f.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),d.appendChild(f);var m=i.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"fill","#000000");var y=i.createNS("http://www.w3.org/2000/svg","path");y.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),m.appendChild(y);var _=i.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(6.0, 7.0)"),_.setAttributeNS(null,"fill","#FFFFFF");var v=i.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"transform","translate(8.0, 8.0)");var g=i.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");var x=i.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#FFFFFF"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962"),v.appendChild(g),v.appendChild(x),s.appendChild(l),s.appendChild(d),s.appendChild(m),s.appendChild(_),s.appendChild(v),o.appendChild(s),o.setAttributeNS(null,"height",41*this._scale+"px"),o.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(o),this._offset=t.Point.convert(r&&r.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(function(t){t.preventDefault()})),this._element.addEventListener("mousedown",(function(t){t.preventDefault()})),Dn(this._element,this._anchor,"marker"),this._popup=null}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.addTo=function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},r.prototype.remove=function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),i.remove(this._element),this._popup&&this._popup.remove(),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},r.prototype.getElement=function(){return this._element},r.prototype.setPopup=function(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){var e=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[e,-1*(24.6+e)],"bottom-right":[-e,-1*(24.6+e)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this},r.prototype._onKeyPress=function(t){var e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},r.prototype._onMapClick=function(t){var e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},r.prototype.getPopup=function(){return this._popup},r.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},r.prototype._update=function(t){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=kn(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e="rotateZ("+this._rotation+"deg)":"map"===this._rotationAlignment&&(e="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r="rotateX("+this._map.getPitch()+"deg)"),t&&"moveend"!==t.type||(this._pos=this._pos.round()),i.setTransform(this._element,Ln[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+r+" "+e)}},r.prototype.getOffset=function(){return this._offset},r.prototype.setOffset=function(e){return this._offset=t.Point.convert(e),this._update(),this},r.prototype._onMove=function(e){if(!this._isDragging){var i=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},r.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},r.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},r.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},r.prototype.isDraggable=function(){return this._draggable},r.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},r.prototype.getRotation=function(){return this._rotation},r.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},r.prototype.getRotationAlignment=function(){return this._rotationAlignment},r.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},r.prototype.getPitchAlignment=function(){return this._pitchAlignment},r}(t.Evented),Fn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},On=0,Un=!1,Nn=function(e){function r(i){e.call(this),this.options=t.extend({},Fn,i),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.onAdd=function(e){var r;return this._map=e,this._container=i.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),r=this._setupUI,void 0!==Rn?r(Rn):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){r(Rn="denied"!==t.state)})):r(Rn=!!t.window.navigator.geolocation),this._container},r.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,On=0,Un=!1},r.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())},r.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},r.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},r.prototype._updateCamera=function(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),o=t.extend({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),o,{geolocateSource:!0})},r.prototype._updateMarker=function(e){if(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},r.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),r=e.distanceTo(i),n=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=n+"px",this._circleElement.style.height=n+"px"},r.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},r.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Un)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},r.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},r.prototype._setupUI=function(e){var r=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=i.create("button","mapboxgl-ctrl-geolocate",this._container),i.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Bn(this._dotElement),this._circleElement=i.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Bn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==r._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(r._watchState="BACKGROUND",r._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),r._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),r.fire(new t.Event("trackuserlocationend")))}))},r.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":On--,Un=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++On>1?(e={maximumAge:6e5,timeout:0},Un=!0):(e=this.options.positionOptions,Un=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},r.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},r}(t.Evented),Vn={maxWidth:100,unit:"metric"},jn=function(e){this.options=t.extend({},Vn,e),t.bindAll(["_onMove","setUnit"],this)};function qn(t,e,i){var r=i&&i.maxWidth||100,n=t._container.clientHeight/2,o=t.unproject([0,n]),a=t.unproject([r,n]),s=o.distanceTo(a);if(i&&"imperial"===i.unit){var l=3.2808*s;l>5280?Gn(e,r,l/5280,t._getUIString("ScaleControl.Miles")):Gn(e,r,l,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Gn(e,r,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Gn(e,r,s/1e3,t._getUIString("ScaleControl.Kilometers")):Gn(e,r,s,t._getUIString("ScaleControl.Meters"))}function Gn(t,e,i,r){var n,o,a,s,l,u=(n=i,(o=Math.pow(10,(""+Math.floor(n)).length-1))*(a=(a=n/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:(s=a,l=Math.pow(10,Math.ceil(-Math.log(s)/Math.LN10)),Math.round(s*l)/l)));t.style.width=e*(u/i)+"px",t.innerHTML=u+" "+r}jn.prototype.getDefaultPosition=function(){return"bottom-left"},jn.prototype._onMove=function(){qn(this._map,this._container,this.options)},jn.prototype.onAdd=function(t){return this._map=t,this._container=i.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},jn.prototype.onRemove=function(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},jn.prototype.setUnit=function(t){this.options.unit=t,qn(this._map,this._container,this.options)};var Zn=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};Zn.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Zn.prototype.onRemove=function(){i.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Zn.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Zn.prototype._setupUI=function(){var e=this._fullscreenButton=i.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);i.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Zn.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},Zn.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Zn.prototype._isFullscreen=function(){return this._fullscreen},Zn.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},Zn.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Wn={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Hn=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Xn=function(e){function r(i){e.call(this),this.options=t.extend(Object.create(Wn),i),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},r.prototype.isOpen=function(){return!!this._map},r.prototype.remove=function(){return this._content&&i.remove(this._content),this._container&&(i.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},r.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},r.prototype.getElement=function(){return this._container},r.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},r.prototype.setHTML=function(e){var i,r=t.window.document.createDocumentFragment(),n=t.window.document.createElement("body");for(n.innerHTML=e;i=n.firstChild;)r.appendChild(i);return this.setDOMContent(r)},r.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},r.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},r.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},r.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},r.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},r.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},r.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},r.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=i.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},r.prototype._onMouseUp=function(t){this._update(t.point)},r.prototype._onMouseMove=function(t){this._update(t.point)},r.prototype._onDrag=function(t){this._update(t.point)},r.prototype._update=function(e){var r=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=i.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=i.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return r._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=kn(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var n=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),o=this.options.anchor,a=function e(i){if(i){if("number"==typeof i){var r=Math.round(Math.sqrt(.5*Math.pow(i,2)));return{center:new t.Point(0,0),top:new t.Point(0,i),"top-left":new t.Point(r,r),"top-right":new t.Point(-r,r),bottom:new t.Point(0,-i),"bottom-left":new t.Point(r,-r),"bottom-right":new t.Point(-r,-r),left:new t.Point(i,0),right:new t.Point(-i,0)}}if(i instanceof t.Point||Array.isArray(i)){var n=t.Point.convert(i);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{center:t.Point.convert(i.center||[0,0]),top:t.Point.convert(i.top||[0,0]),"top-left":t.Point.convert(i["top-left"]||[0,0]),"top-right":t.Point.convert(i["top-right"]||[0,0]),bottom:t.Point.convert(i.bottom||[0,0]),"bottom-left":t.Point.convert(i["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(i["bottom-right"]||[0,0]),left:t.Point.convert(i.left||[0,0]),right:t.Point.convert(i.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!o){var s,l=this._container.offsetWidth,u=this._container.offsetHeight;s=n.y+a.bottom.y<u?["top"]:n.y>this._map.transform.height-u?["bottom"]:[],n.x<l/2?s.push("left"):n.x>this._map.transform.width-l/2&&s.push("right"),o=0===s.length?"bottom":s.join("-")}var c=n.add(a[o]).round();i.setTransform(this._container,Ln[o]+" translate("+c.x+"px,"+c.y+"px)"),Dn(this._container,o,"popup")}},r.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Hn);t&&t.focus()}},r.prototype._onClose=function(){this.remove()},r}(t.Evented),Kn={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:An,NavigationControl:Cn,GeolocateControl:Nn,AttributionControl:gn,ScaleControl:jn,FullscreenControl:Zn,Popup:Xn,Marker:Bn,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Ot().acquire(Dt)},clearPrewarmedResources:function(){var t=Bt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Dt),Bt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Rt.workerCount},set workerCount(t){Rt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:""};return Kn})),i}(),d=Object.defineProperty,f=(t,e,i)=>(((t,e,i)=>{e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i})(t,"symbol"!=typeof e?e+"":e,i),i);class m extends r.Attitude{}class y extends r.Attitude{}class _ extends r.UserPosition{}const v={useMapMatching:!0,ignoreProviders:[],optionalProviders:[],stopOnError:!0,checkAvailabilityOnStart:!0,get hasPoleStar(){return this.optionalProviders.includes("PoleStar")}};const g=new class{constructor(){f(this,"_enabled",!1),f(this,"currentId",0),f(this,"objectsIdMap",new WeakMap),f(this,"pushEvents",{}),f(this,"pushEventsRef",{}),f(this,"interval"),f(this,"initDate")}get enabled(){return this._enabled}set enabled(t){this._enabled=t}initializeInterval(){this.interval||(this.interval=window.setInterval((()=>{for(const[t,e]of Object.entries(this.pushEvents))i.debug("Received "+e+" notifications from "+this.pushEventsRef[Number(t)].getName()+" last second");this.pushEvents={},this.pushEventsRef={}}),1e3))}getObjectId(t){return this.objectsIdMap.has(t)||this.objectsIdMap.set(t,++this.currentId),this.objectsIdMap.get(t)}addEvent(t,e){if(!this.enabled)return;this.initDate||(this.initDate=Date.now()),this.initializeInterval();const r=this.getObjectId(t),n=t.getName();i.debug(n+"["+r+"]."+e)}incrementNotifications(t){if(!this.enabled)return;const e=this.getObjectId(t);let i=this.pushEvents[e];i||(i=0,this.pushEventsRef[e]=t),this.pushEvents[e]=i+1}},x=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(x,"DEFAULT_MESSAGE","Contains ignored provider");let b=x;const w=class t{constructor(){f(this,"id"),f(this,"state","stopped"),f(this,"_lastEvent",null),f(this,"_eventsCallbacks",[]),f(this,"_monitoringCallbacks",[]),f(this,"notify",(t=>{g.incrementNotifications(this),this._eventsCallbacks.forEach((e=>{var i;return null==(i=e.onEvent)?void 0:i.call(e,t)})),this._lastEvent=t})),f(this,"notifyError",(t=>{this._eventsCallbacks.forEach((({id:e,onError:i})=>{this.removeEventListener(e),null==i||i(t)}))})),this.id=t._uniqueId++,g.addEvent(this,"constructor")}getAvailability(){return v.ignoreProviders.includes(this.getName())?Promise.resolve(new b):this.availability()}get hasNativeInterface(){return Boolean(this.nativeInterface)}get nativeInterface(){return"undefined"!=typeof window&&window.__nativeProviders||null}get nativeJsInterface(){return"undefined"==typeof window?null:(window.__nativeJsProviders||(window.__nativeJsProviders={}),window.__nativeJsProviders)}get useCameraNatively(){return!1}addEventListener(e=null,i=null,r=!0){const n=++t._callbackUniqueId;if(this._eventsCallbacks.push({id:n,onEvent:e||(()=>{}),onError:i||(()=>{}),optional:!r}),!r)return n;if("stopped"!==this.state)return n;this.state="starting";let o=Promise.resolve();return o=this.getAvailability(),(async()=>{const t=await o;if(t)return this.state="stopped",void this.notifyError(t);g.addEvent(this,"start"),this.start(),this.state="started",this._monitoringCallbacks.forEach((t=>{var e;return null==(e=t.onStarted)?void 0:e.call(t)}))})(),n}removeEventListener(t){const e=this._eventsCallbacks.find((e=>e.id===t));e&&(this._eventsCallbacks=this._eventsCallbacks.filter((t=>t!==e)),e.optional||this._eventsCallbacks.find((t=>!t.optional))||"stopped"!==this.state&&(g.addEvent(this,"stop"),this.stop(),this.state="stopped",this._monitoringCallbacks.forEach((t=>{var e;return null==(e=t.onStopped)?void 0:e.call(t)}))))}addMonitoringListener(e,i){const r=t._callbackUniqueId++;return this._monitoringCallbacks.push({id:r,onStarted:e||null,onStopped:i||null}),r}removeMonitoringListener(t){this._monitoringCallbacks=this._monitoringCallbacks.filter((e=>e.id!==t))}get lastEvent(){return this._lastEvent}};f(w,"_callbackUniqueId",0),f(w,"_uniqueId",1);let E=w;class I{static async every(t){for(const e of t){const t=await e;if(t)return t}return null}static async some(t){let e;for(const i of t){const t=await i;if(!t)return null;e||(e=t)}return e||null}}const S=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(S,"DEFAULT_MESSAGE","It seems that you ask for IMU events on a desktop browser");let T=S;const A=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}from(t){return this.message+=" from "+t,this}};f(A,"DEFAULT_MESSAGE","Impossible to retrieve events, a sensor is missing");let P=A;class M extends P{constructor(t){super(t)}}const C=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(C,"DEFAULT_MESSAGE","Geolocation api is missing");let z=C;const k=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(k,"DEFAULT_MESSAGE","Geolocation permission denied");let L=k;const D=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(D,"DEFAULT_MESSAGE","Geolocation position unavailable");let R=D;const B=1.6,F=class t extends E{constructor(){super(...arguments),f(this,"discardPositionsAbove",t.DEFAULT_DISCARD_POSITIONS_ABOVE),f(this,"enableHighAccuracy",!0),f(this,"geoLocationId"),f(this,"getName",(()=>"GnssWifi")),f(this,"onNewPosition",(t=>{const{coords:e}=t;if(!e)return;let i;e.heading&&(i=n.deg2rad(e.heading));const o=a.TimeUtils.unixTimestampToPreciseTime(t.timestamp)/1e3,s=new r.UserPosition(e.latitude,e.longitude,B,null,o,e.accuracy,i);this.enableHighAccuracy&&"number"==typeof this.discardPositionsAbove&&e.accuracy>this.discardPositionsAbove||this.notify(s)})),f(this,"onPositionError",(t=>{let e;switch(i.warn(`[Providers] watchPosition error: [${t.code}] ${t.message}`),t.code){case 1:e=new L(t.message);break;case 2:e=new R(t.message);break;default:e=new Error(t.message)}this.notifyError(e)}))}get positionOptions(){return{enableHighAccuracy:this.enableHighAccuracy,timeout:1/0,maximumAge:0}}availability(){return"object"==typeof navigator&&navigator.geolocation?Promise.resolve():Promise.resolve(new z)}start(){navigator.geolocation.getCurrentPosition(this.onNewPosition,this.onPositionError,this.positionOptions),setTimeout((()=>{this.geoLocationId=navigator.geolocation.watchPosition(this.onNewPosition,this.onPositionError,this.positionOptions)}),150)}stop(){void 0!==this.geoLocationId&&navigator.geolocation.clearWatch(this.geoLocationId)}};f(F,"DEFAULT_DISCARD_POSITIONS_ABOVE",50);const O=new F,U=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(U,"DEFAULT_MESSAGE","ARCore is missing");let N=U;const V=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(V,"DEFAULT_MESSAGE","Native interface is missing. You are maybe trying to execute a code which is not available in a web browser");let j=V;const q=class t extends E{constructor(){super(...arguments),f(this,"_nativeProvider"),f(this,"previousPosition",[0,0,0]),f(this,"getName",(()=>"ArCore")),f(this,"pullDataLoop",(()=>{if("stopped"===this.state)return;const t=JSON.parse(this.nativeProvider.getInfo());t.length>1&&this.parsePayload(t),requestAnimationFrame(this.pullDataLoop)}))}availability(){try{if(!this.nativeProvider.checkAvailability())return Promise.resolve(new N)}catch(t){return Promise.resolve(t)}return Promise.resolve()}start(){var t;null==(t=this.nativeProvider)||t.start(),this.pullDataLoop()}stop(){var t;null==(t=this.nativeProvider)||t.stop()}parsePayload(e){const i=e[0];let n,o,s,l,u=1;const c=a.TimeUtils.preciseTime()/1e3;if(i&t.Payload.Pose.ref){n=new m(e.slice(u,u+4),c,t.RELATIVE_ATTITUDE_DRIFT);const i=[e[u+4],e[u+5],e[u+6]];o=new r.RelativePosition(i[0]-this.previousPosition[0],i[1]-this.previousPosition[1],i[2]-this.previousPosition[2],c,1e-4),this.previousPosition=i,u+=t.Payload.Pose.size}i&t.Payload.Barcode.ref&&(l=e[u],u+=t.Payload.Barcode.size),i&t.Payload.ProjMat.ref&&(s=e.slice(u,u+t.Payload.ProjMat.size),u+=t.Payload.ProjMat.size),this.notify({relativePosition:o,relativeAttitude:n,...l&&{barcode:l},...s&&{cameraProjection:s}})}get nativeProvider(){if(!this._nativeProvider){if(!this.nativeInterface)throw new j;if(this._nativeProvider=this.nativeInterface.getArCoreProvider(),!this._nativeProvider)throw new N}return this._nativeProvider}enableBarcodeScanner(){try{this.nativeProvider.enableBarcodeScanner()}catch(t){this.notifyError(t)}}disableBarcodeScanner(){try{this.nativeProvider.disableBarcodeScanner()}catch(t){this.notifyError(t)}}get useCameraNatively(){return!0}};f(q,"Payload",{Pose:{ref:1,size:7},Barcode:{ref:2,size:1},ProjMat:{ref:4,size:16},ImageRef:{ref:8,size:1}}),f(q,"RELATIVE_ATTITUDE_DRIFT",n.deg2rad(3)/60);const G=new q;const Z=new class extends E{constructor(){super(...arguments),f(this,"absoluteAttitudeProviderId"),f(this,"arCoreProviderId"),f(this,"absoluteAttitudeEvent"),f(this,"getName",(()=>"GeoRelativePositionFromArCore")),f(this,"onArCoreEvents",(t=>{const e=t.relativeAttitude,i=t.relativePosition;e&&i&&this.absoluteAttitudeEvent&&this.compute(i,e,this.absoluteAttitudeEvent)}))}availability(){return I.every([G.getAvailability(),Nt.getAvailability()])}start(){this.arCoreProviderId=G.addEventListener(this.onArCoreEvents,this.notifyError),this.absoluteAttitudeProviderId=Nt.addEventListener((t=>this.absoluteAttitudeEvent=t),this.notifyError)}stop(){G.removeEventListener(this.arCoreProviderId),Nt.removeEventListener(this.absoluteAttitudeProviderId)}compute(t,e,i){const n=i.heading-e.heading,o=Math.cos(n)*t.x-Math.sin(n)*t.z,a=-Math.sin(n)*t.x-Math.cos(n)*t.z,s=t.y,l=new r.GeoRelativePosition(o,a,s,t.time,0,i.heading);this.notify(l)}},W={acc:.5,gyr:.3},H={acc:.5,gyr:.3,yc:2};class X{constructor(t=[0,0,1],e=[-1,0,0]){f(this,"P"),f(this,"accRef"),f(this,"cRef"),f(this,"noises"),f(this,"quaternion"),this.accRef=t,this.cRef=e,this.P=n.Matrix4.fromDiagVector(Array(4).fill(.1**2)),this.quaternion=null,this.noises={},this.setRelativeNoises(W),this.setAbsoluteNoises(H)}setRelativeNoises(t){this.noises.relative={acc:n.Matrix3.diag(Array(3).fill(t.acc**2)),gyr:n.Matrix3.diag(Array(3).fill(t.gyr**2))}}setAbsoluteNoises(t){this.noises.absolute={acc:n.Matrix3.diag(Array(3).fill(t.acc**2)),gyr:n.Matrix3.diag(Array(3).fill(t.gyr**2)),yc:n.Matrix3.diag(Array(3).fill(t.yc**2))}}tryInitialize(t,e){const i=n.Vector3.normalize(t);if(e){const t=n.Vector3.normalize(e),r=n.Vector3.normalize(n.Vector3.cross(t,i)),o=n.Vector3.cross(i,r),a=[[r[0],o[0],i[0]],[r[1],o[1],i[1]],[r[2],o[2],i[2]]];this.quaternion=n.Quaternion.fromMatrix3Matlab(a)}else{const t=n.Vector3.dot(i,this.accRef)+1,e=n.Vector3.cross(i,this.accRef);let r=[t,e[0],e[1],e[2]];r=n.Quaternion.normalize(r),this.quaternion=r}return this.quaternion}update(t,e,i,r){if(!this.quaternion)return this.tryInitialize(e,r);let o=this.quaternion;const a=o,s=n.Vector3.multiplyScalar(i,.5*t),l=this.computeC([1,s[0],s[1],s[2]]),u=n.Matrix4.multiplyVector(l,o),c=n.Matrix3.diag([a[0],a[0],a[0]]),h=n.Matrix3.skew([a[1],a[2],a[3]]),p=[-1*a[1],-1*a[2],-1*a[3]],d=n.Matrix.concatRow([p],n.Matrix3.sum(h,c)),f=n.Matrix4.multiplyScalar(n.Matrix.multiply(n.Matrix.multiply(d,this.noises[r?"absolute":"relative"].gyr),n.Matrix.transpose(d)),(t/2)**2),m=n.Matrix4.sum(n.Matrix4.multiply(n.Matrix4.multiply(l,this.P),n.Matrix4.transpose(l)),f),y=n.Vector3.normalize(e);let _,v,g;if(r){const t=n.Vector3.normalize(r),e=n.Vector3.cross(y,t),i=n.Vector3.normalize(e),o=n.Vector3.subtract(i,n.Quaternion.rotateMatlab(u,this.cRef)),a=n.Vector3.subtract(y,n.Quaternion.rotateMatlab(u,this.accRef));_=n.Vector.concat(o,a);const s=this.jacobianES(u,this.cRef),l=this.jacobianES(u,this.accRef);g=n.Matrix.concatRow(s,l);const c=n.Matrix.concatLine(this.noises.absolute.yc,n.Matrix3.zeros),h=n.Matrix.concatLine(n.Matrix3.zeros,this.noises.absolute.acc),p=n.Matrix.concatRow(c,h);v=n.Matrix.multiply(n.Matrix.multiply(m,n.Matrix.transpose(g)),n.Matrix.inverse(n.Matrix.sum(n.Matrix.multiply(n.Matrix.multiply(g,m),n.Matrix.transpose(g)),p)))}else{_=n.Vector3.subtract(y,n.Quaternion.rotateMatlab(u,this.accRef)),g=this.jacobianES(u,this.accRef);const t=this.noises.relative.acc;v=n.Matrix.multiply(n.Matrix.multiply(m,n.Matrix.transpose(g)),n.Matrix3.inverse(n.Matrix3.sum(n.Matrix.multiply(n.Matrix.multiply(g,m),n.Matrix.transpose(g)),t)))}o=n.Quaternion.sum(u,n.Matrix.multiplyVector(v,_));const x=n.Matrix4.multiply(n.Matrix4.subtract(n.Matrix4.identity,n.Matrix.multiply(v,g)),m);return o=n.Quaternion.normalize(o),this.quaternion=o,this.P=x,o}computeC(t){return[[t[0],-t[1],-t[2],-t[3]],[t[1],t[0],t[3],-t[2]],[t[2],-t[3],t[0],t[1]],[t[3],t[2],-t[1],t[0]]]}jacobianES(t,e){const[i,r,n,o]=t,[a,s,l]=e;return[[2*o*s-2*n*l,2*n*s+2*o*l,2*r*s-2*i*l-4*n*a,2*i*s+2*r*l-4*o*a],[2*r*l-2*o*a,2*i*l-4*r*s+2*n*a,2*r*a+2*o*l,2*n*l-2*i*a-4*o*s],[2*n*a-2*r*s,2*o*a-4*r*l-2*i*s,2*i*a-4*n*l+2*o*s,2*r*a+2*n*s]]}}const K=new class extends E{constructor(){super(...arguments),f(this,"getName",(()=>"IMU")),f(this,"parseDeviceMotionEvent",(t=>{const e=t.timeStamp/1e3;let i,r;if(t.accelerationIncludingGravity){const{x:e,y:r,z:n}=t.accelerationIncludingGravity;"number"==typeof e&&"number"==typeof r&&"number"==typeof n&&(i=[e,r,n],a.BrowserUtils.getName()!==a.Browser.SAFARI&&a.BrowserUtils.getName()!==a.Browser.IOS_WEBVIEW||(i[0]*=-1,i[1]*=-1,i[2]*=-1))}if(t.rotationRate){const{alpha:e,beta:i,gamma:o}=t.rotationRate;"number"==typeof e&&"number"==typeof i&&"number"==typeof o&&(r=[n.deg2rad(e),n.deg2rad(i),n.deg2rad(o)])}(i||r)&&this.notify({...i&&{acceleration:{timestamp:e,values:i}},...r&&{angularRate:{timestamp:e,values:r}}})}))}availability(){return a.BrowserUtils.isMobile?Promise.resolve():Promise.resolve(new T)}start(){const t=()=>window.addEventListener("devicemotion",this.parseDeviceMotionEvent,!0),e=DeviceMotionEvent.requestPermission||void 0;e?e().then((e=>{if("granted"!==e)throw new Error("Permission not granted");t()})).catch(this.notifyError):t()}stop(){window.removeEventListener("devicemotion",this.parseDeviceMotionEvent,!0)}},J=class t extends P{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(J,"DEFAULT_MESSAGE","Impossible to retrieve Acceleration data");let Y=J;const Q=new class extends E{constructor(){super(...arguments),f(this,"imuProviderId"),f(this,"getName",(()=>"Accelerometer")),f(this,"availability",(()=>K.getAvailability()))}start(){this.imuProviderId=K.addEventListener((t=>{t.acceleration?this.notify(t.acceleration):this.notifyError((new Y).from("devicemotion"))}),this.notifyError)}stop(){K.removeEventListener(this.imuProviderId)}};class $ extends P{constructor(t){super(t||P.DEFAULT_MESSAGE)}}f($,"DEFAULT_MESSAGE","Impossible to retrieve Angular Rate data");const tt=new class extends E{constructor(){super(...arguments),f(this,"imuProviderId"),f(this,"getName",(()=>"Gyroscope")),f(this,"availability",(()=>K.getAvailability()))}start(){this.imuProviderId=K.addEventListener((t=>{t.angularRate?this.notify(t.angularRate):this.notifyError((new $).from("devicemotion"))}),this.notifyError)}stop(){K.removeEventListener(this.imuProviderId)}},et=class t extends E{constructor(){super(...arguments),f(this,"accelerometerProviderId"),f(this,"ekfAttitude",new X),f(this,"gyroscopeEvent"),f(this,"gyroscopeProviderId"),f(this,"lastTimestamp",0),f(this,"getName",(()=>"RelativeAttitudeFromEkf")),f(this,"onAccelerometerEvent",(e=>{if(!this.gyroscopeEvent)return;const{values:i,timestamp:r}=e;if(0===this.lastTimestamp)return void(this.lastTimestamp=r);const n=r-this.lastTimestamp;this.lastTimestamp=r;const o=this.ekfAttitude.update(n,i,this.gyroscopeEvent.values);if(o){const e=new m(o,r,t.DEFAULT_DRIFT);this.notify(e)}}))}availability(){return I.every([Q.getAvailability(),tt.getAvailability()])}start(){this.accelerometerProviderId=Q.addEventListener((t=>this.onAccelerometerEvent(t)),(t=>this.notifyError(t))),this.gyroscopeProviderId=tt.addEventListener((t=>this.gyroscopeEvent=t),(t=>this.notifyError(t)))}stop(){Q.removeEventListener(this.accelerometerProviderId),tt.removeEventListener(this.gyroscopeProviderId)}};f(et,"DEFAULT_DRIFT",n.deg2rad(5)/60);const it=new et,rt=class t extends E{constructor(){super(...arguments),f(this,"getName",(()=>"RelativeAttitudeFromBrowser")),f(this,"onDeviceOrientationEvent",(e=>{if("number"!=typeof e.alpha||"number"!=typeof e.beta||"number"!=typeof e.gamma)return void this.notifyError((new P).from("deviceorientation"));const i=n.Rotations.eulerToQuaternionZXYDegrees([e.alpha,e.beta,e.gamma]),r=new m(i,e.timeStamp/1e3,t.DEFAULT_DRIFT);this.notify(r)}))}availability(){return a.BrowserUtils.isMobile?Promise.resolve():Promise.resolve(new T)}start(){const t=()=>window.addEventListener("deviceorientation",this.onDeviceOrientationEvent,!0),e=DeviceOrientationEvent.requestPermission||void 0;e?e().then((e=>{if("granted"!==e)throw new Error("Permission not granted");t()})).catch((t=>this.notifyError(t))):t()}stop(){window.removeEventListener("deviceorientation",this.onDeviceOrientationEvent,!0)}};f(rt,"DEFAULT_DRIFT",n.deg2rad(5)/60);const nt=new rt,ot=class t extends E{constructor(){super(...arguments),f(this,"gyroscopeProviderId"),f(this,"getName",(()=>"HighRotationsProvider")),f(this,"availability",(()=>tt.getAvailability())),f(this,"_parseGyroscopeEvent",(e=>{const{values:i,timestamp:r}=e;n.Vector3.norm(i)>t.THRESHOLD&&this.notify({timestamp:r})}))}start(){this.gyroscopeProviderId=tt.addEventListener(this._parseGyroscopeEvent,this.notifyError)}stop(){tt.removeEventListener(this.gyroscopeProviderId)}isInProgress(){if(!this.lastEvent||!tt.lastEvent)return!1;return tt.lastEvent.timestamp-this.lastEvent.timestamp<t.DELAY_CONSIDERATION}};f(ot,"THRESHOLD",10),f(ot,"DELAY_CONSIDERATION",3);const at=new ot,st=class t extends E{constructor(){super(...arguments),f(this,"_highRotationsProviderId"),f(this,"listenerId"),f(this,"provider"),f(this,"getName",(()=>"RelativeAttitudeFromInertial"))}availability(){return I.some([it.getAvailability(),nt.getAvailability()])}start(){it.getAvailability().then((t=>{this.provider=t?nt:it,this.listenerId=this.provider.addEventListener((t=>this._parseEvent(t)),this.notifyError),this._highRotationsProviderId=at.addEventListener(null,this.notifyError)}))}_parseEvent(e){const i=e.clone();if(at.isInProgress()){let e=(i.accuracy||0)+100*t.DEFAULT_DRIFT;e=Math.min(e,Math.PI),i.accuracy=e}this.notify(i)}stop(){this.provider&&(this.provider.removeEventListener(this.listenerId),delete this.provider),at.removeEventListener(this._highRotationsProviderId)}};f(st,"DEFAULT_DRIFT",n.deg2rad(5)/60);const lt=new st,ut=class t{constructor(){f(this,"frequency",0),f(this,"lastVerticalAcc",0),f(this,"maxAcceleration",0),f(this,"lastStepTimestamp",-t.MIN_TIME_BETWEEN_STEPS)}compute(e,i){let r=!1;const n=i[2],o=e-this.lastStepTimestamp;if(n>this.lastVerticalAcc)n>this.maxAcceleration&&(this.maxAcceleration=n);else if(this.maxAcceleration>t.VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD&&o>t.MIN_TIME_BETWEEN_STEPS){this.maxAcceleration=0;const i=e-this.lastStepTimestamp;this.frequency=Math.min(Math.max(1/i,t.MIN_FRENQUENCY),t.MAX_FRENQUENCY),r=!0,this.lastStepTimestamp=e}else this.maxAcceleration=0;return this.lastVerticalAcc=n,r}get lastStepSize(){if(!this.frequency)return 0;return.45+.2*this.frequency}get speed(){return this.lastStepTimestamp?this.lastStepSize*this.frequency:0}};f(ut,"MIN_TIME_BETWEEN_STEPS",.4),f(ut,"MAX_FRENQUENCY",4),f(ut,"MIN_FRENQUENCY",1),f(ut,"VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD",1);let ct=ut;const ht=class t{constructor(){f(this,"frequency",0),f(this,"lastStepTimestamp",-t.MIN_TIME_BETWEEN_STEPS),f(this,"slidingWindow",[])}compute(e,i){if(this.lastStepTimestamp&&this.lastStepTimestamp+t.MIN_TIME_BETWEEN_STEPS>e)return!1;let r=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER;const o=t.WINDOW_TIME;if(this.slidingWindow.forEach(((t,i,a)=>{t.timestamp<e-o?a.splice(i,1):(r=Math.max(t.verticalAcc,r),n=Math.min(t.verticalAcc,n))})),this.slidingWindow.push({timestamp:e,verticalAcc:i[2]}),r>t.VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD&&n<t.VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD){const i=this.lastStepTimestamp?e-this.lastStepTimestamp:1;return this.frequency=Math.min(Math.max(1/i,t.MIN_FRENQUENCY),t.MAX_FRENQUENCY),this.lastStepTimestamp=e,!0}return!1}get lastStepSize(){if(!this.frequency)return 0;return.45+.2*this.frequency}get speed(){return this.lastStepTimestamp?this.lastStepSize*this.frequency:0}};f(ht,"WINDOW_TIME",.3),f(ht,"MIN_TIME_BETWEEN_STEPS",.4),f(ht,"MAX_FRENQUENCY",4),f(ht,"MIN_FRENQUENCY",1),f(ht,"VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD",1.5),f(ht,"VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD",-1);let pt=ht;const dt=class t{constructor(){f(this,"frequency",0),f(this,"influence",.2),f(this,"slidingWindow",[]),f(this,"lastStepTimestamp",-t.MIN_TIME_BETWEEN_STEPS),f(this,"previousVerticalAcc",0)}compute(e,i,r){const n=this.influence*(2*i[2])+(1-this.influence)*this.previousVerticalAcc;if(this.previousVerticalAcc=n,Math.sqrt(r[0]**2+r[1]**2+r[2]**2)>.75)return!1;if(this.lastStepTimestamp&&this.lastStepTimestamp+t.MIN_TIME_BETWEEN_STEPS>e)return!1;let o=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER;if(this.slidingWindow.forEach(((i,r,n)=>{i.timestamp<e-t.WINDOW_TIME?n.splice(r,1):(o=Math.max(i.verticalAcc,o),a=Math.min(i.verticalAcc,a))})),this.slidingWindow.push({timestamp:e,verticalAcc:n}),o>t.VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD&&a<t.VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD){const i=this.lastStepTimestamp?e-this.lastStepTimestamp:1;return this.frequency=Math.min(Math.max(1/i,t.MIN_FRENQUENCY),t.MAX_FRENQUENCY),this.lastStepTimestamp=e,!0}return!1}get lastStepSize(){if(!this.frequency)return 0;return.45+.2*this.frequency}get speed(){return this.lastStepSize&&this.frequency?this.lastStepSize*this.frequency:0}mean(t){let e=0,i=0;for(let r=0;r<t.length;++r)e+=t[r].verticalAcc;return i=e/t.length,i}stddev(t){const e=this.mean(t);let i=0;for(let r=0;r<t.length;++r)i+=(t[r].verticalAcc-e)**2;return Math.sqrt(i/t.length)}};f(dt,"WINDOW_TIME",.3),f(dt,"MIN_TIME_BETWEEN_STEPS",.4),f(dt,"MAX_FRENQUENCY",4),f(dt,"MIN_FRENQUENCY",1),f(dt,"VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD",.75),f(dt,"VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD",-.3);let ft=dt;const mt=class t{constructor(){f(this,"frequency",0),f(this,"influence",.05),f(this,"slidingWindow",[]),f(this,"lastStepTimestamp",-t.MIN_TIME_BETWEEN_STEPS),f(this,"previousVerticalAcc",0),f(this,"previousHorizontalAcc",0)}compute(e,i){const r=this.influence*i[2]+(1-this.influence)*this.previousVerticalAcc;this.previousVerticalAcc=r,this.slidingWindow=this.slidingWindow.filter((i=>i.timestamp>=e-t.WINDOW_TIME)),this.slidingWindow.push({timestamp:e,verticalAcc:r});if(this.lastStepTimestamp&&this.lastStepTimestamp+t.MIN_TIME_BETWEEN_STEPS>e)return!1;let n=Number.MIN_VALUE,o=-1,a=!1;if(this.slidingWindow.forEach(((e,i)=>{e.verticalAcc>n&&e.verticalAcc>=t.VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD&&(n=e.verticalAcc,o=i,a=!0)})),!a)return!1;let s=!1,l=Number.MAX_VALUE;for(let p=0;p<o;p++){const e=this.slidingWindow[p].verticalAcc;if(l=Math.min(l,e),e<t.VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD){s=!0;break}}if(!s)return!1;const u=n-.5*(n-l);let c=!1;for(let t=o+1;t<this.slidingWindow.length;t++)if(this.slidingWindow[t].verticalAcc<=u){c=!0;break}if(!c)return!1;const h=this.lastStepTimestamp?e-this.lastStepTimestamp:1;return this.frequency=Math.min(Math.max(1/h,t.MIN_FRENQUENCY),t.MAX_FRENQUENCY),this.lastStepTimestamp=e,!0}get lastStepSize(){if(!this.frequency)return 0;return.45+.2*this.frequency}get speed(){return this.lastStepSize&&this.frequency?this.lastStepSize*this.frequency:0}mean(t){let e=0,i=0;for(let r=0;r<t.length;++r)e+=t[r];return i=e/t.length,i}stddev(t){const e=this.mean(t);let i=0;for(let r=0;r<t.length;++r)i+=(t[r]-e)**2;return Math.sqrt(i/t.length)}};f(mt,"WINDOW_TIME",.6),f(mt,"MIN_TIME_BETWEEN_STEPS",.6),f(mt,"MAX_FRENQUENCY",4),f(mt,"MIN_FRENQUENCY",1),f(mt,"VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD",.2),f(mt,"VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD",-.1);let yt=mt;const _t=class t extends E{constructor(){super(),f(this,"accelerometerProviderId"),f(this,"attitudeProviderId"),f(this,"gyroscopeProviderId"),f(this,"angularRateEvent"),f(this,"attitudeEvent"),f(this,"numOfSteps",0),f(this,"stepDetector"),f(this,"_stepSizeMultiplier",t.DEFAULT_STEP_SIZE_MULTIPLIER),f(this,"_algorithm",t.DEFAULT_ALGORITHM),f(this,"_accValues",[]),f(this,"getName",(()=>"StepDetector")),f(this,"onAccelerometerEvent",(e=>{if(!this.attitudeEvent||!this.angularRateEvent)return;const{values:i,timestamp:r}=e,n=t.computeLinearAcceleration(this.attitudeEvent.quaternion,i);if(this.stepDetector.compute(r,n,this.angularRateEvent.values)){const t=this.stepDetector.lastStepSize*this._stepSizeMultiplier;this.numOfSteps++,this.notify({size:t,number:this.numOfSteps})}})),this.algorithm=this._algorithm}availability(){return I.every([Q.getAvailability(),tt.getAvailability(),lt.getAvailability()])}start(){this.numOfSteps=0,this.accelerometerProviderId=Q.addEventListener(this.onAccelerometerEvent,this.notifyError),this.gyroscopeProviderId=tt.addEventListener((t=>this.angularRateEvent=t),this.notifyError),this.attitudeProviderId=lt.addEventListener((t=>this.attitudeEvent=t),this.notifyError)}stop(){Q.removeEventListener(this.accelerometerProviderId),tt.removeEventListener(this.gyroscopeProviderId),lt.removeEventListener(this.attitudeProviderId)}static computeLinearAcceleration(t,e){const i=n.Quaternion.rotateMatlab(n.Quaternion.inverse(t),e);return i[2]-=r.Constants.EARTH_GRAVITY,i}set stepSizeMultiplier(t){this._stepSizeMultiplier=t}get stepSizeMultiplier(){return this._stepSizeMultiplier}set algorithm(t){switch(t){case"ladetto":this.stepDetector=new ct;break;case"minMaxPeaks":this.stepDetector=new pt;break;case"minMaxPeaks2":this.stepDetector=new ft;break;default:t="minMaxPeaks3",this.stepDetector=new yt}this._algorithm=t}get algorithm(){return this._algorithm}};f(_t,"DEFAULT_STEP_SIZE_MULTIPLIER",1),f(_t,"DEFAULT_ALGORITHM","minMaxPeaks3");const vt=new _t;const gt=new class extends E{constructor(){super(...arguments),f(this,"absoluteAttitudeProviderId"),f(this,"stepDetectionProviderId"),f(this,"attitudeEvent"),f(this,"misalignmentError",n.deg2rad(3)),f(this,"getName",(()=>"Pdr")),f(this,"onStepEvent",(t=>{if(!this.attitudeEvent)return;const e=t.size,i=this.attitudeEvent,n=i.heading,o=i.accuracy+this.misalignmentError,a=e/2*Math.sin(o/2),s=i.time,l=new r.GeoRelativePosition(e*Math.sin(n),e*Math.cos(n),0,s,a,n);this.notify(l)}))}availability(){return I.every([vt.getAvailability(),Nt.getAvailability()])}start(){this.stepDetectionProviderId=vt.addEventListener(this.onStepEvent,this.notifyError),this.absoluteAttitudeProviderId=Nt.addEventListener((t=>this.attitudeEvent=t),this.notifyError)}stop(){vt.removeEventListener(this.stepDetectionProviderId),Nt.removeEventListener(this.absoluteAttitudeProviderId)}};const xt=new class extends E{constructor(){super(...arguments),f(this,"providerId"),f(this,"geoRelativeProvider"),f(this,"getName",(()=>"GeoRelativePosition"))}availability(){return I.some([gt.getAvailability(),Z.getAvailability()])}async start(){const t=await Z.getAvailability();this.geoRelativeProvider=t?gt:Z,this.providerId=this.geoRelativeProvider.addEventListener(this.notify,this.notifyError)}stop(){var t;null==(t=this.geoRelativeProvider)||t.removeEventListener(this.providerId),delete this.geoRelativeProvider}};const bt=new class extends E{constructor(){super(...arguments),f(this,"providerId"),f(this,"getName",(()=>"InclinationFromAcc")),f(this,"availability",(()=>Q.getAvailability())),f(this,"onAccelerometerEvent",(t=>{const e=t.values,i=window.orientation||0,r=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),n=[e[0]/r,e[1]/r,e[2]/r],o=[n[2]+1,n[1],-n[0],0],a=Math.sqrt(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]),s=[o[0]/a,o[1]/a,o[2]/a,0];let l;l=0===i?Math.asin(2*s[1]*s[0]):90===i?-Math.asin(2*s[2]*s[0]):-90===i?Math.asin(2*s[2]*s[0]):-Math.asin(2*s[1]*s[0]),this.notify(l)}))}start(){this.providerId=Q.addEventListener(this.onAccelerometerEvent,this.notifyError)}stop(){Q.removeEventListener(this.providerId)}};const wt=new class extends E{constructor(){super(...arguments),f(this,"providerId"),f(this,"getName",(()=>"InclinationFromRelativeAttitude")),f(this,"availability",(()=>lt.getAvailability()))}start(){this.providerId=lt.addEventListener((t=>{const e=this.enuQuatToInclination(t.quaternion);this.notify(e)}),this.notifyError)}stop(){lt.removeEventListener(this.providerId)}enuQuatToInclination(t){const e=window.orientation||0;return 0===e?Math.asin(2*(t[2]*t[3]+t[1]*t[0])):90===e?Math.asin(2*(t[1]*t[3]-t[2]*t[0])):-90===e?Math.asin(2*(t[2]*t[0]-t[1]*t[3])):-Math.asin(2*(t[2]*t[3]+t[1]*t[0]))}};const Et=new class extends E{constructor(){super(...arguments),f(this,"provider"),f(this,"providerId"),f(this,"getName",(()=>"Inclination"))}availability(){return I.some([bt.getAvailability(),wt.getAvailability()])}async start(){const t=()=>{this.provider=bt,this.providerId=this.provider.addEventListener(this.notify,this.notifyError)};await wt.getAvailability()?(this.provider=wt,this.providerId=this.provider.addEventListener(this.notify,(()=>{wt.removeEventListener(this.providerId),t()}))):t()}stop(){this.provider&&this.provider.removeEventListener(this.providerId)}};class It{constructor(t,e=null,i=null,r=null){this.size=t,this.calibration=e,this.coarse=i,this.device=r}toJson(){return{size:[this.size.width,this.size.height],...this.calibration&&{calibration:this.calibration},...this.coarse&&{coarse:{...this.coarse.attitude&&{attitude:this.coarse.attitude.toJson()},...this.coarse.position&&{position:this.coarse.position.toJson()}}},..."object"==typeof this.device&&{device:this.device}}}static fromJson(t){var e,i;return new It({width:t.size[0],height:t.size[1]},t.calibration,{...(null==(e=t.coarse)?void 0:e.position)&&{position:r.UserPosition.fromJson(t.coarse.position)},...(null==(i=t.coarse)?void 0:i.attitude)&&{attitude:r.Attitude.fromJson(t.coarse.attitude)}},t.device)}}class St{constructor(t,e){this.metadata=t,this.image=e}toJson(){return{image:l.canvasToBase64(this.image),...this.metadata.toJson()}}static fromJson(t){return new St(It.fromJson(t),l.base64ToCanvas(t.image))}}class Tt{constructor(t,e=null,i=null){this.success=t,this.attitude=e,this.position=i}toJson(){var t,e;return{success:this.success,attitude:null==(t=this.attitude)?void 0:t.toJson(),position:null==(e=this.position)?void 0:e.toJson()}}static fromJson(t,e=null){let i=null;t.attitude&&(i=r.Attitude.fromJson(t.attitude),i.time=e);let n=null;return t.position&&(n=r.UserPosition.fromJson(t.position),n.time=e),new Tt(t.success,i,n)}}class At{static _prepareRequest(t,e=null,i=null){l.convertToGrayscale(t);const r=l.reduceImageSize(t,1280),n=new It({width:r.width,height:r.height},e,i,a.UserAgentUtils.getDeviceFromUserAgent());return new St(n,r)}static async relocalize(t,e,r=null,n=null,o=null){const s=a.TimeUtils.preciseTime()/1e3,l=this._prepareRequest(e,r,n);let u;try{const e=JSON.stringify(l.toJson());i.debug(`[VPS] Request (${(e.length/1024).toFixed(0)} kB) sent to server ${t}`),u=await fetch(t,{method:"POST",body:e,headers:Object.assign({"Content-Type":"application/json",Accept:"application/vnd.geopose+json; version=1"},o||{})})}catch(p){return i.debug("[VPS] Server respond error"),null}if(200!==u.status)return i.debug("[VPS] Server respond error"),null;const c=await u.json(),h=Tt.fromJson(c,s);return i.debug("[VPS] Server respond "+(h.success?"success":"not found")),h}static getHeadingFromQuaternion(t){const[e,i,r,n]=t,o=Math.sqrt(2)/2,a=[o*(e-i),o*(e+i),o*(r+n),o*(n-r)];return-Math.atan2(2*a[3]*a[0]-2*a[2]*a[1],1-2*a[1]**2-2*a[3]**2)}}class Pt{constructor(){f(this,"_providerId"),f(this,"_isRunning",!1),f(this,"_dataOnStart",null)}tickStart(){this._dataOnStart=null,this._isRunning||(this._isRunning=!0,this._providerId=nt.addEventListener((t=>{this._dataOnStart||(this._dataOnStart=t)})))}tickEnd(){if(!this._isRunning)return i.warn("You have to call tickStart before tickEnd"),null;if(this._internalStop(),!this._dataOnStart)return i.warn("Delay was too short between tickStart and tickEnd or RelativeAttitudeProvider cannot be retrieved."),null;const t=nt.lastEvent;return r.Attitude.diff(this._dataOnStart,t)}_internalStop(){nt.removeEventListener(this._providerId),delete this._providerId,this._isRunning=!1}release(){this._isRunning&&this._internalStop()}}const Mt=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(Mt,"DEFAULT_MESSAGE","PoleStar is missing");let Ct=Mt;const zt=new class extends E{constructor(){super(),f(this,"getName",(()=>"PoleStar")),this.addMethodsToNativeJsProvider()}availability(){try{return this.nativeProvider.checkAvailability(),Promise.resolve()}catch(t){return Promise.resolve(t)}}setApiKey(t){this.nativeProvider.setApiKey(t)}start(){this.nativeProvider.start()}stop(){this.nativeProvider.stop()}get nativeProvider(){if(!this.nativeInterface)throw new j;const t=this.nativeInterface.getPoleStarProvider();if(!t)throw new Ct;return t}addMethodsToNativeJsProvider(){this.nativeJsInterface&&(this.nativeJsInterface.polestar={callbackError:t=>this.notifyError(new Error(t)),callbackPosition:t=>{const e=JSON.parse(t),i=a.TimeUtils.unixTimestampToPreciseTime(e.time)/1e3,r=new _(e.lat,e.lng,B,e.alt/5,i,e.accuracy,n.deg2rad(e.bearing));this.notify(r)}})}},kt=class t extends E{constructor(){super(...arguments),f(this,"_relativeRotationCalc"),f(this,"_serverError",!1),f(this,"_cameraError",!1),f(this,"_camera",null),f(this,"_endpoint",null),f(this,"_inclinationProviderId"),f(this,"_minInclinationForRequest",t.DEFAULT_MIN_INCLINATION_FOR_REQUEST),f(this,"_waitTimeMinInclinationForRequest",t.DEFAULT_WAIT_TIME_MIN_INCLINATION_FOR_REQUEST),f(this,"_useCoarsePose",t.DEFAULT_USE_COARSE_POSE),f(this,"getName",(()=>"Vps")),f(this,"availability",(()=>l.Camera.checkAvailability())),f(this,"_onCameraDetected",(({camera:t})=>{this._camera&&i.warn("It seems that more than 1 camera has been detected for VPS. Taking the first..."),this._useCamera(t)})),f(this,"_onCameraRemoved",(()=>{this._camera?(this._camera.off("started",this._internalStart),this._camera.off("stopped",this._internalStop)):i.warn("There is no previously detected camera but once has stopped"),this._camera=null})),f(this,"_internalStart",(async()=>{var e,i;if(!this._endpoint)return void this.notifyError(new Error("VPS endpoint has not been set before calling start()"));let o=null;const s=()=>"stopped"===this.state;for(;!s();){if(null!==o){const e=a.TimeUtils.preciseTime()-o,i=Math.max(0,t.MIN_TIME_BETWEEN_TWO_REQUESTS-e);await new Promise((t=>setTimeout(t,i)))}if(o=a.TimeUtils.preciseTime(),s()||!this._camera||"started"!==this._camera.state)break;const l=Et.lastEvent?Et.lastEvent:null;if(null!==l&&l<this._minInclinationForRequest){await new Promise((t=>setTimeout(t,this._waitTimeMinInclinationForRequest)));continue}null==(e=this._relativeRotationCalc)||e.tickStart();const u=await this._camera.currentImage;if(!u)continue;let c=null;const h=Rt.getBestPositionEvent(O.lastEvent,zt.lastEvent);this._useCoarsePose&&(h||Nt.lastEvent)&&(c={...h&&{position:h},...Nt.lastEvent&&{attitude:Nt.lastEvent}});const p=await At.relocalize(this._endpoint,u,null,c);if(!p||!p.success)continue;const d=p.attitude.quaternion,f=n.Quaternion.multiply(d,t.CAMERA_TO_SMARTPHONE_ROT),m=n.Quaternion.multiply(n.Quaternion.fromAxisAngle([0,0,1],n.deg2rad(window.orientation||0)),f),_=(null==(i=this._relativeRotationCalc)?void 0:i.tickEnd())||new r.Attitude([1,0,0,0]),v=n.Quaternion.multiply(m,_.quaternion),g=new y(v,p.attitude.time,p.attitude.accuracy),x=p.position.clone();if(null===x.accuracy&&(x.accuracy=5),s())break;this.notify({absoluteAttitude:g,absolutePosition:x})}})),f(this,"_internalStop",(()=>{}))}start(){this._inclinationProviderId=Et.addEventListener(),this._relativeRotationCalc=new Pt,l.SharedCameras.on("added",this._onCameraDetected),l.SharedCameras.on("removed",this._onCameraRemoved),l.SharedCameras.list.length&&(l.SharedCameras.list.length>1&&i.warn("It seems that more than 1 camera has been detected for VPS. Taking the first..."),this._useCamera(l.SharedCameras.list[0].camera))}stop(){var t;Et.removeEventListener(this._inclinationProviderId),null==(t=this._relativeRotationCalc)||t.release(),l.SharedCameras.off("added",this._onCameraDetected),l.SharedCameras.off("removed",this._onCameraRemoved),this._camera=null}_useCamera(t){this._camera=t,t.on("started",this._internalStart),t.on("stopped",this._internalStop),"started"===t.state&&this._internalStart()}get endpoint(){return this._endpoint}set endpoint(t){this._endpoint=t}get minInclinationForRequest(){return this._minInclinationForRequest}set minInclinationForRequest(t){this._minInclinationForRequest=t}get waitTimeMinInclinationForRequest(){return this._waitTimeMinInclinationForRequest}set waitTimeMinInclinationForRequest(t){this._waitTimeMinInclinationForRequest=t}get useCoarsePose(){return this._useCoarsePose}set useCoarsePose(t){this._useCoarsePose=t}};f(kt,"MIN_TIME_BETWEEN_TWO_REQUESTS",1e3),f(kt,"DEFAULT_MIN_INCLINATION_FOR_REQUEST",n.deg2rad(60)),f(kt,"DEFAULT_WAIT_TIME_MIN_INCLINATION_FOR_REQUEST",200),f(kt,"DEFAULT_USE_COARSE_POSE",!0),f(kt,"CAMERA_TO_SMARTPHONE_ROT",n.Quaternion.fromAxisAngle([1,0,0],Math.PI));const Lt=new kt,Dt=class t extends E{constructor(){super(...arguments),f(this,"_polestarProviderId"),f(this,"_vpsProviderId"),f(this,"_gnssWifiProviderId"),f(this,"_relativePositionProviderId"),f(this,"_mapMatchingHandlerId"),f(this,"useAllAbsolutePositions",!1),f(this,"_waitUntilNextVpsPosition",!1),f(this,"_lastPolestarFix",null),f(this,"getName",(()=>"AbsolutePosition"))}availability(){return I.some([xt.getAvailability(),O.getAvailability(),...v.hasPoleStar?[zt.getAvailability()]:[],Lt.getAvailability()])}start(){xt.getAvailability().then((t=>{t||(this._relativePositionProviderId=xt.addEventListener((t=>this._onRelativePosition(t))))})),this._gnssWifiProviderId=O.addEventListener((t=>{const e=t.clone();e.bearing=null,this._onAbsolutePosition(e,!1)})),this._vpsProviderId=Lt.addEventListener((t=>this._onAbsolutePosition(t.absolutePosition)),this.notifyError,!1),v.hasPoleStar&&(this._polestarProviderId=zt.addEventListener((t=>{var e;this._lastPolestarFix=a.TimeUtils.preciseTime();if(!this._onAbsolutePosition(t)&&null===(null==(e=this.lastEvent)?void 0:e.level)){const e=this.lastEvent.clone();e.level=t.level,this.notify(e)}}))),this._mapMatchingHandlerId=Wt.addEventListener()}stop(){this._relativePositionProviderId&&(xt.removeEventListener(this._relativePositionProviderId),delete this._relativePositionProviderId),this._gnssWifiProviderId&&(O.removeEventListener(this._gnssWifiProviderId),delete this._gnssWifiProviderId),this._vpsProviderId&&(Lt.removeEventListener(this._vpsProviderId),delete this._vpsProviderId),this._polestarProviderId&&(zt.removeEventListener(this._polestarProviderId),delete this._polestarProviderId),Wt.removeEventListener(this._mapMatchingHandlerId)}_shouldTakeIntoAccountNewAbsolutePosition(e,i=!0){const n=e,o=this.lastEvent||null;if(!o)return!0;const a=n.accuracy*t.ACCURACY_RELOC_RATIO<=o.accuracy;if(a)return!0;const s=o.distanceTo(n)>o.accuracy+n.accuracy;if(s)return!0;const l=s&&n.accuracy<=o.accuracy;if(a&&l)return!0;return!(!i||r.Level.equals(n.level,o.level))}_onAbsolutePosition(t,e=!0){if(!this._shouldTakeIntoAccountNewAbsolutePosition(t,e)&&!this.useAllAbsolutePositions)return!1;const i=t.clone(),r=this.lastEvent?this.lastEvent:null;return r&&(e||(i.level=r.level),null===i.bearing&&(i.bearing=r.bearing)),Wt.canUseMapMatching()?Wt.notifyPositionFromAbsolute(i):(this.notify(i),!0)}_onRelativePosition(t){if(!this.lastEvent||this._waitUntilNextVpsPosition)return!1;const e=this.lastEvent,i=t,r=Math.sqrt(i.x**2+i.y**2),n=Math.atan2(i.x,i.y),o=null!==e.alt?i.z:null,a=e.destinationPoint(r,n,o);return a.bearing=i.bearing,a.time=i.time,a.accuracy+=i.accuracy,Wt.canUseMapMatching()?Wt.notifyPositionFromRelative(a):(this.notify(a),!0)}feed(e){let i;if(!(e instanceof r.UserPosition))throw new Error("data is nor an UserPosition or an AbsolutePositionEvent");if(null===e.time)throw Error("the time of the position is not defined");if(null===e.accuracy)throw Error("the accuracy of the position is not defined");i=e,t.USE_MM_FOR_FEED&&Wt.canUseMapMatching()?Wt.notifyPositionFromFeed(i):this.notify(i)}getBestPositionEvent(...t){return t.reduce(((t,e)=>{if(!t)return e;if(!e||null===e.accuracy||null===e.time)return t;const{accuracy:i,time:r}=e,{accuracy:n,time:o}=t;return i<n+1.3888*(r-o)?e:t}),null)}};f(Dt,"ACCURACY_RELOC_RATIO",1),f(Dt,"USE_MM_FOR_FEED",!0);const Rt=new Dt;class Bt extends E{constructor(){super(...arguments),f(this,"DEFAULT_ACCURACY",n.deg2rad(15)),f(this,"absolutePositionProviderId"),f(this,"absolutePositionEvent"),f(this,"declinationQuaternion"),f(this,"magQuaternion"),f(this,"magQuaternionTimestamp"),f(this,"iosPreviousQuat"),f(this,"iosIsSkyMode",null),f(this,"getName",(()=>"AbsoluteAttitudeFromBrowser")),f(this,"onDeviceOrientationChromeEvent",(t=>{this.magQuaternionTimestamp=t.timeStamp/1e3,"number"==typeof t.alpha&&"number"==typeof t.beta&&"number"==typeof t.gamma?(this.magQuaternion=n.Rotations.eulerToQuaternionZXYDegrees([t.alpha,t.beta,t.gamma]),this.compute()):this.notifyError((new P).from("deviceorientationabsolute"))})),f(this,"onDeviceOrientationSafariEvent",(t=>{if(this.magQuaternionTimestamp=t.timeStamp/1e3,"number"!=typeof t.beta||"number"!=typeof t.gamma)return void this.notifyError((new P).from("deviceorientation"));if("number"!=typeof t.webkitCompassHeading)return void this.notifyError((new M).from("deviceorientation"));let e;const[i,r,o,a]=n.Rotations.eulerToQuaternionZXYDegrees([t.webkitCompassHeading,t.beta,t.gamma]),s=n.rad2deg(Math.acos(i**2-r**2-o**2+a**2));let l=null;s>136?l=!0:s<134?l=!1:this.iosPreviousQuat&&null!==this.iosIsSkyMode&&(l=n.Quaternion.distance([i,r,o,a],this.iosPreviousQuat)<.5?this.iosIsSkyMode:!this.iosIsSkyMode),this.iosPreviousQuat=[i,r,o,a],this.iosIsSkyMode=l,void 0!==l&&(e=l?180-t.webkitCompassHeading:Bt.webkitCompassToHeading(t.webkitCompassHeading,t.beta,t.gamma),this.magQuaternion=n.Rotations.eulerToQuaternionZXYDegrees([e,t.beta,t.gamma]),this.compute())})),f(this,"onAbsolutePositionEvent",(t=>{this.absolutePositionEvent=t;const e=c.field(t.lat,t.lng);this.declinationQuaternion=n.Quaternion.fromAxisAngle([0,0,1],-n.deg2rad(e.declination)),Rt.removeEventListener(this.absolutePositionProviderId),delete this.absolutePositionProviderId,this.compute()}))}availability(){return a.BrowserUtils.isMobile?Promise.resolve():Promise.resolve(new T)}start(){const t=()=>{switch(a.BrowserUtils.getName()){case a.Browser.CHROME:window.addEventListener("deviceorientationabsolute",this.onDeviceOrientationChromeEvent,!0);break;case a.Browser.SAFARI:case a.Browser.IOS_WEBVIEW:window.addEventListener("deviceorientation",this.onDeviceOrientationSafariEvent,!0)}},e=DeviceOrientationEvent.requestPermission||void 0;e?e().then((e=>{if("granted"!==e)throw new Error("Permission not granted");t()})).catch(this.notifyError):t();const i=Rt.lastEvent;i?this.onAbsolutePositionEvent(i):this.absolutePositionProviderId=Rt.addEventListener(this.onAbsolutePositionEvent,this.notifyError,!1)}stop(){switch(a.BrowserUtils.getName()){case a.Browser.CHROME:window.removeEventListener("deviceorientationabsolute",this.onDeviceOrientationChromeEvent,!0);break;case a.Browser.SAFARI:case a.Browser.IOS_WEBVIEW:window.removeEventListener("deviceorientation",this.onDeviceOrientationSafariEvent,!0)}Rt.removeEventListener(this.absolutePositionProviderId)}compute(){if(!this.declinationQuaternion||!this.magQuaternion||!this.absolutePositionEvent)return;const t=n.Quaternion.multiply(this.declinationQuaternion,this.magQuaternion),e=new y(t,this.magQuaternionTimestamp,this.DEFAULT_ACCURACY);this.notify(e)}static webkitCompassToHeading(t,e,i){const r=n.deg2rad(t),o=n.deg2rad(e),a=n.deg2rad(i),s=Math.cos(r/2),l=Math.cos(o/2),u=Math.cos(a/2),c=Math.sin(r/2),h=Math.sin(o/2),p=Math.sin(a/2),d=s*l*u-c*h*p,f=c*l*u+s*h*p;return n.rad2deg(-2*Math.atan(f/d))}}const Ft=new Bt;const Ot=new class extends E{constructor(){super(...arguments),f(this,"arCoreMonitoringId"),f(this,"arCoreProviderId"),f(this,"inertialProviderId"),f(this,"getName",(()=>"RelativeAttitude")),f(this,"availability",(()=>lt.getAvailability())),f(this,"listenInertial",(()=>{this.inertialProviderId=lt.addEventListener(this.notify,this.notifyError)})),f(this,"unlistenInertial",(()=>{lt.removeEventListener(this.inertialProviderId)})),f(this,"listenArCore",(()=>{this.arCoreProviderId=G.addEventListener((t=>this.notify(t.relativeAttitude)),null,!1)})),f(this,"unlistenArCore",(()=>{G.removeEventListener(this.arCoreProviderId)}))}start(){this.arCoreMonitoringId=G.addMonitoringListener((()=>{this.listenArCore(),this.unlistenInertial()}),(()=>{this.unlistenArCore(),this.listenInertial()})),"started"===G.state?this.listenArCore():this.listenInertial()}stop(){G.removeMonitoringListener(this.arCoreMonitoringId),this.unlistenArCore(),this.unlistenInertial()}},Ut=class t extends E{constructor(){super(...arguments),f(this,"_absAttitudeFromBrowser"),f(this,"_vpsProviderId"),f(this,"fromBrowserProviderId"),f(this,"highRotationProviderId"),f(this,"inclinationProviderId"),f(this,"relativeAttitudeProviderId"),f(this,"_attitudeFromBrowserErrored",!1),f(this,"_attitudeFromRelativeErrored",!1),f(this,"_relativeAttitude",null),f(this,"_relativeAccuracy",0),f(this,"_lastForcedHeadingEvent"),f(this,"_relAbsQuat"),f(this,"_wasHighRotationInProgress",!1),f(this,"_timeFirstDivergence",null),f(this,"_callbackMagCalibration"),f(this,"getName",(()=>"AbsoluteAttitude")),f(this,"_onError",(t=>{this._attitudeFromBrowserErrored&&this._attitudeFromRelativeErrored&&this.notifyError(t)})),f(this,"_forceHeadingForRelative",(t=>{if(this.lastEvent&&t.accuracy>this.lastEvent.accuracy)return;const e=e=>{const i=e.heading;this._relAbsQuat=n.Quaternion.fromAxisAngle([0,0,1],i-t.heading),this._relativeAccuracy=0,this._lastForcedHeadingEvent=t};if(this._relativeAttitude)return void e(this._relativeAttitude);const i=Ot.addEventListener((t=>{e(t),Ot.removeEventListener(i)}))})),f(this,"_onRelativeAttitudeEvent",(e=>{var i;const{quaternion:o,accuracy:a,time:s}=e;if(this._relativeAttitude&&(this._relativeAccuracy+=(s-this._relativeAttitude.time)*a),this._relativeAttitude=e,!this._lastForcedHeadingEvent||!this._relAbsQuat)return;const l=Math.min((this._lastForcedHeadingEvent.accuracy||0)+this._relativeAccuracy,Math.PI),u=at.isInProgress();let c=!1;if(this._absAttitudeFromBrowser){const{accuracy:e,heading:a}=this._absAttitudeFromBrowser;if(this._wasHighRotationInProgress&&!u)this._forceHeadingForRelative(this._absAttitudeFromBrowser);else if(e<l){const e=n.Quaternion.multiply(this._relAbsQuat,o),l=new r.Attitude(e),u=Math.abs(n.diffAngle(l.heading,a)),h=Et.lastEvent;u>t.REL_ABS_DIVERGENCE_ANGLE_THRESHOLD&&null!==h&&Math.abs(h-Math.PI/4)>t.REL_ABS_DIVERGENCE_INCLINATION_THRESHOLD&&(c=!0,null!==this._timeFirstDivergence&&s-this._timeFirstDivergence>t.REL_ABS_DIVERGENCE_TIME_THRESHOLD?(this._forceHeadingForRelative(this._absAttitudeFromBrowser),null==(i=this._callbackMagCalibration)||i.call(this,{angle:u}),this._timeFirstDivergence=null):null===this._timeFirstDivergence&&(this._timeFirstDivergence=s))}}c||(this._timeFirstDivergence=null),this._wasHighRotationInProgress=u;const h=n.Quaternion.multiply(this._relAbsQuat,o),p=new y(h,s,l);this.notify(p)})),f(this,"_onAttitudeFromBrowser",(t=>{this._absAttitudeFromBrowser=t,this._lastForcedHeadingEvent||this._forceHeadingForRelative(t)})),f(this,"_onAttitudeFromVps",(t=>{this._forceHeadingForRelative(t)}))}availability(){return I.some([Ft.getAvailability(),Ot.getAvailability()])}start(){this.fromBrowserProviderId=Ft.addEventListener(this._onAttitudeFromBrowser,(t=>{this._attitudeFromBrowserErrored=!0,this._onError(t)})),this._vpsProviderId=Lt.addEventListener((t=>this._onAttitudeFromVps(t.absoluteAttitude)),(t=>this.notifyError(t)),!1),this.relativeAttitudeProviderId=Ot.addEventListener(this._onRelativeAttitudeEvent,(t=>{this._attitudeFromRelativeErrored=!0,this._onError(t)})),this.inclinationProviderId=Et.addEventListener(),this.highRotationProviderId=at.addEventListener()}stop(){Ft.removeEventListener(this.fromBrowserProviderId),Ot.removeEventListener(this.relativeAttitudeProviderId),Et.removeEventListener(this.inclinationProviderId),at.removeEventListener(this.highRotationProviderId),Lt.removeEventListener(this._vpsProviderId)}_setCallbackMagCalibration(t){this._callbackMagCalibration=t}feed(t){if(t instanceof r.AbsoluteHeading){if(null===t.time)throw Error("the time of the absolute heading is not defined");if(null===t.accuracy)throw Error("the accuracy of the absolute heading is not defined");this._forceHeadingForRelative(t)}else{if(!(t instanceof y))throw new Error("data is nor an AbsoluteHeading or an Attitude object");if(null===t.time)throw Error("the time of the attitude is not defined");if(null===t.accuracy)throw Error("the accuracy of the attitude is not defined");this._forceHeadingForRelative(t)}}};f(Ut,"REL_ABS_DIVERGENCE_ANGLE_THRESHOLD",n.deg2rad(25)),f(Ut,"REL_ABS_DIVERGENCE_TIME_THRESHOLD",2.5),f(Ut,"REL_ABS_DIVERGENCE_INCLINATION_THRESHOLD",n.deg2rad(15));const Nt=new Ut,Vt=class t extends E{constructor(){super(...arguments),f(this,"providerId"),f(this,"slidingWindow",[]),f(this,"getName",(()=>"Turn")),f(this,"availability",(()=>Ot.getAvailability())),f(this,"_parseRelativeAttitude",(e=>{const{heading:i}=e,r=e.time;this.slidingWindow=this.slidingWindow.filter((e=>e[0]>=r-t.SLIDING_WINDOW_TIME)),this.slidingWindow.push([r,i]);n.std(this.slidingWindow.map((t=>t[1])))>t.STD_THRESHOLD&&this.notify({timestamp:r})}))}start(){this.providerId=Ot.addEventListener(this._parseRelativeAttitude,this.notifyError)}stop(){Ot.removeEventListener(this.providerId)}isTurning(){if(!this.lastEvent||!Ot.lastEvent)return!1;return Ot.lastEvent.time-this.lastEvent.timestamp<t.CONSIDER_TURN_UNTIL}};f(Vt,"SLIDING_WINDOW_TIME",.3),f(Vt,"STD_THRESHOLD",.075),f(Vt,"CONSIDER_TURN_UNTIL",1);const jt=new Vt,qt=class t extends E{constructor(){super(...arguments),f(this,"_turnProviderId"),f(this,"_stepProviderId"),f(this,"_countSteps",0),f(this,"_stepsConsideredForStraightLine",t.DEFAULT_STEPS_CONSIDERED_FOR_STRAIGHT_LINE),f(this,"getName",(()=>"StraightLine")),f(this,"_onTurn",(()=>{this._countSteps>=this._stepsConsideredForStraightLine&&this.notify(!1),this._countSteps=0})),f(this,"_onStep",(()=>{this._countSteps++,this._countSteps===this._stepsConsideredForStraightLine&&this.notify(!0)}))}availability(){return I.every([jt.getAvailability(),vt.getAvailability()])}start(){this._turnProviderId=jt.addEventListener(this._onTurn),this._stepProviderId=vt.addEventListener(this._onStep)}stop(){jt.removeEventListener(this._turnProviderId),vt.removeEventListener(this._stepProviderId)}isStraight(){return this._countSteps>=this._stepsConsideredForStraightLine}get numStepsDetectedFromLastTurn(){return this._countSteps}get stepsConsideredForStraightLine(){return this._stepsConsideredForStraightLine}set stepsConsideredForStraightLine(t){this._stepsConsideredForStraightLine=t}};f(qt,"DEFAULT_STEPS_CONSIDERED_FOR_STRAIGHT_LINE",2);const Gt=new qt,Zt=class t extends E{constructor(){super(...arguments),f(this,"_mapMatchingMaxDistance",t.DEFAULT_MM_MAX_DIST),f(this,"_mapMatchingMinDistance",t.DEFAULT_MM_MIN_DIST),f(this,"_mapMatchingMaxAngleBearing",t.DEFAULT_MM_MAX_ANGLE),f(this,"_useItineraryStartAsPosition",t.DEFAULT_USE_ITINERARY_START_AS_POSITION),f(this,"_useOrientationMatching",t.DEFAULT_USE_ORIENTATION_MATCHING),f(this,"_hugeJumpDistance",t.DEFAULT_MM_HUGE_JUMP_DISTANCE),f(this,"_disableMMCloseToATurnDistance",t.DEFAULT_DISABLE_MM_CLOSE_TO_A_TURN_DISTANCE),f(this,"_minStepsBetweenOrientationMatching",t.DEFAULT_MIN_STEPS_BETWEEN_ORIENTATION_MATCHING),f(this,"_minStepsForOrientationMatching",t.DEFAULT_MIN_STEPS_FOR_ORIENTATION_MATCHING),f(this,"_lastProjectionsWindowSize",t.DEFAULT_LAST_PROJECTIONS_WINDOW_SIZE),f(this,"_lastProjectionsEdgeAngleThreshold",t.DEFAULT_LAST_PROJECTIONS_EDGE_ANGLE_THRESHOLD),f(this,"_graph",null),f(this,"_internalProvidersStarted",!1),f(this,"_straightLineProviderId"),f(this,"_turnProviderId"),f(this,"_stepProviderId"),f(this,"_projectionsWithAbsAndWithoutRelAttitudeInARow",[]),f(this,"_countStepsFromLastMatching",0),f(this,"_lastProjections",[]),f(this,"_itineraryInfoManager",null),f(this,"getName",(()=>"MapMatchingHandler")),f(this,"availability",(()=>Promise.resolve())),f(this,"_manageStartStop",(()=>{this.graph&&!this._internalProvidersStarted?this._startInternalProviders():!this.graph&&this._internalProvidersStarted&&this._stopInternalProviders()}))}start(){this.graph&&this._startInternalProviders()}stop(){this._stopInternalProviders()}_startInternalProviders(){this.enabled&&this._internalProvidersStarted||(this._straightLineProviderId=Gt.addEventListener(),this._turnProviderId=jt.addEventListener(),this._stepProviderId=vt.addEventListener((()=>this._countStepsFromLastMatching++)),this._internalProvidersStarted=!0)}_stopInternalProviders(){this.enabled&&!this._internalProvidersStarted||(Gt.removeEventListener(this._straightLineProviderId),jt.removeEventListener(this._turnProviderId),vt.removeEventListener(this._stepProviderId),this._internalProvidersStarted=!1)}get enabled(){return v.useMapMatching}get graph(){return this._graph}set graph(t){this._graph=t,this._itineraryInfoManager=null,this.notify({...t&&{graph:t}}),this._manageStartStop(),this.canUseMapMatching()}set itinerary(t){this._graph=t?t.toGraph():null,this._itineraryInfoManager=new o.ItineraryInfoManager(t),this.notify({...t&&{itinerary:t}}),this._manageStartStop(),this.canUseMapMatching()&&t&&this._notifyPositionFromItineraryInput(t)}canUseMapMatching(){return this.enabled&&this.graph}_notifyPositionFromItineraryInput(t){if(!this._useItineraryStartAsPosition||!t.origin)return;const e=Rt.lastEvent||null,i=r.UserPosition.fromCoordinates(t.origin);if(e)i.alt=e.alt,i.time=e.time,i.accuracy=e.accuracy+i.distanceTo(e),i.bearing=e.bearing;else{if(!(t.coords.length>=2))return;i.alt=B,i.time=a.TimeUtils.preciseTime(),i.accuracy=0,i.bearing=t.coords[0].bearingTo(t.coords[1])}const n=this.getProjection(i,!0);n?Rt.notify(n.coords):Rt.notify(i)}notifyPositionFromFeed(t){const e=this.getProjection(t,!0,!1);e?Rt.notify(e.coords):Rt.notify(t)}notifyPositionFromAbsolute(t){let e=null;if(null!==t.bearing&&(e=this.getProjection(t,!0,!0)),!e)return Rt.notify(t),!0;const i=e.distanceFromNearestElement>this._hugeJumpDistance;return!(i&&!Gt.isStraight())&&((!i||!this._detectWrongBigJump(e))&&(Rt.notify(e.coords),this.tryOrientationMatching(e),!0))}notifyPositionFromRelative(t){var e;if(jt.isTurning())return this._projectionsWithAbsAndWithoutRelAttitudeInARow=[],this._lastProjections=[],Rt.notify(t),!0;const i=this.getProjection(t,!0,!0);if(i){this._projectionsWithAbsAndWithoutRelAttitudeInARow=[],this._lastProjections.push(i),this._lastProjections.length>this._lastProjectionsWindowSize&&this._lastProjections.shift();const e=i.distanceFromNearestElement>this._hugeJumpDistance;return e&&!Gt.isStraight()||e&&this._detectWrongBigJump(i)?(Rt.notify(t),!0):this._areLastProjectionsInTheSameDirection()?this._disableMMCloseToATurnDistance>0&&this._hasTurnInCircle(i.coords,this._disableMMCloseToATurnDistance)?(Rt.notify(t),!0):(Rt.notify(i.coords),this.tryOrientationMatching(i),!0):(Rt.notify(t),!0)}if(Gt.isStraight()){const i=t.clone();i.bearing=(null==(e=Ft.lastEvent)?void 0:e.heading)||null;const r=this.getProjection(i,!0,!0);if(r)return this._projectionsWithAbsAndWithoutRelAttitudeInARow.push(r),this._projectionsWithAbsAndWithoutRelAttitudeInARow.length<3?(Rt.notify(t),!0):(this._lastProjections.push(r),this._lastProjections.length>this._lastProjectionsWindowSize&&this._lastProjections.shift(),this._areLastProjectionsInTheSameDirection()?(Rt.notify(r.coords),this.tryOrientationMatching(r),!0):(Rt.notify(t),!0))}return this._projectionsWithAbsAndWithoutRelAttitudeInARow=[],this._lastProjections=[],Rt.notify(t),!0}_detectWrongBigJump(t){if(this._itineraryInfoManager&&Rt.lastEvent){const e=this._itineraryInfoManager.getInfo(Rt.lastEvent),i=this._itineraryInfoManager.getInfo(t.coords);if(e&&i&&e.traveledDistance>i.traveledDistance&&e.traveledDistance-i.traveledDistance>t.origin.accuracy&&t.distanceFromNearestElement>t.origin.accuracy&&t.origin.distanceTo(Rt.lastEvent)<t.origin.accuracy+Rt.lastEvent.accuracy)return!0}return!1}_areLastProjectionsInTheSameDirection(){if(0===this._lastProjections.length)return!1;const t=this._lastProjections[0];return!this._lastProjections.some((e=>!(e.nearestElement instanceof o.Edge)||!(t.nearestElement instanceof o.Edge)||n.diffAngleLines(e.nearestElement.bearing,t.nearestElement.bearing)>this._lastProjectionsEdgeAngleThreshold))}_nodeHasTurn(e){if(!this._graph)return;const i=this._graph.edges.filter((t=>t.vertex1===e||t.vertex2===e));for(let r=0;r<i.length;r++)for(let e=r+1;e<i.length;e++){if(n.diffAngleLines(i[r].bearing,i[e].bearing)>t.DEFAULT_MM_MAX_ANGLE)return!0}return!1}_hasTurnInCircle(t,e){const i=this._graph;return!!i&&i.vertices.filter((i=>i.coords.distanceTo(t)<=e&&r.Level.intersect(i.coords.level,t.level))).some((t=>this._nodeHasTurn(t)))}tryOrientationMatching(t){if(!this._useOrientationMatching)return;if("started"!==this.state||this._countStepsFromLastMatching<this._minStepsBetweenOrientationMatching||Gt.numStepsDetectedFromLastTurn<this._minStepsForOrientationMatching)return;const{nearestElement:e,origin:i}=t;if(!(e instanceof o.Edge))return;let a;const s=n.diffAngle(e.bearing,i.bearing),l=n.diffAngle(e.bearing+Math.PI,i.bearing);a=Math.abs(s)<Math.abs(l)?e.bearing:(e.bearing+Math.PI)%(2*Math.PI);const u=new r.AbsoluteHeading(a,i.time,0);Nt._forceHeadingForRelative(u),this._countStepsFromLastMatching=0}getProjection(t,e,i){var r;const n={...e&&{maxDistance:this._mapMatchingMaxDistance},...i&&{maxBearingAngle:this._mapMatchingMaxAngleBearing}};return null==(r=this._graph)?void 0:r.getProjection(t,n)}get maxDistance(){return this._mapMatchingMaxDistance}set maxDistance(t){this._mapMatchingMaxDistance=t}get minDistance(){return this._mapMatchingMinDistance}set minDistance(t){this._mapMatchingMinDistance=t}get maxAngleBearing(){return this._mapMatchingMaxAngleBearing}set maxAngleBearing(t){this._mapMatchingMaxAngleBearing=t}get useItineraryStartAsPosition(){return this._useItineraryStartAsPosition}set useItineraryStartAsPosition(t){this._useItineraryStartAsPosition=t}get useOrientationMatching(){return this._useOrientationMatching}set useOrientationMatching(t){this._useOrientationMatching=t}get hugeJumpDistance(){return this._hugeJumpDistance}set hugeJumpDistance(t){this._hugeJumpDistance=t}get disableMMCloseToATurnDistance(){return this._disableMMCloseToATurnDistance}set disableMMCloseToATurnDistance(t){this._disableMMCloseToATurnDistance=t}get minStepsBetweenOrientationMatching(){return this._minStepsBetweenOrientationMatching}set minStepsBetweenOrientationMatching(t){this._minStepsBetweenOrientationMatching=t}get minStepsForOrientationMatching(){return this._minStepsForOrientationMatching}set minStepsForOrientationMatching(t){this._minStepsForOrientationMatching=t}get lastProjectionsWindowSize(){return this._lastProjectionsWindowSize}set lastProjectionsWindowSize(t){this._lastProjectionsWindowSize=t}get lastProjectionsEdgeAngleThreshold(){return this._lastProjectionsEdgeAngleThreshold}set lastProjectionsEdgeAngleThreshold(t){this._lastProjectionsEdgeAngleThreshold=t}};f(Zt,"DEFAULT_MM_MAX_ANGLE",n.deg2rad(30)),f(Zt,"DEFAULT_MM_MAX_DIST",30),f(Zt,"DEFAULT_MM_MIN_DIST",0),f(Zt,"DEFAULT_USE_ITINERARY_START_AS_POSITION",!1),f(Zt,"DEFAULT_USE_ORIENTATION_MATCHING",!0),f(Zt,"DEFAULT_MM_HUGE_JUMP_DISTANCE",3),f(Zt,"DEFAULT_DISABLE_MM_CLOSE_TO_A_TURN_DISTANCE",2),f(Zt,"DEFAULT_MIN_STEPS_BETWEEN_ORIENTATION_MATCHING",3),f(Zt,"DEFAULT_MIN_STEPS_FOR_ORIENTATION_MATCHING",5),f(Zt,"DEFAULT_LAST_PROJECTIONS_WINDOW_SIZE",3),f(Zt,"DEFAULT_LAST_PROJECTIONS_EDGE_ANGLE_THRESHOLD",n.deg2rad(3));const Wt=new Zt,Ht=class t{constructor(e,i=t.DEFAULT_FREQUENCY){f(this,"positionsQueue",[]),f(this,"previousPosition",null),f(this,"timeoutNotify"),f(this,"_notifyNext",(()=>{var t;this.positionsQueue.length&&(null==(t=this.callback)||t.call(this,this.positionsQueue.shift()),0!==this.positionsQueue.length?this.timeoutNotify=setTimeout(this._notifyNext,1e3/this.frequency):delete this.timeoutNotify)})),this.callback=e,this.frequency=i}feed(e,i=t.DEFAULT_FLYBY_TIME){if(!(e instanceof r.UserPosition))throw new TypeError("newPosition is not instance of UserPosition");if(null===e.time)throw new Error("newPosition does not have time property");let n;if(0!==this.positionsQueue.length?(n=this.positionsQueue[0],this.positionsQueue=[]):n=this.previousPosition,n){const t=e.time,o=n.distanceTo(e),a=n.bearingTo(e);let s=1;const l=this.frequency*i+1,u=r.Level.clone(e.level);for(;s<l+1;){const i=n.destinationPoint(o*s/l,a);i.time=t+(s-1)/this.frequency,i.level=u,i.bearing=e.bearing,i.accuracy=Math.max(i.accuracy+(e.accuracy-i.accuracy)*s/l,0),this.positionsQueue.push(i),s++}this.timeoutNotify&&clearTimeout(this.timeoutNotify)}else this.positionsQueue.push(e.clone());this.previousPosition=e,this._notifyNext()}clear(){clearTimeout(this.timeoutNotify),delete this.timeoutNotify,this.positionsQueue=[]}};f(Ht,"DEFAULT_FREQUENCY",60),f(Ht,"DEFAULT_FLYBY_TIME",1);let Xt=Ht;const Kt=class t{constructor(t){f(this,"_previousAttitude"),f(this,"_smoothing",null),this.callback=t}feed(e){if(null===e.time)throw new Error("newAttitude does not have time property");const{_previousAttitude:i}=this;if(this._previousAttitude=e,i){if(t.isJump(i,e)){const o=null===this._smoothing?i:this._smoothing.interpAttitude(i),a=o.heading,s=e.heading,l=n.diffAngle(s,a),u=Math.abs(l)<t.HIGH_JUMP_THRESHOLD?t.ROTATION_SPEED_CONVERGENCE:t.ROTATION_SPEED_HIGH_JUMP_CONVERGENCE,c=o.time,h=Math.abs(l)/u,p=l<0?-1:1;this._smoothing={toTime:c+h,interpAttitude:t=>{const e=u*(t.time-c),i=a+e*p,o=n.Quaternion.fromAxisAngle([0,0,1],s-i),l=n.Quaternion.multiply(o,t.quaternion);return new r.Attitude(l,t.time,t.accuracy)}}}if(null!==this._smoothing){if(!(e.time>=this._smoothing.toTime)){const t=this._smoothing.interpAttitude(e);return void this.callback(t)}this._smoothing=null}this.callback(e)}else this.callback(e)}static isJump(e,i){const r=e.heading,o=i.heading,a=n.diffAngle(o,r),s=i.time-e.time,[l,u,c,h]=i.quaternion;return!(Math.abs(Math.asin(2*(l*u+c*h))-Math.PI/4)<t.PITCH_UNCERTAINITY_HEADING_THRESHOLD)&&Math.abs(a)>t.ROTATION_SPEED_JUMP_THRESHOLD*s}};f(Kt,"ROTATION_SPEED_JUMP_THRESHOLD",n.deg2rad(180)),f(Kt,"ROTATION_SPEED_CONVERGENCE",n.deg2rad(10)),f(Kt,"HIGH_JUMP_THRESHOLD",n.deg2rad(20)),f(Kt,"ROTATION_SPEED_HIGH_JUMP_CONVERGENCE",n.deg2rad(100)),f(Kt,"PITCH_UNCERTAINITY_HEADING_THRESHOLD",n.deg2rad(5));new class extends E{constructor(){super(),f(this,"getName",(()=>"MagnetometerCalibrationProvider")),f(this,"availability",(()=>Nt.getAvailability())),Nt._setCallbackMagCalibration((t=>"started"===this.state&&this.notify(t)))}start(){}stop(){}};const Jt=class t extends Error{constructor(e){super(e||t.DEFAULT_MESSAGE)}};f(Jt,"DEFAULT_MESSAGE","IP Resolver failed");let Yt=Jt;new class extends E{constructor(){super(...arguments),f(this,"getName",(()=>"Ip")),f(this,"availability",(()=>Promise.resolve()))}async start(){const t=await fetch("https://ipinfo.io/geo?token=24a7ca2f3b489d");if(!t)return void this.notifyError(new Yt);const e=a.TimeUtils.preciseTime()/1e3,i=(await t.json()).loc.split(","),n=new r.UserPosition(parseFloat(i[0]),parseFloat(i[1]),null,null,e,1e5);this.notify(n)}stop(){}};new class extends E{constructor(){super(...arguments),f(this,"providerId"),f(this,"getName",(()=>"Barcode")),f(this,"availability",(()=>G.getAvailability()))}start(){G.enableBarcodeScanner(),this.providerId=G.addEventListener((t=>t.barcode&&this.notify(t.barcode)),this.notifyError)}stop(){G.disableBarcodeScanner(),G.removeEventListener(this.providerId)}};new class extends E{constructor(){super(...arguments),f(this,"providerId"),f(this,"getName",(()=>"CameraNative")),f(this,"availability",(()=>Promise.resolve()))}start(){"stopped"!==G.state&&this.notify("started"),this.providerId=G.addMonitoringListener((()=>this.notify("started")),(()=>this.notify("stopped")))}stop(){G.removeMonitoringListener(this.providerId)}};new class extends E{constructor(){super(...arguments),f(this,"providerId"),f(this,"getName",(()=>"CameraProjectionMatrix")),f(this,"availability",(()=>G.getAvailability()))}start(){this.providerId=G.addEventListener((t=>t.cameraProjection&&this.notify(t.cameraProjection)),this.notifyError)}stop(){G.removeEventListener(this.providerId)}};class Qt extends p.Evented{constructor(){super(...arguments),e(this,"attitudeProviderId"),e(this,"positionProviderId"),e(this,"smoother",null),e(this,"_started",!1)}start(){if(this._started)return;this._started=!0,this.attitudeProviderId=Nt.addEventListener((t=>this.fire("heading.changed",{heading:t.headingDegrees})),(t=>i.warn(t.message))),this.smoother=new Xt((t=>{this.fire("position.changed",{position:t})})),this.positionProviderId=Rt.addEventListener((t=>this.smoother.feed(t)),(t=>i.warn(t.message)));const t=Rt.lastEvent?Rt.lastEvent:null;t&&this.fire("position.changed",{position:t})}stop(){this._started&&(this._started=!1,Nt.removeEventListener(this.attitudeProviderId),Rt.removeEventListener(this.positionProviderId),this.smoother.clear(),this.smoother=null)}}exports.default=Qt;
|
|
2
|
-
//# sourceMappingURL=CustomMapProvider.js.map
|