/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@huangyunhui/asset@0.0.3/dist/brtmap-2.5.0.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).brtmap=e()}(this,(function(){"use strict";var t,e,r;function i(i,n){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),r=n(a),"undefined"!=typeof window&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=n;else t=n}return i(0,(function(t){var e=r;function r(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=i}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 r,i,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)<(r=0))return r;if(n>(i=1))return i;for(;r<i;){if(o=this.sampleCurveX(n),Math.abs(o-t)<e)return n;t>o?r=n:i=n,n=.5*(i-r)+r}return n},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=n;function n(t,e){this.x=t,this.y=e}n.prototype={clone:function(){return new n(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,r=t.y-this.y;return e*e+r*r},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),r=Math.sin(t),i=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),i=Math.sin(t),n=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-i*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t};var o="undefined"!=typeof self?self:{},a=Math.pow(2,53)-1;function s(t,r,i,n){var o=new e(t,r,i,n);return function(t){return o.solve(t)}}var l=s(.25,.1,.25,1);function u(t,e,r){return Math.min(r,Math.max(e,t))}function h(t,e,r){var i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function p(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var i=0,n=e;i<n.length;i+=1){var o=n[i];for(var a in o)t[a]=o[a]}return t}var c=1;function f(){return c++}function d(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function m(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 y(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function g(t,e){return-1!==t.indexOf(e,t.length-e.length)}function _(t,e,r){var i={};for(var n in t)i[n]=e.call(r||this,t[n],n,t);return i}function v(t,e,r){var i={};for(var n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function x(t){return Array.isArray(t)?t.map(x):"object"==typeof t&&t?_(t,x):t}var b={};function w(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function I(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function S(t){for(var e=0,r=0,i=t.length,n=i-1,o=void 0,a=void 0;r<i;n=r++)e+=((a=t[n]).x-(o=t[r]).x)*(o.y+a.y);return e}function T(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,i,n){var o=i||n;return e[r]=!o||o.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var E=null;function P(t){if(null==E){var e=t.navigator?t.navigator.userAgent:null;E=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return E}function A(t){try{var e=o[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var L,M,k,z,C=o.performance&&o.performance.now?o.performance.now.bind(o.performance):Date.now.bind(Date),D=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame,R=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||o.msCancelAnimationFrame,F={now:C,frame:function(t){var e=D(t);return{cancel:function(){return R(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=o.document.createElement("canvas"),i=r.getContext("2d");if(!i)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,i.drawImage(t,0,0,t.width,t.height),i.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return L||(L=o.document.createElement("a")),L.href=t,L.href},hardwareConcurrency:o.navigator&&o.navigator.hardwareConcurrency||4,get devicePixelRatio(){return o.devicePixelRatio},get prefersReducedMotion(){return!!o.matchMedia&&(null==M&&(M=o.matchMedia("(prefers-reduced-motion: reduce)")),M.matches)}},O={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},B={supported:!1,testSupport:function(t){!N&&z&&(V?U(t):k=t)}},N=!1,V=!1;function U(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,z),t.isContextLost())return;B.supported=!0}catch(t){}t.deleteTexture(e),N=!0}o.document&&((z=o.document.createElement("img")).onload=function(){k&&U(k),k=null,V=!0},z.onerror=function(){N=!0,k=null},z.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var j="01",q=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function G(t){return 0===t.indexOf("mapbox:")}q.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",j,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},q.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},q.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},q.prototype.normalizeStyleURL=function(t,e){if(!G(t))return t;var r=W(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeGlyphsURL=function(t,e){if(!G(t))return t;var r=W(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSourceURL=function(t,e){if(!G(t))return t;var r=W(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSpriteURL=function(t,e,r,i){var n=W(t);return G(t)?(n.path="/styles/v1"+n.path+"/sprite"+e+r,this._makeAPIURL(n,this._customAccessToken||i)):(n.path+=""+e+r,H(n))},q.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!G(t))return t;var r=W(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(F.devicePixelRatio>=2||512===e?"@2x":"")+(B.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var i=this._customAccessToken||function(t){for(var e=0,r=t;e<r.length;e+=1){var i=r[e].match(/^access_token=(.*)$/);if(i)return i[1]}return null}(r.params)||O.ACCESS_TOKEN;return i&&this._skuToken&&r.params.push("sku="+this._skuToken),this._makeAPIURL(r,i)},q.prototype.canonicalizeTileURL=function(t,e){var r=W(t);if(!r.path.match(/(^\/v4\/)/)||!r.path.match(/\.[\w]+$/))return t;var i="mapbox://tiles/";i+=r.path.replace("/v4/","");var n=r.params;return e&&(n=n.filter((function(t){return!t.match(/^access_token=/)}))),n.length&&(i+="?"+n.join("&")),i},q.prototype.canonicalizeTileset=function(t,e){for(var r=!!e&&G(e),i=[],n=0,o=t.tiles||[];n<o.length;n+=1){var a=o[n];X(a)?i.push(this.canonicalizeTileURL(a,r)):i.push(a)}return i},q.prototype._makeAPIURL=function(t,e){var r="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",i=W(O.API_URL);if(t.protocol=i.protocol,t.authority=i.authority,"http"===t.protocol){var n=t.params.indexOf("secure");n>=0&&t.params.splice(n,1)}if("/"!==i.path&&(t.path=""+i.path+t.path),!(e=e||O.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+r);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+r);return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+e),H(t)};var Z=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function X(t){return Z.test(t)}var Y=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function W(t){var e=t.match(Y);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 H(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function K(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(o.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var J=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};J.prototype.getStorageKey=function(t){var e,r=K(O.ACCESS_TOKEN);return e=r&&r.u?o.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},J.prototype.fetchEventData=function(){var t=A("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{var i=o.localStorage.getItem(e);i&&(this.eventData=JSON.parse(i));var n=o.localStorage.getItem(r);n&&(this.anonId=n)}catch(t){w("Unable to read from LocalStorage")}},J.prototype.saveEventData=function(){var t=A("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{o.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&o.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){w("Unable to write to LocalStorage")}},J.prototype.processRequests=function(t){},J.prototype.postEvent=function(t,e,r,i){var n=this;if(O.EVENTS_URL){var o=W(O.EVENTS_URL);o.params.push("access_token="+(i||O.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"2.5.0",skuId:j,userId:this.anonId},s=e?p(a,e):a,l={url:H(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=vt(l,(function(t){n.pendingRequest=null,r(t),n.saveEventData(),n.processRequests(i)}))}},J.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var $,Q,tt=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,r,i){this.skuToken=r,(O.EVENTS_URL&&i||O.ACCESS_TOKEN)&&this.queueRequest({id:e,timestamp:Date.now()},i)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),i=r.id,n=r.timestamp;i&&this.success[i]||(this.anonId||this.fetchEventData(),m(this.anonId)||(this.anonId=d()),this.postEvent(n,{skuToken:this.skuToken},(function(t){t||i&&(e.success[i]=!0)}),t))}},e}(J),et=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){O.EVENTS_URL&&O.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return G(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 r=K(O.ACCESS_TOKEN),i=r?r.u:O.ACCESS_TOKEN,n=i!==this.eventData.tokenU;m(this.anonId)||(this.anonId=d(),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=i)}),t)}},e}(J)),rt=et.postTurnstileEvent.bind(et),it=new tt,nt=it.postMapLoadEvent.bind(it),ot=500,at=50;function st(){o.caches&&!$&&($=o.caches.open("mapbox-tiles"))}function lt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ut,ht=1/0;function pt(){return null==ut&&(ut=o.OffscreenCanvas&&new o.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof o.createImageBitmap),ut}var ct={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ct);var ft,dt,mt=function(t){function e(e,r,i){401===r&&X(i)&&(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=r,this.url=i,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),yt=function(){return"blob"===o.location.protocol&&o.parent?o.parent.location.href:o.location.href},gt=function(t,e){return!(/^file:/.test(r=t.url)||/^file:/.test(yt())&&!/^\w+:/.test(r))&&o.fetch&&o.Request&&o.AbortController&&o.Request.prototype.hasOwnProperty("signal")?function(t,e){var r,i=new o.AbortController,n=new o.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:yt(),signal:i.signal}),a=!1,s=!1,l=(r=n.url).indexOf("sku=")>0&&X(r);"json"===t.type&&n.headers.set("Accept","application/json");var u=function(r,i,a){if(!s){if(r&&"SecurityError"!==r.message&&w(r),i&&a)return h(i);var u=Date.now();o.fetch(n).then((function(r){if(r.ok){var i=l?r.clone():null;return h(r,i,u)}return e(new mt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},h=function(r,i,l){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){s||(i&&l&&function(t,e,r){if(st(),$){var i={status:e.status,statusText:e.statusText,headers:new o.Headers};e.headers.forEach((function(t,e){return i.headers.set(e,t)}));var n=T(e.headers.get("Cache-Control")||"");n["no-store"]||(n["max-age"]&&i.headers.set("Expires",new Date(r+1e3*n["max-age"]).toUTCString()),new Date(i.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===Q)try{new Response(new ReadableStream),Q=!0}catch(t){Q=!1}Q?e(t.body):t.blob().then(e)}(e,(function(e){var r=new o.Response(e,i);st(),$&&$.then((function(e){return e.put(lt(t.url),r)})).catch((function(t){return w(t.message)}))})))}}(n,i,l),a=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){s||e(new Error(t.message))}))};return l?function(t,e){if(st(),!$)return e(null);var r=lt(t.url);$.then((function(t){t.match(r).then((function(i){var n=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=T(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(i);t.delete(r),n&&t.put(r,i.clone()),e(null,i,n)})).catch(e)})).catch(e)}(n,u):u(null,null),{cancel:function(){s=!0,a||i.abort()}}}(t,e):function(t,e){var r=new o.XMLHttpRequest;for(var i in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(i,t.headers[i]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var i=r.response;if("json"===t.type)try{i=JSON.parse(r.response)}catch(t){return e(t)}e(null,i,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new mt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e);var r},_t=function(t,e){return gt(p(t,{type:"arrayBuffer"}),e)},vt=function(t,e){return gt(p(t,{method:"POST"}),e)},xt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";ft=[],dt=0;var bt=function(t,e){if(B.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),dt>=O.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return ft.push(r),r}dt++;var i=!1,n=function(){if(!i)for(i=!0,dt--;ft.length&&dt<O.MAX_PARALLEL_IMAGE_REQUESTS;){var t=ft.shift();t.cancelled||(t.cancel=bt(t.requestParameters,t.callback).cancel)}},a=_t(t,(function(t,r,i,a){n(),t?e(t):r&&(pt()?function(t,e){var r=new o.Blob([new Uint8Array(t)],{type:"image/png"});o.createImageBitmap(r).then((function(t){e(null,t)})).catch((function(t){e(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."))}))}(r,e):function(t,e,r,i){var n=new o.Image,a=o.URL;n.onload=function(){e(null,n),a.revokeObjectURL(n.src),n.onload=null,n.src=xt},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 o.Blob([new Uint8Array(t)],{type:"image/png"});n.cacheControl=r,n.expires=i,n.src=t.byteLength?a.createObjectURL(s):xt}(r,e,i,a))}));return{cancel:function(){a.cancel(),n()}}};function wt(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function It(t,e,r){if(r&&r[t]){var i=r[t].indexOf(e);-1!==i&&r[t].splice(i,1)}}var St=function(t,e){void 0===e&&(e={}),p(this,e),this.type=t},Tt=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",p({error:e},r))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(St),Et=function(){};Et.prototype.on=function(t,e){return this._listeners=this._listeners||{},wt(t,e,this._listeners),this},Et.prototype.off=function(t,e){return It(t,e,this._listeners),It(t,e,this._oneTimeListeners),this},Et.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},wt(t,e,this._oneTimeListeners),this},Et.prototype.fire=function(t,e){"string"==typeof t&&(t=new St(t,e||{}));var r=t.type;if(this.listens(r)){t.target=this;for(var i=0,n=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];i<n.length;i+=1)n[i].call(this,t);for(var o=0,a=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];o<a.length;o+=1){var s=a[o];It(r,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 Tt&&console.error(t.error);return this},Et.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)},Et.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Pt={$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"},"fill-extrusion-outline-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-constant"},"fill-extrusion-outline-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},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"},"icon-height":{type:"number",default:0,minimum:0,units:"meters",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"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"},"text-height":{type:"number",default:0,minimum:0,units:"meters",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"}},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"}}},At=function(t,e,r,i){this.message=(t?t+": ":"")+r,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)};function Lt(t){var e=t.value;return e?[new At(t.key,e,"constants have been deprecated as of v8")]:[]}function Mt(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var i=0,n=e;i<n.length;i+=1){var o=n[i];for(var a in o)t[a]=o[a]}return t}function kt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function zt(t){if(Array.isArray(t))return t.map(zt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var r in t)e[r]=zt(t[r]);return e}return kt(t)}var Ct=function(t){function e(e,r){t.call(this,r),this.message=r,this.key=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),Dt=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var r=0,i=e;r<i.length;r+=1){var n=i[r];this.bindings[n[0]]=n[1]}};Dt.prototype.concat=function(t){return new Dt(this,t)},Dt.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.")},Dt.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Rt={kind:"null"},Ft={kind:"number"},Ot={kind:"string"},Bt={kind:"boolean"},Nt={kind:"color"},Vt={kind:"object"},Ut={kind:"value"},jt={kind:"collator"},qt={kind:"formatted"},Gt={kind:"resolvedImage"};function Zt(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 Yt=[Rt,Ft,Ot,Bt,Nt,qt,Vt,Zt(Ut),Gt];function Wt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Wt(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 r=0,i=Yt;r<i.length;r+=1)if(!Wt(i[r],e))return null}return"Expected "+Xt(t)+" but found "+Xt(e)+" instead."}function Ht(t,e){return e.some((function(e){return e.kind===t.kind}))}function Kt(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}))}function Jt(t,e){return t(e={exports:{}},e.exports),e.exports}var $t=Jt((function(t,e){var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function i(t){return(t=Math.round(t))<0?0:t>255?255:t}function n(t){return i("%"===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,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[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 h=s.substr(0,l),p=s.substr(l+1,u-(l+1)).split(","),c=1;switch(h){case"rgba":if(4!==p.length)return null;c=o(p.pop());case"rgb":return 3!==p.length?null:[n(p[0]),n(p[1]),n(p[2]),c];case"hsla":if(4!==p.length)return null;c=o(p.pop());case"hsl":if(3!==p.length)return null;var f=(parseFloat(p[0])%360+360)%360/360,d=o(p[1]),m=o(p[2]),y=m<=.5?m*(d+1):m+d-m*d,g=2*m-y;return[i(255*a(g,y,f+1/3)),i(255*a(g,y,f)),i(255*a(g,y,f-1/3)),c];default:return null}}return null}}catch(t){}})).parseCSSColor,Qt=function(t,e,r,i){void 0===i&&(i=1),this.r=t,this.g=e,this.b=r,this.a=i};Qt.parse=function(t){if(t){if(t instanceof Qt)return t;if("string"==typeof t){var e=$t(t);if(e)return new Qt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Qt.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],i=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+i+")"},Qt.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]},Qt.black=new Qt(0,0,0,1),Qt.white=new Qt(1,1,1,1),Qt.transparent=new Qt(0,0,0,0),Qt.red=new Qt(1,0,0,1);var te=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};te.prototype.compare=function(t,e){return this.collator.compare(t,e)},te.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ee=function(t,e,r,i,n){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n},re=function(t){this.sections=t};re.fromString=function(t){return new re([new ee(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,r=this.sections;e<r.length;e+=1){var i=r[e];if(i.image)t.push(["image",i.image.name]);else{t.push(i.text);var n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toArray())),t.push(n)}}return t};var ie=function(t){this.name=t.name,this.available=t.available};function ne(t,e,r,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:"Invalid rgba value ["+[t,e,r,i].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof i?[t,e,r,i]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function oe(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 Qt)return!0;if(t instanceof te)return!0;if(t instanceof re)return!0;if(t instanceof ie)return!0;if(Array.isArray(t)){for(var e=0,r=t;e<r.length;e+=1)if(!oe(r[e]))return!1;return!0}if("object"==typeof t){for(var i in t)if(!oe(t[i]))return!1;return!0}return!1}function ae(t){if(null===t)return Rt;if("string"==typeof t)return Ot;if("boolean"==typeof t)return Bt;if("number"==typeof t)return Ft;if(t instanceof Qt)return Nt;if(t instanceof te)return jt;if(t instanceof re)return qt;if(t instanceof ie)return Gt;if(Array.isArray(t)){for(var e,r=t.length,i=0,n=t;i<n.length;i+=1){var o=ae(n[i]);if(e){if(e===o)continue;e=Ut;break}e=o}return Zt(e||Ut,r)}return Vt}function se(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Qt||t instanceof re||t instanceof ie?t.toString():JSON.stringify(t)}ie.prototype.toString=function(){return this.name},ie.fromString=function(t){return t?new ie({name:t,available:!1}):null},ie.prototype.serialize=function(){return["image",this.name]};var le=function(t,e){this.type=t,this.value=e};le.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!oe(t[1]))return e.error("invalid value");var r=t[1],i=ae(r),n=e.expectedType;return"array"!==i.kind||0!==i.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(i=n),new le(i,r)},le.prototype.evaluate=function(){return this.value},le.prototype.eachChild=function(){},le.prototype.outputDefined=function(){return!0},le.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Qt?["rgba"].concat(this.value.toArray()):this.value instanceof re?this.value.serialize():this.value};var ue=function(t){this.name="ExpressionEvaluationError",this.message=t};ue.prototype.toJSON=function(){return this.message};var he={string:Ot,number:Ft,boolean:Bt,object:Vt},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 r,i=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],i++}else o=Ut;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],i++}r=Zt(o,a)}else r=he[n];for(var l=[];i<t.length;i++){var u=e.parse(t[i],i,Ut);if(!u)return null;l.push(u)}return new pe(r,l)},pe.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var r=this.args[e].evaluate(t);if(!Wt(this.type,ae(r)))return r;if(e===this.args.length-1)throw new ue("Expected value to be of type "+Xt(this.type)+", but found "+Xt(ae(r))+" 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 r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);var i=t.N;("number"==typeof i||this.args.length>1)&&e.push(i)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var ce=function(t){this.type=qt,this.sections=t};ce.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var i=[],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,Ft)))return null;var l=null;if(a["text-font"]&&!(l=e.parse(a["text-font"],1,Zt(Ot))))return null;var u=null;if(a["text-color"]&&!(u=e.parse(a["text-color"],1,Nt)))return null;var h=i[i.length-1];h.scale=s,h.font=l,h.textColor=u}else{var p=e.parse(t[o],1,Ut);if(!p)return null;var c=p.type.kind;if("string"!==c&&"value"!==c&&"null"!==c&&"resolvedImage"!==c)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,i.push({content:p,scale:null,font:null,textColor:null})}}return new ce(i)},ce.prototype.evaluate=function(t){return new re(this.sections.map((function(e){var r=e.content.evaluate(t);return ae(r)===Gt?new ee("",r,null,null,null):new ee(se(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ce.prototype.eachChild=function(t){for(var e=0,r=this.sections;e<r.length;e+=1){var i=r[e];t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor)}},ce.prototype.outputDefined=function(){return!1},ce.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e<r.length;e+=1){var i=r[e];t.push(i.content.serialize());var n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),t.push(n)}return t};var fe=function(t){this.type=Gt,this.input=t};fe.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Ot);return r?new fe(r):e.error("No image name provided.")},fe.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=ie.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r},fe.prototype.eachChild=function(t){t(this.input)},fe.prototype.outputDefined=function(){return!1},fe.prototype.serialize=function(){return["image",this.input.serialize()]};var de={"to-boolean":Bt,"to-color":Nt,"to-number":Ft,"to-string":Ot},me=function(t,e){this.type=t,this.args=e};me.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var i=de[r],n=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,Ut);if(!a)return null;n.push(a)}return new me(i,n)},me.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,r,i=0,n=this.args;i<n.length;i+=1){if(r=null,(e=n[i].evaluate(t))instanceof Qt)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}else if(Array.isArray(e)&&!(r=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ne(e[0],e[1],e[2],e[3])))return new Qt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ue(r||"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 ue("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?re.fromString(se(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?ie.fromString(se(this.args[0].evaluate(t))):se(this.args[0].evaluate(t))},me.prototype.eachChild=function(t){this.args.forEach(t)},me.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},me.prototype.serialize=function(){if("formatted"===this.type.kind)return new ce([{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 ye=["Unknown","Point","LineString","Polygon"],ge=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};ge.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},ge.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?ye[this.feature.type]:this.feature.type:null},ge.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},ge.prototype.canonicalID=function(){return this.canonical},ge.prototype.properties=function(){return this.feature&&this.feature.properties||{}},ge.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Qt.parse(t)),e};var _e=function(t,e,r,i){this.name=t,this.type=e,this._evaluate=r,this.args=i};_e.prototype.evaluate=function(t){return this._evaluate(t,this.args)},_e.prototype.eachChild=function(t){this.args.forEach(t)},_e.prototype.outputDefined=function(){return!1},_e.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},_e.parse=function(t,e){var r,i=t[0],n=_e.definitions[i];if(!n)return e.error('Unknown expression "'+i+'". 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 r=e[0];return!Array.isArray(r)||r.length===t.length-1})),l=null,u=0,h=s;u<h.length;u+=1){var p=h[u],c=p[0],f=p[1];l=new Ve(e.registry,e.path,null,e.scope);for(var d=[],m=!1,y=1;y<t.length;y++){var g=t[y],_=Array.isArray(c)?c[y-1]:c.type,v=l.parse(g,1+d.length,_);if(!v){m=!0;break}d.push(v)}if(!m)if(Array.isArray(c)&&c.length!==d.length)l.error("Expected "+c.length+" arguments, but found "+d.length+" instead.");else{for(var x=0;x<d.length;x++){var b=Array.isArray(c)?c[x]:c.type,w=d[x];l.concat(x+1).checkSubtype(b,w.type)}if(0===l.errors.length)return new _e(i,o,f,d)}}if(1===s.length)(r=e.errors).push.apply(r,l.errors);else{for(var I=(s.length?s:a).map((function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map(Xt).join(", ")+")":"("+Xt(e.type)+"...)"})).join(" | "),S=[],T=1;T<t.length;T++){var E=e.parse(t[T],1+S.length);if(!E)return null;S.push(Xt(E.type))}e.error("Expected arguments of type "+I+", but found ("+S.join(", ")+") instead.")}return null},_e.register=function(t,e){for(var r in _e.definitions=e,e)t[r]=_e};var ve=function(t,e,r){this.type=jt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function xe(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 be(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function we(t,e){var r=(180+t[0])/360,i=(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(r*n*8192),Math.round(i*n*8192)]}function Ie(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function Se(t,e){for(var r,i,n,o,a,s,l,u=!1,h=0,p=e.length;h<p;h++)for(var c=e[h],f=0,d=c.length;f<d-1;f++){if((o=(r=t)[0]-(i=c[f])[0])*(l=r[1]-(n=c[f+1])[1])-(s=r[0]-n[0])*(a=r[1]-i[1])==0&&o*s<=0&&a*l<=0)return!1;Ie(t,c[f],c[f+1])&&(u=!u)}return u}function Te(t,e){for(var r=0;r<e.length;r++)if(Se(t,e[r]))return!0;return!1}function Ee(t,e,r,i){var n=i[0]-r[0],o=i[1]-r[1],a=(t[0]-r[0])*o-n*(t[1]-r[1]),s=(e[0]-r[0])*o-n*(e[1]-r[1]);return a>0&&s<0||a<0&&s>0}function Pe(t,e,r){for(var i=0,n=r;i<n.length;i+=1)for(var o=n[i],a=0;a<o.length-1;++a)if(0!=(p=[(h=o[a+1])[0]-(u=o[a])[0],h[1]-u[1]])[0]*(c=[(l=e)[0]-(s=t)[0],l[1]-s[1]])[1]-p[1]*c[0]&&Ee(s,l,u,h)&&Ee(u,h,s,l))return!0;var s,l,u,h,p,c;return!1}function Ae(t,e){for(var r=0;r<t.length;++r)if(!Se(t[r],e))return!1;for(var i=0;i<t.length-1;++i)if(Pe(t[i],t[i+1],e))return!1;return!0}function Le(t,e){for(var r=0;r<e.length;r++)if(Ae(t,e[r]))return!0;return!1}function Me(t,e,r){for(var i=[],n=0;n<t.length;n++){for(var o=[],a=0;a<t[n].length;a++){var s=we(t[n][a],r);xe(e,s),o.push(s)}i.push(o)}return i}function ke(t,e,r){for(var i=[],n=0;n<t.length;n++){var o=Me(t[n],e,r);i.push(o)}return i}function ze(t,e,r,i){if(t[0]<r[0]||t[0]>r[2]){var n=.5*i,o=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;0===o&&(o=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=o}xe(e,t)}function Ce(t,e,r,i){for(var n=8192*Math.pow(2,i.z),o=[8192*i.x,8192*i.y],a=[],s=0,l=t;s<l.length;s+=1)for(var u=0,h=l[s];u<h.length;u+=1){var p=h[u],c=[p.x+o[0],p.y+o[1]];ze(c,e,r,n),a.push(c)}return a}function De(t,e,r,i){for(var n,o=8192*Math.pow(2,i.z),a=[8192*i.x,8192*i.y],s=[],l=0,u=t;l<u.length;l+=1){for(var h=[],p=0,c=u[l];p<c.length;p+=1){var f=c[p],d=[f.x+a[0],f.y+a[1]];xe(e,d),h.push(d)}s.push(h)}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 g=0,_=y[m];g<_.length;g+=1)ze(_[g],e,r,o)}return s}ve.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");var i=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,Bt);if(!i)return null;var n=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,Bt);if(!n)return null;var o=null;return r.locale&&!(o=e.parse(r.locale,1,Ot))?null:new ve(i,n,o)},ve.prototype.evaluate=function(t){return new te(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},ve.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},ve.prototype.outputDefined=function(){return!1},ve.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 Re=function(t,e){this.type=Bt,this.geojson=t,this.geometries=e};function Fe(t){if(t instanceof _e){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 Re)return!1;var e=!0;return t.eachChild((function(t){e&&!Fe(t)&&(e=!1)})),e}function Oe(t){if(t instanceof _e&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!Oe(t)&&(e=!1)})),e}function Be(t,e){if(t instanceof _e&&e.indexOf(t.name)>=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Be(t,e)&&(r=!1)})),r}Re.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(oe(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var i=0;i<r.features.length;++i){var n=r.features[i].geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new Re(r,r.features[i].geometry)}else if("Feature"===r.type){var o=r.geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new Re(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new Re(r,r)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},Re.prototype.evaluate=function(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){var r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){var o=Me(e.coordinates,i,n),a=Ce(t.geometry(),r,i,n);if(!be(r,i))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,i,n),h=Ce(t.geometry(),r,i,n);if(!be(r,i))return!1;for(var p=0,c=h;p<c.length;p+=1)if(!Te(c[p],u))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){var r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){var o=Me(e.coordinates,i,n),a=De(t.geometry(),r,i,n);if(!be(r,i))return!1;for(var s=0,l=a;s<l.length;s+=1)if(!Ae(l[s],o))return!1}if("MultiPolygon"===e.type){var u=ke(e.coordinates,i,n),h=De(t.geometry(),r,i,n);if(!be(r,i))return!1;for(var p=0,c=h;p<c.length;p+=1)if(!Le(c[p],u))return!1}return!0}(t,this.geometries)}return!1},Re.prototype.eachChild=function(){},Re.prototype.outputDefined=function(){return!0},Re.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 r=t[1];return e.scope.has(r)?new Ne(r,e.scope.get(r)):e.error('Unknown variable "'+r+'". Make sure "'+r+'" 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,r,i,n){void 0===e&&(e=[]),void 0===i&&(i=new Dt),void 0===n&&(n=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=i,this.errors=n,this.expectedType=r};function Ue(t,e){for(var r,i=t.length-1,n=0,o=i,a=0;n<=o;)if((r=t[a=Math.floor((n+o)/2)])<=e){if(a===i||e<t[a+1])return a;n=a+1}else{if(!(r>e))throw new ue("Input is not a number.");o=a-1}return 0}Ve.prototype.parse=function(t,e,r,i,n){return void 0===n&&(n={}),e?this.concat(e,r,i)._parse(t,n):this._parse(t,n)},Ve.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new pe(e,[t]):"coerce"===r?new me(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 i=t[0];if("string"!=typeof i)return this.error("Expression name must be a string, but found "+typeof i+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var n=this.registry[i];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=r(o,a,e.typeAnnotation||"coerce");else o=r(o,a,e.typeAnnotation||"assert")}if(!(o instanceof le)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof Ne)return t(e.boundExpression);if(e instanceof _e&&"error"===e.name)return!1;if(e instanceof ve)return!1;if(e instanceof Re)return!1;var r=e instanceof me||e instanceof pe,i=!0;return e.eachChild((function(e){i=r?i&&t(e):i&&e instanceof le})),!!i&&Fe(e)&&Be(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var l=new ge;try{o=new le(o.type,o.evaluate(l))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+i+'". 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,r){var i="number"==typeof t?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new Ve(this.registry,i,e||null,n,this.errors)},Ve.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var i=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Ct(i,t))},Ve.prototype.checkSubtype=function(t,e){var r=Wt(t,e);return r&&this.error(r),r};var je=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var i=0,n=r;i<n.length;i+=1){var o=n[i],a=o[1];this.labels.push(o[0]),this.outputs.push(a)}};function qe(t,e,r){return t*(1-r)+e*r}je.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 r=e.parse(t[1],1,Ft);if(!r)return null;var i=[],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(i.length&&i[i.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 h=e.parse(s,u,n);if(!h)return null;n=n||h.type,i.push([a,h])}return new je(n,r,i)},je.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);var n=e.length;return i>=e[n-1]?r[n-1].evaluate(t):r[Ue(e,i)].evaluate(t)},je.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1)t(r[e])},je.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},je.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 Ge=Object.freeze({__proto__:null,number:qe,color:function(t,e,r){return new Qt(qe(t.r,e.r,r),qe(t.g,e.g,r),qe(t.b,e.b,r),qe(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,i){return qe(t,e[i],r)}))}}),Ze=6/29*3*(6/29),Xe=Math.PI/180,Ye=180/Math.PI;function We(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ze+4/29}function He(t){return t>6/29?t*t*t:Ze*(t-4/29)}function Ke(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Je(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $e(t){var e=Je(t.r),r=Je(t.g),i=Je(t.b),n=We((.4124564*e+.3575761*r+.1804375*i)/.95047),o=We((.2126729*e+.7151522*r+.072175*i)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-We((.0193339*e+.119192*r+.9503041*i)/1.08883)),alpha:t.a}}function Qe(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,i=isNaN(t.b)?e:e-t.b/200;return e=1*He(e),r=.95047*He(r),i=1.08883*He(i),new Qt(Ke(3.2404542*r-1.5371385*e-.4985314*i),Ke(-.969266*r+1.8760108*e+.041556*i),Ke(.0556434*r-.2040259*e+1.0572252*i),t.alpha)}function tr(t,e,r){var i=e-t;return t+r*(i>180||i<-180?i-360*Math.round(i/360):i)}var er={forward:$e,reverse:Qe,interpolate:function(t,e,r){return{l:qe(t.l,e.l,r),a:qe(t.a,e.a,r),b:qe(t.b,e.b,r),alpha:qe(t.alpha,e.alpha,r)}}},rr={forward:function(t){var e=$e(t),r=e.l,i=e.a,n=e.b,o=Math.atan2(n,i)*Ye;return{h:o<0?o+360:o,c:Math.sqrt(i*i+n*n),l:r,alpha:t.a}},reverse:function(t){var e=t.h*Xe,r=t.c;return Qe({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:tr(t.h,e.h,r),c:qe(t.c,e.c,r),l:qe(t.l,e.l,r),alpha:qe(t.alpha,e.alpha,r)}}},ir=Object.freeze({__proto__:null,lab:er,hcl:rr}),nr=function(t,e,r,i,n){this.type=t,this.operator=e,this.interpolation=r,this.input=i,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 or(t,e,r,i){var n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}nr.interpolationFactor=function(t,r,i,n){var o=0;if("exponential"===t.name)o=or(r,t.base,i,n);else if("linear"===t.name)o=or(r,1,i,n);else if("cubic-bezier"===t.name){var a=t.controlPoints;o=new e(a[0],a[1],a[2],a[3]).solve(or(r,1,i,n))}return o},nr.parse=function(t,e){var r=t[0],i=t[1],n=t[2],o=t.slice(3);if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){var a=i[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:a}}else{if("cubic-bezier"!==i[0])return e.error("Unknown interpolation type "+String(i[0]),1,0);var s=i.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);i={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,Ft)))return null;var l=[],u=null;"interpolate-hcl"===r||"interpolate-lab"===r?u=Nt:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var h=0;h<o.length;h+=2){var p=o[h],c=o[h+1],f=h+3,d=h+4;if("number"!=typeof p)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',f);if(l.length&&l[l.length-1][0]>=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var m=e.parse(c,d,u);if(!m)return null;u=u||m.type,l.push([p,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new nr(u,r,i,n,l):e.error("Type "+Xt(u)+" is not interpolatable.")},nr.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);var n=e.length;if(i>=e[n-1])return r[n-1].evaluate(t);var o=Ue(e,i),a=nr.interpolationFactor(this.interpolation,i,e[o],e[o+1]),s=r[o].evaluate(t),l=r[o+1].evaluate(t);return"interpolate"===this.operator?Ge[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?rr.reverse(rr.interpolate(rr.forward(s),rr.forward(l),a)):er.reverse(er.interpolate(er.forward(s),er.forward(l),a))},nr.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1)t(r[e])},nr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},nr.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()],r=0;r<this.labels.length;r++)e.push(this.labels[r],this.outputs[r].serialize());return e};var ar=function(t,e){this.type=t,this.args=e};ar.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var r=null,i=e.expectedType;i&&"value"!==i.kind&&(r=i);for(var n=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=e.parse(a[o],1+n.length,r,void 0,{typeAnnotation:"omit"});if(!s)return null;r=r||s.type,n.push(s)}var l=i&&n.some((function(t){return Wt(i,t.type)}));return new ar(l?Ut:r,n)},ar.prototype.evaluate=function(t){for(var e,r=null,i=0,n=0,o=this.args;n<o.length&&(i++,(r=o[n].evaluate(t))&&r instanceof ie&&!r.available&&(e||(e=r.name),r=null,i===this.args.length&&(r=e)),null===r);n+=1);return r},ar.prototype.eachChild=function(t){this.args.forEach(t)},ar.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},ar.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var sr=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};sr.prototype.evaluate=function(t){return this.result.evaluate(t)},sr.prototype.eachChild=function(t){for(var e=0,r=this.bindings;e<r.length;e+=1)t(r[e][1]);t(this.result)},sr.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var r=[],i=1;i<t.length-1;i+=2){var n=t[i];if("string"!=typeof n)return e.error("Expected string, but found "+typeof n+" instead.",i);if(/[^a-zA-Z0-9_]/.test(n))return e.error("Variable names must contain only alphanumeric characters or '_'.",i);var o=e.parse(t[i+1],i+1);if(!o)return null;r.push([n,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return a?new sr(r,a):null},sr.prototype.outputDefined=function(){return this.result.outputDefined()},sr.prototype.serialize=function(){for(var t=["let"],e=0,r=this.bindings;e<r.length;e+=1){var i=r[e];t.push(i[0],i[1].serialize())}return t.push(this.result.serialize()),t};var lr=function(t,e,r){this.type=t,this.index=e,this.input=r};lr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ft),i=e.parse(t[2],2,Zt(e.expectedType||Ut));return r&&i?new lr(i.type.itemType,r,i):null},lr.prototype.evaluate=function(t){var e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new ue("Array index out of bounds: "+e+" < 0.");if(e>=r.length)throw new ue("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new ue("Array index must be an integer, but found "+e+" instead.");return r[e]},lr.prototype.eachChild=function(t){t(this.index),t(this.input)},lr.prototype.outputDefined=function(){return!1},lr.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var ur=function(t,e){this.type=Bt,this.needle=t,this.haystack=e};ur.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ut),i=e.parse(t[2],2,Ut);return r&&i?Ht(r.type,[Bt,Ot,Ft,Rt,Ut])?new ur(r,i):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Xt(r.type)+" instead"):null},ur.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Kt(e,["boolean","string","number","null"]))throw new ue("Expected first argument to be of type boolean, string, number or null, but found "+Xt(ae(e))+" instead.");if(!Kt(r,["string","array"]))throw new ue("Expected second argument to be of type array or string, but found "+Xt(ae(r))+" instead.");return r.indexOf(e)>=0},ur.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},ur.prototype.outputDefined=function(){return!0},ur.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var hr=function(t,e,r){this.type=Ft,this.needle=t,this.haystack=e,this.fromIndex=r};hr.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 r=e.parse(t[1],1,Ut),i=e.parse(t[2],2,Ut);if(!r||!i)return null;if(!Ht(r.type,[Bt,Ot,Ft,Rt,Ut]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Xt(r.type)+" instead");if(4===t.length){var n=e.parse(t[3],3,Ft);return n?new hr(r,i,n):null}return new hr(r,i)},hr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Kt(e,["boolean","string","number","null"]))throw new ue("Expected first argument to be of type boolean, string, number or null, but found "+Xt(ae(e))+" instead.");if(!Kt(r,["string","array"]))throw new ue("Expected second argument to be of type array or string, but found "+Xt(ae(r))+" instead.");if(this.fromIndex){var i=this.fromIndex.evaluate(t);return r.indexOf(e,i)}return r.indexOf(e)},hr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},hr.prototype.outputDefined=function(){return!1},hr.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 pr=function(t,e,r,i,n,o){this.inputType=t,this.type=e,this.input=r,this.cases=i,this.outputs=n,this.otherwise=o};pr.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 r,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=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 h=0,p=s;h<p.length;h+=1){var c=p[h];if("number"!=typeof c&&"string"!=typeof c)return u.error("Branch labels must be numbers or strings.");if("number"==typeof c&&Math.abs(c)>Number.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof c&&Math.floor(c)!==c)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,ae(c)))return null}else r=ae(c);if(void 0!==n[String(c)])return u.error("Branch labels must be unique.");n[String(c)]=o.length}var f=e.parse(l,a,i);if(!f)return null;i=i||f.type,o.push(f)}var d=e.parse(t[1],1,Ut);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,i);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new pr(r,i,d,n,o,m):null},pr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ae(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},pr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},pr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},pr.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],i={},n=0,o=Object.keys(this.cases).sort();n<o.length;n+=1){var a=o[n];void 0===(p=i[this.cases[a]])?(i[this.cases[a]]=r.length,r.push([this.cases[a],[a]])):r[p][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},l=0,u=r;l<u.length;l+=1){var h=u[l],p=h[0],c=h[1];e.push(1===c.length?s(c[0]):c.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var cr=function(t,e,r){this.type=t,this.branches=e,this.otherwise=r};cr.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 r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var i=[],n=1;n<t.length-1;n+=2){var o=e.parse(t[n],n,Bt);if(!o)return null;var a=e.parse(t[n+1],n+1,r);if(!a)return null;i.push([o,a]),r=r||a.type}var s=e.parse(t[t.length-1],t.length-1,r);return s?new cr(r,i,s):null},cr.prototype.evaluate=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var i=r[e],n=i[1];if(i[0].evaluate(t))return n.evaluate(t)}return this.otherwise.evaluate(t)},cr.prototype.eachChild=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var i=r[e],n=i[1];t(i[0]),t(n)}t(this.otherwise)},cr.prototype.outputDefined=function(){return this.branches.every((function(t){return t[1].outputDefined()}))&&this.otherwise.outputDefined()},cr.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var fr=function(t,e,r,i){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=i};function dr(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 mr(t,e,r,i){return 0===i.compare(e,r)}function yr(t,e,r){var i="=="!==t&&"!="!==t;return function(){function n(t,e,r){this.type=Bt,this.lhs=t,this.rhs=e,this.collator=r,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 r=t[0],o=e.parse(t[1],1,Ut);if(!o)return null;if(!dr(r,o.type))return e.concat(1).error('"'+r+"\" comparisons are not supported for type '"+Xt(o.type)+"'.");var a=e.parse(t[2],2,Ut);if(!a)return null;if(!dr(r,a.type))return e.concat(2).error('"'+r+"\" 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)+"'.");i&&("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,jt)))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(i&&this.hasUntypedArgument){var s=ae(o),l=ae(a);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new ue('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+s.kind+", "+l.kind+") instead.")}if(this.collator&&!i&&this.hasUntypedArgument){var u=ae(o),h=ae(a);if("string"!==u.kind||"string"!==h.kind)return e(n,o,a)}return this.collator?r(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}()}fr.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 r=e.parse(t[1],1,Ut),i=e.parse(t[2],2,Ft);if(!r||!i)return null;if(!Ht(r.type,[Zt(Ut),Ot,Ut]))return e.error("Expected first argument to be of type array or string, but found "+Xt(r.type)+" instead");if(4===t.length){var n=e.parse(t[3],3,Ft);return n?new fr(r.type,r,i,n):null}return new fr(r.type,r,i)},fr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Kt(e,["string","array"]))throw new ue("Expected first argument to be of type array or string, but found "+Xt(ae(e))+" instead.");if(this.endIndex){var i=this.endIndex.evaluate(t);return e.slice(r,i)}return e.slice(r)},fr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},fr.prototype.outputDefined=function(){return!1},fr.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 gr=yr("==",(function(t,e,r){return e===r}),mr),_r=yr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,i){return!mr(0,e,r,i)})),vr=yr("<",(function(t,e,r){return e<r}),(function(t,e,r,i){return i.compare(e,r)<0})),xr=yr(">",(function(t,e,r){return e>r}),(function(t,e,r,i){return i.compare(e,r)>0})),br=yr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,i){return i.compare(e,r)<=0})),wr=yr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,i){return i.compare(e,r)>=0})),Ir=function(t,e,r,i,n){this.type=Ot,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=n};Ir.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Ft);if(!r)return null;var i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");var n=null;if(i.locale&&!(n=e.parse(i.locale,1,Ot)))return null;var o=null;if(i.currency&&!(o=e.parse(i.currency,1,Ot)))return null;var a=null;if(i["min-fraction-digits"]&&!(a=e.parse(i["min-fraction-digits"],1,Ft)))return null;var s=null;return i["max-fraction-digits"]&&!(s=e.parse(i["max-fraction-digits"],1,Ft))?null:new Ir(r,n,o,a,s)},Ir.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))},Ir.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)},Ir.prototype.outputDefined=function(){return!1},Ir.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 Sr=function(t){this.type=Ft,this.input=t};Sr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Xt(r.type)+" instead."):new Sr(r):null},Sr.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 ue("Expected value to be of type string or array, but found "+Xt(ae(e))+" instead.")},Sr.prototype.eachChild=function(t){t(this.input)},Sr.prototype.outputDefined=function(){return!1},Sr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Tr={"==":gr,"!=":_r,">":xr,"<":vr,">=":wr,"<=":br,array:pe,at:lr,boolean:pe,case:cr,coalesce:ar,collator:ve,format:ce,image:fe,in:ur,"index-of":hr,interpolate:nr,"interpolate-hcl":nr,"interpolate-lab":nr,length:Sr,let:sr,literal:le,match:pr,number:pe,"number-format":Ir,object:pe,slice:fr,step:je,string:pe,"to-boolean":me,"to-color":me,"to-number":me,"to-string":me,var:Ne,within:Re};function Er(t,e){var r=e[0],i=e[1],n=e[2],o=e[3];r=r.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);var a=o?o.evaluate(t):1,s=ne(r,i,n,a);if(s)throw new ue(s);return new Qt(r/255*a,i/255*a,n/255*a,a)}function Pr(t,e){return t in e}function Ar(t,e){var r=e[t];return void 0===r?null:r}function Lr(t){return{type:t}}function Mr(t){return{result:"success",value:t}}function kr(t){return{result:"error",value:t}}function zr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Cr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Dr(t){return!!t.expression&&t.expression.interpolated}function Rr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Fr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Or(t){return t}function Br(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Nr(t,e,r,i,n){return Br(typeof r===n?i[r]:void 0,t.default,e.default)}function Vr(t,e,r){if("number"!==Rr(r))return Br(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var n=Ue(t.stops.map((function(t){return t[0]})),r);return t.stops[n][1]}function Ur(t,e,r){var i=void 0!==t.base?t.base:1;if("number"!==Rr(r))return Br(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var o=Ue(t.stops.map((function(t){return t[0]})),r),a=function(t,e,r,i){var n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(r,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Ge[e.type]||Or;if(t.colorSpace&&"rgb"!==t.colorSpace){var h=ir[t.colorSpace];u=function(t,e){return h.reverse(h.interpolate(h.forward(t),h.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==i)return u(r,i,a)}}:u(s,l,a)}function jr(t,e,r){return"color"===e.type?r=Qt.parse(r):"formatted"===e.type?r=re.fromString(r.toString()):"resolvedImage"===e.type?r=ie.fromString(r.toString()):Rr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Br(r,t.default,e.default)}_e.register(Tr,{error:[{kind:"error"},[Ot],function(t,e){throw new ue(e[0].evaluate(t))}],typeof:[Ot,[Ut],function(t,e){return Xt(ae(e[0].evaluate(t)))}],"to-rgba":[Zt(Ft,4),[Nt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Nt,[Ft,Ft,Ft],Er],rgba:[Nt,[Ft,Ft,Ft,Ft],Er],has:{type:Bt,overloads:[[[Ot],function(t,e){return Pr(e[0].evaluate(t),t.properties())}],[[Ot,Vt],function(t,e){var r=e[1];return Pr(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:Ut,overloads:[[[Ot],function(t,e){return Ar(e[0].evaluate(t),t.properties())}],[[Ot,Vt],function(t,e){var r=e[1];return Ar(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[Ut,[Ot],function(t,e){return Ar(e[0].evaluate(t),t.featureState||{})}],properties:[Vt,[],function(t){return t.properties()}],"geometry-type":[Ot,[],function(t){return t.geometryType()}],id:[Ut,[],function(t){return t.id()}],zoom:[Ft,[],function(t){return t.globals.zoom}],"heatmap-density":[Ft,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Ft,[],function(t){return t.globals.lineProgress||0}],accumulated:[Ut,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Ft,Lr(Ft),function(t,e){for(var r=0,i=0,n=e;i<n.length;i+=1)r+=n[i].evaluate(t);return r}],"*":[Ft,Lr(Ft),function(t,e){for(var r=1,i=0,n=e;i<n.length;i+=1)r*=n[i].evaluate(t);return r}],"-":{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)-r.evaluate(t)}],[[Ft],function(t,e){return-e[0].evaluate(t)}]]},"/":[Ft,[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)/r.evaluate(t)}],"%":[Ft,[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)%r.evaluate(t)}],ln2:[Ft,[],function(){return Math.LN2}],pi:[Ft,[],function(){return Math.PI}],e:[Ft,[],function(){return Math.E}],"^":[Ft,[Ft,Ft],function(t,e){var r=e[1];return Math.pow(e[0].evaluate(t),r.evaluate(t))}],sqrt:[Ft,[Ft],function(t,e){return Math.sqrt(e[0].evaluate(t))}],log10:[Ft,[Ft],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN10}],ln:[Ft,[Ft],function(t,e){return Math.log(e[0].evaluate(t))}],log2:[Ft,[Ft],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN2}],sin:[Ft,[Ft],function(t,e){return Math.sin(e[0].evaluate(t))}],cos:[Ft,[Ft],function(t,e){return Math.cos(e[0].evaluate(t))}],tan:[Ft,[Ft],function(t,e){return Math.tan(e[0].evaluate(t))}],asin:[Ft,[Ft],function(t,e){return Math.asin(e[0].evaluate(t))}],acos:[Ft,[Ft],function(t,e){return Math.acos(e[0].evaluate(t))}],atan:[Ft,[Ft],function(t,e){return Math.atan(e[0].evaluate(t))}],min:[Ft,Lr(Ft),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Ft,Lr(Ft),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Ft,[Ft],function(t,e){return Math.abs(e[0].evaluate(t))}],round:[Ft,[Ft],function(t,e){var r=e[0].evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ft,[Ft],function(t,e){return Math.floor(e[0].evaluate(t))}],ceil:[Ft,[Ft],function(t,e){return Math.ceil(e[0].evaluate(t))}],"filter-==":[Bt,[Ot,Ut],function(t,e){var r=e[0],i=e[1];return t.properties()[r.value]===i.value}],"filter-id-==":[Bt,[Ut],function(t,e){var r=e[0];return t.id()===r.value}],"filter-type-==":[Bt,[Ot],function(t,e){var r=e[0];return t.geometryType()===r.value}],"filter-<":[Bt,[Ot,Ut],function(t,e){var r=e[0],i=e[1],n=t.properties()[r.value],o=i.value;return typeof n==typeof o&&n<o}],"filter-id-<":[Bt,[Ut],function(t,e){var r=e[0],i=t.id(),n=r.value;return typeof i==typeof n&&i<n}],"filter->":[Bt,[Ot,Ut],function(t,e){var r=e[0],i=e[1],n=t.properties()[r.value],o=i.value;return typeof n==typeof o&&n>o}],"filter-id->":[Bt,[Ut],function(t,e){var r=e[0],i=t.id(),n=r.value;return typeof i==typeof n&&i>n}],"filter-<=":[Bt,[Ot,Ut],function(t,e){var r=e[0],i=e[1],n=t.properties()[r.value],o=i.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[Bt,[Ut],function(t,e){var r=e[0],i=t.id(),n=r.value;return typeof i==typeof n&&i<=n}],"filter->=":[Bt,[Ot,Ut],function(t,e){var r=e[0],i=e[1],n=t.properties()[r.value],o=i.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[Bt,[Ut],function(t,e){var r=e[0],i=t.id(),n=r.value;return typeof i==typeof n&&i>=n}],"filter-has":[Bt,[Ut],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Bt,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Bt,[Zt(Ot)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Bt,[Zt(Ut)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Bt,[Ot,Zt(Ut)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Bt,[Ot,Zt(Ut)],function(t,e){var r=e[0],i=e[1];return function(t,e,r,i){for(;r<=i;){var n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}(t.properties()[r.value],i.value,0,i.value.length-1)}],all:{type:Bt,overloads:[[[Bt,Bt],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Lr(Bt),function(t,e){for(var r=0,i=e;r<i.length;r+=1)if(!i[r].evaluate(t))return!1;return!0}]]},any:{type:Bt,overloads:[[[Bt,Bt],function(t,e){var r=e[1];return e[0].evaluate(t)||r.evaluate(t)}],[Lr(Bt),function(t,e){for(var r=0,i=e;r<i.length;r+=1)if(i[r].evaluate(t))return!0;return!1}]]},"!":[Bt,[Bt],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[Bt,[Ot],function(t,e){var r=t.globals&&t.globals.isSupportedScript;return!r||r(e[0].evaluate(t))}],upcase:[Ot,[Ot],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Ot,[Ot],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Ot,Lr(Ut),function(t,e){return e.map((function(e){return se(e.evaluate(t))})).join("")}],"resolved-locale":[Ot,[jt],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var qr=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new ge,this._defaultValue=e?function(t){return"color"===t.type&&Fr(t.default)?new Qt(0,0,0,0):"color"===t.type?Qt.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function Gr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Tr}function Zr(t,e){var r=new Ve(Tr,[],e?function(t){var e={color:Nt,string:Ot,number:Ft,enum:Ot,boolean:Bt,formatted:qt,resolvedImage:Gt};return"array"===t.type?Zt(e[t.value]||Ut,t.length):e[t.type]}(e):void 0),i=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Mr(new qr(i,e)):kr(r.errors)}qr.prototype.evaluateWithoutErrorHandling=function(t,e,r,i,n,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)},qr.prototype.evaluate=function(t,e,r,i,n,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,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 ue("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(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Xr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Oe(e.expression)};Xr.prototype.evaluateWithoutErrorHandling=function(t,e,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)},Xr.prototype.evaluate=function(t,e,r,i,n,o){return this._styleExpression.evaluate(t,e,r,i,n,o)};var Yr=function(t,e,r,i){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Oe(e.expression),this.interpolationType=i};function Wr(t,e){if("error"===(t=Zr(t,e)).result)return t;var r=t.value.expression,i=Fe(r);if(!i&&!zr(e))return kr([new Ct("","data expressions not supported")]);var n=Be(r,["zoom"]);if(!n&&!Cr(e))return kr([new Ct("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof sr)r=t(e.result);else if(e instanceof ar)for(var i=0,n=e.args;i<n.length&&!(r=t(n[i]));i+=1);else(e instanceof je||e instanceof nr)&&e.input instanceof _e&&"zoom"===e.input.name&&(r=e);return r instanceof Ct||e.eachChild((function(e){var i=t(e);i instanceof Ct?r=i:!r&&i?r=new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&i&&r!==i&&(r=new Ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),r}(r);return o||n?o instanceof Ct?kr([o]):o instanceof nr&&!Dr(e)?kr([new Ct("",'"interpolate" expressions cannot be used with this property')]):Mr(o?new Yr(i?"camera":"composite",t.value,o.labels,o instanceof nr?o.interpolation:void 0):new Xr(i?"constant":"source",t.value)):kr([new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Yr.prototype.evaluateWithoutErrorHandling=function(t,e,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)},Yr.prototype.evaluate=function(t,e,r,i,n,o){return this._styleExpression.evaluate(t,e,r,i,n,o)},Yr.prototype.interpolationFactor=function(t,e,r){return this.interpolationType?nr.interpolationFactor(this.interpolationType,t,e,r):0};var Hr=function(t,e){this._parameters=t,this._specification=e,Mt(this,function t(e,r){var i,n,o,a="color"===r.type,s=e.stops&&"object"==typeof e.stops[0][0],l=s||!(s||void 0!==e.property),u=e.type||(Dr(r)?"exponential":"interval");if(a&&((e=Mt({},e)).stops&&(e.stops=e.stops.map((function(t){return[t[0],Qt.parse(t[1])]}))),e.default=Qt.parse(e.default?e.default:r.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!ir[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===u)i=Ur;else if("interval"===u)i=Vr;else if("categorical"===u){i=Nr,n=Object.create(null);for(var h=0,p=e.stops;h<p.length;h+=1){var c=p[h];n[c[0]]=c[1]}o=typeof e.stops[0][0]}else{if("identity"!==u)throw new Error('Unknown function type "'+u+'"');i=jr}if(s){for(var f={},d=[],m=0;m<e.stops.length;m++){var y=e.stops[m],g=y[0].zoom;void 0===f[g]&&(f[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},d.push(g)),f[g].stops.push([y[0].value,y[1]])}for(var _=[],v=0,x=d;v<x.length;v+=1){var b=x[v];_.push([f[b].zoom,t(f[b],r)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:nr.interpolationFactor.bind(void 0,w),zoomStops:_.map((function(t){return t[0]})),evaluate:function(t,i){var n=t.zoom;return Ur({stops:_,base:e.base},r,n).evaluate(n,i)}}}if(l){var I="exponential"===u?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:I,interpolationFactor:nr.interpolationFactor.bind(void 0,I),zoomStops:e.stops.map((function(t){return t[0]})),evaluate:function(t){return i(e,r,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?Br(e.default,r.default):i(e,r,s,n,o)}}}(this._parameters,this._specification))};function Kr(t){var e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=[],l=Rr(r);if("object"!==l)return[new At(e,r,"object expected, "+l+" found")];for(var u in r){var h=u.split(".")[0],p=i[h]||i["*"],c=void 0;if(n[h])c=n[h];else if(i[h])c=bi;else if(n["*"])c=n["*"];else{if(!i["*"]){s.push(new At(e,r[u],'unknown property "'+u+'"'));continue}c=bi}s=s.concat(c({key:(e?e+".":e)+u,value:r[u],valueSpec:p,style:o,styleSpec:a,object:r,objectKey:u},r))}for(var f in i)n[f]||i[f].required&&void 0===i[f].default&&void 0===r[f]&&s.push(new At(e,r,'missing required property "'+f+'"'));return s}function Jr(t){var e=t.value,r=t.valueSpec,i=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||bi;if("array"!==Rr(e))return[new At(o,e,"array expected, "+Rr(e)+" found")];if(r.length&&e.length!==r.length)return[new At(o,e,"array length "+r.length+" expected, length "+e.length+" found")];if(r["min-length"]&&e.length<r["min-length"])return[new At(o,e,"array length at least "+r["min-length"]+" expected, length "+e.length+" found")];var s={type:r.value,values:r.values};n.$version<7&&(s.function=r.function),"object"===Rr(r.value)&&(s=r.value);for(var l=[],u=0;u<e.length;u++)l=l.concat(a({array:e,arrayIndex:u,value:e[u],valueSpec:s,style:i,styleSpec:n,key:o+"["+u+"]"}));return l}function $r(t){var e=t.key,r=t.value,i=t.valueSpec,n=Rr(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new At(e,r,"number expected, "+n+" found")]:"minimum"in i&&r<i.minimum?[new At(e,r,r+" is less than the minimum value "+i.minimum)]:"maximum"in i&&r>i.maximum?[new At(e,r,r+" is greater than the maximum value "+i.maximum)]:[]}function Qr(t){var e,r,i,n=t.valueSpec,o=kt(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,l=!s,u="array"===Rr(t.value.stops)&&"array"===Rr(t.value.stops[0])&&"object"===Rr(t.value.stops[0][0]),h=Kr({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 At(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Jr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===Rr(r)&&0===r.length&&e.push(new At(t.key,r,"array must have at least one stop")),e},default:function(t){return bi({key:t.key,value:t.value,valueSpec:n,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&h.push(new At(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||h.push(new At(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!Dr(t.valueSpec)&&h.push(new At(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!zr(t.valueSpec)?h.push(new At(t.key,t.value,"property functions not supported")):s&&!Cr(t.valueSpec)&&h.push(new At(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!u||void 0!==t.value.property||h.push(new At(t.key,t.value,'"property" property is required')),h;function p(t){var e=[],o=t.value,s=t.key;if("array"!==Rr(o))return[new At(s,o,"array expected, "+Rr(o)+" found")];if(2!==o.length)return[new At(s,o,"array length 2 expected, length "+o.length+" found")];if(u){if("object"!==Rr(o[0]))return[new At(s,o,"object expected, "+Rr(o[0])+" found")];if(void 0===o[0].zoom)return[new At(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new At(s,o,"object stop key must have value")];if(i&&i>kt(o[0].zoom))return[new At(s,o[0].zoom,"stop zoom values must appear in ascending order")];kt(o[0].zoom)!==i&&(i=kt(o[0].zoom),r=void 0,a={}),e=e.concat(Kr({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:$r,value:c}}))}else e=e.concat(c({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return Gr(zt(o[1]))?e.concat([new At(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(bi({key:s+"[1]",value:o[1],valueSpec:n,style:t.style,styleSpec:t.styleSpec}))}function c(t,i){var s=Rr(t.value),l=kt(t.value),u=null!==t.value?t.value:i;if(e){if(s!==e)return[new At(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 At(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var h="number expected, "+s+" found";return zr(n)&&void 0===o&&(h+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new At(t.key,u,h)]}return"categorical"!==o||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===s&&void 0!==r&&l<r?[new At(t.key,u,"stop domain values must appear in ascending order")]:(r=l,"categorical"===o&&l in a?[new At(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new At(t.key,u,"integer expected, found "+l)]}}function ti(t){var e=("property"===t.expressionContext?Wr:Zr)(zt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((function(e){return new At(""+t.key+e.key,t.value,e.message)}));var r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new At(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(r))return[new At(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Oe(r))return[new At(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Be(r,["zoom","feature-state"]))return[new At(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Fe(r))return[new At(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ei(t){var e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?-1===i.values.indexOf(kt(r))&&n.push(new At(e,r,"expected one of ["+i.values.join(", ")+"], "+JSON.stringify(r)+" found")):-1===Object.keys(i.values).indexOf(kt(r))&&n.push(new At(e,r,"expected one of ["+Object.keys(i.values).join(", ")+"], "+JSON.stringify(r)+" found")),n}function ri(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,r=t.slice(1);e<r.length;e+=1){var i=r[e];if(!ri(i)&&"boolean"!=typeof i)return!1}return!0;default:return!0}}Hr.deserialize=function(t){return new Hr(t._parameters,t._specification)},Hr.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var ii={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ni(t){if(null==t)return{filter:function(){return!0},needGeometry:!1};ri(t)||(t=ai(t));var e=Zr(t,ii);if("error"===e.result)throw new Error(e.value.map((function(t){return t.key+": "+t.message})).join(", "));return{filter:function(t,r,i){return e.value.evaluate(t,r,{},i)},needGeometry:function t(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var r=1;r<e.length;r++)if(t(e[r]))return!0;return!1}(t)}}function oi(t,e){return t<e?-1:t>e?1:0}function ai(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?si(t[1],t[2],"=="):"!="===r?hi(si(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?si(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(ai))):"all"===r?["all"].concat(t.slice(1).map(ai)):"none"===r?["all"].concat(t.slice(1).map(ai).map(hi)):"in"===r?li(t[1],t.slice(2)):"!in"===r?hi(li(t[1],t.slice(2))):"has"===r?ui(t[1]):"!has"===r?hi(ui(t[1])):"within"!==r||t}function si(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function li(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(oi)]]:["filter-in-small",t,["literal",e]]}}function ui(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function hi(t){return["!",t]}function pi(t){return ri(zt(t.value))?ti(Mt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,i=e.key;if("array"!==Rr(r))return[new At(i,r,"array expected, "+Rr(r)+" found")];var n,o=e.styleSpec,a=[];if(r.length<1)return[new At(i,r,"filter array must have at least 1 element")];switch(a=a.concat(ei({key:i+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),kt(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===kt(r[1])&&a.push(new At(i,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new At(i,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(n=Rr(r[1]))&&a.push(new At(i+"[1]",r[1],"string expected, "+n+" found"));for(var s=2;s<r.length;s++)n=Rr(r[s]),"$type"===kt(r[1])?a=a.concat(ei({key:i+"["+s+"]",value:r[s],valueSpec:o.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&a.push(new At(i+"["+s+"]",r[s],"string, number, or boolean expected, "+n+" found"));break;case"any":case"all":case"none":for(var l=1;l<r.length;l++)a=a.concat(t({key:i+"["+l+"]",value:r[l],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=Rr(r[1]),2!==r.length?a.push(new At(i,r,'filter array for "'+r[0]+'" operator must have 2 elements')):"string"!==n&&a.push(new At(i+"[1]",r[1],"string expected, "+n+" found"));break;case"within":n=Rr(r[1]),2!==r.length?a.push(new At(i,r,'filter array for "'+r[0]+'" operator must have 2 elements')):"object"!==n&&a.push(new At(i+"[1]",r[1],"object expected, "+n+" found"))}return a}(t)}function ci(t,e){var r=t.key,i=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 bi({key:r,value:o,valueSpec:n.transition,style:i,styleSpec:n});var u,h=t.valueSpec||s[a];if(!h)return[new At(r,o,'unknown property "'+a+'"')];if("string"===Rr(o)&&zr(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new At(r,o,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(u[1])+" }`.")];var p=[];return"symbol"===t.layerType&&("text-field"===a&&i&&!i.glyphs&&p.push(new At(r,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Fr(zt(o))&&"identity"===kt(o.type)&&p.push(new At(r,o,'"text-font" does not support identity functions'))),p.concat(bi({key:t.key,value:o,valueSpec:h,style:i,styleSpec:n,expressionContext:"property",propertyType:e,propertyKey:a}))}function fi(t){return ci(t,"paint")}function di(t){return ci(t,"layout")}function mi(t){var e=[],r=t.value,i=t.key,n=t.style,o=t.styleSpec;r.type||r.ref||e.push(new At(i,r,'either "type" or "ref" is required'));var a,s=kt(r.type),l=kt(r.ref);if(r.id)for(var u=kt(r.id),h=0;h<t.arrayIndex;h++){var p=n.layers[h];kt(p.id)===u&&e.push(new At(i,r.id,'duplicate layer id "'+r.id+'", previously used at line '+p.id.__line__))}if("ref"in r)["type","source","source-layer","filter","layout"].forEach((function(t){t in r&&e.push(new At(i,r[t],'"'+t+'" is prohibited for ref layers'))})),n.layers.forEach((function(t){kt(t.id)===l&&(a=t)})),a?a.ref?e.push(new At(i,r.ref,"ref cannot reference another ref layer")):s=kt(a.type):e.push(new At(i,r.ref,'ref layer "'+l+'" not found'));else if("background"!==s)if(r.source){var c=n.sources&&n.sources[r.source],f=c&&kt(c.type);c?"vector"===f&&"raster"===s?e.push(new At(i,r.source,'layer "'+r.id+'" requires a raster source')):"raster"===f&&"raster"!==s?e.push(new At(i,r.source,'layer "'+r.id+'" requires a vector source')):"vector"!==f||r["source-layer"]?"raster-dem"===f&&"hillshade"!==s?e.push(new At(i,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!r.paint||!r.paint["line-gradient"]||"geojson"===f&&c.lineMetrics||e.push(new At(i,r,'layer "'+r.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new At(i,r,'layer "'+r.id+'" must specify a "source-layer"')):e.push(new At(i,r.source,'source "'+r.source+'" not found'))}else e.push(new At(i,r,'missing required property "source"'));return e=e.concat(Kr({key:i,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return bi({key:i+".type",value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"})},filter:pi,layout:function(t){return Kr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return di(Mt({layerType:s},t))}}})},paint:function(t){return Kr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return fi(Mt({layerType:s},t))}}})}}}))}function yi(t){var e=t.value,r=t.key,i=Rr(e);return"string"!==i?[new At(r,e,"string expected, "+i+" found")]:[]}var gi={promoteId:function(t){var e=t.key,r=t.value;if("string"===Rr(r))return yi({key:e,value:r});var i=[];for(var n in r)i.push.apply(i,yi({key:e+"."+n,value:r[n]}));return i}};function _i(t){var e=t.value,r=t.key,i=t.styleSpec,n=t.style;if(!e.type)return[new At(r,e,'"type" is required')];var o,a=kt(e.type);switch(a){case"vector":case"raster":case"raster-dem":return Kr({key:r,value:e,valueSpec:i["source_"+a.replace("-","_")],style:t.style,styleSpec:i,objectElementValidators:gi});case"geojson":if(o=Kr({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,objectElementValidators:gi}),e.cluster)for(var s in e.clusterProperties){var l=e.clusterProperties[s],u=l[0],h="string"==typeof u?[u,["accumulated"],["get",s]]:u;o.push.apply(o,ti({key:r+"."+s+".map",value:l[1],expressionContext:"cluster-map"})),o.push.apply(o,ti({key:r+"."+s+".reduce",value:h,expressionContext:"cluster-reduce"}))}return o;case"video":return Kr({key:r,value:e,valueSpec:i.source_video,style:n,styleSpec:i});case"image":return Kr({key:r,value:e,valueSpec:i.source_image,style:n,styleSpec:i});case"canvas":return[new At(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ei({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,styleSpec:i})}}function vi(t){var e=t.value,r=t.styleSpec,i=r.light,n=t.style,o=[],a=Rr(e);if(void 0===e)return o;if("object"!==a)return o.concat([new At("light",e,"object expected, "+a+" found")]);for(var s in e){var l=s.match(/^(.*)-transition$/);o=o.concat(l&&i[l[1]]&&i[l[1]].transition?bi({key:s,value:e[s],valueSpec:r.transition,style:n,styleSpec:r}):i[s]?bi({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:r}):[new At(s,e[s],'unknown property "'+s+'"')])}return o}var xi={"*":function(){return[]},array:Jr,boolean:function(t){var e=t.value,r=t.key,i=Rr(e);return"boolean"!==i?[new At(r,e,"boolean expected, "+i+" found")]:[]},number:$r,color:function(t){var e=t.key,r=t.value,i=Rr(r);return"string"!==i?[new At(e,r,"color expected, "+i+" found")]:null===$t(r)?[new At(e,r,'color expected, "'+r+'" found')]:[]},constants:Lt,enum:ei,filter:pi,function:Qr,layer:mi,object:Kr,source:_i,light:vi,string:yi,formatted:function(t){return 0===yi(t).length?[]:ti(t)},resolvedImage:function(t){return 0===yi(t).length?[]:ti(t)}};function bi(t){var e=t.value,r=t.valueSpec,i=t.styleSpec;return r.expression&&Fr(kt(e))?Qr(t):r.expression&&Gr(zt(e))?ti(t):r.type&&xi[r.type]?xi[r.type](t):Kr(Mt({},t,{valueSpec:r.type?i[r.type]:r}))}function wi(t){var e=t.value,r=t.key,i=yi(t);return i.length||(-1===e.indexOf("{fontstack}")&&i.push(new At(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&i.push(new At(r,e,'"glyphs" url must include a "{range}" token'))),i}function Ii(t,e){void 0===e&&(e=Pt);var r=[];return r=r.concat(bi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:wi,"*":function(){return[]}}})),t.constants&&(r=r.concat(Lt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Si(r)}function Si(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function Ti(t){return function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return Si(t.apply(this,e))}}Ii.source=Ti(_i),Ii.light=Ti(vi),Ii.layer=Ti(mi),Ii.filter=Ti(pi),Ii.paintProperty=Ti(fi),Ii.layoutProperty=Ti(di);var Ei=Ii,Pi=Ei.light,Ai=Ei.paintProperty,Li=Ei.layoutProperty;function Mi(t,e){var r=!1;if(e&&e.length)for(var i=0,n=e;i<n.length;i+=1)t.fire(new Tt(new Error(n[i].message))),r=!0;return r}var ki=zi;function zi(t,e,r){var i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(r=n[2]);for(var o=0;o<this.d*this.d;o++){var a=n[3+o],s=n[3+o+1];i.push(a===s?null:n.subarray(a,s))}var l=n[3+i.length+1];this.keys=n.subarray(n[3+i.length],l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var u=0;u<this.d*this.d;u++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var h=r/e*t;this.min=-h,this.max=t+h}zi.prototype.insert=function(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)},zi.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},zi.prototype._insertCell=function(t,e,r,i,n,o){this.cells[n].push(o)},zi.prototype.query=function(t,e,r,i,n){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=i&&!n)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,r,i,this._queryCell,s,{},n),s},zi.prototype._queryCell=function(t,e,r,i,n,o,a,s){var l=this.cells[n];if(null!==l)for(var u=this.keys,h=this.bboxes,p=0;p<l.length;p++){var c=l[p];if(void 0===a[c]){var f=4*c;(s?s(h[f+0],h[f+1],h[f+2],h[f+3]):t<=h[f+2]&&e<=h[f+3]&&r>=h[f+0]&&i>=h[f+1])?(a[c]=!0,o.push(u[c])):a[c]=!1}}},zi.prototype._forEachCell=function(t,e,r,i,n,o,a,s){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),p=this._convertToCellCoord(i),c=l;c<=h;c++)for(var f=u;f<=p;f++){var d=this.d*f+c;if((!s||s(this._convertFromCellCoord(c),this._convertFromCellCoord(f),this._convertFromCellCoord(c+1),this._convertFromCellCoord(f+1)))&&n.call(this,t,e,r,i,d,o,a,s))return}},zi.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},zi.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},zi.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,i=0;i<this.cells.length;i++)r+=this.cells[i].length;var n=new Int32Array(e+r+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 Ci=o.ImageData,Di=o.ImageBitmap,Ri={};function Fi(t,e,r){void 0===r&&(r={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Ri[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}for(var Oi in Fi("Object",Object),ki.serialize=function(t,e){var r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},ki.deserialize=function(t){return new ki(t.buffer)},Fi("Grid",ki),Fi("Color",Qt),Fi("Error",Error),Fi("ResolvedImage",ie),Fi("StylePropertyFunction",Hr),Fi("StyleExpression",qr,{omit:["_evaluator"]}),Fi("ZoomDependentExpression",Yr),Fi("ZoomConstantExpression",Xr),Fi("CompoundExpression",_e,{omit:["_evaluate"]}),Tr)Tr[Oi]._classRegistryKey||Fi("Expression_"+Oi,Tr[Oi]);function Bi(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Ni(t){return Di&&t instanceof Di}function Vi(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(Bi(t)||Ni(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var r=t;return e&&e.push(r.buffer),r}if(t instanceof Ci)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var i=[],n=0,o=t;n<o.length;n+=1)i.push(Vi(o[n],e));return i}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)&&!(Ri[s].omit.indexOf(u)>=0)){var h=t[u];l[u]=Ri[s].shallow.indexOf(u)>=0?h:Vi(h,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 Ui(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||Bi(t)||Ni(t)||ArrayBuffer.isView(t)||t instanceof Ci)return t;if(Array.isArray(t))return t.map(Ui);if("object"==typeof t){var e=t.$name||"Object",r=Ri[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var i=Object.create(r.prototype),n=0,o=Object.keys(t);n<o.length;n+=1){var a=o[n];if("$name"!==a){var s=t[a];i[a]=Ri[e].shallow.indexOf(a)>=0?s:Ui(s)}}return i}throw new Error("can't deserialize object of type "+typeof t)}var ji=function(){this.first=!0};ji.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))};var qi=function(t){return t>=1536&&t<=1791},Gi=function(t){return t>=1872&&t<=1919},Zi=function(t){return t>=2208&&t<=2303},Xi=function(t){return t>=11904&&t<=12031},Yi=function(t){return t>=12032&&t<=12255},Wi=function(t){return t>=12272&&t<=12287},Hi=function(t){return t>=12288&&t<=12351},Ki=function(t){return t>=12352&&t<=12447},Ji=function(t){return t>=12448&&t<=12543},$i=function(t){return t>=12544&&t<=12591},Qi=function(t){return t>=12704&&t<=12735},tn=function(t){return t>=12736&&t<=12783},en=function(t){return t>=12784&&t<=12799},rn=function(t){return t>=12800&&t<=13055},nn=function(t){return t>=13056&&t<=13311},on=function(t){return t>=13312&&t<=19903},an=function(t){return t>=19968&&t<=40959},sn=function(t){return t>=40960&&t<=42127},ln=function(t){return t>=42128&&t<=42191},un=function(t){return t>=63744&&t<=64255},hn=function(t){return t>=64336&&t<=65023},pn=function(t){return t>=65040&&t<=65055},cn=function(t){return t>=65072&&t<=65103},fn=function(t){return t>=65104&&t<=65135},dn=function(t){return t>=65136&&t<=65279},mn=function(t){return t>=65280&&t<=65519};function yn(t){for(var e=0,r=t;e<r.length;e+=1)if(gn(r[e].charCodeAt(0)))return!0;return!1}function gn(t){return!(746!==t&&747!==t&&(t<4352||!(Qi(t)||$i(t)||cn(t)&&!(t>=65097&&t<=65103)||un(t)||nn(t)||Xi(t)||tn(t)||!(!Hi(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||on(t)||an(t)||rn(t)||function(t){return t>=12592&&t<=12687}(t)||function(t){return t>=43360&&t<=43391}(t)||function(t){return t>=55216&&t<=55295}(t)||function(t){return t>=4352&&t<=4607}(t)||function(t){return t>=44032&&t<=55215}(t)||Ki(t)||Wi(t)||function(t){return t>=12688&&t<=12703}(t)||Yi(t)||en(t)||Ji(t)&&12540!==t||!(!mn(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)||!(!fn(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||function(t){return t>=5120&&t<=5759}(t)||function(t){return t>=6320&&t<=6399}(t)||pn(t)||function(t){return t>=19904&&t<=19967}(t)||sn(t)||ln(t))))}function _n(t){return!(gn(t)||function(t){return!!(function(t){return t>=128&&t<=255}(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||function(t){return t>=8192&&t<=8303}(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||function(t){return t>=8448&&t<=8527}(t)||function(t){return t>=8528&&t<=8591}(t)||function(t){return t>=8960&&t<=9215}(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||function(t){return t>=9216&&t<=9279}(t)&&9251!==t||function(t){return t>=9280&&t<=9311}(t)||function(t){return t>=9312&&t<=9471}(t)||function(t){return t>=9632&&t<=9727}(t)||function(t){return t>=9728&&t<=9983}(t)&&!(t>=9754&&t<=9759)||function(t){return t>=11008&&t<=11263}(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Hi(t)||Ji(t)||function(t){return t>=57344&&t<=63743}(t)||cn(t)||fn(t)||mn(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function vn(t){return t>=1424&&t<=2303||hn(t)||dn(t)}function xn(t,e){return!(!e&&vn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||function(t){return t>=6016&&t<=6143}(t))}function bn(t){for(var e=0,r=t;e<r.length;e+=1)if(vn(r[e].charCodeAt(0)))return!0;return!1}var wn="unavailable",In=null,Sn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(wn="error")};function Tn(){En.fire(new St("pluginStateChange",{pluginStatus:wn,pluginURL:In}))}var En=new Et,Pn=function(){return wn},An={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===wn||null!=An.applyArabicShaping},isLoading:function(){return"loading"===wn},setState:function(t){wn=t.pluginStatus,In=t.pluginURL},isParsed:function(){return null!=An.applyArabicShaping&&null!=An.processBidirectionalText&&null!=An.processStyledBidirectionalText},getPluginURL:function(){return In}},Ln=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 ji,this.transition={})};Ln.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,i=t;r<i.length;r+=1)if(!xn(i[r].charCodeAt(0),e))return!1;return!0}(t,An.isLoaded())},Ln.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},Ln.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var Mn=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Fr(t))return new Hr(t,e);if(Gr(t)){var r=Wr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var i=t;return"string"==typeof t&&"color"===e.type&&(i=Qt.parse(t)),{kind:"constant",evaluate:function(){return i}}}(void 0===e?t.specification.default:e,t.specification)};Mn.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},Mn.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var kn=function(t){this.property=t,this.value=new Mn(t,void 0)};kn.prototype.transitioned=function(t,e){return new Cn(this.property,this.value,e,p({},t.transition,this.transition),t.now)},kn.prototype.untransitioned=function(){return new Cn(this.property,this.value,null,{},0)};var zn=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};zn.prototype.getValue=function(t){return x(this._values[t].value.value)},zn.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new kn(this._values[t].property)),this._values[t].value=new Mn(this._values[t].property,null===e?void 0:x(e))},zn.prototype.getTransition=function(t){return x(this._values[t].transition)},zn.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new kn(this._values[t].property)),this._values[t].transition=x(e)||void 0},zn.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);e<r.length;e+=1){var i=r[e],n=this.getValue(i);void 0!==n&&(t[i]=n);var o=this.getTransition(i);void 0!==o&&(t[i+"-transition"]=o)}return t},zn.prototype.transitioned=function(t,e){for(var r=new Dn(this._properties),i=0,n=Object.keys(this._values);i<n.length;i+=1){var o=n[i];r._values[o]=this._values[o].transitioned(t,e._values[o])}return r},zn.prototype.untransitioned=function(){for(var t=new Dn(this._properties),e=0,r=Object.keys(this._values);e<r.length;e+=1){var i=r[e];t._values[i]=this._values[i].untransitioned()}return t};var Cn=function(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)};Cn.prototype.possiblyEvaluate=function(t,e,r){var i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),o=this.prior;if(o){if(i>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return o.possiblyEvaluate(t,e,r);var a=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,r),n,function(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}return n};var Dn=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};Dn.prototype.possiblyEvaluate=function(t,e,r){for(var i=new On(this._properties),n=0,o=Object.keys(this._values);n<o.length;n+=1){var a=o[n];i._values[a]=this._values[a].possiblyEvaluate(t,e,r)}return i},Dn.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 Rn=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};Rn.prototype.getValue=function(t){return x(this._values[t].value)},Rn.prototype.setValue=function(t,e){this._values[t]=new Mn(this._values[t].property,null===e?void 0:x(e))},Rn.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);e<r.length;e+=1){var i=r[e],n=this.getValue(i);void 0!==n&&(t[i]=n)}return t},Rn.prototype.possiblyEvaluate=function(t,e,r){for(var i=new On(this._properties),n=0,o=Object.keys(this._values);n<o.length;n+=1){var a=o[n];i._values[a]=this._values[a].possiblyEvaluate(t,e,r)}return i};var Fn=function(t,e,r){this.property=t,this.value=e,this.parameters=r};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,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)};var On=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};On.prototype.get=function(t){return this._values[t]};var Bn=function(t){this.specification=t};Bn.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},Bn.prototype.interpolate=function(t,e,r){var i=Ge[this.specification.type];return i?i(t,e,r):t};var Nn=function(t,e){this.specification=t,this.overrides=e};Nn.prototype.possiblyEvaluate=function(t,e,r,i){return new Fn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)}:t.expression,e)},Nn.prototype.interpolate=function(t,e,r){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 i=Ge[this.specification.type];return i?new Fn(this,{kind:"constant",value:i(t.value.value,e.value.value,r)},t.parameters):t},Nn.prototype.evaluate=function(t,e,r,i,n,o){return"constant"===t.kind?t.value:t.evaluate(e,r,i,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,r,i){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,{},r,i),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,r,i,n,o){if("source"===t.kind){var a=t.evaluate(e,r,i,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value},e.prototype._calculate=function(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(Nn),Un=function(t){this.specification=t};Un.prototype.possiblyEvaluate=function(t,e,r,i){if(void 0!==t.value){if("constant"===t.expression.kind){var n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new Ln(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Ln(Math.floor(e.zoom),e)),t.expression.evaluate(new Ln(Math.floor(e.zoom+1),e)),e)}},Un.prototype._calculate=function(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},Un.prototype.interpolate=function(t){return t};var jn=function(t){this.specification=t};jn.prototype.possiblyEvaluate=function(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)},jn.prototype.interpolate=function(){return!1};var qn=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var i=this.defaultPropertyValues[e]=new Mn(r,void 0),n=this.defaultTransitionablePropertyValues[e]=new kn(r);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}};Fi("DataDrivenProperty",Nn),Fi("DataConstantProperty",Bn),Fi("CrossFadedDataDrivenProperty",Vn),Fi("CrossFadedProperty",Un),Fi("ColorRampProperty",jn);var Gn=function(t){function e(e,r){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),r.layout&&(this._unevaluatedLayout=new Rn(r.layout)),r.paint)){for(var i in this._transitionablePaint=new zn(r.paint),e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(var n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new On(r.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,r){void 0===r&&(r={}),null!=e&&this._validate(Li,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return g(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Ai,"layers."+this.id+".paint."+t,t,e,r))return!1;if(g(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;var i=this._transitionablePaint._values[t],n="cross-faded-data-driven"===i.property.specification["property-type"],o=i.value.isDataDriven(),a=i.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,r){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),v(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,r,i,n){return void 0===n&&(n={}),(!n||!1!==n.validate)&&Mi(this,t.call(Ei,{key:e,layerType:this.type,objectKey:r,value:i,styleSpec:Pt,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&&zr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Et),Zn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Xn=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},Yn=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Wn(t,e){void 0===e&&(e=1);var r=0,i=0;return{members:t.map((function(t){var n=Zn[t.type].BYTES_PER_ELEMENT,o=r=Hn(r,Math.max(e,n)),a=t.components||1;return i=Math.max(i,n),r+=n*a,{name:t.name,type:t.type,components:a,offset:o}})),size:Hn(r,Math.max(i,e)),alignment:e}}function Hn(t,e){return Math.ceil(t/e)*e}Yn.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Yn.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},Yn.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Yn.prototype.clear=function(){this.length=0},Yn.prototype.resize=function(t){this.reserve(t),this.length=t},Yn.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)}},Yn.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};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.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var i=2*t;return this.int16[i+0]=e,this.int16[i+1]=r,t},e}(Yn);Kn.prototype.bytesPerElement=4,Fi("StructArrayLayout2i4",Kn);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)},e.prototype.emplaceBack=function(t,e,r,i){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)},e.prototype.emplace=function(t,e,r,i,n){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,t},e}(Yn);Jn.prototype.bytesPerElement=8,Fi("StructArrayLayout4i8",Jn);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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)},e.prototype.emplace=function(t,e,r,i,n,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Yn);$n.prototype.bytesPerElement=12,Fi("StructArrayLayout2i4i12",$n);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)},e.prototype.emplaceBack=function(t,e,r,i,n,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)},e.prototype.emplace=function(t,e,r,i,n,o,a){var s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,t},e}(Yn);Qn.prototype.bytesPerElement=8,Fi("StructArrayLayout2i4ub8",Qn);var to=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 r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var i=2*t;return this.float32[i+0]=e,this.float32[i+1]=r,t},e}(Yn);to.prototype.bytesPerElement=8,Fi("StructArrayLayout2f8",to);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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o,a,s,l,u){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,o,a,s,l,u)},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l,u,h){var p=10*t;return this.uint16[p+0]=e,this.uint16[p+1]=r,this.uint16[p+2]=i,this.uint16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.uint16[p+8]=u,this.uint16[p+9]=h,t},e}(Yn);eo.prototype.bytesPerElement=20,Fi("StructArrayLayout10ui20",eo);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._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,r,i,n,o,a,s,l,u,h,p){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,i,n,o,a,s,l,u,h,p)},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l,u,h,p,c){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=i,this.int16[f+3]=n,this.uint16[f+4]=o,this.uint16[f+5]=a,this.uint16[f+6]=s,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=h,this.int16[f+10]=p,this.int16[f+11]=c,t},e}(Yn);ro.prototype.bytesPerElement=24,Fi("StructArrayLayout4i4ui4i24",ro);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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)},e.prototype.emplace=function(t,e,r,i){var n=3*t;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t},e}(Yn);io.prototype.bytesPerElement=12,Fi("StructArrayLayout3f12",io);var no=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}(Yn);no.prototype.bytesPerElement=4,Fi("StructArrayLayout1ul4",no);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._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,r,i,n,o,a,s,l){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,o,a,s,l)},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l,u){var h=10*t,p=5*t;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=o,this.int16[h+5]=a,this.uint32[p+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=u,t},e}(Yn);oo.prototype.bytesPerElement=20,Fi("StructArrayLayout6i1ul2ui20",oo);var ao=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,r,i,n,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)},e.prototype.emplace=function(t,e,r,i,n,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Yn);ao.prototype.bytesPerElement=12,Fi("StructArrayLayout2i2i2i12",ao);var so=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,r,i,n){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,i,n)},e.prototype.emplace=function(t,e,r,i,n,o){var a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.int16[s+6]=n,this.int16[s+7]=o,t},e}(Yn);so.prototype.bytesPerElement=16,Fi("StructArrayLayout2f1f2i16",so);var lo=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,r,i){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)},e.prototype.emplace=function(t,e,r,i,n){var o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[a+1]=i,this.float32[a+2]=n,t},e}(Yn);lo.prototype.bytesPerElement=12,Fi("StructArrayLayout2ub2f12",lo);var uo=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,r){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)},e.prototype.emplace=function(t,e,r,i){var n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t},e}(Yn);uo.prototype.bytesPerElement=6,Fi("StructArrayLayout3ui6",uo);var ho=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,r,i,n,o,a,s,l,u,h,p,c,f,d,m,y){var g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,i,n,o,a,s,l,u,h,p,c,f,d,m,y)},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l,u,h,p,c,f,d,m,y,g){var _=24*t,v=12*t,x=48*t;return this.int16[_+0]=e,this.int16[_+1]=r,this.uint16[_+2]=i,this.uint16[_+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[_+10]=l,this.uint16[_+11]=u,this.uint16[_+12]=h,this.float32[v+7]=p,this.float32[v+8]=c,this.uint8[x+36]=f,this.uint8[x+37]=d,this.uint8[x+38]=m,this.uint32[v+10]=y,this.int16[_+22]=g,t},e}(Yn);ho.prototype.bytesPerElement=48,Fi("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ho);var po=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,r,i,n,o,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,w,I,S,T,E,P){var A=this.length;return this.resize(A+1),this.emplace(A,t,e,r,i,n,o,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,w,I,S,T,E,P)},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,w,I,S,T,E,P,A){var L=34*t,M=17*t;return this.int16[L+0]=e,this.int16[L+1]=r,this.int16[L+2]=i,this.int16[L+3]=n,this.int16[L+4]=o,this.int16[L+5]=a,this.int16[L+6]=s,this.int16[L+7]=l,this.uint16[L+8]=u,this.uint16[L+9]=h,this.uint16[L+10]=p,this.uint16[L+11]=c,this.uint16[L+12]=f,this.uint16[L+13]=d,this.uint16[L+14]=m,this.uint16[L+15]=y,this.uint16[L+16]=g,this.uint16[L+17]=_,this.uint16[L+18]=v,this.uint16[L+19]=x,this.uint16[L+20]=b,this.uint16[L+21]=w,this.uint16[L+22]=I,this.uint32[M+12]=S,this.float32[M+13]=T,this.float32[M+14]=E,this.float32[M+15]=P,this.float32[M+16]=A,t},e}(Yn);po.prototype.bytesPerElement=68,Fi("StructArrayLayout8i15ui1ul4f68",po);var co=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}(Yn);co.prototype.bytesPerElement=4,Fi("StructArrayLayout1f4",co);var fo=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,r){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)},e.prototype.emplace=function(t,e,r,i){var n=3*t;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t},e}(Yn);fo.prototype.bytesPerElement=6,Fi("StructArrayLayout3i6",fo);var mo=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,r){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)},e.prototype.emplace=function(t,e,r,i){var n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=r,this.uint16[n+3]=i,t},e}(Yn);mo.prototype.bytesPerElement=8,Fi("StructArrayLayout1ul2ui8",mo);var yo=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 r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,t},e}(Yn);yo.prototype.bytesPerElement=4,Fi("StructArrayLayout2ui4",yo);var go=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}(Yn);go.prototype.bytesPerElement=2,Fi("StructArrayLayout1ui2",go);var _o=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,r,i){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)},e.prototype.emplace=function(t,e,r,i,n){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,t},e}(Yn);_o.prototype.bytesPerElement=16,Fi("StructArrayLayout4f16",_o);var vo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={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 r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(Xn);vo.prototype.size=20;var xo=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 vo(this,t)},e}(oo);Fi("CollisionBoxArray",xo);var bo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={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 r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(Xn);bo.prototype.size=48;var wo=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 bo(this,t)},e}(ho);Fi("PlacedSymbolArray",wo);var Io=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={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 r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(Xn);Io.prototype.size=68;var So=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 Io(this,t)},e}(po);Fi("SymbolInstanceArray",So);var To=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}(co);Fi("GlyphOffsetArray",To);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.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}(fo);Fi("SymbolLineVertexArray",Eo);var Po=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(Xn);Po.prototype.size=8;var Ao=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 Po(this,t)},e}(mo);Fi("FeatureIndexArray",Ao);var Lo=Wn([{name:"a_pos",components:2,type:"Int16"}],4).members,Mo=function(t){void 0===t&&(t=[]),this.segments=t};function ko(t,e){return 256*(t=u(Math.floor(t),0,255))+u(Math.floor(e),0,255)}Mo.prototype.prepareSegment=function(t,e,r,i){var n=this.segments[this.segments.length-1];return t>Mo.MAX_VERTEX_ARRAY_LENGTH&&w("Max vertices per segment is "+Mo.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!n||n.vertexLength+t>Mo.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i)&&(n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==i&&(n.sortKey=i),this.segments.push(n)),n},Mo.prototype.get=function(){return this.segments},Mo.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var r=e[t];for(var i in r.vaos)r.vaos[i].destroy()}},Mo.simpleSegment=function(t,e,r,i){return new Mo([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])},Mo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fi("SegmentVector",Mo);var zo=Wn([{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=Jt((function(t){t.exports=function(t,e){var r,i,n,o,a,s,l,u;for(i=t.length-(r=3&t.length),n=e,a=3432918353,s=461845907,u=0;u<i;)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,r){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}})),Do=Jt((function(t){t.exports=function(t,e){for(var r,i=t.length,n=e^i,o=0;i>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++o;switch(i){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}})),Ro=Co,Fo=Do;Ro.murmur3=Co,Ro.murmur2=Fo;var Oo=function(){this.ids=[],this.positions=[],this.indexed=!1};Oo.prototype.add=function(t,e,r,i){this.ids.push(No(t)),this.positions.push(e,r,i)},Oo.prototype.getPositions=function(t){for(var e=No(t),r=0,i=this.ids.length-1;r<i;){var n=r+i>>1;this.ids[n]>=e?i=n:r=n+1}for(var o=[];this.ids[r]===e;)o.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return o},Oo.serialize=function(t,e){var r=new Float64Array(t.ids),i=new Uint32Array(t.positions);return function t(e,r,i,n){for(;i<n;){for(var o=e[i+n>>1],a=i-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(r,3*a,3*s),Vo(r,3*a+1,3*s+1),Vo(r,3*a+2,3*s+2)}s-i<n-s?(t(e,r,i,s),i=s+1):(t(e,r,s+1,n),n=s)}}(r,i,0,r.length-1),e&&e.push(r.buffer,i.buffer),{ids:r,positions:i}},Oo.deserialize=function(t){var e=new Oo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e};var Bo=Math.pow(2,53)-1;function No(t){var e=+t;return!isNaN(e)&&e<=Bo?e:Ro(String(t))}function Vo(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}Fi("FeaturePositionMap",Oo);var Uo=function(t,e){this.gl=t.gl,this.location=e},jo=function(t){function e(e,r){t.call(this,e,r),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}(Uo),qo=function(t){function e(e,r){t.call(this,e,r),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}(Uo),Go=function(t){function e(e,r){t.call(this,e,r),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}(Uo),Zo=function(t){function e(e,r){t.call(this,e,r),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}(Uo),Xo=function(t){function e(e,r){t.call(this,e,r),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}(Uo),Yo=function(t){function e(e,r){t.call(this,e,r),this.current=Qt.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}(Uo),Wo=new Float32Array(16),Ho=function(t){function e(e,r){t.call(this,e,r),this.current=Wo}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}(Uo);function Ko(t){return[ko(255*t.r,255*t.g),ko(255*t.b,255*t.a)]}var Jo=function(t,e,r){this.value=t,this.uniformNames=e.map((function(t){return"u_"+t})),this.type=r};Jo.prototype.setUniform=function(t,e,r){t.set(r.constantOr(this.value))},Jo.prototype.getBinding=function(t,e,r){return"color"===this.type?new Yo(t,e):new qo(t,e)};var $o=function(t,e){this.uniformNames=e.map((function(t){return"u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};$o.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr},$o.prototype.setUniform=function(t,e,r,i){var n="u_pattern_to"===i?this.patternTo:"u_pattern_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;n&&t.set(n)},$o.prototype.getBinding=function(t,e,r){return"u_pattern"===r.substr(0,9)?new Xo(t,e):new qo(t,e)};var Qo=function(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?2:1,offset:0}})),this.paintVertexArray=new i};Qo.prototype.populatePaintArray=function(t,e,r,i,n){var o=this.paintVertexArray.length,a=this.expression.evaluate(new Ln(0),e,{},i,[],n);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)},Qo.prototype.updatePaintArray=function(t,e,r,i){var n=this.expression.evaluate({zoom:0},r,i);this._setPaintValue(t,e,n)},Qo.prototype._setPaintValue=function(t,e,r){if("color"===this.type)for(var i=Ko(r),n=t;n<e;n++)this.paintVertexArray.emplace(n,i[0],i[1]);else{for(var o=t;o<e;o++)this.paintVertexArray.emplace(o,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}},Qo.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))},Qo.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var ta=function(t,e,r,i,n,o){this.expression=t,this.uniformNames=e.map((function(t){return"u_"+t+"_t"})),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?4:2,offset:0}})),this.paintVertexArray=new o};ta.prototype.populatePaintArray=function(t,e,r,i,n){var o=this.expression.evaluate(new Ln(this.zoom),e,{},i,[],n),a=this.expression.evaluate(new Ln(this.zoom+1),e,{},i,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)},ta.prototype.updatePaintArray=function(t,e,r,i){var n=this.expression.evaluate({zoom:this.zoom},r,i),o=this.expression.evaluate({zoom:this.zoom+1},r,i);this._setPaintValue(t,e,n,o)},ta.prototype._setPaintValue=function(t,e,r,i){if("color"===this.type)for(var n=Ko(r),o=Ko(i),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,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}},ta.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))},ta.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},ta.prototype.setUniform=function(t,e){var r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=u(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)},ta.prototype.getBinding=function(t,e,r){return new qo(t,e)};var ea=function(t,e,r,i,n,o){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n};ea.prototype.populatePaintArray=function(t,e,r){var i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,e.patterns&&e.patterns[this.layerId],r)},ea.prototype.updatePaintArray=function(t,e,r,i,n){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],n)},ea.prototype._setPaintValues=function(t,e,r,i){if(i&&r){var n=i[r.min],o=i[r.mid],a=i[r.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)}},ea.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,zo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,zo.members,this.expression.isStateDependent))},ea.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var ra=function(t,e,r){this.binders={},this._buffers=[];var i=[];for(var n in t.paint._values)if(r(n)){var o=t.paint.get(n);if(o instanceof Fn&&zr(o.property.specification)){var a=na(n,t.type),s=o.value,l=o.property.specification.type,u=o.property.useIntegerZoom,h=o.property.specification["property-type"],p="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===s.kind)this.binders[n]=p?new $o(s.value,a):new Jo(s.value,a,l),i.push("/u_"+n);else if("source"===s.kind||p){var c=oa(n,l,"source");this.binders[n]=p?new ea(s,l,u,e,c,t.id):new Qo(s,a,l,c),i.push("/a_"+n)}else{var f=oa(n,l,"composite");this.binders[n]=new ta(s,a,l,u,e,f),i.push("/z_"+n)}}}this.cacheKey=i.sort().join("")};ra.prototype.getMaxValue=function(t){var e=this.binders[t];return e instanceof Qo||e instanceof ta?e.maxValue:0},ra.prototype.populatePaintArrays=function(t,e,r,i,n){for(var o in this.binders){var a=this.binders[o];(a instanceof Qo||a instanceof ta||a instanceof ea)&&a.populatePaintArray(t,e,r,i,n)}},ra.prototype.setConstantPatternPositions=function(t,e){for(var r in this.binders){var i=this.binders[r];i instanceof $o&&i.setConstantPatternPositions(t,e)}},ra.prototype.updatePaintArrays=function(t,e,r,i,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],h=r.feature(u.index);for(var p in this.binders){var c=this.binders[p];if((c instanceof Qo||c instanceof ta||c instanceof ea)&&!0===c.expression.isStateDependent){var f=i.paint.get(p);c.expression=f.value,c.updatePaintArray(u.start,u.end,h,t[a],n),o=!0}}}return o},ra.prototype.defines=function(){var t=[];for(var e in this.binders){var r=this.binders[e];(r instanceof Jo||r instanceof $o)&&t.push.apply(t,r.uniformNames.map((function(t){return"#define HAS_UNIFORM_"+t})))}return t},ra.prototype.getBinderAttributes=function(){var t=[];for(var e in this.binders){var r=this.binders[e];if(r instanceof Qo||r instanceof ta)for(var i=0;i<r.paintVertexAttributes.length;i++)t.push(r.paintVertexAttributes[i].name);else if(r instanceof ea)for(var n=0;n<zo.members.length;n++)t.push(zo.members[n].name)}return t},ra.prototype.getBinderUniforms=function(){var t=[];for(var e in this.binders){var r=this.binders[e];if(r instanceof Jo||r instanceof $o||r instanceof ta)for(var i=0,n=r.uniformNames;i<n.length;i+=1)t.push(n[i])}return t},ra.prototype.getPaintVertexBuffers=function(){return this._buffers},ra.prototype.getUniforms=function(t,e){var r=[];for(var i in this.binders){var n=this.binders[i];if(n instanceof Jo||n instanceof $o||n instanceof ta)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);r.push({name:s,property:i,binding:l})}}}return r},ra.prototype.setUniforms=function(t,e,r,i){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,i,r.get(l),s)}},ra.prototype.updatePaintBuffers=function(t){for(var e in this._buffers=[],this.binders){var r=this.binders[e];if(t&&r instanceof ea){var i=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof Qo||r instanceof ta)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}},ra.prototype.upload=function(t){for(var e in this.binders){var r=this.binders[e];(r instanceof Qo||r instanceof ta||r instanceof ea)&&r.upload(t)}this.updatePaintBuffers()},ra.prototype.destroy=function(){for(var t in this.binders){var e=this.binders[t];(e instanceof Qo||e instanceof ta||e instanceof ea)&&e.destroy()}};var ia=function(t,e,r){void 0===r&&(r=function(){return!0}),this.programConfigurations={};for(var i=0,n=t;i<n.length;i+=1){var o=n[i];this.programConfigurations[o.id]=new ra(o,e,r)}this.needsUpload=!1,this._featureMap=new Oo,this._bufferOffset=0};function na(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"],"text-height":["height"],"icon-height":["height"],"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 oa(t,e,r){var i={color:{source:to,composite:_o},number:{source:co,composite:to}},n=function(t){return{"line-pattern":{source:eo,composite:eo},"fill-pattern":{source:eo,composite:eo},"fill-extrusion-pattern":{source:eo,composite:eo}}[t]}(t);return n&&n[r]||i[e][r]}ia.prototype.populatePaintArrays=function(t,e,r,i,n,o){for(var a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,i,n,o);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},ia.prototype.updatePaintArrays=function(t,e,r,i){for(var n=0,o=r;n<o.length;n+=1){var a=o[n];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,e,a,i)||this.needsUpload}},ia.prototype.get=function(t){return this.programConfigurations[t]},ia.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},ia.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},Fi("ConstantBinder",Jo),Fi("CrossFadedConstantBinder",$o),Fi("SourceExpressionBinder",Qo),Fi("CrossFadedCompositeBinder",ea),Fi("CompositeExpressionBinder",ta),Fi("ProgramConfiguration",ra,{omit:["_buffers"]}),Fi("ProgramConfigurationSet",ia);var aa=Math.pow(2,14)-1,sa=-aa-1;function la(t){for(var e=8192/t.extent,r=t.loadGeometry(),i=0;i<r.length;i++)for(var n=r[i],o=0;o<n.length;o++){var a=n[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=u(s,sa,aa),a.y=u(l,sa,aa),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&w("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function ua(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?la(t):[]}}function ha(t,e,r,i,n){t.emplaceBack(2*e+(i+1)/2,2*r+(n+1)/2)}var pa=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 Kn,this.indexArray=new uo,this.segments=new Mo,this.programConfigurations=new ia(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function ca(t,e){for(var r=0;r<t.length;r++)if(ba(e,t[r]))return!0;for(var i=0;i<e.length;i++)if(ba(t,e[i]))return!0;return!!ya(t,e)}function fa(t,e,r){return!!ba(t,e)||!!_a(e,t,r)}function da(t,e){if(1===t.length)return xa(e,t[0]);for(var r=0;r<e.length;r++)for(var i=e[r],n=0;n<i.length;n++)if(ba(t,i[n]))return!0;for(var o=0;o<t.length;o++)if(xa(e,t[o]))return!0;for(var a=0;a<e.length;a++)if(ya(t,e[a]))return!0;return!1}function ma(t,e,r){if(t.length>1){if(ya(t,e))return!0;for(var i=0;i<e.length;i++)if(_a(e[i],t,r))return!0}for(var n=0;n<t.length;n++)if(_a(t[n],e,r))return!0;return!1}function ya(t,e){if(0===t.length||0===e.length)return!1;for(var r=0;r<t.length-1;r++)for(var i=t[r],n=t[r+1],o=0;o<e.length-1;o++)if(ga(i,n,e[o],e[o+1]))return!0;return!1}function ga(t,e,r,i){return I(t,r,i)!==I(e,r,i)&&I(t,e,r)!==I(t,e,i)}function _a(t,e,r){var i=r*r;if(1===e.length)return t.distSqr(e[0])<i;for(var n=1;n<e.length;n++)if(va(t,e[n-1],e[n])<i)return!0;return!1}function va(t,e,r){var i=e.distSqr(r);if(0===i)return t.distSqr(e);var n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return t.distSqr(n<0?e:n>1?r:r.sub(e)._mult(n)._add(e))}function xa(t,e){for(var r,i,n,o=!1,a=0;a<t.length;a++)for(var s=0,l=(r=t[a]).length-1;s<r.length;l=s++)(i=r[s]).y>e.y!=(n=r[l]).y>e.y&&e.x<(n.x-i.x)*(e.y-i.y)/(n.y-i.y)+i.x&&(o=!o);return o}function ba(t,e){for(var r=!1,i=0,n=t.length-1;i<t.length;n=i++){var o=t[i],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&&(r=!r)}return r}function wa(t,e,r){var i=r[0],n=r[2];if(t.x<i.x&&e.x<i.x||t.x>n.x&&e.x>n.x||t.y<i.y&&e.y<i.y||t.y>n.y&&e.y>n.y)return!1;var o=I(t,e,r[0]);return o!==I(t,e,r[1])||o!==I(t,e,r[2])||o!==I(t,e,r[3])}function Ia(t,e,r){var i=e.paint.get(t).value;return"constant"===i.kind?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Sa(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ta(t,e,r,n,o){if(!e[0]&&!e[1])return t;var a=i.convert(e)._mult(o);"viewport"===r&&a._rotate(-n);for(var s=[],l=0;l<t.length;l++)s.push(t[l].sub(a));return s}pa.prototype.populate=function(t,e,r){var i=this.layers[0],n=[],o=null;"circle"===i.type&&(o=i.layout.get("circle-sort-key"));for(var a=0,s=t;a<s.length;a+=1){var l=s[a],u=l.feature,h=l.id,p=l.index,c=l.sourceLayerIndex,f=this.layers[0]._featureFilter.needGeometry,d=ua(u,f);if(this.layers[0]._featureFilter.filter(new Ln(this.zoom),d,r)){var m=o?o.evaluate(d,{},r):void 0,y={id:h,properties:u.properties,type:u.type,sourceLayerIndex:c,index:p,geometry:f?d.geometry:la(u),patterns:{},sortKey:m};n.push(y)}}o&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var g=0,_=n;g<_.length;g+=1){var v=_[g],x=v.geometry,b=v.index,w=v.sourceLayerIndex,I=t[b].feature;this.addFeature(v,x,b,r),e.featureIndex.insert(I,x,b,w,this.index)}},pa.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},pa.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},pa.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},pa.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Lo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},pa.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},pa.prototype.addFeature=function(t,e,r,i){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,h=l.y;if(!(u<0||u>=8192||h<0||h>=8192)){var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),c=p.vertexLength;ha(this.layoutVertexArray,u,h,-1,-1),ha(this.layoutVertexArray,u,h,1,-1),ha(this.layoutVertexArray,u,h,1,1),ha(this.layoutVertexArray,u,h,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),p.vertexLength+=4,p.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},i)},Fi("CircleBucket",pa,{omit:["layers"]});var Ea=new qn({"circle-sort-key":new Nn(Pt.layout_circle["circle-sort-key"])}),Pa={paint:new qn({"circle-radius":new Nn(Pt.paint_circle["circle-radius"]),"circle-color":new Nn(Pt.paint_circle["circle-color"]),"circle-blur":new Nn(Pt.paint_circle["circle-blur"]),"circle-opacity":new Nn(Pt.paint_circle["circle-opacity"]),"circle-translate":new Bn(Pt.paint_circle["circle-translate"]),"circle-translate-anchor":new Bn(Pt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Bn(Pt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Bn(Pt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Nn(Pt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Nn(Pt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Nn(Pt.paint_circle["circle-stroke-opacity"])}),layout:Ea},Aa="undefined"!=typeof Float32Array?Float32Array:Array;function La(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 Ma(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],p=e[8],c=e[9],f=e[10],d=e[11],m=e[12],y=e[13],g=e[14],_=e[15],v=r[0],x=r[1],b=r[2],w=r[3];return t[0]=v*i+x*s+b*p+w*m,t[1]=v*n+x*l+b*c+w*y,t[2]=v*o+x*u+b*f+w*g,t[3]=v*a+x*h+b*d+w*_,t[4]=(v=r[4])*i+(x=r[5])*s+(b=r[6])*p+(w=r[7])*m,t[5]=v*n+x*l+b*c+w*y,t[6]=v*o+x*u+b*f+w*g,t[7]=v*a+x*h+b*d+w*_,t[8]=(v=r[8])*i+(x=r[9])*s+(b=r[10])*p+(w=r[11])*m,t[9]=v*n+x*l+b*c+w*y,t[10]=v*o+x*u+b*f+w*g,t[11]=v*a+x*h+b*d+w*_,t[12]=(v=r[12])*i+(x=r[13])*s+(b=r[14])*p+(w=r[15])*m,t[13]=v*n+x*l+b*c+w*y,t[14]=v*o+x*u+b*f+w*g,t[15]=v*a+x*h+b*d+w*_,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var ka,za=Ma;function Ca(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*a,t[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*a,t[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*a,t[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*a,t}ka=new Aa(3),Aa!=Float32Array&&(ka[0]=0,ka[1]=0,ka[2]=0),function(){var t=new Aa(4);Aa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[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,Pa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new pa(t)},e.prototype.queryRadius=function(t){var e=t;return Ia("circle-radius",this,e)+Ia("circle-stroke-width",this,e)+Sa(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,i,n,o,a,s){for(var l=Ta(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),h="map"===this.paint.get("circle-pitch-alignment"),p=h?l:function(t,e){return t.map((function(t){return Ra(t,e)}))}(l,s),c=h?u*a:u,f=0,d=i;f<d.length;f+=1)for(var m=0,y=d[f];m<y.length;m+=1){var g=y[m],_=h?g:Ra(g,s),v=c,x=Ca([],[g.x,g.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?v*=x[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(v*=o.cameraToCenterDistance/x[3]),fa(p,_,v))return!0}return!1},e}(Gn));function Ra(t,e){var r=Ca([],[t.x,t.y,0,1],e);return new i(r[0]/r[3],r[1]/r[3])}var Fa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(pa);function Oa(t,e,r,i){var n=e.width,o=e.height;if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==n*o*r)throw new RangeError("mismatched image size")}else i=new Uint8Array(n*o*r);return t.width=n,t.height=o,t.data=i,t}function Ba(t,e,r){var i=e.width,n=e.height;if(i!==t.width||n!==t.height){var o=Oa({},{width:i,height:n},r);Na(t,o,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,i),height:Math.min(t.height,n)},r),t.width=i,t.height=n,t.data=o.data}}function Na(t,e,r,i,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.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||i.x>e.width-n.width||i.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=((r.y+l)*t.width+r.x)*o,h=((i.y+l)*e.width+i.x)*o,p=0;p<n.width*o;p++)s[h+p]=a[u+p];return e}Fi("HeatmapBucket",Fa,{omit:["layers"]});var Va=function(t,e){Oa(this,t,1,e)};Va.prototype.resize=function(t){Ba(this,t,1)},Va.prototype.clone=function(){return new Va({width:this.width,height:this.height},new Uint8Array(this.data))},Va.copy=function(t,e,r,i,n){Na(t,e,r,i,n,1)};var Ua=function(t,e){Oa(this,t,4,e)};Ua.prototype.resize=function(t){Ba(this,t,4)},Ua.prototype.replace=function(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t},Ua.prototype.clone=function(){return new Ua({width:this.width,height:this.height},new Uint8Array(this.data))},Ua.copy=function(t,e,r,i,n){Na(t,e,r,i,n,4)},Fi("AlphaImage",Va),Fi("RGBAImage",Ua);var ja={paint:new qn({"heatmap-radius":new Nn(Pt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Nn(Pt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Bn(Pt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new jn(Pt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Bn(Pt.paint_heatmap["heatmap-opacity"])})};function qa(t){var e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new Ua({width:r,height:i}),o=function(r,i,o){e[t.evaluationKey]=o;var a=t.expression.evaluate(e);n.data[r+i+0]=Math.floor(255*a.r/a.a),n.data[r+i+1]=Math.floor(255*a.g/a.a),n.data[r+i+2]=Math.floor(255*a.b/a.a),n.data[r+i+3]=Math.floor(255*a.a)};if(t.clips)for(var a=0,s=0;a<i;++a,s+=4*r)for(var l=0,u=0;l<r;l++,u+=4){var h=l/(r-1),p=t.clips[a];o(s,u,p.start*(1-h)+p.end*h)}else for(var c=0,f=0;c<r;c++,f+=4)o(0,f,c/(r-1));return n}var Ga=function(t){function e(e){t.call(this,e,ja),this._updateColorRamp()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Fa(t)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){"heatmap-color"===t&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){this.colorRamp=qa({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}(Gn),Za={paint:new qn({"hillshade-illumination-direction":new Bn(Pt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Bn(Pt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Bn(Pt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Bn(Pt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Bn(Pt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Bn(Pt.paint_hillshade["hillshade-accent-color"])})},Xa=function(t){function e(e){t.call(this,e,Za)}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}(Gn),Ya=Wn([{name:"a_pos",components:2,type:"Int16"}],4).members,Wa=Ka,Ha=Ka;function Ka(t,e,r){r=r||2;var i,n,o,a,s,l,u,h=e&&e.length,p=h?e[0]*r:t.length,c=Ja(t,0,p,r,!0),f=[];if(!c||c.next===c.prev)return f;if(h&&(c=function(t,e,r,i){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=Ja(t,e[n]*i,n<o-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),s.push(ls(a));for(s.sort(ns),n=0;n<s.length;n++)os(s[n],r),r=$a(r,r.next);return r}(t,e,c,r)),t.length>80*r){i=o=t[0],n=a=t[1];for(var d=r;d<p;d+=r)(s=t[d])<i&&(i=s),(l=t[d+1])<n&&(n=l),s>o&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-i,a-n))?1/u:0}return Qa(c,f,r,i,n,u),f}function Ja(t,e,r,i,n){var o,a;if(n===bs(t,e,r,i)>0)for(o=e;o<r;o+=i)a=_s(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=_s(o,t[o],t[o+1],a);return a&&cs(a,a.next)&&(vs(a),a=a.next),a}function $a(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!cs(i,i.next)&&0!==ps(i.prev,i,i.next))i=i.next;else{if(vs(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function Qa(t,e,r,i,n,o,a){if(t){!a&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=ss(n.x,n.y,e,r,i)),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,r,i,n,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e<u&&(s++,i=i.nextZ);e++);for(l=u;s>0||l>0&&i;)0!==s&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,l--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,u*=2}while(a>1)}(n)}(t,i,n,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?es(t,i,n,o):ts(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),vs(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?Qa(t=rs($a(t),e,r),e,r,i,n,o,2):2===a&&is(t,e,r,i,n,o):Qa($a(t),e,r,i,n,o,1);break}}}function ts(t){var e=t.prev,r=t,i=t.next;if(ps(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(us(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&ps(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function es(t,e,r,i){var n=t.prev,o=t,a=t.next;if(ps(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=ss(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,r,i),h=ss(s,l,e,r,i),p=t.prevZ,c=t.nextZ;p&&p.z>=u&&c&&c.z<=h;){if(p!==t.prev&&p!==t.next&&us(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&ps(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,c!==t.prev&&c!==t.next&&us(n.x,n.y,o.x,o.y,a.x,a.y,c.x,c.y)&&ps(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&us(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&ps(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;c&&c.z<=h;){if(c!==t.prev&&c!==t.next&&us(n.x,n.y,o.x,o.y,a.x,a.y,c.x,c.y)&&ps(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function rs(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!cs(n,o)&&fs(n,i,i.next,o)&&ys(n,o)&&ys(o,n)&&(e.push(n.i/r),e.push(i.i/r),e.push(o.i/r),vs(i),vs(i.next),i=t=o),i=i.next}while(i!==t);return $a(i)}function is(t,e,r,i,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&hs(a,s)){var l=gs(a,s);return a=$a(a,a.next),l=$a(l,l.next),Qa(a,e,r,i,n,o),void Qa(l,e,r,i,n,o)}s=s.next}a=a.next}while(a!==t)}function ns(t,e){return t.x-e.x}function os(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r;var l,u=r,h=r.x,p=r.y,c=1/0;i=r;do{n>=i.x&&i.x>=h&&n!==i.x&&us(o<p?n:a,o,h,p,o<p?a:n,o,i.x,i.y)&&(l=Math.abs(o-i.y)/(n-i.x),ys(i,t)&&(l<c||l===c&&(i.x>r.x||i.x===r.x&&as(r,i)))&&(r=i,c=l)),i=i.next}while(i!==u);return r}(t,e)){var r=gs(e,t);$a(e,e.next),$a(r,r.next)}}function as(t,e){return ps(t.prev,t,e.prev)<0&&ps(e.next,t,t.next)<0}function ss(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ls(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function us(t,e,r,i,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function hs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&fs(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(ys(t,e)&&ys(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(ps(t.prev,t,e.prev)||ps(t,e.prev,e))||cs(t,e)&&ps(t.prev,t,t.next)>0&&ps(e.prev,e,e.next)>0)}function ps(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function cs(t,e){return t.x===e.x&&t.y===e.y}function fs(t,e,r,i){var n=ms(ps(t,e,r)),o=ms(ps(t,e,i)),a=ms(ps(r,i,t)),s=ms(ps(r,i,e));return n!==o&&a!==s||!(0!==n||!ds(t,r,e))||!(0!==o||!ds(t,i,e))||!(0!==a||!ds(r,t,i))||!(0!==s||!ds(r,e,i))}function ds(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ms(t){return t>0?1:t<0?-1:0}function ys(t,e){return ps(t.prev,t,t.next)<0?ps(t,e,t.next)>=0&&ps(t,t.prev,e)>=0:ps(t,e,t.prev)<0||ps(t,t.next,e)<0}function gs(t,e){var r=new xs(t.i,t.x,t.y),i=new xs(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function _s(t,e,r,i){var n=new xs(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function vs(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 xs(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function bs(t,e,r,i){for(var n=0,o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}function ws(t,e,r,i,n){!function t(e,r,i,n,o){for(;n>i;){if(n-i>600){var a=n-i+1,s=r-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(i,Math.floor(r-s*u/a+h)),Math.min(n,Math.floor(r+(a-s)*u/a+h)),o)}var p=e[r],c=i,f=n;for(Is(e,i,r),o(e[n],p)>0&&Is(e,i,n);c<f;){for(Is(e,c,f),c++,f--;o(e[c],p)<0;)c++;for(;o(e[f],p)>0;)f--}0===o(e[i],p)?Is(e,i,f):Is(e,++f,n),f<=r&&(i=f+1),r<=f&&(n=f-1)}}(t,e,r||0,i||t.length-1,n||Ss)}function Is(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function Ss(t,e){return t<e?-1:t>e?1:0}function Ts(t,e){var r=t.length;if(r<=1)return[t];for(var i,n,o=[],a=0;a<r;a++){var s=S(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===n&&(n=s<0),n===s<0?(i&&o.push(i),i=[t[a]]):i.push(t[a]))}if(i&&o.push(i),e>1)for(var l=0;l<o.length;l++)o[l].length<=e||(ws(o[l],e,1,o[l].length-1,Es),o[l]=o[l].slice(0,e));return o}function Es(t,e){return e.area-t.area}function Ps(t,e,r){for(var i=r.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,i[l.to]=!0,i[l.from]=!0)}return n}function As(t,e,r,i,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 h=u.evaluate({zoom:i-1},r,{},n.availableImages),p=u.evaluate({zoom:i},r,{},n.availableImages),c=u.evaluate({zoom:i+1},r,{},n.availableImages);p=p&&p.name?p.name:p,c=c&&c.name?c.name:c,o[h=h&&h.name?h.name:h]=!0,o[p]=!0,o[c]=!0,r.patterns[l.id]={min:h,mid:p,max:c}}}return r}Ka.deviation=function(t,e,r,i){var n=e&&e.length,o=Math.abs(bs(t,0,n?e[0]*r:t.length,r));if(n)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(bs(t,e[a]*r,a<s-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<i.length;a+=3){var u=i[a]*r,h=i[a+1]*r,p=i[a+2]*r;l+=Math.abs((t[u]-t[p])*(t[h+1]-t[u+1])-(t[u]-t[h])*(t[p+1]-t[u+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},Ka.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,n=0;n<t.length;n++){for(var o=0;o<t[n].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[n][o][a]);n>0&&r.holes.push(i+=t[n-1].length)}return r},Wa.default=Ha;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 Kn,this.indexArray=new uo,this.indexArray2=new yo,this.programConfigurations=new ia(t.layers,t.zoom),this.segments=new Mo,this.segments2=new Mo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};Ls.prototype.populate=function(t,e,r){this.hasPattern=Ps("fill",this.layers,e);for(var i=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,h=s.index,p=s.sourceLayerIndex,c=this.layers[0]._featureFilter.needGeometry,f=ua(l,c);if(this.layers[0]._featureFilter.filter(new Ln(this.zoom),f,r)){var d=i?i.evaluate(f,{},r,e.availableImages):void 0,m={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:c?f.geometry:la(l),patterns:{},sortKey:d};n.push(m)}}i&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,g=n;y<g.length;y+=1){var _=g[y],v=_.geometry,x=_.index,b=_.sourceLayerIndex;if(this.hasPattern){var w=As("fill",this.layers,_,this.zoom,e);this.patternFeatures.push(w)}else this.addFeature(_,v,x,r,{});e.featureIndex.insert(t[x].feature,v,x,b,this.index)}},Ls.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Ls.prototype.addFeatures=function(t,e,r){for(var i=0,n=this.patternFeatures;i<n.length;i+=1){var o=n[i];this.addFeature(o,o.geometry,o.index,e,r)}},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,Ya),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,r,i,n){for(var o=0,a=Ts(e,500);o<a.length;o+=1){for(var s=a[o],l=0,u=0,h=s;u<h.length;u+=1)l+=h[u].length;for(var p=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray),c=p.vertexLength,f=[],d=[],m=0,y=s;m<y.length;m+=1){var g=y[m];if(0!==g.length){g!==s[0]&&d.push(f.length/2);var _=this.segments2.prepareSegment(g.length,this.layoutVertexArray,this.indexArray2),v=_.vertexLength;this.layoutVertexArray.emplaceBack(g[0].x,g[0].y),this.indexArray2.emplaceBack(v+g.length-1,v),f.push(g[0].x),f.push(g[0].y);for(var x=1;x<g.length;x++)this.layoutVertexArray.emplaceBack(g[x].x,g[x].y),this.indexArray2.emplaceBack(v+x-1,v+x),f.push(g[x].x),f.push(g[x].y);_.vertexLength+=g.length,_.primitiveLength+=g.length}}for(var b=Wa(f,d),w=0;w<b.length;w+=3)this.indexArray.emplaceBack(c+b[w],c+b[w+1],c+b[w+2]);p.vertexLength+=l,p.primitiveLength+=b.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)},Fi("FillBucket",Ls,{omit:["layers","patternFeatures"]});var Ms=new qn({"fill-sort-key":new Nn(Pt.layout_fill["fill-sort-key"])}),ks={paint:new qn({"fill-antialias":new Bn(Pt.paint_fill["fill-antialias"]),"fill-opacity":new Nn(Pt.paint_fill["fill-opacity"]),"fill-color":new Nn(Pt.paint_fill["fill-color"]),"fill-outline-color":new Nn(Pt.paint_fill["fill-outline-color"]),"fill-translate":new Bn(Pt.paint_fill["fill-translate"]),"fill-translate-anchor":new Bn(Pt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Vn(Pt.paint_fill["fill-pattern"])}),layout:Ms},zs=function(t){function e(e){t.call(this,e,ks)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r);var i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.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 Sa(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,i,n,o,a){return da(Ta(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),i)},e.prototype.isTileClipped=function(){return!0},e}(Gn),Cs=Wn([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,Ds=Rs;function Rs(t,e,r,i,n){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n,t.readFields(Fs,this,e)}function Fs(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function Os(t){for(var e,r,i=0,n=0,o=t.length,a=o-1;n<o;a=n++)i+=((r=t[a]).x-(e=t[n]).x)*(e.y+r.y);return i}Rs.types=["Unknown","Point","LineString","Polygon"],Rs.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,o=0,a=0,s=0,l=[];t.pos<r;){if(o<=0){var u=t.readVarint();n=7&u,o=u>>3}if(o--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new i(a,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&l.push(e),l},Rs.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(i<=0){var h=t.readVarint();r=7&h,i=h>>3}if(i--,1===r||2===r)(n+=t.readSVarint())<a&&(a=n),n>s&&(s=n),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,u]},Rs.prototype.toGeoJSON=function(t,e,r){var i,n,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=Rs.types[this.type];function h(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(i=0;i<l.length;i++)p[i]=l[i][0];h(l=p);break;case 2:for(i=0;i<l.length;i++)h(l[i]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,i,n=[],o=0;o<e;o++){var a=Os(t[o]);0!==a&&(void 0===i&&(i=a<0),i===a<0?(r&&n.push(r),r=[t[o]]):r.push(t[o]))}return r&&n.push(r),n}(l),i=0;i<l.length;i++)for(n=0;n<l[i].length;n++)h(l[i][n])}1===l.length?l=l[0]:u="Multi"+u;var c={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(c.id=this.id),c};var Bs=Ns;function Ns(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(Vs,this,e),this.length=this._features.length}function Vs(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var i=t.readVarint()>>3;e=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return e}(r))}function Us(t,e,r){if(3===t){var i=new Bs(r,r.readVarint()+r.pos);i.length&&(e[i.name]=i)}}Ns.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 js={VectorTile:function(t,e){this.layers=t.readFields(Us,{},e)},VectorTileFeature:Ds,VectorTileLayer:Bs},qs=js.VectorTileFeature.types,Gs=Math.pow(2,13);function Zs(t,e,r,i,n,o,a,s){t.emplaceBack(e,r,2*Math.floor(i*Gs)+a,n*Gs*2,o*Gs*2,Math.round(s))}function Xs(t,e,r,i,n,o,a,s){t.emplaceBack(e,r,0,0,o,1)}var Ys=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 $n,this.indexArray=new uo,this.programConfigurations=new ia(t.layers,t.zoom),this.segments=new Mo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.outlineVertexArray=new $n,this.outlineIndexArray=new yo,this.outlineProgramConfigurations=new ia(t.layers,t.zoom),this.outlineSegments=new Mo};function Ws(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}Ys.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=Ps("fill-extrusion",this.layers,e);for(var i=0,n=t;i<n.length;i+=1){var o=n[i],a=o.feature,s=o.id,l=o.index,u=o.sourceLayerIndex,h=this.layers[0]._featureFilter.needGeometry,p=ua(a,h);if(this.layers[0]._featureFilter.filter(new Ln(this.zoom),p,r)){var c={id:s,sourceLayerIndex:u,index:l,geometry:h?p.geometry:la(a),properties:a.properties,type:a.type,patterns:{}};this.hasPattern?this.features.push(As("fill-extrusion",this.layers,c,this.zoom,e)):this.addFeature(c,c.geometry,l,r,{}),e.featureIndex.insert(a,c.geometry,l,u,this.index,!0)}}},Ys.prototype.addFeatures=function(t,e,r){for(var i=0,n=this.features;i<n.length;i+=1){var o=n[i];this.addFeature(o,o.geometry,o.index,e,r)}},Ys.prototype.update=function(t,e,r){this.stateDependentLayers.length&&(this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r),this.outlineProgramConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r))},Ys.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ys.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ys.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Cs),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.outlineVertexBuffer=t.createVertexBuffer(this.outlineVertexArray,Cs),this.outlineIndexBuffer=t.createIndexBuffer(this.outlineIndexArray)),this.programConfigurations.upload(t),this.outlineProgramConfigurations.upload(t),this.uploaded=!0},Ys.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.outlineVertexBuffer.destroy(),this.outlineIndexBuffer.destroy(),this.outlineProgramConfigurations.destroy(),this.outlineSegments.destroy())},Ys.prototype.addFeature=function(t,e,r,i,n){for(var o=0,a=Ts(e,500);o<a.length;o+=1){for(var s=a[o],l=0,u=0,h=s;u<h.length;u+=1)l+=h[u].length;for(var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),c=0,f=s;c<f.length;c+=1){var d=f[c];if(0!==d.length&&!((z=d).every((function(t){return t.x<0}))||z.every((function(t){return t.x>8192}))||z.every((function(t){return t.y<0}))||z.every((function(t){return t.y>8192}))))for(var m=0,y=0;y<d.length;y++){var g=d[y];if(y>=1){var _=d[y-1];if(!Ws(g,_)){p.vertexLength+4>Mo.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var v=g.sub(_)._perp()._unit(),x=_.dist(g);m+x>32768&&(m=0),Zs(this.layoutVertexArray,g.x,g.y,v.x,v.y,0,0,m),Zs(this.layoutVertexArray,g.x,g.y,v.x,v.y,0,1,m),Zs(this.layoutVertexArray,_.x,_.y,v.x,v.y,0,0,m+=x),Zs(this.layoutVertexArray,_.x,_.y,v.x,v.y,0,1,m);var b=p.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2}}}}if(p.vertexLength+l>Mo.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===qs[t.type]){for(var w=[],I=[],S=p.vertexLength,T=0,E=s;T<E.length;T+=1){var P=E[T];if(0!==P.length){P!==s[0]&&I.push(w.length/2);for(var A=0;A<P.length;A++){var L=P[A];Zs(this.layoutVertexArray,L.x,L.y,0,0,1,1,0),w.push(L.x),w.push(L.y)}}}for(var M=Wa(w,I),k=0;k<M.length;k+=3)this.indexArray.emplaceBack(S+M[k],S+M[k+2],S+M[k+1]);p.primitiveLength+=M.length/3,p.vertexLength+=l}}var z;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i),this.addFeatureOutline(t,e,r,i)},Ys.prototype.addFeatureOutline=function(t,e,r,i){for(var n=0,o=e;n<o.length;n+=1)for(var a=o[n],s=this.outlineSegments.prepareSegment(2,this.outlineVertexArray,this.outlineIndexArray),l=1;l<a.length;l++){var u=a[l-1],h=a[l];if(!Ws(u,h)){s.vertexLength+2>Mo.MAX_VERTEX_ARRAY_LENGTH&&(s=this.outlineSegments.prepareSegment(2,this.outlineVertexArray,this.outlineIndexArray)),Xs(this.outlineVertexArray,u.x,u.y,0,0,parseInt(this.zoom)),Xs(this.outlineVertexArray,h.x,h.y,0,0,parseInt(this.zoom));var p=s.vertexLength;this.outlineIndexArray.emplaceBack(p,p+1),s.vertexLength+=2,s.primitiveLength+=1}}this.outlineProgramConfigurations.populatePaintArrays(this.outlineVertexArray.length,t,r)},Fi("FillExtrusionBucket",Ys,{omit:["layers","features"]});var Hs={paint:new qn({"fill-extrusion-opacity":new Bn(Pt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Nn(Pt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Bn(Pt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Bn(Pt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Vn(Pt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Nn(Pt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Nn(Pt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Bn(Pt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-outline-width":new Bn(Pt["paint_fill-extrusion"]["fill-extrusion-outline-width"]),"fill-extrusion-outline-color":new Nn(Pt["paint_fill-extrusion"]["fill-extrusion-outline-color"])})},Ks=function(t){function e(e){t.call(this,e,Hs)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Ys(t)},e.prototype.queryRadius=function(){return Sa(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s,l){var u=Ta(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),h=this.paint.get("fill-extrusion-height").evaluate(e,r),p=this.paint.get("fill-extrusion-base").evaluate(e,r),c=function(t,e){for(var r=[],n=0,o=t;n<o.length;n+=1){var a=o[n],s=[a.x,a.y,0,1];Ca(s,s,e),r.push(new i(s[0]/s[3],s[1]/s[3]))}return r}(u,l),f=function(t,e,r,n){for(var o=[],a=[],s=n[8]*e,l=n[9]*e,u=n[10]*e,h=n[11]*e,p=n[8]*r,c=n[9]*r,f=n[10]*r,d=n[11]*r,m=0,y=t;m<y.length;m+=1){for(var g=[],_=[],v=0,x=y[m];v<x.length;v+=1){var b=x[v],w=b.x,I=b.y,S=n[0]*w+n[4]*I+n[12],T=n[1]*w+n[5]*I+n[13],E=n[2]*w+n[6]*I+n[14],P=n[3]*w+n[7]*I+n[15],A=E+u,L=P+h,M=S+p,k=T+c,z=E+f,C=P+d,D=new i((S+s)/L,(T+l)/L);D.z=A/L,g.push(D);var R=new i(M/C,k/C);R.z=z/C,_.push(R)}o.push(g),a.push(_)}return[o,a]}(n,p,h,l);return function(t,e,r){var i=1/0;da(r,e)&&(i=$s(r,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];ca(r,u)&&(i=Math.min(i,$s(r,u)))}return i!==1/0&&i}(f[0],f[1],c)},e}(Gn);function Js(t,e){return t.x*e.x+t.y*e.y}function $s(t,e){if(1===t.length){for(var r,i=0,n=e[i++];!r||n.equals(r);)if(!(r=e[i++]))return 1/0;for(;i<e.length;i++){var o=e[i],a=t[0],s=r.sub(n),l=o.sub(n),u=a.sub(n),h=Js(s,s),p=Js(s,l),c=Js(l,l),f=Js(u,s),d=Js(u,l),m=h*c-p*p,y=(c*f-p*d)/m,g=(h*d-p*f)/m,_=n.z*(1-y-g)+r.z*y+o.z*g;if(isFinite(_))return _}return 1/0}for(var v=1/0,x=0,b=e;x<b.length;x+=1)v=Math.min(v,b[x].z);return v}var Qs=Wn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,tl=Wn([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,el=js.VectorTileFeature.types,rl=Math.cos(Math.PI/180*37.5),il=Math.pow(2,14)/.5,nl=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 Qn,this.layoutVertexArray2=new to,this.indexArray=new uo,this.programConfigurations=new ia(t.layers,t.zoom),this.segments=new Mo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};nl.prototype.populate=function(t,e,r){this.hasPattern=Ps("line",this.layers,e);for(var i=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,h=s.index,p=s.sourceLayerIndex,c=this.layers[0]._featureFilter.needGeometry,f=ua(l,c);if(this.layers[0]._featureFilter.filter(new Ln(this.zoom),f,r)){var d=i?i.evaluate(f,{},r):void 0,m={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:c?f.geometry:la(l),patterns:{},sortKey:d};n.push(m)}}i&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,g=n;y<g.length;y+=1){var _=g[y],v=_.geometry,x=_.index,b=_.sourceLayerIndex;if(this.hasPattern){var w=As("line",this.layers,_,this.zoom,e);this.patternFeatures.push(w)}else this.addFeature(_,v,x,r,{});e.featureIndex.insert(t[x].feature,v,x,b,this.index)}},nl.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},nl.prototype.addFeatures=function(t,e,r){for(var i=0,n=this.patternFeatures;i<n.length;i+=1){var o=n[i];this.addFeature(o,o.geometry,o.index,e,r)}},nl.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},nl.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},nl.prototype.upload=function(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,tl)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Qs),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},nl.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},nl.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}},nl.prototype.addFeature=function(t,e,r,i,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 h=0,p=e;h<p.length;h+=1)this.addLine(p[h],t,a,s,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)},nl.prototype.addLine=function(t,e,r,i,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"===el[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"===r&&(n=1.05);var h,p=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),f=void 0,d=void 0,m=void 0,y=void 0;this.e1=this.e2=-1,s&&(y=t[u].sub(h=t[l-2])._unit()._perp());for(var g=u;g<l;g++)if(!(d=g===l-1?s?t[u+1]:void 0:t[g+1])||!t[g].equals(d)){y&&(m=y),h&&(f=h),h=t[g],y=d?d.sub(h)._unit()._perp():m;var _=(m=m||y).add(y);0===_.x&&0===_.y||_._unit();var v=m.x*y.x+m.y*y.y,x=_.x*y.x+_.y*y.y,b=0!==x?1/x:1/0,w=2*Math.sqrt(2-2*x),I=x<rl&&f&&d,S=m.x*y.y-m.y*y.x>0;if(I&&g>u){var T=h.dist(f);if(T>2*p){var E=h.sub(h.sub(f)._mult(p/T)._round());this.updateDistance(f,E),this.addCurrentVertex(E,m,0,0,c),f=E}}var P=f&&d,A=P?r:s?"butt":i;if(P&&"round"===A&&(b<o?A="miter":b<=2&&(A="fakeround")),"miter"===A&&b>n&&(A="bevel"),"bevel"===A&&(b>2&&(A="flipbevel"),b<n&&(A="miter")),f&&this.updateDistance(f,h),"miter"===A)_._mult(b),this.addCurrentVertex(h,_,0,0,c);else if("flipbevel"===A){if(b>100)_=y.mult(-1);else{var L=b*m.add(y).mag()/m.sub(y).mag();_._perp()._mult(L*(S?-1:1))}this.addCurrentVertex(h,_,0,0,c),this.addCurrentVertex(h,_.mult(-1),0,0,c)}else if("bevel"===A||"fakeround"===A){var M=-Math.sqrt(b*b-1),k=S?M:0,z=S?0:M;if(f&&this.addCurrentVertex(h,m,k,z,c),"fakeround"===A)for(var C=Math.round(180*w/Math.PI/20),D=1;D<C;D++){var R=D/C;if(.5!==R){var F=R-.5;R+=R*F*(R-1)*((1.0904+v*(v*(3.55645-1.43519*v)-3.2452))*F*F+(.848013+v*(.215638*v-1.06021)))}var O=y.sub(m)._mult(R)._add(m)._unit()._mult(S?-1:1);this.addHalfVertex(h,O.x,O.y,!1,S,0,c)}d&&this.addCurrentVertex(h,y,-k,-z,c)}else if("butt"===A)this.addCurrentVertex(h,_,0,0,c);else if("square"===A){var B=f?1:-1;this.addCurrentVertex(h,_,B,B,c)}else"round"===A&&(f&&(this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m,1,1,c,!0)),d&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(I&&g<l-1){var N=h.dist(d);if(N>2*p){var V=h.add(d.sub(h)._mult(p/N)._round());this.updateDistance(h,V),this.addCurrentVertex(V,y,0,0,c),h=V}}}}},nl.prototype.addCurrentVertex=function(t,e,r,i,n,o){void 0===o&&(o=!1);var a=e.y*i-e.x,s=-e.y-e.x*i;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,o,!1,r,n),this.addHalfVertex(t,a,s,o,!0,-i,n),this.distance>il/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,i,n,o))},nl.prototype.addHalfVertex=function(t,e,r,i,n,o,a){var s=.5*(this.lineClips?this.scaledDistance*(il-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(i?1:0),(t.y<<1)+(n?1:0),Math.round(63*e)+128,Math.round(63*r)+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},nl.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},nl.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Fi("LineBucket",nl,{omit:["layers","patternFeatures"]});var ol=new qn({"line-cap":new Bn(Pt.layout_line["line-cap"]),"line-join":new Nn(Pt.layout_line["line-join"]),"line-miter-limit":new Bn(Pt.layout_line["line-miter-limit"]),"line-round-limit":new Bn(Pt.layout_line["line-round-limit"]),"line-sort-key":new Nn(Pt.layout_line["line-sort-key"])}),al={paint:new qn({"line-opacity":new Nn(Pt.paint_line["line-opacity"]),"line-color":new Nn(Pt.paint_line["line-color"]),"line-translate":new Bn(Pt.paint_line["line-translate"]),"line-translate-anchor":new Bn(Pt.paint_line["line-translate-anchor"]),"line-width":new Nn(Pt.paint_line["line-width"]),"line-gap-width":new Nn(Pt.paint_line["line-gap-width"]),"line-offset":new Nn(Pt.paint_line["line-offset"]),"line-blur":new Nn(Pt.paint_line["line-blur"]),"line-dasharray":new Un(Pt.paint_line["line-dasharray"]),"line-pattern":new Vn(Pt.paint_line["line-pattern"]),"line-gradient":new jn(Pt.paint_line["line-gradient"])}),layout:ol},sl=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,r){return r=new Ln(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,i,n){return r=p({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,i,n)},e}(Nn))(al.paint.properties["line-width"].specification);sl.useIntegerZoom=!0;var ll=function(t){function e(e){t.call(this,e,al),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 je,this.gradientVersion=(this.gradientVersion+1)%a)},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=sl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new nl(t)},e.prototype.queryRadius=function(t){var e=t,r=ul(Ia("line-width",this,e),Ia("line-gap-width",this,e)),i=Ia("line-offset",this,e);return r/2+Math.abs(i)+Sa(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s){var l=Ta(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*ul(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),h=this.paint.get("line-offset").evaluate(e,r);return h&&(n=function(t,e){for(var r=[],n=new i(0,0),o=0;o<t.length;o++){for(var a=t[o],s=[],l=0;l<a.length;l++){var u=a[l],h=a[l+1],p=0===l?n:u.sub(a[l-1])._unit()._perp(),c=l===a.length-1?n:h.sub(u)._unit()._perp(),f=p._add(c)._unit();f._mult(1/(f.x*c.x+f.y*c.y)),s.push(f._mult(e)._add(u))}r.push(s)}return r}(n,h*s)),function(t,e,r){for(var i=0;i<e.length;i++){var n=e[i];if(t.length>=3)for(var o=0;o<n.length;o++)if(ba(t,n[o]))return!0;if(ma(t,n,r))return!0}return!1}(l,n,u)},e.prototype.isTileClipped=function(){return!0},e}(Gn);function ul(t,e){return e>0?e+2*t:t}var hl=Wn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pl=Wn([{name:"a_projected_pos",components:3,type:"Float32"}],4),cl=(Wn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Wn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),fl=(Wn([{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"}]),Wn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),dl=Wn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ml(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var i=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),An.applyArabicShaping&&(t=An.applyArabicShaping(t)),t}(t.text,e,r)})),t}Wn([{name:"triangle",components:3,type:"Uint16"}]),Wn([{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"}]),Wn([{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"}]),Wn([{type:"Float32",name:"offsetX"}]),Wn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var yl={"!":"︕","#":"＃",$:"＄","%":"％","&":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","<":"︿","=":"＝",">":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂"},gl=function(t,e,r,i,n){var o,a,s=8*n-i-1,l=(1<<s)-1,u=l>>1,h=-7,p=r?n-1:0,c=r?-1:1,f=t[e+p];for(p+=c,o=f&(1<<-h)-1,f>>=-h,h+=s;h>0;o=256*o+t[e+p],p+=c,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=i;h>0;a=256*a+t[e+p],p+=c,h-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=u}return(f?-1:1)*a*Math.pow(2,o-i)},_l=function(t,e,r,i,n,o){var a,s,l,u=8*o-n-1,h=(1<<u)-1,p=h>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,d=i?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=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+p>=1?c/l:c*Math.pow(2,1-p))*l>=2&&(a++,l/=2),a+p>=h?(s=0,a=h):a+p>=1?(s=(e*l-1)*Math.pow(2,n),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;t[r+f]=255&s,f+=d,s/=256,n-=8);for(a=a<<n|s,u+=n;u>0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*m},vl=xl;function xl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}xl.Varint=0,xl.Fixed64=1,xl.Bytes=2,xl.Fixed32=5;var bl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function wl(t){return t.type===xl.Bytes?t.readVarint()+t.pos:t.pos+1}function Il(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Sl(t,e,r){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(i);for(var n=r.pos-1;n>=t;n--)r.buf[n+i]=r.buf[n]}function Tl(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function El(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Pl(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Al(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Ll(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Ml(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function kl(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function zl(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Cl(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Dl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Rl(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Fl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Ol(t,e,r){1===t&&r.readMessage(Bl,e)}function Bl(t,e,r){if(3===t){var i=r.readMessage(Nl,{}),n=i.width,o=i.height,a=i.left,s=i.top,l=i.advance;e.push({id:i.id,bitmap:new Va({width:n+6,height:o+6},i.bitmap),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function Nl(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function Vl(t){for(var e=0,r=0,i=0,n=t;i<n.length;i+=1){var o=n[i];e+=o.w*o.h,r=Math.max(r,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)),r),h:1/0}],s=0,l=0,u=0,h=t;u<h.length;u+=1)for(var p=h[u],c=a.length-1;c>=0;c--){var f=a[c];if(!(p.w>f.w||p.h>f.h)){if(p.x=f.x,p.y=f.y,l=Math.max(l,p.y+p.h),s=Math.max(s,p.x+p.w),p.w===f.w&&p.h===f.h){var d=a.pop();c<a.length&&(a[c]=d)}else p.h===f.h?(f.x+=p.w,f.w-=p.w):p.w===f.w?(f.y+=p.h,f.h-=p.h):(a.push({x:f.x+p.w,y:f.y,w:f.w-p.w,h:p.h}),f.y+=p.h,f.h-=p.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}xl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),n=i>>3,o=this.pos;this.type=7&i,t(n,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Dl(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=Dl(this.buf,this.pos)+4294967296*Dl(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Dl(this.buf,this.pos)+4294967296*Fl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=gl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=gl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,i=this.buf;return e=127&(r=i[this.pos++]),r<128?e:(e|=(127&(r=i[this.pos++]))<<7,r<128?e:(e|=(127&(r=i[this.pos++]))<<14,r<128?e:(e|=(127&(r=i[this.pos++]))<<21,r<128?e:function(t,e,r){var i,n,o=r.buf;if(i=(112&(n=o[r.pos++]))>>4,n<128)return Il(t,i,e);if(i|=(127&(n=o[r.pos++]))<<3,n<128)return Il(t,i,e);if(i|=(127&(n=o[r.pos++]))<<10,n<128)return Il(t,i,e);if(i|=(127&(n=o[r.pos++]))<<17,n<128)return Il(t,i,e);if(i|=(127&(n=o[r.pos++]))<<24,n<128)return Il(t,i,e);if(i|=(1&(n=o[r.pos++]))<<31,n<128)return Il(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=i[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=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&bl?function(t,e,r){return bl.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var i="",n=e;n<r;){var o,a,s,l=t[n],u=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>r)break;1===h?l<128&&(u=l):2===h?128==(192&(o=t[n+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===h?(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===h&&(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,h=1):u>65535&&(u-=65536,i+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),i+=String.fromCharCode(u),n+=h}return i}(this.buf,e,t)},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!==xl.Bytes)return t.push(this.readVarint(e));var r=wl(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==xl.Bytes)return t.push(this.readSVarint());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==xl.Bytes)return t.push(this.readBoolean());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==xl.Bytes)return t.push(this.readFloat());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==xl.Bytes)return t.push(this.readDouble());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==xl.Bytes)return t.push(this.readFixed32());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==xl.Bytes)return t.push(this.readSFixed32());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==xl.Bytes)return t.push(this.readFixed64());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==xl.Bytes)return t.push(this.readSFixed64());var e=wl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===xl.Varint)for(;this.buf[this.pos++]>127;);else if(e===xl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===xl.Fixed32)this.pos+=4;else{if(e!==xl.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 r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(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 r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((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)))))}(i,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,r){for(var i,n,o=0;o<e.length;o++){if((i=e.charCodeAt(o))>55295&&i<57344){if(!n){i>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):n=i;continue}if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(t[r++]=239,t[r++]=191,t[r++]=189,n=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=63&i|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Sl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),_l(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),_l(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 r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var i=this.pos-r;i>=128&&Sl(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,r){this.writeTag(t,xl.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Tl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,El,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Ll,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Pl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Al,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Ml,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,kl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,zl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Cl,e)},writeBytesField:function(t,e){this.writeTag(t,xl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,xl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,xl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,xl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,xl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,xl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,xl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,xl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,xl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,xl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ul=function(t,e){var r=e.pixelRatio,i=e.version,n=e.stretchX,o=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=n,this.stretchY=o,this.content=a,this.version=i},jl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};jl.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},jl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},jl.tlbr.get=function(){return this.tl.concat(this.br)},jl.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Ul.prototype,jl);var ql=function(t,e){var r={},i={};this.haveRenderCallbacks=[];var n=[];this.addImages(t,r,n),this.addImages(e,i,n);var o=Vl(n),a=new Ua({width:o.w||1,height:o.h||1});for(var s in t){var l=t[s],u=r[s].paddedRect;Ua.copy(l.data,a,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(var h in e){var p=e[h],c=i[h].paddedRect,f=c.x+1,d=c.y+1,m=p.data.width,y=p.data.height;Ua.copy(p.data,a,{x:0,y:0},{x:f,y:d},p.data),Ua.copy(p.data,a,{x:0,y:y-1},{x:f,y:d-1},{width:m,height:1}),Ua.copy(p.data,a,{x:0,y:0},{x:f,y:d+y},{width:m,height:1}),Ua.copy(p.data,a,{x:m-1,y:0},{x:f-1,y:d},{width:1,height:y}),Ua.copy(p.data,a,{x:0,y:0},{x:f+m,y:d},{width:1,height:y})}this.image=a,this.iconPositions=r,this.patternPositions=i};ql.prototype.addImages=function(t,e,r){for(var i in t){var n=t[i],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(o),e[i]=new Ul(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}},ql.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},ql.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var i=t.tl;r.update(e.data,void 0,{x:i[0],y:i[1]})}},Fi("ImagePosition",Ul),Fi("ImageAtlas",ql);var Gl={horizontal:1,vertical:2,horizontalOnly:3},Zl=function(){this.scale=1,this.fontStack="",this.imageName=null};Zl.forText=function(t,e){var r=new Zl;return r.scale=t||1,r.fontStack=e,r},Zl.forImage=function(t){var e=new Zl;return e.imageName=t,e};var Xl=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Yl(t,e,r,i,n,o,a,s,l,u,h,p,c,f,d,m){var y,g=Xl.fromFeature(t,n);p===Gl.vertical&&g.verticalizePunctuation();var _=An.processBidirectionalText,v=An.processStyledBidirectionalText;if(_&&1===g.sections.length){y=[];for(var x=0,b=_(g.toString(),tu(g,u,o,e,i,f,d));x<b.length;x+=1){var w=b[x],I=new Xl;I.text=w,I.sections=g.sections;for(var S=0;S<w.length;S++)I.sectionIndex.push(0);y.push(I)}}else if(v){y=[];for(var T=0,E=v(g.text,g.sectionIndex,tu(g,u,o,e,i,f,d));T<E.length;T+=1){var P=E[T],A=new Xl;A.text=P[0],A.sectionIndex=P[1],A.sections=g.sections,y.push(A)}}else y=function(t,e){for(var r=[],i=t.text,n=0,o=0,a=e;o<a.length;o+=1){var s=a[o];r.push(t.substring(n,s)),n=s}return n<i.length&&r.push(t.substring(n,i.length)),r}(g,tu(g,u,o,e,i,f,d));var L=[],M={positionedLines:L,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,e,r,i,n,o,a,s,l,u,h,p){for(var c=0,f=-17,d=0,m=0,y="right"===s?1:"left"===s?0:.5,g=0,_=0,v=n;_<v.length;_+=1){var x=v[_];x.trim();var b=x.getMaxScale(),w=24*(b-1),I={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=I;var S=I.positionedGlyphs,T=0;if(x.length()){for(var E=0;E<x.length();E++){var P=x.getSection(E),A=x.getSectionIndex(E),L=x.getCharCode(E),M=0,k=null,z=null,C=null,D=24,R=!(l===Gl.horizontal||!h&&!gn(L)||h&&(Wl[L]||(G=L,qi(G)||Gi(G)||Zi(G)||hn(G)||dn(G))));if(P.imageName){var F=i[P.imageName];if(!F)continue;C=P.imageName,t.iconsInText=t.iconsInText||!0,z=F.paddedRect;var O=F.displaySize;P.scale=24*P.scale/p,M=w+(24-O[1]*P.scale),D=(k={width:O[0],height:O[1],left:1,top:-3,advance:R?O[1]:O[0]}).advance;var B=R?O[0]*P.scale-24*b:O[1]*P.scale-24*b;B>0&&B>T&&(T=B)}else{var N=r[P.fontStack],V=N&&N[L];if(V&&V.rect)z=V.rect,k=V.metrics;else{var U=e[P.fontStack],j=U&&U[L];if(!j)continue;k=j.metrics}M=24*(b-P.scale)}R?(t.verticalizable=!0,S.push({glyph:L,imageName:C,x:c,y:f+M,vertical:R,scale:P.scale,fontStack:P.fontStack,sectionIndex:A,metrics:k,rect:z}),c+=D*P.scale+u):(S.push({glyph:L,imageName:C,x:c,y:f+M,vertical:R,scale:P.scale,fontStack:P.fontStack,sectionIndex:A,metrics:k,rect:z}),c+=k.advance*P.scale+u)}0!==S.length&&(d=Math.max(c-u,d),ru(S,0,S.length-1,y,T)),c=0;var q=o*b+T;I.lineOffset=Math.max(T,w),f+=q,m=Math.max(q,m),++g}else f+=o,++g}var G,Z=f- -17,X=eu(a),Y=X.horizontalAlign,W=X.verticalAlign;(function(t,e,r,i,n,o,a,s,l){var u,h=(e-r)*n;u=o!==a?-s*i- -17:(-i*l+.5)*a;for(var p=0,c=t;p<c.length;p+=1)for(var f=0,d=c[p].positionedGlyphs;f<d.length;f+=1){var m=d[f];m.x+=h,m.y+=u}})(t.positionedLines,y,Y,W,d,m,o,Z,n.length),t.top+=-W*Z,t.bottom=t.top+Z,t.left+=-Y*d,t.right=t.left+d}(M,e,r,i,y,a,s,l,p,u,c,m),!function(t){for(var e=0,r=t;e<r.length;e+=1)if(0!==r[e].positionedGlyphs.length)return!1;return!0}(L)&&M}Xl.fromFeature=function(t,e){for(var r=new Xl,i=0;i<t.sections.length;i++){var n=t.sections[i];n.image?r.addImageSection(n):r.addTextSection(n,e)}return r},Xl.prototype.length=function(){return this.text.length},Xl.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},Xl.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},Xl.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},Xl.prototype.verticalizePunctuation=function(){this.text=function(t){for(var e="",r=0;r<t.length;r++){var i=t.charCodeAt(r+1)||null,n=t.charCodeAt(r-1)||null;e+=i&&_n(i)&&!yl[t[r+1]]||n&&_n(n)&&!yl[t[r-1]]||!yl[t[r]]?t[r]:yl[t[r]]}return e}(this.text)},Xl.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&Wl[this.text.charCodeAt(e)];e++)t++;for(var r=this.text.length,i=this.text.length-1;i>=0&&i>=t&&Wl[this.text.charCodeAt(i)];i--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},Xl.prototype.substring=function(t,e){var r=new Xl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},Xl.prototype.toString=function(){return this.text},Xl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},Xl.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Zl.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,i=0;i<t.text.length;++i)this.sectionIndex.push(r)},Xl.prototype.addImageSection=function(t){var e=t.image?t.image.name:"";if(0!==e.length){var r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(Zl.forImage(e)),this.sectionIndex.push(this.sections.length-1)):w("Reached maximum number of images 6401")}else w("Can't add FormattedSection with an empty image.")},Xl.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Wl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Hl={};function Kl(t,e,r,i,n,o){if(e.imageName){var a=i[e.imageName];return a?a.displaySize[0]*e.scale*24/o+n:0}var s=r[e.fontStack],l=s&&s[t];return l?l.metrics.advance*e.scale+n:0}function Jl(t,e,r,i){var n=Math.pow(t-e,2);return i?t<e?n/2:2*n:n+Math.abs(r)*r}function $l(t,e,r){var i=0;return 10===t&&(i-=1e4),r&&(i+=150),40!==t&&65288!==t||(i+=50),41!==e&&65289!==e||(i+=50),i}function Ql(t,e,r,i,n,o){for(var a=null,s=Jl(e,r,n,o),l=0,u=i;l<u.length;l+=1){var h=u[l],p=Jl(e-h.x,r,n,o)+h.badness;p<=s&&(a=h,s=p)}return{index:t,x:e,priorBreak:a,badness:s}}function tu(t,e,r,i,n,o,a){if("point"!==o)return[];if(!t)return[];for(var s,l=[],u=function(t,e,r,i,n,o){for(var a=0,s=0;s<t.length();s++){var l=t.getSection(s);a+=Kl(t.getCharCode(s),l,i,n,e,o)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,i,n,a),h=t.text.indexOf("​")>=0,p=0,c=0;c<t.length();c++){var f=t.getSection(c),d=t.getCharCode(c);if(Wl[d]||(p+=Kl(d,f,i,n,e,a)),c<t.length()-1){var m=!((s=d)<11904||!(Qi(s)||$i(s)||cn(s)||un(s)||nn(s)||Xi(s)||tn(s)||Hi(s)||on(s)||an(s)||rn(s)||mn(s)||Ki(s)||Wi(s)||Yi(s)||en(s)||Ji(s)||pn(s)||ln(s)||sn(s)));(Hl[d]||m||f.imageName)&&l.push(Ql(c+1,p,u,l,$l(d,t.getCharCode(c+1),m&&h),!1))}}return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Ql(t.length(),p,u,l,0,!0))}function eu(t){var e=.5,r=.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":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function ru(t,e,r,i,n){if(i||n)for(var o=t[r],a=(t[r].x+o.metrics.advance*o.scale)*i,s=e;s<=r;s++)t[s].x-=a,t[s].y+=n}function iu(t,e,r,i,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 h,p,c,f,d=e.left*o,m=e.right*o;"width"===r||"both"===r?(f=n[0]+d-i[3],p=n[0]+m+i[1]):p=(f=n[0]+(d+m-s.displaySize[0])/2)+s.displaySize[0];var y=e.top*o,g=e.bottom*o;return"height"===r||"both"===r?(h=n[1]+y-i[0],c=n[1]+g+i[2]):c=(h=n[1]+(y+g-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:h,right:p,bottom:c,left:f,collisionPadding:a}}Hl[10]=!0,Hl[32]=!0,Hl[38]=!0,Hl[40]=!0,Hl[41]=!0,Hl[43]=!0,Hl[45]=!0,Hl[47]=!0,Hl[173]=!0,Hl[183]=!0,Hl[8203]=!0,Hl[8208]=!0,Hl[8211]=!0,Hl[8231]=!0;var nu=function(t){function e(e,r,i,n){t.call(this,e,r),this.angle=i,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}(i);function ou(t,e){var r=e.expression;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Ln(t+1))};if("source"===r.kind)return{kind:"source"};for(var i=r.zoomStops,n=r.interpolationType,o=0;o<i.length&&i[o]<=t;)o++;for(var a=o=Math.max(0,o-1);a<i.length&&i[a]<t+1;)a++;a=Math.min(i.length-1,a);var s=i[o],l=i[a];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n}:{kind:"camera",minZoom:s,maxZoom:l,minSize:r.evaluate(new Ln(s)),maxSize:r.evaluate(new Ln(l)),interpolationType:n}}function au(t,e,r){var i=e.uSize,n=r.lowerSize;return"source"===t.kind?n/128:"composite"===t.kind?qe(n/128,r.upperSize/128,e.uSizeT):i}function su(t,e){var r=0,i=0;if("constant"===t.kind)i=t.layoutSize;else if("source"!==t.kind){var n=t.interpolationType,o=n?u(nr.interpolationFactor(n,e,t.minZoom,t.maxZoom),0,1):0;"camera"===t.kind?i=qe(t.minSize,t.maxSize,o):r=o}return{uSizeT:r,uSize:i}}Fi("Anchor",nu);var lu=Object.freeze({__proto__:null,getSizeData:ou,evaluateSizeForFeature:au,evaluateSizeForZoom:su,SIZE_PACK_FACTOR:128});function uu(t,e,r,i,n){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-r/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<r/2;){var h=t[a],p=t[a+1];if(!p)return!1;var c=t[a-1].angleTo(h)-h.angleTo(p);for(c=Math.abs((c+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:c}),u+=c;s-l[0].distance>i;)u-=l.shift().angleDelta;if(u>n)return!1;a++,s+=h.dist(p)}return!0}function hu(t){for(var e=0,r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function pu(t,e,r){return t?.6*e*r:0}function cu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function fu(t,e,r,i,n,o){for(var a=pu(r,n,o),s=cu(r,i)*o,l=0,u=hu(t)/2,h=0;h<t.length-1;h++){var p=t[h],c=t[h+1],f=p.dist(c);if(l+f>u){var d=(u-l)/f,m=qe(p.x,c.x,d),y=qe(p.y,c.y,d),g=new nu(m,y,c.angleTo(p),h);return g._round(),!a||uu(t,g,s,a,e)?g:void 0}l+=f}}function du(t,e,r,i,n,o,a,s,l){var u=pu(i,o,a),h=cu(i,n),p=h*a,c=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-p<e/4&&(e=p+e/4),function t(e,r,i,n,o,a,s,l,u){for(var h=a/2,p=hu(e),c=0,f=r-i,d=[],m=0;m<e.length-1;m++){for(var y=e[m],g=e[m+1],_=y.dist(g),v=g.angleTo(y);f+i<c+_;){var x=((f+=i)-c)/_,b=qe(y.x,g.x,x),w=qe(y.y,g.y,x);if(b>=0&&b<u&&w>=0&&w<u&&f-h>=0&&f+h<=p){var I=new nu(b,w,v,m);I._round(),n&&!uu(e,I,a,n,o)||d.push(I)}}c+=_}return l||d.length||s||(d=t(e,c/2,i,n,o,a,s,!0,u)),d}(t,c?e/2*s%e:(h/2+2*o)*a*s%e,e,u,r,p,c,!1,l)}function mu(t,e,r,n,o){for(var a=[],s=0;s<t.length;s++)for(var l=t[s],u=void 0,h=0;h<l.length-1;h++){var p=l[h],c=l[h+1];p.x<e&&c.x<e||(p.x<e?p=new i(e,p.y+(e-p.x)/(c.x-p.x)*(c.y-p.y))._round():c.x<e&&(c=new i(e,p.y+(e-p.x)/(c.x-p.x)*(c.y-p.y))._round()),p.y<r&&c.y<r||(p.y<r?p=new i(p.x+(r-p.y)/(c.y-p.y)*(c.x-p.x),r)._round():c.y<r&&(c=new i(p.x+(r-p.y)/(c.y-p.y)*(c.x-p.x),r)._round()),p.x>=n&&c.x>=n||(p.x>=n?p=new i(n,p.y+(n-p.x)/(c.x-p.x)*(c.y-p.y))._round():c.x>=n&&(c=new i(n,p.y+(n-p.x)/(c.x-p.x)*(c.y-p.y))._round()),p.y>=o&&c.y>=o||(p.y>=o?p=new i(p.x+(o-p.y)/(c.y-p.y)*(c.x-p.x),o)._round():c.y>=o&&(c=new i(p.x+(o-p.y)/(c.y-p.y)*(c.x-p.x),o)._round()),u&&p.equals(u[u.length-1])||a.push(u=[p]),u.push(c)))))}return a}function yu(t,e,r,n){var o=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,u=a.paddedRect.h-2,h=t.right-t.left,p=t.bottom-t.top,c=a.stretchX||[[0,l]],f=a.stretchY||[[0,u]],d=function(t,e){return t+e[1]-e[0]},m=c.reduce(d,0),y=f.reduce(d,0),g=l-m,_=u-y,v=0,x=m,b=0,w=y,I=0,S=g,T=0,E=_;if(a.content&&n){var P=a.content;v=gu(c,0,P[0]),b=gu(f,0,P[1]),x=gu(c,P[0],P[2]),w=gu(f,P[1],P[3]),I=P[0]-v,T=P[1]-b,S=P[2]-P[0]-x,E=P[3]-P[1]-w}var A=function(n,o,l,u){var c=vu(n.stretch-v,x,h,t.left),f=xu(n.fixed-I,S,n.stretch,m),d=vu(o.stretch-b,w,p,t.top),g=xu(o.fixed-T,E,o.stretch,y),_=vu(l.stretch-v,x,h,t.left),P=xu(l.fixed-I,S,l.stretch,m),A=vu(u.stretch-b,w,p,t.top),L=xu(u.fixed-T,E,u.stretch,y),M=new i(c,d),k=new i(_,d),z=new i(_,A),C=new i(c,A),D=new i(f/s,g/s),R=new i(P/s,L/s),F=e*Math.PI/180;if(F){var O=Math.sin(F),B=Math.cos(F),N=[B,-O,O,B];M._matMult(N),k._matMult(N),C._matMult(N),z._matMult(N)}var V=n.stretch+n.fixed,U=o.stretch+o.fixed;return{tl:M,tr:k,bl:C,br:z,tex:{x:a.paddedRect.x+1+V,y:a.paddedRect.y+1+U,w:l.stretch+l.fixed-V,h:u.stretch+u.fixed-U},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:S/s/h,minFontScaleY:E/s/p,isSDF:r}};if(n&&(a.stretchX||a.stretchY))for(var L=_u(c,g,m),M=_u(f,_,y),k=0;k<L.length-1;k++)for(var z=L[k],C=L[k+1],D=0;D<M.length-1;D++)o.push(A(z,M[D],C,M[D+1]));else o.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return o}function gu(t,e,r){for(var i=0,n=0,o=t;n<o.length;n+=1){var a=o[n];i+=Math.max(e,Math.min(r,a[1]))-Math.max(e,Math.min(r,a[0]))}return i}function _u(t,e,r){for(var i=[{fixed:-1,stretch:0}],n=0,o=t;n<o.length;n+=1){var a=o[n],s=a[0],l=a[1],u=i[i.length-1];i.push({fixed:s-u.stretch,stretch:u.stretch}),i.push({fixed:s-u.stretch,stretch:u.stretch+(l-s)})}return i.push({fixed:e+1,stretch:r}),i}function vu(t,e,r,i){return t/e*r+i}function xu(t,e,r,i){return t-e*r/i}var bu=function(t,e,r,n,o,a,s,l,u,h){if(this.boxStartIndex=t.length,u){var p=a.top,c=a.bottom,f=a.collisionPadding;f&&(p-=f[1],c+=f[3]);var d=c-p;d>0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var m=a.top*s-l,y=a.bottom*s+l,g=a.left*s-l,_=a.right*s+l,v=a.collisionPadding;if(v&&(g-=v[0]*s,m-=v[1]*s,_+=v[2]*s,y+=v[3]*s),h){var x=new i(g,m),b=new i(_,m),w=new i(g,y),I=new i(_,y),S=h*Math.PI/180;x._rotate(S),b._rotate(S),w._rotate(S),I._rotate(S),g=Math.min(x.x,b.x,w.x,I.x),_=Math.max(x.x,b.x,w.x,I.x),m=Math.min(x.y,b.y,w.y,I.y),y=Math.max(x.y,b.y,w.y,I.y)}t.emplaceBack(e.x,e.y,g,m,_,y,r,n,o)}this.boxEndIndex=t.length},wu=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=Iu),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function Iu(t,e){return t<e?-1:t>e?1:0}function Su(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,o=1/0,a=-1/0,s=-1/0,l=t[0],u=0;u<l.length;u++){var h=l[u];(!u||h.x<n)&&(n=h.x),(!u||h.y<o)&&(o=h.y),(!u||h.x>a)&&(a=h.x),(!u||h.y>s)&&(s=h.y)}var p=Math.min(a-n,s-o),c=p/2,f=new wu([],Tu);if(0===p)return new i(n,o);for(var d=n;d<a;d+=p)for(var m=o;m<s;m+=p)f.push(new Eu(d+c,m+c,c,t));for(var y=function(t){for(var e=0,r=0,i=0,n=t[0],o=0,a=n.length,s=a-1;o<a;s=o++){var l=n[o],u=n[s],h=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*h,i+=(l.y+u.y)*h,e+=3*h}return new Eu(r/e,i/e,0,t)}(t),g=f.length;f.length;){var _=f.pop();(_.d>y.d||!y.d)&&(y=_,r&&console.log("found best %d after %d probes",Math.round(1e4*_.d)/1e4,g)),_.max-y.d<=e||(f.push(new Eu(_.p.x-(c=_.h/2),_.p.y-c,c,t)),f.push(new Eu(_.p.x+c,_.p.y-c,c,t)),f.push(new Eu(_.p.x-c,_.p.y+c,c,t)),f.push(new Eu(_.p.x+c,_.p.y+c,c,t)),g+=4)}return r&&(console.log("num probes: "+g),console.log("best distance: "+y.d)),y.p}function Tu(t,e){return e.max-t.max}function Eu(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,i=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],h=o[l];u.y>t.y!=h.y>t.y&&t.x<(h.x-u.x)*(t.y-u.y)/(h.y-u.y)+u.x&&(r=!r),i=Math.min(i,va(t,u,h))}return(r?1:-1)*Math.sqrt(i)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}wu.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},wu.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}},wu.prototype.peek=function(){return this.data[0]},wu.prototype._up=function(t){for(var e=this.data,r=this.compare,i=e[t];t>0;){var n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i},wu.prototype._down=function(t){for(var e=this.data,r=this.compare,i=this.length>>1,n=e[t];t<i;){var o=1+(t<<1),a=e[o],s=o+1;if(s<this.length&&r(e[s],a)<0&&(o=s,a=e[s]),r(a,n)>=0)break;e[t]=a,t=o}e[t]=n};var Pu=Number.POSITIVE_INFINITY;function Au(t,e){return e[1]!==Pu?function(t,e,r){var i=0,n=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(t){case"top-right":case"bottom-right":case"right":i=-e;break;case"top-left":case"bottom-left":case"left":i=e}return[i,n]}(t,e[0],e[1]):function(t,e){var r=0,i=0;e<0&&(e=0);var n=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":i=n-7;break;case"bottom-right":case"bottom-left":i=7-n;break;case"bottom":i=7-e;break;case"top":i=e-7}switch(t){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=e;break;case"right":r=-e}return[r,i]}(t,e[0])}function Lu(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 Mu(t,e,r,n,o,a,s,l,u,h,p,c,f,d,m){var y=function(t,e,r,n,o,a,s,l){for(var u=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,h=[],p=0,c=e.positionedLines;p<c.length;p+=1)for(var f=c[p],d=0,m=f.positionedGlyphs;d<m.length;d+=1){var y=m[d];if(y.rect){var g=y.rect||{},_=4,v=!0,x=1,b=0,w=(o||l)&&y.vertical,I=y.metrics.advance*y.scale/2;if(l&&e.verticalizable&&(b=f.lineOffset/2-(y.imageName?-(24-y.metrics.width*y.scale)/2:24*(y.scale-1))),y.imageName){var S=s[y.imageName];v=S.sdf,_=1/(x=S.pixelRatio)}var T=o?[y.x+I,y.y]:[0,0],E=o?[0,0]:[y.x+I+r[0],y.y+r[1]-b],P=[0,0];w&&(P=E,E=[0,0]);var A=(y.metrics.left-_)*y.scale-I+E[0],L=(-y.metrics.top-_)*y.scale+E[1],M=A+g.w*y.scale/x,k=L+g.h*y.scale/x,z=new i(A,L),C=new i(M,L),D=new i(A,k),R=new i(M,k);if(w){var F=new i(-I,I- -17),O=-Math.PI/2,B=12-I,N=new i(22-B,-(y.imageName?B:0)),V=new(Function.prototype.bind.apply(i,[null].concat(P)));z._rotateAround(O,F)._add(N)._add(V),C._rotateAround(O,F)._add(N)._add(V),D._rotateAround(O,F)._add(N)._add(V),R._rotateAround(O,F)._add(N)._add(V)}if(u){var U=Math.sin(u),j=Math.cos(u),q=[j,-U,U,j];z._matMult(q),C._matMult(q),D._matMult(q),R._matMult(q)}var G=new i(0,0),Z=new i(0,0);h.push({tl:z,tr:C,bl:D,br:R,tex:g,writingMode:e.writingMode,glyphOffset:T,sectionIndex:y.sectionIndex,isSDF:v,pixelOffsetTL:G,pixelOffsetBR:Z,minFontScaleX:0,minFontScaleY:0})}}return h}(0,r,l,o,a,s,n,t.allowVerticalPlacement),g=t.textSizeData,_=null;"source"===g.kind?(_=[128*o.layout.get("text-size").evaluate(s,{})])[0]>32640&&w(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===g.kind&&((_=[128*d.compositeTextSizes[0].evaluate(s,{},m),128*d.compositeTextSizes[1].evaluate(s,{},m)])[0]>32640||_[1]>32640)&&w(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,y,_,l,a,s,h,e,u.lineStartIndex,u.lineLength,f,m);for(var v=0,x=p;v<x.length;v+=1)c[x[v]]=t.text.placedSymbolArray.length-1;return 4*y.length}function ku(t){for(var e in t)return t[e];return null}function zu(t,e,r,i){var n=t.compareText;if(e in n){for(var o=n[e],a=o.length-1;a>=0;a--)if(i.dist(o[a])<r)return!0}else n[e]=[];return n[e].push(i),!1}var Cu=js.VectorTileFeature.types,Du=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ru(t,e,r,i,n,o,a,s,l,u,h,p,c){var f=s?Math.min(32640,Math.round(s[0])):0,d=s?Math.min(32640,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(32*i),Math.round(32*n),o,a,(f<<1)+(l?1:0),d,16*u,16*h,256*p,256*c)}function Fu(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Ou(t){for(var e=0,r=t.sections;e<r.length;e+=1)if(bn(r[e].text))return!0;return!1}var Bu=function(t){this.layoutVertexArray=new ro,this.indexArray=new uo,this.programConfigurations=t,this.segments=new Mo,this.dynamicLayoutVertexArray=new io,this.opacityVertexArray=new no,this.placedSymbolArray=new wo};Bu.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length},Bu.prototype.upload=function(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hl.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,pl.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Du,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))},Bu.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},Fi("SymbolBuffers",Bu);var Nu=function(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Mo,this.collisionVertexArray=new lo};Nu.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,cl.members,!0)},Nu.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},Fi("CollisionBuffers",Nu);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=La([]),this.placementViewportMatrix=La([]);var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ou(this.zoom,e["text-size"]),this.iconSizeData=ou(this.zoom,e["icon-size"]);var r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==i.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((function(t){return Gl[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 Bu(new ia(this.layers,this.zoom,(function(t){return/^text/.test(t)}))),this.icon=new Bu(new ia(this.layers,this.zoom,(function(t){return/^icon/.test(t)}))),this.glyphOffsetArray=new To,this.lineVertexArray=new Eo,this.symbolInstances=new So},Vu.prototype.calculateGlyphDependencies=function(t,e,r,i,n){for(var o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(r||i)&&n){var a=yl[t.charAt(o)];a&&(e[a.charCodeAt(0)]=!0)}},Vu.prototype.populate=function(t,e,r){var i=this.layers[0],n=i.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,h=n.get("symbol-sort-key");if(this.features=[],l||u){for(var p=e.iconDependencies,c=e.glyphDependencies,f=e.availableImages,d=new Ln(this.zoom),m=0,y=t;m<y.length;m+=1){var g=y[m],_=g.feature,v=g.id,x=g.index,b=g.sourceLayerIndex,w=i._featureFilter.needGeometry,I=ua(_,w);if(i._featureFilter.filter(d,I,r)){w||(I.geometry=la(_));var S=void 0;if(l){var T=i.getValueAndResolveTokens("text-field",I,r,f),E=re.factory(T);Ou(E)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Pn()||this.hasRTLText&&An.isParsed())&&(S=ml(E,i,I))}var P=void 0;if(u){var A=i.getValueAndResolveTokens("icon-image",I,r,f);P=A instanceof ie?A:ie.fromString(A)}if(S||P){var L=this.sortFeaturesByKey?h.evaluate(I,{},r):void 0;if(this.features.push({id:v,text:S,icon:P,index:x,sourceLayerIndex:b,geometry:I.geometry,properties:_.properties,type:Cu[_.type],sortKey:L}),P&&(p[P.name]=!0),S){var M=o.evaluate(I,{},r).join(","),k="map"===n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Gl.vertical)>=0;for(var z=0,C=S.sections;z<C.length;z+=1){var D=C[z];if(D.image)p[D.image.name]=!0;else{var R=yn(S.toString()),F=D.fontStack||M,O=c[F]=c[F]||{};this.calculateGlyphDependencies(D.text,O,k,this.allowVerticalPlacement,R)}}}}}}"line"===n.get("symbol-placement")&&(this.features=function(t){var e={},r={},i=[],n=0;function o(e){i.push(t[e]),n++}function a(t,e,n){var o=r[t];return delete r[t],r[e]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(n[0]),o}function s(t,r,n){var o=e[r];return delete e[r],e[t]=o,i[o].geometry[0].shift(),i[o].geometry[0]=n[0].concat(i[o].geometry[0]),o}function l(t,e,r){var i=r?e[0][e[0].length-1]:e[0][0];return t+":"+i.x+":"+i.y}for(var u=0;u<t.length;u++){var h=t[u],p=h.geometry,c=h.text?h.text.toString():null;if(c){var f=l(c,p),d=l(c,p,!0);if(f in r&&d in e&&r[f]!==e[d]){var m=s(f,d,p),y=a(f,d,i[m].geometry);delete e[f],delete r[d],r[l(c,i[y].geometry,!0)]=y,i[m].geometry=null}else f in r?a(f,d,p):d in e?s(f,d,p):(o(u),e[f]=n-1,r[d]=n-1)}else o(u)}return i.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,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))},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 r=this.lineVertexArray.length;if(void 0!==t.segment){for(var i=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:i},a<e.length-1&&(i+=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:r,lineLength:this.lineVertexArray.length-r}},Vu.prototype.addSymbols=function(t,e,r,i,n,o,a,s,l,u,h,p){for(var c=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,c,this.canOverlap?o.sortKey:void 0),m=this.glyphOffsetArray.length,y=d.vertexLength,g=this.allowVerticalPlacement&&a===Gl.vertical?Math.PI/2:0,_=o.text&&o.text.sections,v=0;v<e.length;v++){var x=e[v],b=x.tl,w=x.tr,I=x.bl,S=x.br,T=x.tex,E=x.pixelOffsetTL,P=x.pixelOffsetBR,A=x.minFontScaleX,L=x.minFontScaleY,M=x.glyphOffset,k=x.isSDF,z=x.sectionIndex,C=d.vertexLength,D=M[1];Ru(f,s.x,s.y,b.x,D+b.y,T.x,T.y,r,k,E.x,E.y,A,L),Ru(f,s.x,s.y,w.x,D+w.y,T.x+T.w,T.y,r,k,P.x,E.y,A,L),Ru(f,s.x,s.y,I.x,D+I.y,T.x,T.y+T.h,r,k,E.x,P.y,A,L),Ru(f,s.x,s.y,S.x,D+S.y,T.x+T.w,T.y+T.h,r,k,P.x,P.y,A,L),Fu(t.dynamicLayoutVertexArray,s,g),c.emplaceBack(C,C+1,C+2),c.emplaceBack(C+1,C+2,C+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(M[0]),v!==e.length-1&&z===e[v+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,o,o.index,{},p,_&&_[z])}t.placedSymbolArray.emplaceBack(s.x,s.y,m,this.glyphOffsetArray.length-m,y,l,u,s.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],a,0,!1,0,h)},Vu.prototype._addCollisionDebugVertex=function(t,e,r,i,n,o){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(o.x),Math.round(o.y))},Vu.prototype.addCollisionDebugVertices=function(t,e,r,n,o,a,s){var l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,h=o.layoutVertexArray,p=o.collisionVertexArray,c=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(h,p,a,c,f,new i(t,e)),this._addCollisionDebugVertex(h,p,a,c,f,new i(r,e)),this._addCollisionDebugVertex(h,p,a,c,f,new i(r,n)),this._addCollisionDebugVertex(h,p,a,c,f,new i(t,n)),l.vertexLength+=4;var d=o.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4},Vu.prototype.addDebugCollisionBoxes=function(t,e,r,i){for(var n=t;n<e;n++){var o=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(o.x1,o.y1,o.x2,o.y2,i?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,r)}},Vu.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Nu(ao,fl.members,yo),this.iconCollisionBox=new Nu(ao,fl.members,yo);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,r,i,n,o,a,s,l){for(var u={},h=e;h<r;h++){var p=t.get(h);u.textBox={x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,anchorPointX:p.anchorPointX,anchorPointY:p.anchorPointY},u.textFeatureIndex=p.featureIndex;break}for(var c=i;c<n;c++){var f=t.get(c);u.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},u.verticalTextFeatureIndex=f.featureIndex;break}for(var d=o;d<a;d++){var m=t.get(d);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 g=t.get(y);u.verticalIconBox={x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,anchorPointX:g.anchorPointX,anchorPointY:g.anchorPointY},u.verticalIconFeatureIndex=g.featureIndex;break}return u},Vu.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.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 r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+4*r.numGlyphs,n=r.vertexStartIndex;n<i;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),r=Math.cos(t),i=[],n=[],o=[],a=0;a<this.symbolInstances.length;++a){o.push(a);var s=this.symbolInstances.get(a);i.push(0|Math.round(e*s.anchorX+r*s.anchorY)),n.push(s.featureIndex)}return o.sort((function(t,e){return i[t]-i[e]||n[e]-n[t]})),o},Vu.prototype.addToSortKeyRanges=function(t,e){var r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.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 r=0,i=this.symbolInstanceIndexes;r<i.length;r+=1){var n=this.symbolInstances.get(i[r]);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((function(t,r,i){t>=0&&i.indexOf(t)===r&&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)}},Fi("SymbolBucket",Vu,{omit:["layers","collisionBoxArray","features","compareText"]}),Vu.MAX_GLYPHS=65535,Vu.addDynamicAttributes=Fu;var Uu=new qn({"symbol-placement":new Bn(Pt.layout_symbol["symbol-placement"]),"symbol-spacing":new Bn(Pt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Bn(Pt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Nn(Pt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Bn(Pt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Bn(Pt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Bn(Pt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Bn(Pt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Bn(Pt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Nn(Pt.layout_symbol["icon-size"]),"icon-text-fit":new Bn(Pt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Bn(Pt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Nn(Pt.layout_symbol["icon-image"]),"icon-rotate":new Nn(Pt.layout_symbol["icon-rotate"]),"icon-padding":new Bn(Pt.layout_symbol["icon-padding"]),"icon-keep-upright":new Bn(Pt.layout_symbol["icon-keep-upright"]),"icon-offset":new Nn(Pt.layout_symbol["icon-offset"]),"icon-anchor":new Nn(Pt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Bn(Pt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Bn(Pt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Bn(Pt.layout_symbol["text-rotation-alignment"]),"text-field":new Nn(Pt.layout_symbol["text-field"]),"text-font":new Nn(Pt.layout_symbol["text-font"]),"text-size":new Nn(Pt.layout_symbol["text-size"]),"text-max-width":new Nn(Pt.layout_symbol["text-max-width"]),"text-line-height":new Bn(Pt.layout_symbol["text-line-height"]),"text-letter-spacing":new Nn(Pt.layout_symbol["text-letter-spacing"]),"text-justify":new Nn(Pt.layout_symbol["text-justify"]),"text-radial-offset":new Nn(Pt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Bn(Pt.layout_symbol["text-variable-anchor"]),"text-anchor":new Nn(Pt.layout_symbol["text-anchor"]),"text-max-angle":new Bn(Pt.layout_symbol["text-max-angle"]),"text-writing-mode":new Bn(Pt.layout_symbol["text-writing-mode"]),"text-rotate":new Nn(Pt.layout_symbol["text-rotate"]),"text-padding":new Bn(Pt.layout_symbol["text-padding"]),"text-keep-upright":new Bn(Pt.layout_symbol["text-keep-upright"]),"text-transform":new Nn(Pt.layout_symbol["text-transform"]),"text-offset":new Nn(Pt.layout_symbol["text-offset"]),"text-allow-overlap":new Bn(Pt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Bn(Pt.layout_symbol["text-ignore-placement"]),"text-optional":new Bn(Pt.layout_symbol["text-optional"])}),ju={paint:new qn({"icon-opacity":new Nn(Pt.paint_symbol["icon-opacity"]),"icon-color":new Nn(Pt.paint_symbol["icon-color"]),"icon-halo-color":new Nn(Pt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Nn(Pt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Nn(Pt.paint_symbol["icon-halo-blur"]),"icon-translate":new Bn(Pt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Bn(Pt.paint_symbol["icon-translate-anchor"]),"icon-height":new Nn(Pt.paint_symbol["icon-height"]),"text-opacity":new Nn(Pt.paint_symbol["text-opacity"]),"text-color":new Nn(Pt.paint_symbol["text-color"],{runtimeType:Nt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new Nn(Pt.paint_symbol["text-halo-color"]),"text-halo-width":new Nn(Pt.paint_symbol["text-halo-width"]),"text-halo-blur":new Nn(Pt.paint_symbol["text-halo-blur"]),"text-translate":new Bn(Pt.paint_symbol["text-translate"]),"text-translate-anchor":new Bn(Pt.paint_symbol["text-translate-anchor"]),"text-height":new Nn(Pt.paint_symbol["text-height"])}),layout:Uu},qu=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Rt,this.defaultValue=t};qu.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},qu.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},qu.prototype.outputDefined=function(){return!1},qu.prototype.serialize=function(){return null},Fi("FormatSectionOverride",qu,{omit:["defaultValue"]});var Gu=function(t){function e(e){t.call(this,e,ju)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var i=this.layout.get("text-writing-mode");if(i){for(var n=[],o=0,a=i;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,r,i){var n=this.layout.get(t).evaluate(e,{},r,i),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Gr(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,(function(e,r){return r in t?String(t[r]):""}))}(e.properties,n)},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,r=ju.paint.overridableProperties;t<r.length;t+=1){var i=r[t];if(e.hasPaintOverride(this.layout,i)){var n,o=this.paint.get(i),a=new qu(o),s=new qr(a,o.property.specification);n="constant"===o.value.kind||"source"===o.value.kind?new Xr("source",s):new Yr("composite",s,o.value.zoomStops,o.value._interpolationType),this.paint._values[i]=new Fn(o.property,n,o.parameters)}}},e.prototype._handleOverridablePaintPropertyUpdate=function(t,r,i){return!(!this.layout||r.isDataDriven()||i.isDataDriven())&&e.hasPaintOverride(this.layout,t)},e.hasPaintOverride=function(t,e){var r=t.get("text-field"),i=ju.paint.properties[e],n=!1,o=function(t){for(var e=0,r=t;e<r.length;e+=1)if(i.overrides&&i.overrides.hasOverride(r[e]))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof re)o(r.value.value.sections);else if("source"===r.value.kind){var a=function(t){n||(t instanceof le&&ae(t.value)===qt?o(t.value.sections):t instanceof ce?o(t.sections):t.eachChild(a))},s=r.value;s._styleExpression&&a(s._styleExpression.expression)}return n},e}(Gn),Zu={paint:new qn({"background-color":new Bn(Pt.paint_background["background-color"]),"background-pattern":new Un(Pt.paint_background["background-pattern"]),"background-opacity":new Bn(Pt.paint_background["background-opacity"])})},Xu=function(t){function e(e){t.call(this,e,Zu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Gn),Yu={paint:new qn({"raster-opacity":new Bn(Pt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Bn(Pt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Bn(Pt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Bn(Pt.paint_raster["raster-brightness-max"]),"raster-saturation":new Bn(Pt.paint_raster["raster-saturation"]),"raster-contrast":new Bn(Pt.paint_raster["raster-contrast"]),"raster-resampling":new Bn(Pt.paint_raster["raster-resampling"]),"raster-fade-duration":new Bn(Pt.paint_raster["raster-fade-duration"])})},Wu=function(t){function e(e){t.call(this,e,Yu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Gn),Hu=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}(Gn),Ku={circle:Da,heatmap:Ga,hillshade:Xa,fill:zs,"fill-extrusion":Ks,line:ll,symbol:Gu,background:Xu,raster:Wu},Ju=o.HTMLImageElement,$u=o.HTMLCanvasElement,Qu=o.HTMLVideoElement,th=o.ImageData,eh=o.ImageBitmap,rh=function(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,i)};rh.prototype.update=function(t,e,r){var i=t.width,n=t.height,o=!(this.size&&this.size[0]===i&&this.size[1]===n||r),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=[i,n],t instanceof Ju||t instanceof $u||t instanceof Qu||t instanceof th||eh&&t instanceof eh?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,i,n,0,this.format,s.UNSIGNED_BYTE,t.data);else{var l=r||{x:0,y:0},u=l.x,h=l.y;t instanceof Ju||t instanceof $u||t instanceof Qu||t instanceof th||eh&&t instanceof eh?s.texSubImage2D(s.TEXTURE_2D,0,u,h,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,u,h,i,n,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D)},rh.prototype.bind=function(t,e,r){var i=this.context.gl;i.bindTexture(i.TEXTURE_2D,this.texture),r!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=i.LINEAR),t!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrap=e)},rh.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},rh.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var ih=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()})};ih.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))},ih.prototype.remove=function(){delete this._channel,this._callback=function(){}};var nh=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},y(["receive","process"],this),this.invoker=new ih(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=o};function oh(t,e,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[t*i-2*Math.PI*6378137/2,e*i-2*Math.PI*6378137/2]}nh.prototype.send=function(t,e,r,i,n){var o=this;void 0===n&&(n=!1);var a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[a]=r);var s=P(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:i,mustQueue:n,sourceMapId:this.mapId,data:Vi(e,s)},s),{cancel:function(){r&&delete o.callbacks[a],o.target.postMessage({id:a,type:"<cancel>",targetMapId:i,sourceMapId:o.mapId})}}},nh.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];var i=this.cancelCallbacks[r];delete this.cancelCallbacks[r],i&&i()}else e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},nh.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)}},nh.prototype.processTask=function(t,e){var r=this;if("<response>"===e.type){var i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(Ui(e.error)):i(null,Ui(e.data)))}else{var n=!1,o=P(this.globalScope)?void 0:[],a=e.hasCallback?function(e,i){n=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"<response>",sourceMapId:r.mapId,error:e?Vi(e):null,data:Vi(i,o)},o)}:function(t){n=!0},s=null,l=Ui(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)}},nh.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var ah=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]))};ah.prototype.setNorthEast=function(t){return this._ne=t instanceof sh?new sh(t.lng,t.lat):sh.convert(t),this},ah.prototype.setSouthWest=function(t){return this._sw=t instanceof sh?new sh(t.lng,t.lat):sh.convert(t),this},ah.prototype.extend=function(t){var e,r,i=this._sw,n=this._ne;if(t instanceof sh)e=t,r=t;else{if(!(t instanceof ah))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(ah.convert(t)):this.extend(sh.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return i||n?(i.lng=Math.min(e.lng,i.lng),i.lat=Math.min(e.lat,i.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new sh(e.lng,e.lat),this._ne=new sh(r.lng,r.lat)),this},ah.prototype.getCenter=function(){return new sh((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},ah.prototype.getSouthWest=function(){return this._sw},ah.prototype.getNorthEast=function(){return this._ne},ah.prototype.getNorthWest=function(){return new sh(this.getWest(),this.getNorth())},ah.prototype.getSouthEast=function(){return new sh(this.getEast(),this.getSouth())},ah.prototype.getWest=function(){return this._sw.lng},ah.prototype.getSouth=function(){return this._sw.lat},ah.prototype.getEast=function(){return this._ne.lng},ah.prototype.getNorth=function(){return this._ne.lat},ah.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},ah.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},ah.prototype.isEmpty=function(){return!(this._sw&&this._ne)},ah.prototype.contains=function(t){var e=sh.convert(t),r=e.lng,i=e.lat,n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n},ah.convert=function(t){return!t||t instanceof ah?t:new ah(t)};var sh=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")};sh.prototype.wrap=function(){return new sh(h(this.lng,-180,180),this.lat)},sh.prototype.toArray=function(){return[this.lng,this.lat]},sh.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},sh.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,i=t.lat*e,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(n,1))},sh.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new ah(new sh(this.lng-r,this.lat-e),new sh(this.lng+r,this.lat+e))},sh.convert=function(t){if(t instanceof sh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new sh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new sh(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 lh=2*Math.PI*6371008.8;function uh(t){return lh*Math.cos(t*Math.PI/180)}function hh(t){return(180+t)/360}function ph(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ch(t,e){return t/uh(e)}function fh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var dh=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};dh.fromLngLat=function(t,e){void 0===e&&(e=0);var r=sh.convert(t);return new dh(hh(r.lng),ph(r.lat),ch(e,r.lat))},dh.prototype.toLngLat=function(){return new sh(360*this.x-180,fh(this.y))},dh.prototype.toAltitude=function(){return this.z*uh(fh(this.y))},dh.prototype.meterInMercatorCoordinateUnits=function(){return 1/lh*(t=fh(this.y),1/Math.cos(t*Math.PI/180));var t};var mh=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=_h(0,t,t,e,r)};mh.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},mh.prototype.url=function(t,e){var r,i,n,o,a,s=(i=this.y,n=this.z,o=oh(256*(r=this.x),256*(i=Math.pow(2,n)-i-1),n),a=oh(256*(r+1),256*(i+1),n),o[0]+","+o[1]+","+a[0]+","+a[1]),l=function(t,e,r){for(var i,n="",o=t;o>0;o--)n+=(e&(i=1<<o-1)?1:0)+(r&i?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)},mh.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new i(8192*(t.x*e-this.x),8192*(t.y*e-this.y))},mh.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var yh=function(t,e){this.wrap=t,this.canonical=e,this.key=_h(t,e.z,e.z,e.x,e.y)},gh=function(t,e,r,i,n){this.overscaledZ=t,this.wrap=e,this.canonical=new mh(r,+i,+n),this.key=_h(e,t,r,i,n)};function _h(t,e,r,i,n){(t*=2)<0&&(t=-1*t-1);var o=1<<r;return(o*o*t+o*n+i).toString(36)+r.toString(36)+e.toString(36)}gh.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},gh.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new gh(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new gh(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},gh.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?_h(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):_h(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},gh.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},gh.prototype.children=function(t){if(this.overscaledZ>=t)return[new gh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new gh(e,this.wrap,e,r,i),new gh(e,this.wrap,e,r+1,i),new gh(e,this.wrap,e,r,i+1),new gh(e,this.wrap,e,r+1,i+1)]},gh.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))},gh.prototype.wrapped=function(){return new gh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},gh.prototype.unwrapTo=function(t){return new gh(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},gh.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},gh.prototype.toUnwrapped=function(){return new yh(this.wrap,this.canonical)},gh.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},gh.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new dh(t.x-this.wrap,t.y))},Fi("CanonicalTileID",mh),Fi("OverscaledTileID",gh,{omit:["posMatrix"]});var vh=function(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return w('"'+r+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=e.height;var i=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox";for(var n=0;n<i;n++)this.data[this._idx(-1,n)]=this.data[this._idx(0,n)],this.data[this._idx(i,n)]=this.data[this._idx(i-1,n)],this.data[this._idx(n,-1)]=this.data[this._idx(n,0)],this.data[this._idx(n,i)]=this.data[this._idx(n,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)]};vh.prototype.get=function(t,e){var r=new Uint8Array(this.data.buffer),i=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[i],r[i+1],r[i+2])},vh.prototype.getUnpackVector=function(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},vh.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)},vh.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},vh.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},vh.prototype.getPixels=function(){return new Ua({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},vh.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var i=e*this.dim,n=e*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:i=n-1;break;case 1:n=i+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,l=-r*this.dim,u=o;u<a;u++)for(var h=i;h<n;h++)this.data[this._idx(h,u)]=t.data[this._idx(h+s,u+l)]},Fi("DEMData",vh);var xh=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}};xh.prototype.encode=function(t){return this._stringToNumber[t]},xh.prototype.decode=function(t){return this._numberToString[t]};var bh=function(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=i,this.properties=t.properties,this.id=n},wh={geometry:{configurable:!0}};wh.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},wh.geometry.set=function(t){this._geometry=t},bh.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(bh.prototype,wh);var Ih=function(){this.state={},this.stateChanges={},this.deletedStates={}};Ih.prototype.updateState=function(t,e,r){var i=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][i]=this.stateChanges[t][i]||{},p(this.stateChanges[t][i],r),null===this.deletedStates[t])for(var n in this.deletedStates[t]={},this.state[t])n!==i&&(this.deletedStates[t][n]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][i])for(var o in this.deletedStates[t][i]={},this.state[t][i])r[o]||(this.deletedStates[t][i][o]=null);else for(var a in r)this.deletedStates[t]&&this.deletedStates[t][i]&&null===this.deletedStates[t][i][a]&&delete this.deletedStates[t][i][a]},Ih.prototype.removeFeatureState=function(t,e,r){if(null!==this.deletedStates[t]){var i=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e)null!==this.deletedStates[t][i]&&(this.deletedStates[t][i]=this.deletedStates[t][i]||{},this.deletedStates[t][i][r]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][i])for(r in this.deletedStates[t][i]={},this.stateChanges[t][i])this.deletedStates[t][i][r]=null;else this.deletedStates[t][i]=null;else this.deletedStates[t]=null}},Ih.prototype.getState=function(t,e){var r=String(e),i=p({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);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 i[o]}return i},Ih.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},Ih.prototype.coalesceChanges=function(t,e){var r={};for(var i in this.stateChanges){this.state[i]=this.state[i]||{};var n={};for(var o in this.stateChanges[i])this.state[i][o]||(this.state[i][o]={}),p(this.state[i][o],this.stateChanges[i][o]),n[o]=this.state[i][o];r[i]=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 h=0,c=Object.keys(this.deletedStates[a][u]);h<c.length;h+=1)delete this.state[a][u][c[h]];s[u]=this.state[a][u]}r[a]=r[a]||{},p(r[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(var f in t)t[f].setFeatureState(r,e)};var Sh=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ki(8192,16,0),this.grid3D=new ki(8192,16,0),this.featureIndexArray=new Ao,this.promoteId=e};function Th(t,e,r,i,n){return _(t,(function(t,o){var a=e instanceof On?e.get(o):null;return a&&a.evaluate?a.evaluate(r,i,n):a}))}function Eh(t){for(var e=1/0,r=1/0,i=-1/0,n=-1/0,o=0,a=t;o<a.length;o+=1){var s=a[o];e=Math.min(e,s.x),r=Math.min(r,s.y),i=Math.max(i,s.x),n=Math.max(n,s.y)}return{minX:e,minY:r,maxX:i,maxY:n}}function Ph(t,e){return e-t}Sh.prototype.insert=function(t,e,r,i,n,o){var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);for(var s=o?this.grid3D:this.grid,l=0;l<e.length;l++){for(var u=e[l],h=[1/0,1/0,-1/0,-1/0],p=0;p<u.length;p++){var c=u[p];h[0]=Math.min(h[0],c.x),h[1]=Math.min(h[1],c.y),h[2]=Math.max(h[2],c.x),h[3]=Math.max(h[3],c.y)}h[0]<8192&&h[1]<8192&&h[2]>=0&&h[3]>=0&&s.insert(a,h[0],h[1],h[2],h[3])}},Sh.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new js.VectorTile(new vl(this.rawTileData)).layers,this.sourceLayerCoder=new xh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Sh.prototype.query=function(t,e,r,n){var o=this;this.loadVTLayers();for(var a=t.params||{},s=8192/t.tileSize/t.scale,l=ni(a.filter),u=t.queryGeometry,h=t.queryPadding*s,p=Eh(u),c=this.grid.query(p.minX-h,p.minY-h,p.maxX+h,p.maxY+h),f=Eh(t.cameraQueryGeometry),d=this.grid3D.query(f.minX-h,f.minY-h,f.maxX+h,f.maxY+h,(function(e,r,n,o){return function(t,e,r,n,o){for(var a=0,s=t;a<s.length;a+=1){var l=s[a];if(e<=l.x&&r<=l.y&&n>=l.x&&o>=l.y)return!0}var u=[new i(e,r),new i(e,o),new i(n,o),new i(n,r)];if(t.length>2)for(var h=0,p=u;h<p.length;h+=1)if(ba(t,p[h]))return!0;for(var c=0;c<t.length-1;c++)if(wa(t[c],t[c+1],u))return!0;return!1}(t.cameraQueryGeometry,e-h,r-h,n+h,o+h)})),m=0,y=d;m<y.length;m+=1)c.push(y[m]);c.sort(Ph);for(var g,_={},v=function(i){var h=c[i];if(h!==g){g=h;var p=o.featureIndexArray.get(h),f=null;o.loadMatchingFeature(_,p.bucketIndex,p.sourceLayerIndex,p.featureIndex,l,a.layers,a.availableImages,e,r,n,(function(e,r,i){return f||(f=la(e)),r.queryIntersectsFeature(u,e,i,f,o.z,t.transform,s,t.pixelPosMatrix)}))}},x=0;x<c.length;x++)v(x);return _},Sh.prototype.loadMatchingFeature=function(t,e,r,i,n,o,a,s,l,u,h){var c=this.bucketLayerIDs[e];if(!o||function(t,e){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(o,c)){var f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(i);if(n.needGeometry){var m=ua(d,!0);if(!n.filter(new Ln(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!n.filter(new Ln(this.tileID.overscaledZ),d))return;for(var y=this.getId(d,f),g=0;g<c.length;g++){var _=c[g];if(!(o&&o.indexOf(_)<0)){var v=s[_];if(v){var x={};void 0!==y&&u&&(x=u.getState(v.sourceLayer||"_geojsonTileLayer",y));var b=p({},l[_]);b.paint=Th(b.paint,v.paint,d,x,a),b.layout=Th(b.layout,v.layout,d,x,a);var w=!h||h(d,v,x);if(w){var I=new bh(d,this.z,this.x,this.y,y);I.layer=b;var S=t[_];void 0===S&&(S=t[_]=[]),S.push({featureIndex:i,feature:I,intersectionZ:w})}}}}}},Sh.prototype.lookupSymbolFeatures=function(t,e,r,i,n,o,a,s){var l={};this.loadVTLayers();for(var u=ni(n),h=0,p=t;h<p.length;h+=1)this.loadMatchingFeature(l,r,i,p[h],u,o,a,s,e);return l},Sh.prototype.hasLayer=function(t){for(var e=0,r=this.bucketLayerIDs;e<r.length;e+=1)for(var i=0,n=r[e];i<n.length;i+=1)if(t===n[i])return!0;return!1},Sh.prototype.getId=function(t,e){var r=t.id;return this.promoteId&&"boolean"==typeof(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]])&&(r=Number(r)),r},Fi("FeatureIndex",Sh,{omit:["rawTileData","sourceLayerCoder"]});var Ah=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"};Ah.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<F.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},Ah.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},Ah.prototype.loadVectorData=function(t,e,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var i 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 r={};if(!e)return r;for(var i=function(){var t=o[n],i=t.layerIds.map((function(t){return e.getLayer(t)})).filter(Boolean);if(0!==i.length){t.layers=i,t.stateDependentLayerIds&&(t.stateDependentLayers=t.stateDependentLayerIds.map((function(t){return i.filter((function(e){return e.id===t}))[0]})));for(var a=0,s=i;a<s.length;a+=1)r[s[a].id]=t}},n=0,o=t;n<o.length;n+=1)i();return r}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var n=this.buckets[i];if(n instanceof Vu){if(this.hasSymbolBuckets=!0,!r)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"!==Pn()||function(){if("deferred"!==wn||!In)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");wn="loading",Tn(),In&&_t({url:In},(function(t){t?Sn(t):(wn="loaded",Tn())}))}();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 xo},Ah.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"},Ah.prototype.getBucket=function(t){return this.buckets[t.id]},Ah.prototype.upload=function(t){for(var e in this.buckets){var r=this.buckets[e];r.uploadPending()&&r.upload(t)}var i=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new rh(t,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new rh(t,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)},Ah.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},Ah.prototype.queryRenderedFeatures=function(t,e,r,i,n,o,a,s,l,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:a,queryPadding:this.queryPadding*l},t,e,r):{}},Ah.prototype.querySourceFeatures=function(t,e){var r=this.latestFeatureIndex;if(r&&r.rawTileData){var i=r.loadVTLayers(),n=e?e.sourceLayer:"",o=i._geojsonTileLayer||i[n];if(o)for(var a=ni(e&&e.filter),s=this.tileID.canonical,l=s.z,u=s.x,h=s.y,p={z:l,x:u,y:h},c=0;c<o.length;c++){var f=o.feature(c);if(a.needGeometry){var d=ua(f,!0);if(!a.filter(new Ln(this.tileID.overscaledZ),d,this.tileID.canonical))continue}else if(!a.filter(new Ln(this.tileID.overscaledZ),f))continue;var m=r.getId(f,n),y=new bh(f,l,u,h,m);y.tile=p,t.push(y)}}},Ah.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Ah.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},Ah.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=T(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var i=Date.now(),n=!1;if(this.expirationTime>i)n=!1;else if(e)if(this.expirationTime<e)n=!0;else{var o=this.expirationTime-e;o?this.expirationTime=i+Math.max(o,3e4):n=!0}else n=!0;n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},Ah.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)},Ah.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(t).length){var r=this.latestFeatureIndex.loadVTLayers();for(var i in this.buckets)if(e.style.hasLayer(i)){var n=this.buckets[i],o=n.layers[0].sourceLayer||"_geojsonTileLayer",a=r[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(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}}},Ah.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},Ah.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<F.now()},Ah.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},Ah.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=F.now()+t},Ah.prototype.setDependencies=function(t,e){for(var r={},i=0,n=e;i<n.length;i+=1)r[n[i]]=!0;this.dependencies[t]=r},Ah.prototype.hasDependency=function(t,e){for(var r=0,i=t;r<i.length;r+=1){var n=this.dependencies[i[r]];if(n)for(var o=0,a=e;o<a.length;o+=1)if(n[a[o]])return!0}return!1};var Lh=o.performance,Mh=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},Lh.mark(this._marks.start)};Mh.prototype.finish=function(){Lh.mark(this._marks.end);var t=Lh.getEntriesByName(this._marks.measure);return 0===t.length&&(Lh.measure(this._marks.measure,this._marks.start,this._marks.end),t=Lh.getEntriesByName(this._marks.measure),Lh.clearMarks(this._marks.start),Lh.clearMarks(this._marks.end),Lh.clearMeasures(this._marks.measure)),t},t.Actor=nh,t.AlphaImage=Va,t.CanonicalTileID=mh,t.CollisionBoxArray=xo,t.Color=Qt,t.DEMData=vh,t.DataConstantProperty=Bn,t.DictionaryCoder=xh,t.EXTENT=8192,t.ErrorEvent=Tt,t.EvaluationParameters=Ln,t.Event=St,t.Evented=Et,t.FeatureIndex=Sh,t.FillBucket=Ls,t.FillExtrusionBucket=Ys,t.ImageAtlas=ql,t.ImagePosition=Ul,t.LineBucket=nl,t.LngLat=sh,t.LngLatBounds=ah,t.MercatorCoordinate=dh,t.ONE_EM=24,t.OverscaledTileID=gh,t.Point=i,t.Point$1=i,t.Properties=qn,t.Protobuf=vl,t.RGBAImage=Ua,t.RequestManager=q,t.RequestPerformance=Mh,t.ResourceType=ct,t.SegmentVector=Mo,t.SourceFeatureState=Ih,t.StructArrayLayout1ui2=go,t.StructArrayLayout2f1f2i16=so,t.StructArrayLayout2i4=Kn,t.StructArrayLayout3ui6=uo,t.StructArrayLayout4i8=Jn,t.SymbolBucket=Vu,t.Texture=rh,t.Tile=Ah,t.Transitionable=zn,t.Uniform1f=qo,t.Uniform1i=jo,t.Uniform2f=Go,t.Uniform3f=Zo,t.Uniform4f=Xo,t.UniformColor=Yo,t.UniformMatrix4f=Ho,t.UnwrappedTileID=yh,t.ValidationError=At,t.WritingMode=Gl,t.ZoomHistory=ji,t.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},t.addDynamicAttributes=Fu,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var i=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==--i&&r(o,n)}))}))},t.bezier=s,t.bindAll=y,t.browser=F,t.cacheEntryPossiblyAdded=function(t){++ht>at&&(t.getActor().send("enforceCacheSizeLimit",ot),ht=0)},t.clamp=u,t.clipLine=mu,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=x,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=dl,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=Jt,t.createExpression=Zr,t.createLayout=Wn,t.createStyleLayer=function(t){return"custom"===t.type?new Hu(t):new Ku[t.type](t)},t.cross=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=n*l-o*s,t[1]=o*a-i*l,t[2]=i*s-n*a,t},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var i=0;i<e.length;i++)if(!t(e[i],r[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var n in e)if(!t(e[n],r[n]))return!1;return!0}return e===r},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=l,t.emitValidationErrors=Mi,t.endsWith=g,t.enforceCacheSizeLimit=function(t){st(),$&&$.then((function(e){e.keys().then((function(r){for(var i=0;i<r.length-t;i++)e.delete(r[i])}))}))},t.evaluateSizeForFeature=au,t.evaluateSizeForZoom=su,t.evaluateVariableOffset=Au,t.evented=En,t.extend=p,t.featureFilter=ni,t.filterObject=v,t.fromRotation=function(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=0,t[3]=-r,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.getAnchorAlignment=eu,t.getAnchorJustification=Lu,t.getArrayBuffer=_t,t.getImage=bt,t.getJSON=function(t,e){return gt(p(t,{type:"json"}),e)},t.getReferrer=yt,t.getVideo=function(t,e){var r,i,n=o.document.createElement("video");n.muted=!0,n.onloadstart=function(){e(null,n)};for(var a=0;a<t.length;a++){var s=o.document.createElement("source");r=t[a],i=void 0,(i=o.document.createElement("a")).href=r,(i.protocol!==o.document.location.protocol||i.host!==o.document.location.host)&&(n.crossOrigin="Anonymous"),s.src=t[a],n.appendChild(s)}return{cancel:function(){}}},t.identity=La,t.invert=function(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],p=e[9],c=e[10],f=e[11],d=e[12],m=e[13],y=e[14],g=e[15],_=r*s-i*a,v=r*l-n*a,x=r*u-o*a,b=i*l-n*s,w=i*u-o*s,I=n*u-o*l,S=h*m-p*d,T=h*y-c*d,E=h*g-f*d,P=p*y-c*m,A=p*g-f*m,L=c*g-f*y,M=_*L-v*A+x*P+b*E-w*T+I*S;return M?(t[0]=(s*L-l*A+u*P)*(M=1/M),t[1]=(n*A-i*L-o*P)*M,t[2]=(m*I-y*w+g*b)*M,t[3]=(c*w-p*I-f*b)*M,t[4]=(l*E-a*L-u*T)*M,t[5]=(r*L-n*E+o*T)*M,t[6]=(y*x-d*I-g*v)*M,t[7]=(h*I-c*x+f*v)*M,t[8]=(a*A-s*E+u*S)*M,t[9]=(i*E-r*A-o*S)*M,t[10]=(d*w-m*x+g*_)*M,t[11]=(p*x-h*w-f*_)*M,t[12]=(s*T-a*P-l*S)*M,t[13]=(r*P-i*T+n*S)*M,t[14]=(m*v-d*b-y*_)*M,t[15]=(h*b-p*v+c*_)*M,t):null},t.isMapboxURL=G,t.keysDifference=function(t,e){var r=[];for(var i in t)i in e||r.push(i);return r},t.makeRequest=gt,t.mapObject=_,t.mercatorXfromLng=hh,t.mercatorYfromLat=ph,t.mercatorZfromAltitude=ch,t.mul=za,t.multiply=Ma,t.mvt=js,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.normalize=function(t,e){var r=e[0],i=e[1],n=e[2],o=r*r+i*i+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=qe,t.offscreenCanvasSupported=pt,t.ortho=function(t,e,r,i,n,o,a){var s=1/(e-r),l=1/(i-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+r)*s,t[13]=(n+i)*l,t[14]=(a+o)*u,t[15]=1,t},t.parseGlyphPBF=function(t){return new vl(t).readFields(Ol,[])},t.pbf=vl,t.performSymbolLayout=function(t,e,r,i,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 h=t.textSizeData,p=h.maxZoom;u.compositeTextSizes=[l["text-size"].possiblyEvaluate(new Ln(h.minZoom),a),l["text-size"].possiblyEvaluate(new Ln(p),a)]}if("composite"===t.iconSizeData.kind){var c=t.iconSizeData,f=c.maxZoom;u.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new Ln(c.minZoom),a),l["icon-size"].possiblyEvaluate(new Ln(f),a)]}u.layoutTextSize=l["text-size"].possiblyEvaluate(new Ln(t.zoom+1),a),u.layoutIconSize=l["icon-size"].possiblyEvaluate(new Ln(t.zoom+1),a),u.textMaxSize=l["text-size"].possiblyEvaluate(new Ln(18));for(var d=24*s.get("text-line-height"),m="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),y=s.get("text-keep-upright"),g=s.get("text-size"),_=function(){var o=x[v],l=s.get("text-font").evaluate(o,{},a).join(","),h=g.evaluate(o,{},a),p=u.layoutTextSize.evaluate(o,{},a),c=u.layoutIconSize.evaluate(o,{},a),f={horizontal:{},vertical:void 0},_=o.text,b=[0,0];if(_){var I=_.toString(),S=24*s.get("text-letter-spacing").evaluate(o,{},a),T=function(t){for(var e=0,r=t;e<r.length;e+=1)if(i=r[e].charCodeAt(0),qi(i)||Gi(i)||Zi(i)||hn(i)||dn(i))return!1;var i;return!0}(I)?S:0,E=s.get("text-anchor").evaluate(o,{},a),P=s.get("text-variable-anchor");if(!P){var A=s.get("text-radial-offset").evaluate(o,{},a);b=A?Au(E,[24*A,Pu]):s.get("text-offset").evaluate(o,{},a).map((function(t){return 24*t}))}var L=m?"center":s.get("text-justify").evaluate(o,{},a),M=s.get("symbol-placement"),k="point"===M?24*s.get("text-max-width").evaluate(o,{},a):0,z=function(){t.allowVerticalPlacement&&yn(I)&&(f.vertical=Yl(_,e,r,n,l,k,d,E,"left",T,b,Gl.vertical,!0,M,p,h))};if(!m&&P){for(var C="auto"===L?P.map((function(t){return Lu(t)})):[L],D=!1,R=0;R<C.length;R++){var F=C[R];if(!f.horizontal[F])if(D)f.horizontal[F]=f.horizontal[0];else{var O=Yl(_,e,r,n,l,k,d,"center",F,T,b,Gl.horizontal,!1,M,p,h);O&&(f.horizontal[F]=O,D=1===O.positionedLines.length)}}z()}else{"auto"===L&&(L=Lu(E));var B=Yl(_,e,r,n,l,k,d,E,L,T,b,Gl.horizontal,!1,M,p,h);B&&(f.horizontal[L]=B),z(),yn(I)&&m&&y&&(f.vertical=Yl(_,e,r,n,l,k,d,E,L,T,b,Gl.vertical,!1,M,p,h))}}var N=void 0,V=!1;if(o.icon&&o.icon.name){var U=i[o.icon.name];U&&(N=function(t,e,r){var i=eu(r),n=e[0]-t.displaySize[0]*i.horizontalAlign,o=e[1]-t.displaySize[1]*i.verticalAlign;return{image:t,top:o,bottom:o+t.displaySize[1],left:n,right:n+t.displaySize[0]}}(n[o.icon.name],s.get("icon-offset").evaluate(o,{},a),s.get("icon-anchor").evaluate(o,{},a)),V=U.sdf,void 0===t.sdfIcons?t.sdfIcons=U.sdf:t.sdfIcons!==U.sdf&&w("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(U.pixelRatio!==t.pixelRatio||0!==s.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}var j=ku(f.horizontal)||f.vertical;t.iconsInText=!!j&&j.iconsInText,(j||N)&&function(t,e,r,i,n,o,a,s,l,u,h){var p=o.textMaxSize.evaluate(e,{});void 0===p&&(p=a);var c,f=t.layers[0].layout,d=f.get("icon-offset").evaluate(e,{},h),m=ku(r.horizontal),y=a/24,g=t.tilePixelRatio*y,_=t.tilePixelRatio*p/24,v=t.tilePixelRatio*s,x=t.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*t.tilePixelRatio,I=f.get("icon-padding")*t.tilePixelRatio,S=f.get("text-max-angle")/180*Math.PI,T="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),E="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),P=f.get("symbol-placement"),A=x/2,L=f.get("icon-text-fit");i&&"none"!==L&&(t.allowVerticalPlacement&&r.vertical&&(c=iu(i,r.vertical,L,f.get("icon-text-fit-padding"),d,y)),m&&(i=iu(i,m,L,f.get("icon-text-fit-padding"),d,y)));var M=function(s,p){p.x<0||p.x>=8192||p.y<0||p.y>=8192||function(t,e,r,i,n,o,a,s,l,u,h,p,c,f,d,m,y,g,_,v,x,b,I,S,T){var E,P,A,L,M,k=t.addToLineVertexArray(e,r),z=0,C=0,D=0,R=0,F=-1,O=-1,B={},N=Ro(""),V=0,U=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(V=(E=s.layout.get("text-offset").evaluate(x,{},S).map((function(t){return 24*t})))[0],U=E[1]):(V=24*s.layout.get("text-radial-offset").evaluate(x,{},S),U=Pu),t.allowVerticalPlacement&&i.vertical){var j=s.layout.get("text-rotate").evaluate(x,{},S)+90;L=new bu(l,e,u,h,p,i.vertical,c,f,d,j),a&&(M=new bu(l,e,u,h,p,a,y,g,d,j))}if(n){var q=s.layout.get("icon-rotate").evaluate(x,{}),G="none"!==s.layout.get("icon-text-fit"),Z=yu(n,q,I,G),X=a?yu(a,q,I,G):void 0;A=new bu(l,e,u,h,p,n,y,g,!1,q),z=4*Z.length;var Y=t.iconSizeData,W=null;"source"===Y.kind?(W=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&w(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===Y.kind&&((W=[128*b.compositeIconSizes[0].evaluate(x,{},S),128*b.compositeIconSizes[1].evaluate(x,{},S)])[0]>32640||W[1]>32640)&&w(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,Z,W,v,_,x,!1,e,k.lineStartIndex,k.lineLength,-1,S),F=t.icon.placedSymbolArray.length-1,X&&(C=4*X.length,t.addSymbols(t.icon,X,W,v,_,x,Gl.vertical,e,k.lineStartIndex,k.lineLength,-1,S),O=t.icon.placedSymbolArray.length-1)}for(var H in i.horizontal){var K=i.horizontal[H];if(!P){N=Ro(K.text);var J=s.layout.get("text-rotate").evaluate(x,{},S);P=new bu(l,e,u,h,p,K,c,f,d,J)}var $=1===K.positionedLines.length;if(D+=Mu(t,e,K,o,s,d,x,m,k,i.vertical?Gl.horizontal:Gl.horizontalOnly,$?Object.keys(i.horizontal):[H],B,F,b,S),$)break}i.vertical&&(R+=Mu(t,e,i.vertical,o,s,d,x,m,k,Gl.vertical,["vertical"],B,O,b,S));var Q=P?P.boxStartIndex:t.collisionBoxArray.length,tt=P?P.boxEndIndex:t.collisionBoxArray.length,et=L?L.boxStartIndex:t.collisionBoxArray.length,rt=L?L.boxEndIndex:t.collisionBoxArray.length,it=A?A.boxStartIndex:t.collisionBoxArray.length,nt=A?A.boxEndIndex:t.collisionBoxArray.length,ot=M?M.boxStartIndex:t.collisionBoxArray.length,at=M?M.boxEndIndex:t.collisionBoxArray.length,st=-1,lt=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=lt(P,st),st=lt(L,st),st=lt(A,st);var ut=(st=lt(M,st))>-1?1:0;ut&&(st*=T/24),t.glyphOffsetArray.length>=Vu.MAX_GLYPHS&&w("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,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,F,O,N,Q,tt,et,rt,it,nt,ot,at,u,D,R,z,C,ut,0,c,V,U,st)}(t,p,s,r,i,n,c,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,b,T,l,v,I,E,d,e,o,u,h,a)};if("line"===P)for(var k=0,z=mu(e.geometry,0,0,8192,8192);k<z.length;k+=1)for(var C=z[k],D=0,R=du(C,x,S,r.vertical||m,i,24,_,t.overscaling,8192);D<R.length;D+=1){var F=R[D];m&&zu(t,m.text,A,F)||M(C,F)}else if("line-center"===P)for(var O=0,B=e.geometry;O<B.length;O+=1){var N=B[O];if(N.length>1){var V=fu(N,S,r.vertical||m,i,24,_);V&&M(N,V)}}else if("Polygon"===e.type)for(var U=0,j=Ts(e.geometry,0);U<j.length;U+=1){var q=j[U],G=Su(q,16);M(q[0],new nu(G.x,G.y,0))}else if("LineString"===e.type)for(var Z=0,X=e.geometry;Z<X.length;Z+=1){var Y=X[Z];M(Y,new nu(Y[0].x,Y[0].y,0))}else if("Point"===e.type)for(var W=0,H=e.geometry;W<H.length;W+=1)for(var K=0,J=H[W];K<J.length;K+=1){var $=J[K];M([$],new nu($.x,$.y,0))}}(t,o,f,N,i,u,p,c,b,V,a)},v=0,x=t.features;v<x.length;v+=1)_();o&&t.generateCollisionDebugBuffers()},t.perspective=function(t,e,r,i,n){var o,a=1/Math.tan(e/2);return t[0]=a/r,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+i)*(o=1/(i-n)),t[14]=2*n*i*o):(t[10]=-1,t[14]=-2*i),t},t.pick=function(t,e){for(var r={},i=0;i<e.length;i++){var n=e[i];n in t&&(r[n]=t[n])}return r},t.plugin=An,t.polygonIntersectsPolygon=ca,t.postMapLoadEvent=nt,t.postTurnstileEvent=rt,t.potpack=Vl,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=Fi,t.registerForPluginStateChange=function(t){return t({pluginStatus:wn,pluginURL:In}),En.on("pluginStateChange",t),t},t.renderColorRamp=qa,t.rotate=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=i*l+o*s,t[1]=n*l+a*s,t[2]=i*-s+o*l,t[3]=n*-s+a*l,t},t.rotateX=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],h=e[9],p=e[10],c=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*i,t[5]=a*n+h*i,t[6]=s*n+p*i,t[7]=l*n+c*i,t[8]=u*n-o*i,t[9]=h*n-a*i,t[10]=p*n-s*i,t[11]=c*n-l*i,t},t.rotateZ=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],h=e[5],p=e[6],c=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*i,t[1]=a*n+h*i,t[2]=s*n+p*i,t[3]=l*n+c*i,t[4]=u*n-o*i,t[5]=h*n-a*i,t[6]=p*n-s*i,t[7]=c*n-l*i,t},t.scale=function(t,e,r){var i=r[0],n=r[1],o=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,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,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},t.scale$2=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},t.setCacheLimits=function(t,e){ot=t,at=e},t.sphericalToCartesian=function(t){var e=t[0],r=t[1],i=t[2];return r+=90,r*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(i),y:e*Math.sin(r)*Math.sin(i),z:e*Math.cos(i)}},t.sqrLen=function(t){var e=t[0],r=t[1];return e*e+r*r},t.styleSpec=Pt,t.sub=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},t.symbolSize=lu,t.transformMat3=function(t,e,r){var i=e[0],n=e[1],o=e[2];return t[0]=i*r[0]+n*r[3]+o*r[6],t[1]=i*r[1]+n*r[4]+o*r[7],t[2]=i*r[2]+n*r[5]+o*r[8],t},t.transformMat4=Ca,t.translate=function(t,e,r){var i,n,o,a,s,l,u,h,p,c,f,d,m=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*g+e[12],t[13]=e[1]*m+e[5]*y+e[9]*g+e[13],t[14]=e[2]*m+e[6]*y+e[10]*g+e[14],t[15]=e[3]*m+e[7]*y+e[11]*g+e[15]):(n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],p=e[8],c=e[9],f=e[10],d=e[11],t[0]=i=e[0],t[1]=n,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=h,t[8]=p,t[9]=c,t[10]=f,t[11]=d,t[12]=i*m+s*y+p*g+e[12],t[13]=n*m+l*y+c*g+e[13],t[14]=o*m+u*y+f*g+e[14],t[15]=a*m+h*y+d*g+e[15]),t},t.triggerPluginCompletionEvent=Sn,t.uniqueId=f,t.unwrapExports=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t},t.validateCustomStyleLayer=function(t){var e=[],r=t.id;return void 0===r&&e.push({message:"layers."+r+': missing required property "id"'}),void 0===t.render&&e.push({message:"layers."+r+': missing required method "render"'}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers."+r+': property "renderingMode" must be either "2d" or "3d"'}),e},t.validateLight=Pi,t.validateStyle=Ei,t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.vectorTile=js,t.version="2.5.0",t.warnOnce=w,t.webpSupported=B,t.window=o,t.wrap=h})),i(0,(function(t){function e(t){var r=typeof t;if("number"===r||"boolean"===r||"string"===r||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var i="[",n=0,o=t;n<o.length;n+=1)i+=e(o[n])+",";return i+"]"}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 r(r){for(var i="",n=0,o=t.refProperties;n<o.length;n+=1)i+="/"+e(r[o[n]]);return i}var i=function(t){this.keyCache={},t&&this.replace(t)};i.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},i.prototype.update=function(e,i){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,h=i;u<h.length;u+=1){var p=h[u];delete this.keyCache[p],delete this._layerConfigs[p],delete this._layers[p]}this.familiesBySource={};for(var c=0,f=function(t,e){for(var i={},n=0;n<t.length;n++){var o=e&&e[t[n].id]||r(t[n]);e&&(e[t[n].id]=o);var a=i[o];a||(a=i[o]=[]),a.push(t[n])}var s=[];for(var l in i)s.push(i[l]);return s}(t.values(this._layerConfigs),this.keyCache);c<f.length;c+=1){var d=f[c].map((function(t){return n._layers[t.id]})),m=d[0];if("none"!==m.visibility){var y=m.source||"",g=this.familiesBySource[y];g||(g=this.familiesBySource[y]={});var _=m.sourceLayer||"_geojsonTileLayer",v=g[_];v||(v=g[_]=[]),v.push(d)}}};var n=function(e){var r={},i=[];for(var n in e){var o=e[n],a=r[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};i.push(u),a[s]={rect:u,metrics:l.metrics}}}}var h=t.potpack(i),p=new t.AlphaImage({width:h.w||1,height:h.h||1});for(var c in e){var f=e[c];for(var d in f){var m=f[+d];if(m&&0!==m.bitmap.width&&0!==m.bitmap.height){var y=r[c][d].rect;t.AlphaImage.copy(m.bitmap,p,{x:0,y:0},{x:y.x+1,y:y.y+1},m.bitmap)}}}this.image=p,this.positions=r};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,r,i){for(var n=new t.EvaluationParameters(r),o=0,a=e;o<a.length;o+=1)a[o].recalculate(n,i)}function s(e,r){var i=t.getArrayBuffer(e.request,(function(e,i,n,o){e?r(e):i&&r(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(i)),rawData:i,cacheControl:n,expires:o})}));return function(){i.cancel(),r()}}o.prototype.parse=function(e,r,i,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()),h=new t.FeatureIndex(this.tileID,this.promoteId);h.bucketLayerIDs=[];var p,c,f,d,m={},y={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:i},g=r.familiesBySource[this.source];for(var _ in g){var v=e.layers[_];if(v){1===v.version&&t.warnOnce('Vector tile source "'+this.source+'" layer "'+_+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var x=u.encode(_),b=[],w=0;w<v.length;w++){var I=v.feature(w),S=h.getId(I,_);b.push({feature:I,id:S,index:w,sourceLayerIndex:x})}for(var T=0,E=g[_];T<E.length;T+=1){var P=E[T],A=P[0];A.minzoom&&this.zoom<Math.floor(A.minzoom)||A.maxzoom&&this.zoom>=A.maxzoom||"none"!==A.visibility&&(a(P,this.zoom,i),(m[A.id]=A.createBucket({index:h.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,y,this.tileID.canonical),h.bucketLayerIDs.push(P.map((function(t){return t.id}))))}}}var L=t.mapObject(y.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(L).length?o.send("getGlyphs",{uid:this.uid,stacks:L},(function(t,e){p||(p=t,c=e,z.call(l))})):c={};var M=Object.keys(y.iconDependencies);M.length?o.send("getImages",{icons:M,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){p||(p=t,f=e,z.call(l))})):f={};var k=Object.keys(y.patternDependencies);function z(){if(p)return s(p);if(c&&f&&d){var e=new n(c),r=new t.ImageAtlas(f,d);for(var o in m){var l=m[o];l instanceof t.SymbolBucket?(a(l.layers,this.zoom,i),t.performSymbolLayout(l,c,e.positions,f,r.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,i),l.addFeatures(y,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(m).filter((function(t){return!t.isEmpty()})),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?c:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}k.length?o.send("getImages",{icons:k,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){p||(p=t,d=e,z.call(l))})):d={},z.call(this)};var l=function(t,e,r,i){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=i||s,this.loading={},this.loaded={}};l.prototype.loadTile=function(e,r){var i=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 i.loading[n],e||!o)return s.status="done",i.loaded[n]=s,r(e);var l=o.rawData,u={};o.expires&&(u.expires=o.expires),o.cacheControl&&(u.cacheControl=o.cacheControl);var h={};if(a){var p=a.finish();p&&(h.resourceTiming=JSON.parse(JSON.stringify(p)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,i.layerIndex,i.availableImages,i.actor,(function(e,i){if(e||!i)return r(e);r(null,t.extend({rawTileData:l.slice(0)},i,u,h))})),i.loaded=i.loaded||{},i.loaded[n]=s}))},l.prototype.reloadTile=function(t,e){var r=this,i=this.loaded,n=t.uid,o=this;if(i&&i[n]){var a=i[n];a.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,i){var n=a.reloadCallback;n&&(delete a.reloadCallback,a.parse(a.vectorTile,o.layerIndex,r.availableImages,o.actor,n)),e(t,i)};"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 r=this.loading,i=t.uid;r&&r[i]&&r[i].abort&&(r[i].abort(),delete r[i]),e()},l.prototype.removeTile=function(t,e){var r=this.loaded,i=t.uid;r&&r[i]&&delete r[i],e()};var u=t.window.ImageBitmap,h=function(){this.loaded={}};function p(t,e){if(0!==t.length){c(t[0],e);for(var r=1;r<t.length;r++)c(t[r],!e)}}function c(t,e){for(var r=0,i=0,n=t.length,o=n-1;i<n;o=i++)r+=(t[i][0]-t[o][0])*(t[o][1]+t[i][1]);r>=0!=!!e&&t.reverse()}h.prototype.loadTile=function(e,r){var i=e.uid,n=e.encoding,o=e.rawImageData,a=u&&o instanceof u?this.getImageData(o):o,s=new t.DEMData(i,a,n);this.loaded=this.loaded||{},this.loaded[i]=s,r(null,s)},h.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 r=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:r.width,height:r.height},r.data)},h.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var f=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=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))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,i=this._feature.geometry;r<i.length;r+=1){var n=i[r];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,h=s[a];u<h.length;u+=1){var p=h[u];l.push(new t.Point$1(p[0],p[1]))}o.push(l)}return o},d.prototype.toGeoJSON=function(t,e,r){return f.call(this,t,e,r)};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 d(this._features[t])};var y=t.vectorTile.VectorTileFeature,g=_;function _(t,e){this.options=e||{},this.features=t,this.length=t.length}function v(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}_.prototype.feature=function(t){return new v(this.features[t],this.options.extent)},v.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var i=e[r],n=[],o=0;o<i.length;o++)n.push(new t.Point$1(i[o][0],i[o][1]));this.geometry.push(n)}return this.geometry},v.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,i=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),r=Math.max(r,l.x),i=Math.min(i,l.y),n=Math.max(n,l.y)}return[e,i,r,n]},v.prototype.toGeoJSON=y.prototype.toGeoJSON;var x=w,b=g;function w(e){var r=new t.pbf;return function(t,e){for(var r in t.layers)e.writeMessage(3,I,t.layers[r])}(e,r),r.finish()}function I(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var i={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)i.feature=t.feature(r),e.writeMessage(2,S,i);var n=i.keys;for(r=0;r<n.length;r++)e.writeStringField(3,n[r]);var o=i.values;for(r=0;r<o.length;r++)e.writeMessage(4,L,o[r])}function S(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,T,t),e.writeVarintField(3,r.type),e.writeMessage(4,A,r)}function T(t,e){var r=t.feature,i=t.keys,n=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=o[s];void 0===l&&(i.push(s),o[s]=l=i.length-1),e.writeVarint(l);var u=r.properties[s],h=typeof u;"string"!==h&&"boolean"!==h&&"number"!==h&&(u=JSON.stringify(u));var p=h+":"+u,c=a[p];void 0===c&&(n.push(u),a[p]=c=n.length-1),e.writeVarint(c)}}function E(t,e){return(e<<3)+(7&t)}function P(t){return t<<1^t>>31}function A(t,e){for(var r=t.loadGeometry(),i=t.type,n=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;1===i&&(u=l.length),e.writeVarint(E(1,u));for(var h=3===i?l.length-1:l.length,p=0;p<h;p++){1===p&&1!==i&&e.writeVarint(E(2,h-1));var c=l[p].x-n,f=l[p].y-o;e.writeVarint(P(c)),e.writeVarint(P(f)),n+=c,o+=f}3===i&&e.writeVarint(E(7,1))}}function L(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function M(t,e,r,i){k(t,r,i),k(e,2*r,2*i),k(e,2*r+1,2*i+1)}function k(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function z(t,e,r,i){var n=t-r,o=e-i;return n*n+o*o}x.fromVectorTileJs=w,x.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var i in t)r[i]=new g(t[i].features,e),r[i].name=i,r[i].version=e.version,r[i].extent=e.extent;return w({layers:r})},x.GeoJSONWrapper=b;var C=function(t){return t[0]},D=function(t){return t[1]},R=function(t,e,r,i,n){void 0===e&&(e=C),void 0===r&&(r=D),void 0===i&&(i=64),void 0===n&&(n=Float64Array),this.nodeSize=i,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]=r(t[l]);!function t(e,r,i,n,o,a){if(!(o-n<=i)){var s=n+o>>1;!function t(e,r,i,n,o,a){for(;o>n;){if(o-n>600){var s=o-n+1,l=i-n+1,u=Math.log(s),h=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*h*(s-h)/s)*(l-s/2<0?-1:1);t(e,r,i,Math.max(n,Math.floor(i-l*h/s+p)),Math.min(o,Math.floor(i+(s-l)*h/s+p)),a)}var c=r[2*i+a],f=n,d=o;for(M(e,r,n,i),r[2*o+a]>c&&M(e,r,n,o);f<d;){for(M(e,r,f,d),f++,d--;r[2*f+a]<c;)f++;for(;r[2*d+a]>c;)d--}r[2*n+a]===c?M(e,r,n,d):M(e,r,++d,o),d<=i&&(n=d+1),i<=d&&(o=d-1)}}(e,r,s,n,o,a%2),t(e,r,i,n,s-1,a+1),t(e,r,i,s+1,o,a+1)}}(a,s,i,0,a.length-1,0)};R.prototype.range=function(t,e,r,i){return function(t,e,r,i,n,o,a){for(var s,l,u=[0,t.length-1,0],h=[];u.length;){var p=u.pop(),c=u.pop(),f=u.pop();if(c-f<=a)for(var d=f;d<=c;d++)l=e[2*d+1],(s=e[2*d])>=r&&s<=n&&l>=i&&l<=o&&h.push(t[d]);else{var m=Math.floor((f+c)/2);l=e[2*m+1],(s=e[2*m])>=r&&s<=n&&l>=i&&l<=o&&h.push(t[m]);var y=(p+1)%2;(0===p?r<=s:i<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===p?n>=s:o>=l)&&(u.push(m+1),u.push(c),u.push(y))}}return h}(this.ids,this.coords,t,e,r,i,this.nodeSize)},R.prototype.within=function(t,e,r){return function(t,e,r,i,n,o){for(var a=[0,t.length-1,0],s=[],l=n*n;a.length;){var u=a.pop(),h=a.pop(),p=a.pop();if(h-p<=o)for(var c=p;c<=h;c++)z(e[2*c],e[2*c+1],r,i)<=l&&s.push(t[c]);else{var f=Math.floor((p+h)/2),d=e[2*f],m=e[2*f+1];z(d,m,r,i)<=l&&s.push(t[f]);var y=(u+1)%2;(0===u?r-n<=d:i-n<=m)&&(a.push(p),a.push(f-1),a.push(y)),(0===u?r+n>=d:i+n>=m)&&(a.push(f+1),a.push(h),a.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var F={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},O=function(t){this.options=G(Object.create(F),t),this.trees=new Array(this.options.maxZoom+1)};function B(t,e,r,i,n){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:i,properties:n}}function N(t,e){var r=t.geometry.coordinates,i=r[1];return{x:j(r[0]),y:q(i),zoom:1/0,index:e,parentId:-1}}function V(t){return{type:"Feature",id:t.id,properties:U(t),geometry:{type:"Point",coordinates:[(i=t.x,360*(i-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,i}function U(t){var e=t.numPoints,r=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:r})}function j(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function G(t,e){for(var r in e)t[r]=e[r];return t}function Z(t){return t.x}function X(t){return t.y}function Y(t,e,r,i,n,o){var a=n-r,s=o-i;if(0!==a||0!==s){var l=((t-r)*a+(e-i)*s)/(a*a+s*s);l>1?(r=n,i=o):l>0&&(r+=a*l,i+=s*l)}return(a=t-r)*a+(s=e-i)*s}function W(t,e,r,i){var n={id:void 0===t?null:t,type:e,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)H(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var i=0;i<e.length;i++)H(t,e[i]);else if("MultiPolygon"===r)for(i=0;i<e.length;i++)for(var n=0;n<e[i].length;n++)H(t,e[i][n])}(n),n}function H(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function K(t,e,r,i){if(e.geometry){var n=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=i||0),"Point"===o)J(n,s);else if("MultiPoint"===o)for(var u=0;u<n.length;u++)J(n[u],s);else if("LineString"===o)$(n,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(u=0;u<n.length;u++)$(n[u],s=[],a,!1),t.push(W(l,"LineString",s,e.properties));return}Q(n,s,a,!1)}else if("Polygon"===o)Q(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<e.geometry.geometries.length;u++)K(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<n.length;u++){var h=[];Q(n[u],h,a,!0),s.push(h)}}t.push(W(l,o,s,e.properties))}}function J(t,e){e.push(tt(t[0])),e.push(et(t[1])),e.push(0)}function $(t,e,r,i){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+=i?(n*u-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-o,2))),n=l,o=u}var h=e.length-3;e[2]=1,function t(e,r,i,n){for(var o,a=n,s=i-r>>1,l=i-r,u=e[r],h=e[r+1],p=e[i],c=e[i+1],f=r+3;f<i;f+=3){var d=Y(e[f],e[f+1],u,h,p,c);if(d>a)o=f,a=d;else if(d===a){var m=Math.abs(f-s);m<l&&(o=f,l=m)}}a>n&&(o-r>3&&t(e,r,o,n),e[o+2]=a,i-o>3&&t(e,o,i,n))}(e,0,h,r),e[h+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Q(t,e,r,i){for(var n=0;n<t.length;n++){var o=[];$(t[n],o,r,i),e.push(o)}}function tt(t){return t/360+.5}function et(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function rt(t,e,r,i,n,o,a,s){if(i/=e,o>=(r/=e)&&a<i)return t;if(a<r||o>=i)return null;for(var l=[],u=0;u<t.length;u++){var h=t[u],p=h.geometry,c=h.type,f=0===n?h.minX:h.minY,d=0===n?h.maxX:h.maxY;if(f>=r&&d<i)l.push(h);else if(!(d<r||f>=i)){var m=[];if("Point"===c||"MultiPoint"===c)it(p,m,r,i,n);else if("LineString"===c)nt(p,m,r,i,n,!1,s.lineMetrics);else if("MultiLineString"===c)at(p,m,r,i,n,!1);else if("Polygon"===c)at(p,m,r,i,n,!0);else if("MultiPolygon"===c)for(var y=0;y<p.length;y++){var g=[];at(p[y],g,r,i,n,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&"LineString"===c){for(y=0;y<m.length;y++)l.push(W(h.id,c,m[y],h.tags));continue}"LineString"!==c&&"MultiLineString"!==c||(1===m.length?(c="LineString",m=m[0]):c="MultiLineString"),"Point"!==c&&"MultiPoint"!==c||(c=3===m.length?"Point":"MultiPoint"),l.push(W(h.id,c,m,h.tags))}}}return l.length?l:null}function it(t,e,r,i,n){for(var o=0;o<t.length;o+=3){var a=t[o+n];a>=r&&a<=i&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function nt(t,e,r,i,n,o,a){for(var s,l,u=ot(t),h=0===n?lt:ut,p=t.start,c=0;c<t.length-3;c+=3){var f=t[c],d=t[c+1],m=t[c+2],y=t[c+3],g=t[c+4],_=0===n?f:d,v=0===n?y:g,x=!1;a&&(s=Math.sqrt(Math.pow(f-y,2)+Math.pow(d-g,2))),_<r?v>r&&(l=h(u,f,d,y,g,r),a&&(u.start=p+s*l)):_>i?v<i&&(l=h(u,f,d,y,g,i),a&&(u.start=p+s*l)):st(u,f,d,m),v<r&&_>=r&&(l=h(u,f,d,y,g,r),x=!0),v>i&&_<=i&&(l=h(u,f,d,y,g,i),x=!0),!o&&x&&(a&&(u.end=p+s*l),e.push(u),u=ot(t)),a&&(p+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(_=0===n?f:d)>=r&&_<=i&&st(u,f,d,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,r,i,n,o){for(var a=0;a<t.length;a++)nt(t[a],e,r,i,n,o,!1)}function st(t,e,r,i){t.push(e),t.push(r),t.push(i)}function lt(t,e,r,i,n,o){var a=(o-e)/(i-e);return t.push(o),t.push(r+(n-r)*a),t.push(1),a}function ut(t,e,r,i,n,o){var a=(o-r)/(n-r);return t.push(e+(i-e)*a),t.push(o),t.push(1),a}function ht(t,e){for(var r=[],i=0;i<t.length;i++){var n,o=t[i],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)n=pt(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){n=[];for(var s=0;s<o.geometry.length;s++)n.push(pt(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(pt(o.geometry[s][u],e));n.push(l)}r.push(W(o.id,a,n,o.tags))}return r}function pt(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function ct(t,e){if(t.transformed)return t;var r,i,n,o=1<<t.z,a=t.x,s=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,h=l.type;if(l.geometry=[],1===h)for(i=0;i<u.length;i+=2)l.geometry.push(ft(u[i],u[i+1],e,o,a,s));else for(i=0;i<u.length;i++){var p=[];for(n=0;n<u[i].length;n+=2)p.push(ft(u[i][n],u[i][n+1],e,o,a,s));l.geometry.push(p)}}return t.transformed=!0,t}function ft(t,e,r,i,n,o){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-o))]}function dt(t,e,r,i,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:r,y:i,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,h=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),h>a.maxX&&(a.maxX=h),p>a.maxY&&(a.maxY=p)}return a}function mt(t,e,r,i){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,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<n.length;s++)yt(a,n[s],t,r,"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,r,!0,0===s)}if(a.length){var h=e.tags||null;if("LineString"===o&&i.lineMetrics){for(var p in h={},e.tags)h[p]=e.tags[p];h.mapbox_clip_start=n.start/n.size,h.mapbox_clip_end=n.end/n.size}var c={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:h};null!==e.id&&(c.id=e.id),t.features.push(c)}}function yt(t,e,r,i,n,o){var a=i*i;if(i>0&&e.size<(n?a:i))r.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===i||e[l+2]>a)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;n&&function(t,e){for(var r=0,i=0,n=t.length,o=n-2;i<n;o=i,i+=2)r+=(t[i]-t[o])*(t[i+1]+t[o+1]);if(r>0===e)for(i=0,n=t.length;i<n/2;i+=2){var a=t[i],s=t[i+1];t[i]=t[n-2-i],t[i+1]=t[n-1-i],t[n-2-i]=a,t[n-1-i]=s}}(s,o),t.push(s)}}function gt(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&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 i=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var i=0;i<t.features.length;i++)K(r,t.features[i],e,i);else K(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(i=function(t,e){var r=e.buffer/e.extent,i=t,n=rt(t,1,-1-r,r,0,-1,2,e),o=rt(t,1,1-r,2+r,0,-1,2,e);return(n||o)&&(i=rt(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=ht(n,1).concat(i)),o&&(i=i.concat(ht(o,-1)))),i}(i,e)).length&&this.splitTile(i,0,0,0),r&&(i.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 _t(t,e,r){return 32*((1<<t)*r+e)+t}function vt(t,e){var r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var i=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!i)return e(null,null);var n=new m(i.features),o=x(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:n,rawData:o.buffer})}O.prototype.load=function(t){var e=this.options,r=e.log,i=e.minZoom,n=e.maxZoom,o=e.nodeSize;r&&console.time("total time");var a="prepare "+t.length+" points";r&&console.time(a),this.points=t;for(var s=[],l=0;l<t.length;l++)t[l].geometry&&s.push(N(t[l],l));this.trees[n+1]=new R(s,Z,X,o,Float32Array),r&&console.timeEnd(a);for(var u=n;u>=i;u--){var h=+Date.now();s=this._cluster(s,u),this.trees[u]=new R(s,Z,X,o,Float32Array),r&&console.log("z%d: %d clusters in %dms",u,s.length,+Date.now()-h)}return r&&console.timeEnd("total time"),this},O.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,i=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)r=-180,n=180;else if(r>n){var a=this.getClusters([r,i,180,o],e),s=this.getClusters([-180,i,n,o],e);return a.concat(s)}for(var l=this.trees[this._limitZoom(e)],u=[],h=0,p=l.range(j(r),q(o),j(n),q(i));h<p.length;h+=1){var c=l.points[p[h]];u.push(c.numPoints?V(c):this.points[c.index])}return u},O.prototype.getChildren=function(t){var e=this._getOriginId(t),r=this._getOriginZoom(t),i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);var o=n.points[e];if(!o)throw new Error(i);for(var a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=[],l=0,u=n.within(o.x,o.y,a);l<u.length;l+=1){var h=n.points[u[l]];h.parentId===t&&s.push(h.numPoints?V(h):this.points[h.index])}if(0===s.length)throw new Error(i);return s},O.prototype.getLeaves=function(t,e,r){var i=[];return this._appendLeaves(i,t,e=e||10,r=r||0,0),i},O.prototype.getTile=function(t,e,r){var i=this.trees[this._limitZoom(t)],n=Math.pow(2,t),o=this.options,a=o.radius/o.extent,s=(r-a)/n,l=(r+1+a)/n,u={features:[]};return this._addTileFeatures(i.range((e-a)/n,s,(e+1+a)/n,l),i.points,e,r,n,u),0===e&&this._addTileFeatures(i.range(1-a/n,s,1,l),i.points,n,r,n,u),e===n-1&&this._addTileFeatures(i.range(0,s,a/n,l),i.points,-1,r,n,u),u.features.length?u:null},O.prototype.getClusterExpansionZoom=function(t){for(var e=this._getOriginZoom(t)-1;e<=this.options.maxZoom;){var r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e},O.prototype._appendLeaves=function(t,e,r,i,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<=i?n+=l.point_count:n=this._appendLeaves(t,l.cluster_id,r,i,n):n<i?n++:t.push(s),t.length===r)break}return n},O.prototype._addTileFeatures=function(t,e,r,i,n,o){for(var a=0,s=t;a<s.length;a+=1){var l=e[s[a]],u=l.numPoints,h={type:1,geometry:[[Math.round(this.options.extent*(l.x*n-r)),Math.round(this.options.extent*(l.y*n-i))]],tags:u?U(l):this.points[l.index].properties},p=void 0;u?p=l.id:this.options.generateId?p=l.index:this.points[l.index].id&&(p=this.points[l.index].id),void 0!==p&&(h.id=p),o.features.push(h)}},O.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))},O.prototype._cluster=function(t,e){for(var r=[],i=this.options,n=i.reduce,o=i.minPoints,a=i.radius/(i.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],h=u.within(l.x,l.y,a),p=l.numPoints||1,c=p,f=0,d=h;f<d.length;f+=1){var m=u.points[d[f]];m.zoom>e&&(c+=m.numPoints||1)}if(c>=o){for(var y=l.x*p,g=l.y*p,_=n&&p>1?this._map(l,!0):null,v=(s<<5)+(e+1)+this.points.length,x=0,b=h;x<b.length;x+=1){var w=u.points[b[x]];if(!(w.zoom<=e)){w.zoom=e;var I=w.numPoints||1;y+=w.x*I,g+=w.y*I,w.parentId=v,n&&(_||(_=this._map(l,!0)),n(_,this._map(w)))}}l.parentId=v,r.push(B(y/c,g/c,v,c,_))}else if(r.push(l),c>1)for(var S=0,T=h;S<T.length;S+=1){var E=u.points[T[S]];E.zoom<=e||(E.zoom=e,r.push(E))}}}return r},O.prototype._getOriginId=function(t){return t-this.points.length>>5},O.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},O.prototype._map=function(t,e){if(t.numPoints)return e?G({},t.properties):t.properties;var r=this.points[t.index].properties,i=this.options.map(r);return e&&i===r?G({},i):i},gt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},gt.prototype.splitTile=function(t,e,r,i,n,o,a){for(var s=[t,e,r,i],l=this.options,u=l.debug;s.length;){i=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var h=1<<e,p=_t(e,r,i),c=this.tiles[p];if(!c&&(u>1&&console.time("creation"),c=this.tiles[p]=dt(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,c.numFeatures,c.numPoints,c.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(c.source=t,n){if(e===l.maxZoom||e===n)continue;var d=1<<n-e;if(r!==Math.floor(o/d)||i!==Math.floor(a/d))continue}else if(e===l.indexMaxZoom||c.numPoints<=l.indexMaxPoints)continue;if(c.source=null,0!==t.length){u>1&&console.time("clipping");var m,y,g,_,v,x,b=.5*l.buffer/l.extent,w=.5-b,I=.5+b,S=1+b;m=y=g=_=null,v=rt(t,h,r-b,r+I,0,c.minX,c.maxX,l),x=rt(t,h,r+w,r+S,0,c.minX,c.maxX,l),t=null,v&&(m=rt(v,h,i-b,i+I,1,c.minY,c.maxY,l),y=rt(v,h,i+w,i+S,1,c.minY,c.maxY,l),v=null),x&&(g=rt(x,h,i-b,i+I,1,c.minY,c.maxY,l),_=rt(x,h,i+w,i+S,1,c.minY,c.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*r,2*i),s.push(y||[],e+1,2*r,2*i+1),s.push(g||[],e+1,2*r+1,2*i),s.push(_||[],e+1,2*r+1,2*i+1)}}},gt.prototype.getTile=function(t,e,r){var i=this.options,n=i.extent,o=i.debug;if(t<0||t>24)return null;var a=1<<t,s=_t(t,e=(e%a+a)%a,r);if(this.tiles[s])return ct(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,h=e,p=r;!l&&u>0;)u--,h=Math.floor(h/2),p=Math.floor(p/2),l=this.tiles[_t(u,h,p)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,h,p),o>1&&console.time("drilling down"),this.splitTile(l.source,u,h,p,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ct(this.tiles[s],n):null):null};var xt=function(e){function r(t,r,i,n){e.call(this,t,r,i,vt),n&&(this.loadGeoJSON=n)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.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())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,i=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var n=!!(i&&i.request&&i.request.collectResourceTiming)&&new t.RequestPerformance(i.request);this.loadGeoJSON(i,(function(o,a){if(o||!a)return r(o);if("object"!=typeof a)return r(new Error("Input data given to '"+i.source+"' is not a valid GeoJSON object."));!function t(e,r){var i,n=e&&e.type;if("FeatureCollection"===n)for(i=0;i<e.features.length;i++)t(e.features[i],r);else if("GeometryCollection"===n)for(i=0;i<e.geometries.length;i++)t(e.geometries[i],r);else if("Feature"===n)t(e.geometry,r);else if("Polygon"===n)p(e.coordinates,r);else if("MultiPolygon"===n)for(i=0;i<e.coordinates.length;i++)p(e.coordinates[i],r);return e}(a,!0);try{if(i.filter){var s=t.createExpression(i.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=i.cluster?new O(function(e){var r=e.superclusterOptions,i=e.clusterProperties;if(!i||!r)return r;for(var n={},o={},a={accumulated:null,zoom:0},s={properties:null},l=Object.keys(i),u=0,h=l;u<h.length;u+=1){var p=h[u],c=i[p],f=c[0],d=t.createExpression(c[1]),m=t.createExpression("string"==typeof f?[f,["accumulated"],["get",p]]:f);n[p]=d.value,o[p]=m.value}return r.map=function(t){s.properties=t;for(var e={},r=0,i=l;r<i.length;r+=1){var o=i[r];e[o]=n[o].evaluate(a,s)}return e},r.reduce=function(t,e){s.properties=e;for(var r=0,i=l;r<i.length;r+=1){var n=i[r];a.accumulated=t[n],t[n]=o[n].evaluate(a,s)}},r}(i)).load(a.features):function(t,e){return new gt(t,e)}(a,i.geojsonVtOptions)}catch(o){return r(o)}e.loaded={};var u={};if(n){var h=n.finish();h&&(u.resourceTiming={},u.resourceTiming[i.source]=JSON.parse(JSON.stringify(h)))}r(null,u)}))}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var i=this.loaded;return i&&i[t.uid]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r.prototype.getClusterExpansionZoom=function(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}},r.prototype.getClusterChildren=function(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}},r.prototype.getClusterLeaves=function(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}},r}(l),bt=function(e){var r=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(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.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,r){for(var i in this.availableImages[t]=e,this.workerSources[t]){var n=this.workerSources[t][i];for(var o in n)n[o].availableImages=e}r()},bt.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},bt.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},bt.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},bt.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},bt.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},bt.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},bt.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},bt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},bt.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var i=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==i.removeSource?i.removeSource(e,r):r()}},bt.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},bt.prototype.syncRTLPluginState=function(e,r,i){try{t.plugin.setState(r);var n=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=n){this.self.importScripts(n);var o=t.plugin.isParsed();i(o?void 0:new Error("RTL Text Plugin failed to import scripts from "+n),o)}}catch(t){i(t.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 i),e},bt.prototype.getWorkerSource=function(t,e,r){var i=this;return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][r]||(this.workerSources[t][e][r]=new this.workerSourceTypes[e]({send:function(e,r,n){i.actor.send(e,r,n,t)}},this.getLayerIndex(t),this.getAvailableImages(t))),this.workerSources[t][e][r]},bt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new h),this.demWorkerSources[t][e]},bt.prototype.enforceCacheSizeLimit=function(e,r){t.enforceCacheSizeLimit(r)},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new bt(self)),bt})),i(0,(function(t){var e={create:function(e,r,i){var n=t.window.document.createElement(e);return void 0!==r&&(n.className=r),i&&i.appendChild(n),n},createNS:function(e,r){return t.window.document.createElementNS(e,r)}},r=t.window.document&&t.window.document.documentElement.style;function i(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 n,o=i(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);e.disableDrag=function(){r&&o&&(n=r[o],r[o]="none")},e.enableDrag=function(){r&&o&&(r[o]=n)};var a=i(["transform","WebkitTransform"]);e.setTransform=function(t,e){t.style[a]=e};var s=!1;try{var l=Object.defineProperty({},"passive",{get:function(){s=!0}});t.window.addEventListener("test",l,l),t.window.removeEventListener("test",l,l)}catch(t){s=!1}e.addEventListener=function(t,e,r,i){void 0===i&&(i={}),t.addEventListener(e,r,"passive"in i&&s?i:i.capture)},e.removeEventListener=function(t,e,r,i){void 0===i&&(i={}),t.removeEventListener(e,r,"passive"in i&&s?i:i.capture)};var u=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",u,!0)};function h(t){var e=t.userImage;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}e.suppressClick=function(){t.window.addEventListener("click",u,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",u,!0)}),0)},e.mousePos=function(e,r){var i=e.getBoundingClientRect();return new t.Point(r.clientX-i.left-e.clientLeft,r.clientY-i.top-e.clientTop)},e.touchPos=function(e,r){for(var i=e.getBoundingClientRect(),n=[],o=0;o<r.length;o++)n.push(new t.Point(r[o].clientX-i.left-e.clientLeft,r[o].clientY-i.top-e.clientTop));return n},e.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},e.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var p=function(e){function r(){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&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e<r.length;e+=1){var i=r[e];this._notify(i.ids,i.callback)}this.requestors=[]}},r.prototype.getImage=function(t){return this.images[t]},r.prototype.addImage=function(t,e){this._validate(t,e)&&(this.images[t]=e)},r.prototype._validate=function(e,r){var i=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchX" value'))),i=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchY" value'))),i=!1),this._validateContent(r.content,r)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "content" value'))),i=!1),i},r.prototype._validateStretch=function(t,e){if(!t)return!0;for(var r=0,i=0,n=t;i<n.length;i+=1){var o=n[i];if(o[0]<r||o[1]<o[0]||e<o[1])return!1;r=o[1]}return!0},r.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]))},r.prototype.updateImage=function(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0},r.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()},r.prototype.listImages=function(){return Object.keys(this.images)},r.prototype.getImages=function(t,e){var r=!0;if(!this.isLoaded())for(var i=0,n=t;i<n.length;i+=1)this.images[n[i]]||(r=!1);this.isLoaded()||r?this._notify(t,e):this.requestors.push({ids:t,callback:e})},r.prototype._notify=function(e,r){for(var i={},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?i[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.')}r(null,i)},r.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},r.prototype.getPattern=function(e){var r=this.patterns[e],i=this.getImage(e);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{var n={w:i.data.width+2,h:i.data.height+2,x:0,y:0},o=new t.ImagePosition(n,i);this.patterns[e]={bin:n,position:o}}return this._updatePatternAtlas(),this.patterns[e].position},r.prototype.bind=function(e){var r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)},r.prototype._updatePatternAtlas=function(){var e=[];for(var r in this.patterns)e.push(this.patterns[r].bin);var i=t.potpack(e),n=i.w,o=i.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,h=l.y+1,p=this.images[s].data,c=p.width,f=p.height;t.RGBAImage.copy(p,a,{x:0,y:0},{x:u,y:h},{width:c,height:f}),t.RGBAImage.copy(p,a,{x:0,y:f-1},{x:u,y:h-1},{width:c,height:1}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:u,y:h+f},{width:c,height:1}),t.RGBAImage.copy(p,a,{x:c-1,y:0},{x:u-1,y:h},{width:1,height:f}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:u+c,y:h},{width:1,height:f})}this.dirty=!0},r.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},r.prototype.dispatchRenderCallbacks=function(t){for(var e=0,r=t;e<r.length;e+=1){var i=r[e];if(!this.callbackDispatchedThisFrame[i]){this.callbackDispatchedThisFrame[i]=!0;var n=this.images[i];h(n)&&this.updateImage(i,n)}}},r}(t.Evented),c=m,f=m,d=1e20;function m(t,e,r,i,n,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=i||.25,this.fontFamily=n||"sans-serif",this.fontWeight=o||"normal",this.radius=r||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 y(t,e,r,i,n,o,a){for(var s=0;s<e;s++){for(var l=0;l<r;l++)i[l]=t[l*e+s];for(g(i,n,o,a,r),l=0;l<r;l++)t[l*e+s]=n[l]}for(l=0;l<r;l++){for(s=0;s<e;s++)i[s]=t[l*e+s];for(g(i,n,o,a,e),s=0;s<e;s++)t[l*e+s]=Math.sqrt(n[s])}}function g(t,e,r,i,n){r[0]=0,i[0]=-d,i[1]=+d;for(var o=1,a=0;o<n;o++){for(var s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);s<=i[a];)a--,s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);r[++a]=o,i[a]=s,i[a+1]=+d}for(o=0,a=0;o<n;o++){for(;i[a+1]<o;)a++;e[o]=(o-r[a])*(o-r[a])+t[r[a]]}}m.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),r=new Uint8ClampedArray(this.size*this.size),i=0;i<this.size*this.size;i++){var n=e.data[4*i+3]/255;this.gridOuter[i]=1===n?0:0===n?d:Math.pow(Math.max(0,.5-n),2),this.gridInner[i]=1===n?d:0===n?0:Math.pow(Math.max(0,n-.5),2)}for(y(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),y(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),i=0;i<this.size*this.size;i++)r[i]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[i]-this.gridInner[i])/this.radius+this.cutoff))));return r},c.default=f;var _=function(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}};_.prototype.setURL=function(t){this.url=t},_.prototype.getGlyphs=function(e,r){var i=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 r=t.stack,n=t.id,o=i.entries[r];o||(o=i.entries[r]={glyphs:{},requests:{},ranges:{}});var a=o.glyphs[n];if(void 0===a){if(a=i._tinySDF(o,r,n))return o.glyphs[n]=a,void e(null,{stack:r,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:r,id:n,glyph:a});else{var l=o.requests[s];l||(l=o.requests[s]=[],_.loadGlyphRange(r,s,i.url,i.requestManager,(function(t,e){if(e){for(var r in e)i._doesCharSupportLocalGlyph(+r)||(o.glyphs[+r]=e[+r]);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,i){t?e(t):i&&e(null,{stack:r,id:n,glyph:i[n]||null})}))}}else e(null,{stack:r,id:n,glyph:a})}),(function(t,e){if(t)r(t);else if(e){for(var i={},n=0,o=e;n<o.length;n+=1){var a=o[n],s=a.stack,l=a.id,u=a.glyph;(i[s]||(i[s]={}))[l]=u&&{id:u.id,bitmap:u.bitmap.clone(),metrics:u.metrics}}r(null,i)}}))},_.prototype._doesCharSupportLocalGlyph=function(t){return!0},_.prototype._tinySDF=function(e,r,i){var n=this.localIdeographFontFamily;if(n&&this._doesCharSupportLocalGlyph(i)){var o=e.tinySDF;if(!o){var a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),o=e.tinySDF=new _.TinySDF(24,3,8,.25,n,a)}var s=String.fromCharCode(i),l=o.ctx.measureText(s).width;return{id:i,bitmap:new t.AlphaImage({width:30,height:30},o.draw(s)),metrics:{width:24,height:24,left:0,top:-8,advance:l}}}},_.loadGlyphRange=function(e,r,i,n,o){var a=256*r,s=a+255,l=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",a+"-"+s),t.ResourceType.Glyphs);t.getArrayBuffer(l,(function(e,r){if(e)o(e);else if(r){for(var i={},n=0,a=t.parseGlyphPBF(r);n<a.length;n+=1){var s=a[n];i[s.id]=s}o(null,i)}}))},_.TinySDF=c;var v=function(){this.specification=t.styleSpec.light.position};v.prototype.possiblyEvaluate=function(e,r){return t.sphericalToCartesian(e.expression.evaluate(r))},v.prototype.interpolate=function(e,r,i){return{x:t.number(e.x,r.x,i),y:t.number(e.y,r.y,i),z:t.number(e.z,r.z,i)}};var x=new t.Properties({anchor:new t.DataConstantProperty(t.styleSpec.light.anchor),position:new v,color:new t.DataConstantProperty(t.styleSpec.light.color),intensity:new t.DataConstantProperty(t.styleSpec.light.intensity)}),b=function(e){function r(r){e.call(this),this._transitionable=new t.Transitionable(x),this.setLight(r),this._transitioning=this._transitionable.untransitioned()}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getLight=function(){return this._transitionable.serialize()},r.prototype.setLight=function(e,r){if(void 0===r&&(r={}),!this._validate(t.validateLight,e,r))for(var i in e){var n=e[i];t.endsWith(i,"-transition")?this._transitionable.setTransition(i.slice(0,-11),n):this._transitionable.setValue(i,n)}},r.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},r.prototype.hasTransition=function(){return this._transitioning.hasTransition()},r.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},r.prototype._validate=function(e,r,i){return(!i||!1!==i.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.styleSpec})))},r}(t.Evented),w=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};w.prototype.getDash=function(t,e){var r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]},w.prototype.getDashRanges=function(t,e,r){var i=[],n=t.length%2==1?-t[t.length-1]*r:0,o=t[0]*r,a=!0;i.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];i.push({left:n=s*r,right:o=(s+=u)*r,isDash:a=!a,zeroLength:0===u})}return i},w.prototype.addRoundDash=function(t,e,r){for(var i=e/2,n=-r;n<=r;n++)for(var o=this.width*(this.nextRow+r+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),h=Math.abs(l-s.right),p=Math.min(u,h),c=void 0,f=n/r*(i+1);if(s.isDash){var d=i-Math.abs(f);c=Math.sqrt(p*p+d*d)}else c=i-Math.sqrt(p*p+f*f);this.data[o+l]=Math.max(0,Math.min(255,c+128))}},w.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],i=t[e+1];r.zeroLength?t.splice(e,1):i&&i.isDash===r.isDash&&(i.left=r.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 h=Math.abs(u-l.left),p=Math.abs(u-l.right),c=Math.min(h,p);this.data[a+u]=Math.max(0,Math.min(255,(l.isDash?c:-c)+128))}},w.prototype.addDash=function(e,r){var i=r?7:0,n=2*i+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);r?this.addRoundDash(l,s,i):this.addRegularDash(l)}var u={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:o};return this.nextRow+=n,this.dirty=!0,u},w.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(r,i){this.workerPool=r,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],i,this.id);a.name="Worker "+o,this.actors.push(a)}};function S(e,r,i){var n=function(n,o){if(n)return i(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=r.canonicalizeTileset(a,e.url),i(null,a)}};return e.url?t.getJSON(r.transformRequest(r.normalizeSourceURL(e.url),t.ResourceType.Source),n):t.browser.frame((function(){return n(null,e)}))}I.prototype.broadcast=function(e,r,i){t.asyncAll(this.actors,(function(t,i){t.send(e,r,i)}),i=i||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,r,i){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=r||0,this.maxzoom=i||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 r=Math.pow(2,e.z),i=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*r),n=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*r),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*r),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*r);return e.x>=i&&e.x<o&&e.y>=n&&e.y<a};var E=function(e){function r(r,i,n,o){if(e.call(this),this.id=r,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(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.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(r,i){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):i&&(t.extend(e,i),i.bounds&&(e.tileBounds=new T(i.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(i.tiles,e.map._requestManager._customAccessToken),t.postMapLoadEvent(i.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"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setSourceProperty=function(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},r.prototype.setTiles=function(t){var e=this;return this.setSourceProperty((function(){e._options.tiles=t})),this},r.prototype.setUrl=function(t){var e=this;return this.setSourceProperty((function(){e.url=t,e._options.url=t})),this},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.loadTile=function(e,r){var i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(i,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(i,n){return delete e.request,e.aborted?r(null):i&&404!==i.status?r(i):(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),r(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=r: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)))},r.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)},r.prototype.unloadTile=function(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)},r.prototype.hasTransition=function(){return!1},r}(t.Evented),P=function(e){function r(r,i,n,o){e.call(this),this.id=r,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"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.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(r,i){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):i&&(t.extend(e,i),i.bounds&&(e.tileBounds=new T(i.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(i.tiles),t.postMapLoadEvent(i.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"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.loadTile=function(e,r){var i=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",r(null);else if(n)e.state="errored",r(n);else if(o){i.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=i.map.painter.context,s=a.gl;e.texture=i.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(i.dispatcher),r(null)}}))},r.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},r.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()},r.prototype.hasTransition=function(){return!1},r}(t.Evented),A=function(e){function r(r,i,n,o){e.call(this,r,i,n,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},r.prototype.loadTile=function(e,r){var i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function n(t,i){t&&(e.state="errored",r(t)),i&&(e.dem=i,e.needsHillshadePrepare=!0,e.state="loaded",r(null))}e.request=t.getImage(this.map._requestManager.transformRequest(i,t.ResourceType.Tile),function(i,o){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(i)e.state="errored",r(i);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)},r.prototype._getNeighboringTiles=function(e){var r=e.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,o=0===r.x?e.wrap-1:e.wrap,a=(r.x+1+i)%i,s=r.x+1===i?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new t.OverscaledTileID(e.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),l},r.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})},r}(P),L=function(e){function r(r,i,n,o){e.call(this),this.id=r,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=i.data,this._options=t.extend({},i),this._collectResourceTiming=i.collectResourceTiming,this._resourceTiming=[],void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*a,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?Math.min(i.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(i.clusterRadius||50)*a,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(r){if(r)e.fire(new t.ErrorEvent(r));else{var i={dataType:"source",sourceDataType:"metadata"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(i.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",i))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var i={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(i.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",i))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,i){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},i),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var i=t.extend({},this.workerOptions),n=this._data;"string"==typeof n?(i.request=this.map._requestManager.transformRequest(t.browser.resolveURL(n),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(n),this.actor.send(this.type+".loadData",i,(function(t,n){r._removed||n&&n.abandoned||(r._loaded=!0,n&&n.resourceTiming&&n.resourceTiming[r.id]&&(r._resourceTiming=n.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:i.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var i=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?r(null):t?r(t):(e.loadVectorData(o,i.map.painter,"reloadTile"===n),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),M=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),k=function(e){function r(t,r,i,n){e.call(this),this.id=t,this.dispatcher=i,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var i=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){i._loaded=!0,n?i.fire(new t.ErrorEvent(n)):o&&(i.image=o,e&&(i.coordinates=e),r&&r(),i._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.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},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,i=1/0,n=-1/0,o=-1/0,a=0,s=e;a<s.length;a+=1){var l=s[a];r=Math.min(r,l.x),i=Math.min(i,l.y),n=Math.max(n,l.x),o=Math.max(o,l.y)}var u=Math.max(n-r,o-i),h=Math.max(0,Math.floor(-Math.log(u)/Math.LN2)),p=Math.pow(2,h);return new t.CanonicalTileID(h,Math.floor((r+n)/2*p),Math.floor((i+o)/2*p))}(i),this.minzoom=this.maxzoom=this.tileID.z;var n=i.map((function(t){return r.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},r.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,r=e.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,M.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var n=this.tiles[i];"loaded"!==n.state&&(n.state="loaded",n.texture=this.texture)}}},r.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))},r.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return!1},r}(t.Evented),z=function(e){function r(t,r,i,n){e.call(this,t,r,i,n),this.roundZoom=!0,this.type="video",this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1;var r=this.options;this.urls=[];for(var i=0,n=r.urls;i<n.length;i+=1)this.urls.push(this.map._requestManager.transformRequest(n[i],t.ResourceType.Source).url);t.getVideo(this.urls,(function(r,i){e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):i&&(e.video=i,e.video.loop=!0,e.video.addEventListener("playing",(function(){e.map.triggerRepaint()})),e.map&&e.video.play(),e._finishLoading())}))},r.prototype.pause=function(){this.video&&this.video.pause()},r.prototype.play=function(){this.video&&this.video.play()},r.prototype.seek=function(e){if(this.video){var r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,M.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var n=this.tiles[i];"loaded"!==n.state&&(n.state="loaded",n.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(k),C=function(e){function r(r,i,n,o){e.call(this,r,i,n,o),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.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."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.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())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.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 r=this.map.painter.context,i=r.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,M.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(r,this.canvas,i.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[n];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var r=e[t];if(isNaN(r)||r<=0)return!0}return!1},r}(k),D={vector:E,raster:P,"raster-dem":A,geojson:L,video:z,image:k,canvas:C};function R(e,r){var i=t.identity([]);return t.translate(i,i,[1,1,0]),t.scale(i,i,[.5*e.width,.5*e.height,1]),t.multiply(i,i,e.calculatePosMatrix(r.toUnwrapped()))}function F(t,e,r,i,n,o){var a=function(t,e,r){if(t)for(var i=0,n=t;i<n.length;i+=1){var o=e[n[i]];if(o&&o.source===r&&"fill-extrusion"===o.type)return!0}else for(var a in e){var s=e[a];if(s.source===r&&"fill-extrusion"===s.type)return!0}return!1}(n&&n.layers,e,t.id),s=o.maxPitchScaleFactor(),l=t.tilesIn(i,s,a);l.sort(O);for(var u=[],h=0,p=l;h<p.length;h+=1){var c=p[h];u.push({wrappedTileID:c.tileID.wrapped().key,queryResults:c.tile.queryRenderedFeatures(e,r,t._state,c.queryGeometry,c.cameraQueryGeometry,c.scale,n,o,s,R(t.transform,c.tileID))})}var f=function(t){for(var e={},r={},i=0,n=t;i<n.length;i+=1){var o=n[i],a=o.queryResults,s=o.wrappedTileID,l=r[s]=r[s]||{};for(var u in a)for(var h=a[u],p=l[u]=l[u]||{},c=e[u]=e[u]||[],f=0,d=h;f<d.length;f+=1){var m=d[f];p[m.featureIndex]||(p[m.featureIndex]=!0,c.push(m))}}return e}(u);for(var d in f)f[d].forEach((function(e){var r=e.feature,i=t.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}));return f}function O(t,e){var r=t.tileID,i=e.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}var B=function(t,e){this.max=t,this.onRemove=e,this.reset()};B.prototype.reset=function(){for(var t in this.data)for(var e=0,r=this.data[t];e<r.length;e+=1){var i=r[e];i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value)}return this.data={},this.order=[],this},B.prototype.add=function(t,e,r){var i=this,n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);var o={value:e,timeout:void 0};if(void 0!==r&&(o.timeout=setTimeout((function(){i.remove(t,o)}),r)),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},B.prototype.has=function(t){return t.wrapped().key in this.data},B.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},B.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},B.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},B.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},B.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,i=void 0===e?0:this.data[r].indexOf(e),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this},B.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},B.prototype.filter=function(t){var e=[];for(var r in this.data)for(var i=0,n=this.data[r];i<n.length;i+=1){var o=n[i];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,r){this.context=t;var i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.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"},U=function(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,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};U.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},U.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},U.prototype.enableAttributes=function(t,e){for(var r=0;r<this.attributes.length;r++){var i=e.attributes[this.attributes[r].name];void 0!==i&&t.enableVertexAttribArray(i)}},U.prototype.setVertexAttribPointers=function(t,e,r){for(var i=0;i<this.attributes.length;i++){var n=this.attributes[i],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[V[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}},U.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var j=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};j.prototype.get=function(){return this.current},j.prototype.set=function(t){},j.prototype.getDefault=function(){return this.default},j.prototype.setDefault=function(){this.set(this.default)};var q=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.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)},r}(j),G=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}(j),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 0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)},e}(j),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,!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}(j),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(){return!0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)},e}(j),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 255},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)},e}(j),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{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}(j),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(){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}(j),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!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}(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[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}(j),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.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},e}(j),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 this.gl.LESS},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)},e}(j),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!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}(j),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}(j),it=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.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)},r}(j),nt=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}(j),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!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}(j),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 this.gl.BACK},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)},e}(j),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.CCW},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)},e}(j),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 null},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)},e}(j),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 this.gl.TEXTURE0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)},e}(j),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}(j),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}(j),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 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}(j),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}(j),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.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},e}(j),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){var e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1},e}(j),yt=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}(j),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 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}(j),_t=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}(j),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!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}(j),xt=function(t){function e(e,r){t.call(this,e),this.context=e,this.parent=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e}(j),bt=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}(xt),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.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}(xt),It=function(t,e,r,i){this.context=t,this.width=e,this.height=r;var n=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new bt(t,n),i&&(this.depthAttachment=new wt(t,n))};It.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){var r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)};var St=function(t,e,r){this.func=t,this.mask=e,this.range=r};St.ReadOnly=!1,St.ReadWrite=!0,St.disabled=new St(519,St.ReadOnly,[0,1]);var Tt=function(t,e,r,i,n,o){this.test=t,this.ref=e,this.mask=r,this.fail=i,this.depthFail=n,this.pass=o};Tt.disabled=new Tt({func:519,mask:0},0,0,7680,7680,7680);var Et=function(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r};Et.disabled=new Et(Et.Replace=[1,0],t.Color.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,t.Color.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([1,771],t.Color.transparent,[!0,!0,!0,!0]);var Pt=function(t,e,r){this.enable=t,this.mode=e,this.frontFace=r};Pt.disabled=new Pt(!1,1029,2305),Pt.backCCW=new Pt(!0,1029,2305);var At=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new q(this),this.clearDepth=new G(this),this.clearStencil=new Z(this),this.colorMask=new X(this),this.depthMask=new Y(this),this.stencilMask=new W(this),this.stencilFunc=new H(this),this.stencilOp=new K(this),this.stencilTest=new J(this),this.depthRange=new $(this),this.depthTest=new Q(this),this.depthFunc=new tt(this),this.blend=new et(this),this.blendFunc=new rt(this),this.blendColor=new it(this),this.blendEquation=new nt(this),this.cullFace=new ot(this),this.cullFaceSide=new at(this),this.frontFace=new st(this),this.program=new lt(this),this.activeTexture=new ut(this),this.viewport=new ht(this),this.bindFramebuffer=new pt(this),this.bindRenderbuffer=new ct(this),this.bindTexture=new ft(this),this.bindVertexBuffer=new dt(this),this.bindElementBuffer=new mt(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new yt(this),this.pixelStoreUnpack=new gt(this),this.pixelStoreUnpackPremultiplyAlpha=new _t(this),this.pixelStoreUnpackFlipY=new vt(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)};At.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()},At.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},At.prototype.createIndexBuffer=function(t,e){return new N(this,t,e)},At.prototype.createVertexBuffer=function(t,e,r){return new U(this,t,e,r)},At.prototype.createRenderbuffer=function(t,e,r){var i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),n},At.prototype.createFramebuffer=function(t,e,r){return new It(this,t,e,r)},At.prototype.clear=function(t){var e=t.color,r=t.depth,i=this.gl,n=0;e&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),i.clear(n)},At.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))},At.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)},At.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)},At.prototype.setColorMode=function(e){t.deepEqual(e.blendFunction,Et.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},At.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Lt=function(e){function r(r,i,n){var o=this;e.call(this),this.id=r,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,r,i,n){var o=new D[r.type](e,r,i,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}(r,i,n,this),this._tiles={},this._cache=new B(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new t.SourceFeatureState}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)},r.prototype.onRemove=function(t){this._source&&this._source.onRemove&&this._source.onRemove(t)},r.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},r.prototype.getSource=function(){return this._source},r.prototype.pause=function(){this._paused=!0},r.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)}},r.prototype._loadTile=function(t,e){return this._source.loadTile(t,e)},r.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,(function(){}))},r.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,(function(){}))},r.prototype.serialize=function(){return this._source.serialize()},r.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 r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}},r.prototype.getIds=function(){return t.values(this._tiles).map((function(t){return t.tileID})).sort(Mt).map((function(t){return t.key}))},r.prototype.getRenderableIds=function(e){var r=this,i=[];for(var n in this._tiles)this._isIdRenderable(n,e)&&i.push(this._tiles[n]);return e?i.sort((function(e,i){var n=e.tileID,o=i.tileID,a=new t.Point(n.canonical.x,n.canonical.y)._rotate(r.transform.angle),s=new t.Point(o.canonical.x,o.canonical.y)._rotate(r.transform.angle);return n.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x})).map((function(t){return t.tileID.key})):i.map((function(t){return t.tileID})).sort(Mt).map((function(t){return t.key}))},r.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},r.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},r.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")},r.prototype._reloadTile=function(t,e){var r=this._tiles[t];r&&("loading"!==r.state&&(r.state=e),this._loadTile(r,this._tileLoaded.bind(this,r,t,e)))},r.prototype._tileLoaded=function(e,r,i,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"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,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}))},r.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),r=0;r<e.length;r++){var i=e[r];if(t.neighboringTiles&&t.neighboringTiles[i]){var n=this.getTileByID(i);o(t,n),o(n,t)}}function o(t,e){t.needsHillshadePrepare=!0;var r=e.tileID.canonical.x-t.tileID.canonical.x,i=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===r&&0===i||Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,i),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,i){for(var n in this._tiles){var o=this._tiles[n];if(!(i[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>r)){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]){i[a.key]=a;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var i=t.overscaledZ-1;i>=e;i--){var n=t.scaledTo(i),o=this._getLoadedTile(n);if(o)return o}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,i=Math.floor(e*r*5),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(n)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var i in this._tiles){var n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}for(var o in this._tiles=r,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}},r.prototype.update=function(e){var i=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 i._source.hasTile(t)})))):n=[];var o=e.coveringZoomLevel(this._source),a=Math.max(o-r.maxOverzooming,this._source.minzoom),s=Math.max(o+r.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(n,o);if(kt(this._source.type)){for(var u={},h={},p=0,c=Object.keys(l);p<c.length;p+=1){var f=c[p],d=l[f],m=this._tiles[f];if(m&&!(m.fadeEndTime&&m.fadeEndTime<=t.browser.now())){var y=this.findLoadedParent(d,a);y&&(this._addTile(y.tileID),u[y.tileID.key]=y.tileID),h[f]=d}}for(var g in this._retainLoadedChildren(h,o,s,l),u)l[g]||(this._coveredTiles[g]=!0,l[g]=u[g])}for(var _ in l)this._tiles[_].clearFadeHold();for(var v=0,x=t.keysDifference(this._tiles,l);v<x.length;v+=1){var b=x[v],w=this._tiles[b];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}},r.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)},r.prototype._updateRetainedTiles=function(t,e){for(var i={},n={},o=Math.max(e-r.maxOverzooming,this._source.minzoom),a=Math.max(e+r.maxUnderzooming,this._source.minzoom),s={},l=0,u=t;l<u.length;l+=1){var h=u[l],p=this._addTile(h);i[h.key]=h,p.hasData()||e<this._source.maxzoom&&(s[h.key]=h)}this._retainLoadedChildren(s,e,a,i);for(var c=0,f=t;c<f.length;c+=1){var d=f[c],m=this._tiles[d.key];if(!m.hasData()){if(e+1>this._source.maxzoom){var y=d.children(this._source.maxzoom)[0],g=this.getTile(y);if(g&&g.hasData()){i[y.key]=y;continue}}else{var _=d.children(this._source.maxzoom);if(i[_[0].key]&&i[_[1].key]&&i[_[2].key]&&i[_[3].key])continue}for(var v=m.wasRequested(),x=d.overscaledZ-1;x>=o;--x){var b=d.scaledTo(x);if(n[b.key])break;if(n[b.key]=!0,!(m=this.getTile(b))&&v&&(m=this._addTile(b)),m&&(i[b.key]=b,v=m.wasRequested(),m.hasData()))break}}}return i},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,i=this._tiles[t].tileID;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){r=this._loadedParentTiles[i.key];break}e.push(i.key);var n=i.scaledTo(i.overscaledZ-1);if(r=this._getLoadedTile(n))break;i=n}for(var o=0,a=e;o<a.length;o+=1)this._loadedParentTiles[a[o]]=r}},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var i=Boolean(r);return i||(r=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,i||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((function(){r._reloadTile(t,"expired"),delete r._timers[t]}),i))},r.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))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,i){var n=this,o=[],a=this.transform;if(!a)return o;for(var s=i?a.getCameraQueryGeometry(e):e,l=e.map((function(t){return a.pointCoordinate(t)})),u=s.map((function(t){return a.pointCoordinate(t)})),h=this.getIds(),p=1/0,c=1/0,f=-1/0,d=-1/0,m=0,y=u;m<y.length;m+=1){var g=y[m];p=Math.min(p,g.x),c=Math.min(c,g.y),f=Math.max(f,g.x),d=Math.max(d,g.y)}for(var _=function(e){var i=n._tiles[h[e]];if(!i.holdingForFade()){var s=i.tileID,m=Math.pow(2,a.zoom-i.tileID.overscaledZ),y=r*i.queryPadding*t.EXTENT/i.tileSize/m,g=[s.getTilePoint(new t.MercatorCoordinate(p,c)),s.getTilePoint(new t.MercatorCoordinate(f,d))];if(g[0].x-y<t.EXTENT&&g[0].y-y<t.EXTENT&&g[1].x+y>=0&&g[1].y+y>=0){var _=l.map((function(t){return s.getTilePoint(t)})),v=u.map((function(t){return s.getTilePoint(t)}));o.push({tile:i,tileID:s,queryGeometry:_,cameraQueryGeometry:v,scale:m})}}},v=0;v<h.length;v++)_(v);return o},r.prototype.getVisibleCoordinates=function(t){for(var e=this,r=this.getRenderableIds(t).map((function(t){return e._tiles[t].tileID})),i=0,n=r;i<n.length;i+=1){var o=n[i];o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped())}return r},r.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(kt(this._source.type))for(var e in this._tiles){var r=this._tiles[e];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var i=this._tiles[t];i&&i.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function Mt(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),i=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||i-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function kt(t){return"raster"===t||"image"===t||"video"===t}function zt(){return new t.window.Worker(Ks.workerUrl)}Lt.maxOverzooming=10,Lt.maxUnderzooming=3;var Ct=function(){this.active={}};Ct.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<Ct.workerCount;)this.workers.push(new zt);return this.active[t]=!0,this.workers.slice()},Ct.prototype.release=function(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((function(t){t.terminate()})),this.workers=null)},Ct.prototype.isPreloaded=function(){return!!this.active.mapboxgl_preloaded_worker_pool},Ct.prototype.numActive=function(){return Object.keys(this.active).length};var Dt,Rt=Math.floor(t.browser.hardwareConcurrency/2);function Ft(e,r){var i={};for(var n in e)"ref"!==n&&(i[n]=e[n]);return t.refProperties.forEach((function(t){t in r&&(i[t]=r[t])})),i}function Ot(t){t=t.slice();for(var e=Object.create(null),r=0;r<t.length;r++)e[t[r].id]=t[r];for(var i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=Ft(t[i],e[t[i].ref]));return t}Ct.workerCount=Math.max(Math.min(Rt,6),1);var Bt={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 Nt(t,e,r){r.push({command:Bt.addSource,args:[t,e[t]]})}function Vt(t,e,r){e.push({command:Bt.removeSource,args:[t]}),r[t]=!0}function Ut(t,e,r,i){Vt(t,r,i),Nt(t,e,r)}function jt(e,r,i){var n;for(n in e[i])if(e[i].hasOwnProperty(n)&&"data"!==n&&!t.deepEqual(e[i][n],r[i][n]))return!1;for(n in r[i])if(r[i].hasOwnProperty(n)&&"data"!==n&&!t.deepEqual(e[i][n],r[i][n]))return!1;return!0}function qt(e,r,i,n,o,a){var s;for(s in r=r||{},e=e||{})e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||i.push({command:a,args:[n,s,r[s],o]}));for(s in r)r.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||i.push({command:a,args:[n,s,r[s],o]}))}function Gt(t){return t.id}function Zt(t,e){return t[e.id]=e,t}var Xt=function(t,e){this.reset(t,e)};Xt.prototype.reset=function(t,e){this.points=t||[],this._distances=[0];for(var r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-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},Xt.prototype.lerp=function(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);for(var r=1,i=this._distances[r],n=e*this.paddedLength+this.padding;i<n&&r<this._distances.length;)i=this._distances[++r];var o=r-1,a=this._distances[o],s=i-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[r].mult(l))};var Yt=function(t,e,r){var i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var o=0;o<this.xCellCount*this.yCellCount;o++)i.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 Wt(e,r,i,n,o){var a=t.create();return r?(t.scale(a,a,[1/o,1/o,1]),i||t.rotateZ(a,a,n.angle)):t.multiply(a,n.labelPlaneMatrix,e),a}function Ht(e,r,i,n,o){if(r){var a=t.clone(e);return t.scale(a,a,[o,o,1]),i||t.rotateZ(a,a,-n.angle),a}return n.glCoordMatrix}function Kt(e,r){var i=[e.x,e.y,0,1];se(i,i,r);var n=i[3];return{point:new t.Point(i[0]/n,i[1]/n),signedDistanceFromCamera:n}}function Jt(t,e){return.5+t/e*.5}function $t(t,e){var r=t[0]/t[3],i=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&i>=-e[1]&&i<=e[1]}function Qt(e,r,i,n,o,a,s,l){var u=n?e.textSizeData:e.iconSizeData,h=t.evaluateSizeForZoom(u,i.transform.zoom),p=[256/i.width*2+1,256/i.height*2+1],c=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;c.clear();for(var f=e.lineVertexArray,d=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=i.transform.width/i.transform.height,y=!1,g=0;g<d.length;g++){var _=d.get(g);if(_.hidden||_.writingMode===t.WritingMode.vertical&&!y)ae(_.numGlyphs,c);else{y=!1;var v=[_.anchorX,_.anchorY,0,1];if(t.transformMat4(v,v,r),$t(v,p)){var x=Jt(i.transform.cameraToCenterDistance,v[3]),b=t.evaluateSizeForFeature(u,h,_),w=s?b/x:b*x,I=new t.Point(_.anchorX,_.anchorY),S=Kt(I,o).point,T={},E=re(_,w,!1,l,r,o,a,e.glyphOffsetArray,f,c,S,I,T,m);y=E.useVertical,(E.notEnoughRoom||y||E.needsFlipping&&re(_,w,!0,l,r,o,a,e.glyphOffsetArray,f,c,S,I,T,m).notEnoughRoom)&&ae(_.numGlyphs,c)}else ae(_.numGlyphs,c)}}n?e.text.dynamicLayoutVertexBuffer.updateData(c):e.icon.dynamicLayoutVertexBuffer.updateData(c)}function te(t,e,r,i,n,o,a,s,l,u,h){var p=s.glyphStartIndex+s.numGlyphs,c=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,d=e.getoffsetX(s.glyphStartIndex),m=e.getoffsetX(p-1),y=ne(t*d,r,i,n,o,a,s.segment,c,f,l,u,h);if(!y)return null;var g=ne(t*m,r,i,n,o,a,s.segment,c,f,l,u,h);return g?{first:y,last:g}:null}function ee(e,r,i,n){return e===t.WritingMode.horizontal&&Math.abs(i.y-r.y)>Math.abs(i.x-r.x)*n?{useVertical:!0}:(e===t.WritingMode.vertical?r.y<i.y:r.x>i.x)?{needsFlipping:!0}:null}function re(e,r,i,n,o,a,s,l,u,h,p,c,f,d){var m,y=r/24,g=e.lineOffsetX*y,_=e.lineOffsetY*y;if(e.numGlyphs>1){var v=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=te(y,l,g,_,i,p,c,e,u,a,f);if(!w)return{notEnoughRoom:!0};var I=Kt(w.first.point,s).point,S=Kt(w.last.point,s).point;if(n&&!i){var T=ee(e.writingMode,I,S,d);if(T)return T}m=[w.first];for(var E=e.glyphStartIndex+1;E<v-1;E++)m.push(ne(y*l.getoffsetX(E),g,_,i,p,c,e.segment,x,b,u,a,f));m.push(w.last)}else{if(n&&!i){var P=Kt(c,o).point,A=e.lineStartIndex+e.segment+1,L=new t.Point(u.getx(A),u.gety(A)),M=Kt(L,o),k=M.signedDistanceFromCamera>0?M.point:ie(c,L,P,1,o),z=ee(e.writingMode,P,k,d);if(z)return z}var C=ne(y*l.getoffsetX(e.glyphStartIndex),g,_,i,p,c,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,f);if(!C)return{notEnoughRoom:!0};m=[C]}for(var D=0,R=m;D<R.length;D+=1){var F=R[D];t.addDynamicAttributes(h,F.point,F.angle)}return{}}function ie(t,e,r,i,n){var o=Kt(t.add(t.sub(e)._unit()),n).point,a=r.sub(o);return r.add(a._mult(i/a.mag()))}function ne(e,r,i,n,o,a,s,l,u,h,p,c){var f=n?e-r:e+r,d=f>0?1:-1,m=0;n&&(d*=-1,m=Math.PI),d<0&&(m+=Math.PI);for(var y=d>0?l+s:l+s+1,g=o,_=o,v=0,x=0,b=Math.abs(f),w=[];v+x<=b;){if((y+=d)<l||y>=u)return null;if(_=g,w.push(g),void 0===(g=c[y])){var I=new t.Point(h.getx(y),h.gety(y)),S=Kt(I,p);if(S.signedDistanceFromCamera>0)g=c[y]=S.point;else{var T=y-d;g=ie(0===v?a:new t.Point(h.getx(T),h.gety(T)),I,_,b-v+1,p)}}v+=x,x=_.dist(g)}var E=(b-v)/x,P=g.sub(_),A=P.mult(E)._add(_);A._add(P._unit()._perp()._mult(i*d));var L=m+Math.atan2(g.y-_.y,g.x-_.x);return w.push(A),{point:A,angle:L,path:w}}Yt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Yt.prototype.insert=function(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)},Yt.prototype.insertCircle=function(t,e,r,i){this._forEachCell(e-i,r-i,e+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(i)},Yt.prototype._insertBoxCell=function(t,e,r,i,n,o){this.boxCells[n].push(o)},Yt.prototype._insertCircleCell=function(t,e,r,i,n,o){this.circleCells[n].push(o)},Yt.prototype._query=function(t,e,r,i,n,o){if(r<0||t>this.width||i<0||e>this.height)return!n&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=i){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],h=this.circles[3*l+1],p=this.circles[3*l+2];a.push({key:this.circleKeys[l],x1:u-p,y1:h-p,x2:u+p,y2:h+p})}return o?a.filter(o):a}return this._forEachCell(t,e,r,i,this._queryCell,a,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?a.length>0:a},Yt.prototype._queryCircle=function(t,e,r,i,n){var o=t-r,a=t+r,s=e-r,l=e+r;if(a<0||o>this.width||l<0||s>this.height)return!i&&[];var u=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,u,{hitTest:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},n),i?u.length>0:u},Yt.prototype.query=function(t,e,r,i,n){return this._query(t,e,r,i,!1,n)},Yt.prototype.hitTest=function(t,e,r,i,n){return this._query(t,e,r,i,!0,n)},Yt.prototype.hitTestCircle=function(t,e,r,i){return this._queryCircle(t,e,r,!0,i)},Yt.prototype._queryCell=function(t,e,r,i,n,o,a,s){var l=a.seenUids,u=this.boxCells[n];if(null!==u)for(var h=this.bboxes,p=0,c=u;p<c.length;p+=1){var f=c[p];if(!l.box[f]){l.box[f]=!0;var d=4*f;if(t<=h[d+2]&&e<=h[d+3]&&r>=h[d+0]&&i>=h[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:h[d],y1:h[d+1],x2:h[d+2],y2:h[d+3]})}}}var m=this.circleCells[n];if(null!==m)for(var y=this.circles,g=0,_=m;g<_.length;g+=1){var v=_[g];if(!l.circle[v]){l.circle[v]=!0;var x=3*v;if(this._circleAndRectCollide(y[x],y[x+1],y[x+2],t,e,r,i)&&(!s||s(this.circleKeys[v]))){if(a.hitTest)return o.push(!0),!0;var b=y[x],w=y[x+1],I=y[x+2];o.push({key:this.circleKeys[v],x1:b-I,y1:w-I,x2:b+I,y2:w+I})}}}},Yt.prototype._queryCellCircle=function(t,e,r,i,n,o,a,s){var l=a.circle,u=a.seenUids,h=this.boxCells[n];if(null!==h)for(var p=this.bboxes,c=0,f=h;c<f.length;c+=1){var d=f[c];if(!u.box[d]){u.box[d]=!0;var m=4*d;if(this._circleAndRectCollide(l.x,l.y,l.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!s||s(this.boxKeys[d])))return o.push(!0),!0}}var y=this.circleCells[n];if(null!==y)for(var g=this.circles,_=0,v=y;_<v.length;_+=1){var x=v[_];if(!u.circle[x]){u.circle[x]=!0;var b=3*x;if(this._circlesCollide(g[b],g[b+1],g[b+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[x])))return o.push(!0),!0}}},Yt.prototype._forEachCell=function(t,e,r,i,n,o,a,s){for(var l=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),h=this._convertToXCellCoord(r),p=this._convertToYCellCoord(i),c=l;c<=h;c++)for(var f=u;f<=p;f++)if(n.call(this,t,e,r,i,this.xCellCount*f+c,o,a,s))return},Yt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},Yt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},Yt.prototype._circlesCollide=function(t,e,r,i,n,o){var a=i-t,s=n-e,l=r+o;return l*l>a*a+s*s},Yt.prototype._circleAndRectCollide=function(t,e,r,i,n,o,a){var s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+r)return!1;var u=(a-n)/2,h=Math.abs(e-(n+u));if(h>u+r)return!1;if(l<=s||h<=u)return!0;var p=l-s,c=h-u;return p*p+c*c<=r*r};var oe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ae(t,e){for(var r=0;r<t;r++){var i=e.length;e.resize(i+4),e.float32.set(oe,3*i)}}function se(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t[3]=r[3]*i+r[7]*n+r[15],t}var le=function(t,e,r){void 0===e&&(e=new Yt(t.width+200,t.height+200,25)),void 0===r&&(r=new Yt(t.width+200,t.height+200,25)),this.transform=t,this.grid=e,this.ignoredGrid=r,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 ue(e,r,i){return r*(t.EXTENT/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}le.prototype.placeCollisionBox=function(t,e,r,i,n){var o=this.projectAndGetPerspectiveRatio(i,t.anchorPointX,t.anchorPointY),a=r*o.perspectiveRatio,s=t.x1*a+o.point.x,l=t.y1*a+o.point.y,u=t.x2*a+o.point.x,h=t.y2*a+o.point.y;return!this.isInsideGrid(s,l,u,h)||!e&&this.grid.hitTest(s,l,u,h,n)?{box:[],offscreen:!1}:{box:[s,l,u,h],offscreen:this.isOffscreen(s,l,u,h)}},le.prototype.placeCollisionCircles=function(e,r,i,n,o,a,s,l,u,h,p,c,f){var d=[],m=new t.Point(r.anchorX,r.anchorY),y=Kt(m,a),g=Jt(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),_=(h?o/g:o*g)/t.ONE_EM,v=Kt(m,s).point,x=te(_,n,r.lineOffsetX*_,r.lineOffsetY*_,!1,v,m,r,i,s,{}),b=!1,w=!1,I=!0;if(x){for(var S=.5*c*g+f,T=new t.Point(-100,-100),E=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),P=new Xt,A=x.first,L=x.last,M=[],k=A.path.length-1;k>=1;k--)M.push(A.path[k]);for(var z=1;z<L.path.length;z++)M.push(L.path[z]);var C=2.5*S;if(l){var D=M.map((function(t){return Kt(t,l)}));M=D.some((function(t){return t.signedDistanceFromCamera<=0}))?[]:D.map((function(t){return t.point}))}var R=[];if(M.length>0){for(var F=M[0].clone(),O=M[0].clone(),B=1;B<M.length;B++)F.x=Math.min(F.x,M[B].x),F.y=Math.min(F.y,M[B].y),O.x=Math.max(O.x,M[B].x),O.y=Math.max(O.y,M[B].y);R=F.x>=T.x&&O.x<=E.x&&F.y>=T.y&&O.y<=E.y?[M]:O.x<T.x||F.x>E.x||O.y<T.y||F.y>E.y?[]:t.clipLine([M],T.x,T.y,E.x,E.y)}for(var N=0,V=R;N<V.length;N+=1){var U;P.reset(V[N],.25*S),U=P.length<=.5*S?1:Math.ceil(P.paddedLength/C)+1;for(var j=0;j<U;j++){var q=j/Math.max(U-1,1),G=P.lerp(q),Z=G.x+100,X=G.y+100;d.push(Z,X,S,0);var Y=Z-S,W=X-S,H=Z+S,K=X+S;if(I=I&&this.isOffscreen(Y,W,H,K),w=w||this.isInsideGrid(Y,W,H,K),!e&&this.grid.hitTestCircle(Z,X,S,p)&&(b=!0,!u))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!u&&b||!w?[]:d,offscreen:I,collisionDetected:b}},le.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var r=[],i=1/0,n=1/0,o=-1/0,a=-1/0,s=0,l=e;s<l.length;s+=1){var u=l[s],h=new t.Point(u.x+100,u.y+100);i=Math.min(i,h.x),n=Math.min(n,h.y),o=Math.max(o,h.x),a=Math.max(a,h.y),r.push(h)}for(var p={},c={},f=0,d=this.grid.query(i,n,o,a).concat(this.ignoredGrid.query(i,n,o,a));f<d.length;f+=1){var m=d[f],y=m.key;if(void 0===p[y.bucketInstanceId]&&(p[y.bucketInstanceId]={}),!p[y.bucketInstanceId][y.featureIndex]){var g=[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(r,g)&&(p[y.bucketInstanceId][y.featureIndex]=!0,void 0===c[y.bucketInstanceId]&&(c[y.bucketInstanceId]=[]),c[y.bucketInstanceId].push(y.featureIndex))}}return c},le.prototype.insertCollisionBox=function(t,e,r,i,n){(e?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:n},t[0],t[1],t[2],t[3])},le.prototype.insertCollisionCircles=function(t,e,r,i,n){for(var o=e?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:i,collisionGroupID:n},s=0;s<t.length;s+=4)o.insertCircle(a,t[s],t[s+1],t[s+2])},le.prototype.projectAndGetPerspectiveRatio=function(e,r,i){var n=[r,i,0,1];return se(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}},le.prototype.isOffscreen=function(t,e,r,i){return r<100||t>=this.screenRightBoundary||i<100||e>this.screenBottomBoundary},le.prototype.isInsideGrid=function(t,e,r,i){return r>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary},le.prototype.getViewportMatrix=function(){var e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e};var he=function(t,e,r,i){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):i&&r?1:0,this.placed=r};he.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var pe=function(t,e,r,i,n){this.text=new he(t?t.text:null,e,r,n),this.icon=new he(t?t.icon:null,e,i,n)};pe.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var ce=function(t,e,r){this.text=t,this.icon=e,this.skipFade=r},fe=function(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]},de=function(t,e,r,i,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n},me=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};function ye(e,r,i,n,o){var a=t.getAnchorAlignment(e),s=-(a.horizontalAlign-.5)*r,l=-(a.verticalAlign-.5)*i,u=t.evaluateVariableOffset(e,n);return new t.Point(s+u[0]*o,l+u[1]*o)}function ge(e,r,i,n,o,a){var s=e.x1,l=e.x2,u=e.y1,h=e.y2,p=e.anchorPointX,c=e.anchorPointY,f=new t.Point(r,i);return n&&f._rotate(o?a:-a),{x1:s+f.x,y1:u+f.y,x2:l+f.x,y2:h+f.y,anchorPointX:p,anchorPointY:c}}me.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 _e=function(t,e,r,i){this.transform=t.clone(),this.collisionIndex=new le(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new me(r),this.collisionCircleArrays={},this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}};function ve(t,e,r,i,n){t.emplaceBack(e?1:0,r?1:0,i||0,n||0),t.emplaceBack(e?1:0,r?1:0,i||0,n||0),t.emplaceBack(e?1:0,r?1:0,i||0,n||0),t.emplaceBack(e?1:0,r?1:0,i||0,n||0)}_e.prototype.getBucketParts=function(e,r,i,n){var o=i.getBucket(r),a=i.latestFeatureIndex;if(o&&a&&r.id===o.layerIds[0]){var s=i.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/t.EXTENT,p=this.transform.calculatePosMatrix(i.tileID.toUnwrapped()),c="map"===l.get("text-pitch-alignment"),f="map"===l.get("text-rotation-alignment"),d=ue(i,1,this.transform.zoom),m=Wt(p,c,f,this.transform,d),y=null;if(c){var g=Ht(p,c,f,this.transform,d);y=t.multiply([],this.transform.labelPlaneMatrix,g)}this.retainedQueryData[o.bucketInstanceId]=new de(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);var _={bucket:o,layout:l,posMatrix:p,textLabelPlaneMatrix:m,labelToScreenMatrix:y,scale:u,textPixelRatio:h,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(var v=0,x=o.sortKeyRanges;v<x.length;v+=1){var b=x[v];e.push({sortKey:b.sortKey,symbolInstanceStart:b.symbolInstanceStart,symbolInstanceEnd:b.symbolInstanceEnd,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}},_e.prototype.attemptAnchorPlacement=function(t,e,r,i,n,o,a,s,l,u,h,p,c,f,d){var m,y=[p.textOffset0,p.textOffset1],g=ye(t,r,i,y,n),_=this.collisionIndex.placeCollisionBox(ge(e,g.x,g.y,o,a,this.transform.angle),h,s,l,u.predicate);if(!d||0!==this.collisionIndex.placeCollisionBox(ge(d,g.x,g.y,o,a,this.transform.angle),h,s,l,u.predicate).box.length)return _.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(m=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:y,width:r,height:i,anchor:t,textBoxScale:n,prevAnchor:m},this.markUsedJustification(c,t,p,f),c.allowVerticalPlacement&&(this.markUsedOrientation(c,f,p),this.placedOrientations[p.crossTileID]=f),{shift:g,placedGlyphBoxes:_}):void 0},_e.prototype.placeLayerBucketPart=function(e,r,i){var n=this,o=e.parameters,a=o.bucket,s=o.layout,l=o.posMatrix,u=o.textLabelPlaneMatrix,h=o.labelToScreenMatrix,p=o.textPixelRatio,c=o.holdingForFade,f=o.collisionBoxArray,d=o.partiallyEvaluatedTextSize,m=o.collisionGroup,y=s.get("text-optional"),g=s.get("icon-optional"),_=s.get("text-allow-overlap"),v=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"),I="viewport-y"===s.get("symbol-z-order"),S=_&&(v||!a.hasIconData()||g),T=v&&(_||!a.hasTextData()||y);!a.collisionArrays&&f&&a.deserializeCollisionBoxes(f);var E=function(e,o){if(!r[e.crossTileID])if(c)n.placements[e.crossTileID]=new ce(!1,!1,!1);else{var f,I=!1,E=!1,P=!0,A=null,L={box:null,offscreen:null},M={box:null,offscreen:null},k=null,z=null,C=0,D=0,R=0;o.textFeatureIndex?C=o.textFeatureIndex:e.useRuntimeCollisionCircles&&(C=e.featureIndex),o.verticalTextFeatureIndex&&(D=o.verticalTextFeatureIndex);var F=o.textBox;if(F){var O=function(r){var i=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!r&&n.prevPlacement){var o=n.prevPlacement.placedOrientations[e.crossTileID];o&&(n.placedOrientations[e.crossTileID]=o,n.markUsedOrientation(a,i=o,e))}return i},B=function(r,i){if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&o.verticalTextBox)for(var n=0,s=a.writingModes;n<s.length&&(s[n]===t.WritingMode.vertical?(L=i(),M=L):L=r(),!(L&&L.box&&L.box.length));n+=1);else L=r()};if(s.get("text-variable-anchor")){var N=s.get("text-variable-anchor");if(n.prevPlacement&&n.prevPlacement.variableOffsets[e.crossTileID]){var V=n.prevPlacement.variableOffsets[e.crossTileID];N.indexOf(V.anchor)>0&&(N=N.filter((function(t){return t!==V.anchor}))).unshift(V.anchor)}var U=function(t,r,i){for(var o=t.x2-t.x1,s=t.y2-t.y1,u=e.textBoxScale,h=w&&!v?r:null,c={box:[],offscreen:!1},f=_?2*N.length:N.length,d=0;d<f;++d){var y=n.attemptAnchorPlacement(N[d%N.length],t,o,s,u,x,b,p,l,m,d>=N.length,e,a,i,h);if(y&&(c=y.placedGlyphBoxes)&&c.box&&c.box.length){I=!0,A=y.shift;break}}return c};B((function(){return U(F,o.iconBox,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&!(L&&L.box&&L.box.length)&&e.numVerticalGlyphVertices>0&&r?U(r,o.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),L&&(I=L.box,P=L.offscreen);var j=O(L&&L.box);if(!I&&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,r){var i=n.collisionIndex.placeCollisionBox(t,_,p,l,m.predicate);return i&&i.box&&i.box.length&&(n.markUsedOrientation(a,r,e),n.placedOrientations[e.crossTileID]=r),i};B((function(){return G(F,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?G(r,t.WritingMode.vertical):{box:null,offscreen:null}})),O(L&&L.box&&L.box.length)}}if(I=(f=L)&&f.box&&f.box.length>0,P=f&&f.offscreen,e.useRuntimeCollisionCircles){var Z=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),X=t.evaluateSizeForFeature(a.textSizeData,d,Z),Y=s.get("text-padding");k=n.collisionIndex.placeCollisionCircles(_,Z,a.lineVertexArray,a.glyphOffsetArray,X,l,u,h,i,b,m.predicate,e.collisionCircleDiameter,Y),I=_||k.circles.length>0&&!k.collisionDetected,P=P&&k.offscreen}if(o.iconFeatureIndex&&(R=o.iconFeatureIndex),o.iconBox){var W=function(t){var e=w&&A?ge(t,A.x,A.y,x,b,n.transform.angle):t;return n.collisionIndex.placeCollisionBox(e,v,p,l,m.predicate)};E=M&&M.box&&M.box.length&&o.verticalIconBox?(z=W(o.verticalIconBox)).box.length>0:(z=W(o.iconBox)).box.length>0,P=P&&z.offscreen}var H=y||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,K=g||0===e.numIconVertices;if(H||K?K?H||(E=E&&I):I=E&&I:E=I=E&&I,I&&f&&f.box&&n.collisionIndex.insertCollisionBox(f.box,s.get("text-ignore-placement"),a.bucketInstanceId,M&&M.box&&D?D:C,m.ID),E&&z&&n.collisionIndex.insertCollisionBox(z.box,s.get("icon-ignore-placement"),a.bucketInstanceId,R,m.ID),k&&(I&&n.collisionIndex.insertCollisionCircles(k.circles,s.get("text-ignore-placement"),a.bucketInstanceId,C,m.ID),i)){var J=a.bucketInstanceId,$=n.collisionCircleArrays[J];void 0===$&&($=n.collisionCircleArrays[J]=new fe);for(var Q=0;Q<k.circles.length;Q+=4)$.circles.push(k.circles[Q+0]),$.circles.push(k.circles[Q+1]),$.circles.push(k.circles[Q+2]),$.circles.push(k.collisionDetected?1:0)}n.placements[e.crossTileID]=new ce(I||S,E||T,P||a.justReloaded),r[e.crossTileID]=!0}};if(I)for(var P=a.getSortedSymbolIndexes(this.transform.angle),A=P.length-1;A>=0;--A){var L=P[A];E(a.symbolInstances.get(L),a.collisionArrays[L])}else for(var M=e.symbolInstanceStart;M<e.symbolInstanceEnd;M++)E(a.symbolInstances.get(M),a.collisionArrays[M]);if(i&&a.bucketInstanceId in this.collisionCircleArrays){var k=this.collisionCircleArrays[a.bucketInstanceId];t.invert(k.invProjMatrix,l),k.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1},_e.prototype.markUsedJustification=function(e,r,i,n){var o;o=n===t.WritingMode.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(r)];for(var a=0,s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];a<s.length;a+=1){var l=s[a];l>=0&&(e.text.placedSymbolArray.get(l).crossTileID=o>=0&&l!==o?0:i.crossTileID)}},_e.prototype.markUsedOrientation=function(e,r,i){for(var n=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,o=r===t.WritingMode.vertical?r:0,a=0,s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];a<s.length;a+=1)e.text.placedSymbolArray.get(s[a]).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)},_e.prototype.commit=function(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;var e=this.prevPlacement,r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;var i=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 pe(u,i,l.text,l.icon),r=r||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new pe(null,i,l.text,l.icon,l.skipFade),r=r||l.text||l.icon)}for(var h in n){var p=n[h];if(!this.opacities[h]){var c=new pe(p,i,!1,!1);c.isHidden()||(this.opacities[h]=c,r=r||p.text.placed||p.icon.placed)}}for(var f in o)this.variableOffsets[f]||!this.opacities[f]||this.opacities[f].isHidden()||(this.variableOffsets[f]=o[f]);for(var d in a)this.placedOrientations[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.placedOrientations[d]=a[d]);r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},_e.prototype.updateLayerOpacities=function(t,e){for(var r={},i=0,n=e;i<n.length;i+=1){var o=n[i],a=o.getBucket(t);a&&o.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,r,o.collisionBoxArray)}},_e.prototype.updateBucketOpacities=function(e,r,i){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 pe(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),u=o.get("text-variable-anchor"),h="map"===o.get("text-rotation-alignment"),p="map"===o.get("text-pitch-alignment"),c="none"!==o.get("icon-text-fit"),f=new pe(null,0,s&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);for(var d=function(t,e,r){for(var i=0;i<e/4;i++)t.opacityVertexArray.emplaceBack(r)},m=function(i){var o=e.symbolInstances.get(i),s=o.numHorizontalGlyphVertices,l=o.numVerticalGlyphVertices,m=o.crossTileID,y=n.opacities[m];r[m]?y=a:y||(n.opacities[m]=y=f),r[m]=!0;var g=o.numIconVertices>0,_=n.placedOrientations[o.crossTileID],v=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=Pe(y.text);d(e.text,s,v?Ae:b),d(e.text,l,x?Ae:b);var w=y.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||v?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var I=n.variableOffsets[o.crossTileID];I&&n.markUsedJustification(e,I.anchor,o,_);var S=n.placedOrientations[o.crossTileID];S&&(n.markUsedJustification(e,"left",o,S),n.markUsedOrientation(e,S,o))}if(g){var T=Pe(y.icon),E=!(c&&o.verticalPlacedIconSymbolIndex&&v);o.placedIconSymbolIndex>=0&&(d(e.icon,o.numIconVertices,E?T:Ae),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=y.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,o.numVerticalIconVertices,E?Ae:T),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var P=e.collisionArrays[i];if(P){var A=new t.Point(0,0);if(P.textBox||P.verticalTextBox){var L=!0;if(u){var M=n.variableOffsets[m];M?(A=ye(M.anchor,M.width,M.height,M.textOffset,M.textBoxScale),h&&A._rotate(p?n.transform.angle:-n.transform.angle)):L=!1}P.textBox&&ve(e.textCollisionBox.collisionVertexArray,y.text.placed,!L||v,A.x,A.y),P.verticalTextBox&&ve(e.textCollisionBox.collisionVertexArray,y.text.placed,!L||x,A.x,A.y)}var k=Boolean(!x&&P.verticalIconBox);P.iconBox&&ve(e.iconCollisionBox.collisionVertexArray,y.icon.placed,k,c?A.x:0,c?A.y:0),P.verticalIconBox&&ve(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!k,c?A.x:0,c?A.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 g=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=g.invProjMatrix,e.placementViewportMatrix=g.viewportMatrix,e.collisionCircleArray=g.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}},_e.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},_e.prototype.zoomAdjustment=function(t){return Math.max(0,(this.transform.zoom-t)/1.5)},_e.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},_e.prototype.stillRecent=function(t,e){var r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t},_e.prototype.setStale=function(){this.stale=!0};var xe=Math.pow(2,25),be=Math.pow(2,24),we=Math.pow(2,17),Ie=Math.pow(2,16),Se=Math.pow(2,9),Te=Math.pow(2,8),Ee=Math.pow(2,1);function Pe(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*xe+e*be+r*we+e*Ie+r*Se+e*Te+r*Ee+e}var Ae=0,Le=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=[]};Le.prototype.continuePlacement=function(t,e,r,i,n){for(var o=this._bucketParts;this._currentTileIndex<t.length;)if(e.getBucketParts(o,i,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,r),this._currentPartIndex++,n())return!0;return!1};var Me=function(t,e,r,i,n,o,a){this.placement=new _e(t,n,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1};Me.prototype.isDone=function(){return this._done},Me.prototype.continuePlacement=function(e,r,i){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=r[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 Le(s)),this._inProgressLayer.continuePlacement(i[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Me.prototype.commit=function(t){return this.placement.commit(t),this.placement};var ke=512/t.EXTENT/2,ze=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var i=0;i<e.length;i++){var n=e.get(i),o=n.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:n.crossTileID,coord:this.getScaledCoordinates(n,t)})}};ze.prototype.getScaledCoordinates=function(e,r){var i=ke/Math.pow(2,r.canonical.z-this.tileID.canonical.z);return{x:Math.floor((r.canonical.x*t.EXTENT+e.anchorX)*i),y:Math.floor((r.canonical.y*t.EXTENT+e.anchorY)*i)}},ze.prototype.findMatches=function(t,e,r){for(var i=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 h=u[l];if(Math.abs(h.coord.x-s.x)<=i&&Math.abs(h.coord.y-s.y)<=i&&!r[h.crossTileID]){r[h.crossTileID]=!0,o.crossTileID=h.crossTileID;break}}}}};var Ce=function(){this.maxCrossTileID=0};Ce.prototype.generate=function(){return++this.maxCrossTileID};var De=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};De.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var r in this.indexes){var i=this.indexes[r],n={};for(var o in i){var a=i[o];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),n[a.tileID.key]=a}this.indexes[r]=n}this.lng=t},De.prototype.addBucket=function(t,e,r){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 i=0;i<e.symbolInstances.length;i++)e.symbolInstances.get(i).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 h=0;h<e.symbolInstances.length;h++){var p=e.symbolInstances.get(h);p.crossTileID||(p.crossTileID=r.generate(),n[p.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new ze(t,e.symbolInstances,e.bucketInstanceId),!0},De.prototype.removeBucketCrossTileIDs=function(t,e){for(var r in e.indexedSymbolInstances)for(var i=0,n=e.indexedSymbolInstances[r];i<n.length;i+=1)delete this.usedCrossTileIDs[t][n[i].crossTileID]},De.prototype.removeStaleBuckets=function(t){var e=!1;for(var r in this.indexes){var i=this.indexes[r];for(var n in i)t[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],e=!0)}return e};var Re=function(){this.layerIndexes={},this.crossTileIDs=new Ce,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Re.prototype.addLayer=function(t,e,r){var i=this.layerIndexes[t.id];void 0===i&&(i=this.layerIndexes[t.id]=new De);var n=!1,o={};i.handleWrapJump(r);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),i.addBucket(l.tileID,u,this.crossTileIDs)&&(n=!0),o[u.bucketInstanceId]=!0)}return i.removeStaleBuckets(o)&&(n=!0),n},Re.prototype.pruneUnusedLayers=function(t){var e={};for(var r in t.forEach((function(t){e[t]=!0})),this.layerIndexes)e[r]||delete this.layerIndexes[r]};var Fe=function(e,r){return t.emitValidationErrors(e,r&&r.filter((function(t){return"source.canvas"!==t.identifier})))},Oe=t.pick(Bt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Be=t.pick(Bt,["setCenter","setZoom","setBearing","setPitch"]),Ne=function(){var e={},r=t.styleSpec.$version;for(var i in t.styleSpec.$root){var n,o=t.styleSpec.$root[i];o.required&&null!=(n="version"===i?r:"array"===o.type?[]:{})&&(e[i]=n)}return e}(),Ve=function(e){function r(i,n){var o=this;void 0===n&&(n={}),e.call(this),this.map=i,this.dispatcher=new I((Dt||(Dt=new Ct),Dt),this),this.imageManager=new p,this.imageManager.setEventedParent(this),this.glyphManager=new _(i._requestManager,n.localIdeographFontFamily),this.lineAtlas=new w(256,512),this.crossTileSymbolIndex=new Re,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=r.registerForPluginStateChange((function(e){a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(function(e,r){if(t.triggerPluginCompletionEvent(e),r&&r.every((function(t){return t})))for(var i in a.sourceCaches)a.sourceCaches[i].reload()}))})),this.on("data",(function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=o.sourceCaches[t.sourceId];if(e){var r=e.getSource();if(r&&r.vectorLayerIds)for(var i in o._layers){var n=o._layers[i];n.source===r.id&&o._validateLayer(n)}}}}))}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadURL=function(e,r){var i=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var n="boolean"==typeof r.validate?r.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,r.accessToken);var o=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(o,(function(e,r){i._request=null,e?i.fire(new t.ErrorEvent(e)):r&&i._load(r,n)}))},r.prototype.loadJSON=function(e,r){var i=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((function(){i._request=null,i._load(e,!1!==r.validate)}))},r.prototype.loadEmpty=function(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Ne,!1)},r.prototype._load=function(e,r){if(!r||!Fe(this,t.validateStyle(e))){for(var i in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(i,e.sources[i],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var n=Ot(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 b(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}},r.prototype._loadSprite=function(e){var r=this;this._spriteRequest=function(e,r,i){var n,o,a,s=t.browser.devicePixelRatio>1?"@2x":"",l=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,a||(a=t,n=e,h())})),u=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){u=null,a||(a=t,o=e,h())}));function h(){if(a)i(a);else if(n&&o){var e=t.browser.getImageData(o),r={};for(var s in n){var l=n[s],u=l.width,h=l.height,p=l.x,c=l.y,f=l.sdf,d=l.pixelRatio,m=l.stretchX,y=l.stretchY,g=l.content,_=new t.RGBAImage({width:u,height:h});t.RGBAImage.copy(e,_,{x:p,y:c},{x:0,y:0},{width:u,height:h}),r[s]={data:_,pixelRatio:d,sdf:f,stretchX:m,stretchY:y,content:g}}i(null,r)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(e,this.map._requestManager,(function(e,i){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(i)for(var n in i)r.imageManager.addImage(n,i[n]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var i=e.sourceLayer;if(i){var n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+i+'" does not exist on source "'+n.id+'" as specified by style layer "'+e.id+'"')))}}},r.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()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,i=t;r<i.length;r+=1){var n=this._layers[i[r]];"custom"!==n.type&&e.push(n.serialize())}return e},r.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},r.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},r.prototype.update=function(e){if(this._loaded){var r=this._changed;if(this._changed){var i=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);for(var o in(i.length||n.length)&&this._updateWorkerLayers(i,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 h=this.sourceCaches[u];l[u]=h.used,h.used=!1}for(var p=0,c=this._order;p<c.length;p+=1){var f=this._layers[c[p]];f.recalculate(e,this._availableImages),!f.isHidden(e.zoom)&&f.source&&(this.sourceCaches[f.source].used=!0)}for(var d in l){var m=this.sourceCaches[d];l[d]!==m.used&&m.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.z=e.zoom,r&&this.fire(new t.Event("data",{dataType:"style"}))}},r.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={}}},r.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},r.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},r.prototype.setState=function(e){var r=this;if(this._checkLoaded(),Fe(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=Ot(e.layers);var i=function(e,r){if(!e)return[{command:Bt.setStyle,args:[r]}];var i=[];try{if(!t.deepEqual(e.version,r.version))return[{command:Bt.setStyle,args:[r]}];t.deepEqual(e.center,r.center)||i.push({command:Bt.setCenter,args:[r.center]}),t.deepEqual(e.zoom,r.zoom)||i.push({command:Bt.setZoom,args:[r.zoom]}),t.deepEqual(e.bearing,r.bearing)||i.push({command:Bt.setBearing,args:[r.bearing]}),t.deepEqual(e.pitch,r.pitch)||i.push({command:Bt.setPitch,args:[r.pitch]}),t.deepEqual(e.sprite,r.sprite)||i.push({command:Bt.setSprite,args:[r.sprite]}),t.deepEqual(e.glyphs,r.glyphs)||i.push({command:Bt.setGlyphs,args:[r.glyphs]}),t.deepEqual(e.transition,r.transition)||i.push({command:Bt.setTransition,args:[r.transition]}),t.deepEqual(e.light,r.light)||i.push({command:Bt.setLight,args:[r.light]});var n={},o=[];!function(e,r,i,n){var o;for(o in r=r||{},e=e||{})e.hasOwnProperty(o)&&(r.hasOwnProperty(o)||Vt(o,i,n));for(o in r)r.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.deepEqual(e[o],r[o])||("geojson"===e[o].type&&"geojson"===r[o].type&&jt(e,r,o)?i.push({command:Bt.setGeoJSONSourceData,args:[o,r[o].data]}):Ut(o,r,i,n)):Nt(o,r,i))}(e.sources,r.sources,o,n);var a=[];e.layers&&e.layers.forEach((function(t){n[t.source]?i.push({command:Bt.removeLayer,args:[t.id]}):a.push(t)})),i=i.concat(o),function(e,r,i){r=r||[];var n,o,a,s,l,u,h,p=(e=e||[]).map(Gt),c=r.map(Gt),f=e.reduce(Zt,{}),d=r.reduce(Zt,{}),m=p.slice(),y=Object.create(null);for(n=0,o=0;n<p.length;n++)d.hasOwnProperty(a=p[n])?o++:(i.push({command:Bt.removeLayer,args:[a]}),m.splice(m.indexOf(a,o),1));for(n=0,o=0;n<c.length;n++)m[m.length-1-n]!==(a=c[c.length-1-n])&&(f.hasOwnProperty(a)?(i.push({command:Bt.removeLayer,args:[a]}),m.splice(m.lastIndexOf(a,m.length-o),1)):o++,i.push({command:Bt.addLayer,args:[d[a],u=m[m.length-n]]}),m.splice(m.length-n,0,a),y[a]=!0);for(n=0;n<c.length;n++)if(s=f[a=c[n]],l=d[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(h in qt(s.layout,l.layout,i,a,null,Bt.setLayoutProperty),qt(s.paint,l.paint,i,a,null,Bt.setPaintProperty),t.deepEqual(s.filter,l.filter)||i.push({command:Bt.setFilter,args:[a,l.filter]}),t.deepEqual(s.minzoom,l.minzoom)&&t.deepEqual(s.maxzoom,l.maxzoom)||i.push({command:Bt.setLayerZoomRange,args:[a,l.minzoom,l.maxzoom]}),s)s.hasOwnProperty(h)&&"layout"!==h&&"paint"!==h&&"filter"!==h&&"metadata"!==h&&"minzoom"!==h&&"maxzoom"!==h&&(0===h.indexOf("paint.")?qt(s[h],l[h],i,a,h.slice(6),Bt.setPaintProperty):t.deepEqual(s[h],l[h])||i.push({command:Bt.setLayerProperty,args:[a,h,l[h]]}));for(h in l)l.hasOwnProperty(h)&&!s.hasOwnProperty(h)&&"layout"!==h&&"paint"!==h&&"filter"!==h&&"metadata"!==h&&"minzoom"!==h&&"maxzoom"!==h&&(0===h.indexOf("paint.")?qt(s[h],l[h],i,a,h.slice(6),Bt.setPaintProperty):t.deepEqual(s[h],l[h])||i.push({command:Bt.setLayerProperty,args:[a,h,l[h]]}))}else i.push({command:Bt.removeLayer,args:[a]}),u=m[m.lastIndexOf(a)+1],i.push({command:Bt.addLayer,args:[l,u]})}(a,r.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:Bt.setStyle,args:[r]}]}return i}(this.serialize(),e).filter((function(t){return!(t.command in Be)}));if(0===i.length)return!1;var n=i.filter((function(t){return!(t.command in Oe)}));if(n.length>0)throw new Error("Unimplemented: "+n.map((function(t){return t.command})).join(", ")+".");return i.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._afterImageUpdated(e)},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.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)},r.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"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,i){var n=this;if(void 0===i&&(i={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,i))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Lt(e,r,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}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.clearTiles(),i.onRemove&&i.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,i){void 0===i&&(i={}),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(Fe(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},i))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[o.id]=o.serialize()}var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" 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)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var i=this._order.indexOf(e);this._order.splice(i,1);var n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" 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.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.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.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,i){this._checkLoaded();var n=this.getLayer(e);n?n.minzoom===r&&n.maxzoom===i||(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),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.")))},r.prototype.setFilter=function(e,r,i){void 0===i&&(i={}),this._checkLoaded();var n=this.getLayer(e);if(n){if(!t.deepEqual(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,"layers."+n.id+".filter",r,null,i)||(n.filter=t.clone$1(r),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.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,i,n){void 0===n&&(n={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(r),i)||(o.setLayoutProperty(r,i,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.")))},r.prototype.getLayoutProperty=function(e,r){var i=this.getLayer(e);if(i)return i.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,i,n){void 0===n&&(n={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(r),i)||(o.setPaintProperty(r,i,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.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var i=e.source,n=e.sourceLayer,o=this.sourceCaches[i];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,r)):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.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var i=e.source,n=this.sourceCaches[i];if(void 0!==n){var o=n.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?r&&"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,r):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.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,i=e.sourceLayer,n=this.sourceCaches[r];if(void 0!==n){if("vector"!==n.getSource().type||i)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),n.getFeatureState(i,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 '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.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}))},r.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},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},i={},n=[],o=this._order.length-1;o>=0;o--){var a=this._order[o];if(r(a)){i[a]=o;for(var s=0,l=t;s<l.length;s+=1){var u=l[s][a];if(u)for(var h=0,p=u;h<p.length;h+=1)n.push(p[h])}}}n.sort((function(t,e){return e.intersectionZ-t.intersectionZ}));for(var c=[],f=this._order.length-1;f>=0;f--){var d=this._order[f];if(r(d))for(var m=n.length-1;m>=0;m--){var y=n[m].feature;if(i[y.layer.id]<f)break;c.push(y),n.pop()}else for(var g=0,_=t;g<_.length;g+=1){var v=_[g][d];if(v)for(var x=0,b=v;x<b.length;x+=1)c.push(b[x].feature)}}return c},r.prototype.queryRenderedFeatures=function(e,r,i){r&&r.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",r.filter,null,r);var n={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var o=0,a=r.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 h in r.availableImages=this._availableImages,this.sourceCaches)r.layers&&!n[h]||u.push(F(this.sourceCaches[h],this._layers,this._serializedLayers,e,r,i));return this.placement&&u.push(function(t,e,r,i,n,o,a){for(var s={},l=o.queryRenderedSymbols(i),u=[],h=0,p=Object.keys(l).map(Number);h<p.length;h+=1)u.push(a[p[h]]);u.sort(O);for(var c=function(){var r=d[f],i=r.featureIndex.lookupSymbolFeatures(l[r.bucketInstanceId],e,r.bucketIndex,r.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(var o in i){var a=s[o]=s[o]||[],u=i[o];u.sort((function(t,e){var i=r.featureSortOrder;if(i){var n=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-n}return e.featureIndex-t.featureIndex}));for(var h=0,p=u;h<p.length;h+=1)a.push(p[h])}},f=0,d=u;f<d.length;f+=1)c();var m=function(e){s[e].forEach((function(i){var n=i.feature,o=r[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,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)},r.prototype.querySourceFeatures=function(e,r){r&&r.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",r.filter,null,r);var i=this.sourceCaches[e];return i?function(t,e){for(var r=t.getRenderableIds().map((function(e){return t.getTileByID(e)})),i=[],n={},o=0;o<r.length;o++){var a=r[o],s=a.tileID.canonical.key;n[s]||(n[s]=!0,a.querySourceFeatures(i,e))}return i}(i,r):[]},r.prototype.addSourceType=function(t,e,i){return r.getSourceType(t)?i(new Error('A source type called "'+t+'" already exists.')):(r.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))},r.prototype.getLight=function(){return this.light.getLight()},r.prototype.setLight=function(e,r){void 0===r&&(r={}),this._checkLoaded();var i=this.light.getLight(),n=!1;for(var o in e)if(!t.deepEqual(e[o],i[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,r),this.light.updateTransitions(a)}},r.prototype._validate=function(e,r,i,n,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&Fe(this,e.call(t.validateStyle,t.extend({key:r,style:this.serialize(),value:i,styleSpec:t.styleSpec},n)))},r.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 r in this.sourceCaches)this.sourceCaches[r].clearTiles(),this.sourceCaches[r].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},r.prototype._clearSource=function(t){this.sourceCaches[t].clearTiles()},r.prototype._reloadSource=function(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()},r.prototype._updateSources=function(t){for(var e in this.sourceCaches)this.sourceCaches[e].update(t)},r.prototype._generateCollisionBoxes=function(){for(var t in this.sourceCaches)this._reloadSource(t)},r.prototype._updatePlacement=function(e,r,i,n,o){void 0===o&&(o=!1);for(var a=!1,s=!1,l={},u=0,h=this._order;u<h.length;u+=1){var p=this._layers[h[u]];if("symbol"===p.type){if(!l[p.source]){var c=this.sourceCaches[p.source];l[p.source]=c.getRenderableIds(!0).map((function(t){return c.getTileByID(t)})).sort((function(t,e){return e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)}))}var f=this.crossTileSymbolIndex.addLayer(p,l[p.source],e.center.lng);a=a||f}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Me(e,this._order,o,r,i,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 d=0,m=this._order;d<m.length;d+=1){var y=this._layers[m[d]];"symbol"===y.type&&this.placement.updateLayerOpacities(y,l[y.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())},r.prototype._releaseSymbolFadeTiles=function(){for(var t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()},r.prototype.getImages=function(t,e,r){this.imageManager.getImages(e.icons,r),this._updateTilesForChangedImages();var i=this.sourceCaches[e.source];i&&i.setDependencies(e.tileID.key,e.type,e.icons)},r.prototype.getGlyphs=function(t,e,r){this.glyphManager.getGlyphs(e.stacks,r)},r.prototype.getResource=function(e,r,i){return t.makeRequest(r,i)},r}(t.Evented);Ve.getSourceType=function(t){return D[t]},Ve.setSourceType=function(t,e){D[t]=e},Ve.registerForPluginStateChange=t.registerForPluginStateChange;var Ue=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),je=yr("#ifdef GL_ES\r\nprecision mediump float;\r\n#else\r\n#if !defined(lowp)\r\n#define lowp\r\n#endif\r\n#if !defined(mediump)\r\n#define mediump\r\n#endif\r\n#if !defined(highp)\r\n#define highp\r\n#endif\r\n#endif","#ifdef GL_ES\r\nprecision highp float;\r\n#else\r\n#if !defined(lowp)\r\n#define lowp\r\n#endif\r\n#if !defined(mediump)\r\n#define mediump\r\n#endif\r\n#if !defined(highp)\r\n#define highp\r\n#endif\r\n#endif\nvec2 unpack_float(const float packedValue) {\r\nint packedIntValue=int(packedValue);\r\nint v0=packedIntValue/256;\r\nreturn vec2(v0,packedIntValue-v0*256);\r\n}\r\nvec2 unpack_opacity(const float packedOpacity) {\r\nint intOpacity=int(packedOpacity)/2;\r\nreturn vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));\r\n}vec4 decode_color(const vec2 encodedColor) {\r\nreturn vec4(\r\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\r\n);\r\n}float unpack_mix_vec2(const vec2 packedValue,const float t) {\r\nreturn mix(packedValue[0],packedValue[1],t);\r\n}vec4 unpack_mix_color(const vec4 packedColors,const float t) {\r\nvec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));\r\nvec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));\r\nreturn mix(minColor,maxColor,t);\r\n}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) {\r\nvec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);\r\nreturn (tile_units_to_pixels*pos+offset)/pattern_size;\r\n}"),qe=yr("uniform vec4 u_color;\r\nuniform float u_opacity;\r\nvoid main() {\r\ngl_FragColor=u_color*u_opacity;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","attribute vec2 a_pos;\r\nuniform mat4 u_matrix;\r\nvoid main() {\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\n}"),Ge=yr("uniform vec2 u_pattern_tl_a;\r\nuniform vec2 u_pattern_br_a;\r\nuniform vec2 u_pattern_tl_b;\r\nuniform vec2 u_pattern_br_b;\r\nuniform vec2 u_texsize;\r\nuniform float u_mix;\r\nuniform float u_opacity;\r\nuniform sampler2D u_image;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvoid main() {\r\nvec2 imagecoord=mod(v_pos_a,1.0);\r\nvec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);\r\nvec4 color1=texture2D(u_image,pos);\r\nvec2 imagecoord_b=mod(v_pos_b,1.0);\r\nvec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);\r\nvec4 color2=texture2D(u_image,pos2);\r\ngl_FragColor=mix(color1,color2,u_mix)*u_opacity;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_pattern_size_a;\r\nuniform vec2 u_pattern_size_b;\r\nuniform vec2 u_pixel_coord_upper;\r\nuniform vec2 u_pixel_coord_lower;\r\nuniform float u_scale_a;\r\nuniform float u_scale_b;\r\nuniform float u_tile_units_to_pixels;\r\nattribute vec2 a_pos;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvoid main() {\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\nv_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);\r\nv_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);\r\n}"),Ze=yr("varying vec3 v_data;\r\n#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define mediump float radius\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define highp vec4 stroke_color\r\n#pragma mapbox: define mediump float stroke_width\r\n#pragma mapbox: define lowp float stroke_opacity\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize mediump float radius\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize highp vec4 stroke_color\r\n#pragma mapbox: initialize mediump float stroke_width\r\n#pragma mapbox: initialize lowp float stroke_opacity\r\nvec2 extrude=v_data.xy;\r\nfloat extrude_length=length(extrude);\r\nlowp float antialiasblur=v_data.z;\r\nfloat antialiased_blur=-max(blur,antialiasblur);\r\nfloat opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);\r\nfloat color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\r\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\r\n);\r\ngl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform bool u_scale_with_map;\r\nuniform bool u_pitch_with_map;\r\nuniform vec2 u_extrude_scale;\r\nuniform lowp float u_device_pixel_ratio;\r\nuniform highp float u_camera_to_center_distance;\r\nattribute vec2 a_pos;\r\nvarying vec3 v_data;\r\n#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define mediump float radius\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define highp vec4 stroke_color\r\n#pragma mapbox: define mediump float stroke_width\r\n#pragma mapbox: define lowp float stroke_opacity\r\nvoid main(void) {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize mediump float radius\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize highp vec4 stroke_color\r\n#pragma mapbox: initialize mediump float stroke_width\r\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);\r\nif (u_pitch_with_map) {\r\nvec2 corner_position=circle_center;\r\nif (u_scale_with_map) {\r\ncorner_position+=extrude*(radius+stroke_width)*u_extrude_scale;\r\n} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);\r\ncorner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);\r\n}\r\ngl_Position=u_matrix*vec4(corner_position,0,1);\r\n} else {\r\ngl_Position=u_matrix*vec4(circle_center,0,1);\r\nif (u_scale_with_map) {\r\ngl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;\r\n} else {\r\ngl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;\r\n}\r\n}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);\r\nv_data=vec3(extrude.x,extrude.y,antialiasblur);\r\n}"),Xe=yr("void main() {\r\ngl_FragColor=vec4(1.0);\r\n}","attribute vec2 a_pos;\r\nuniform mat4 u_matrix;\r\nvoid main() {\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\n}"),Ye=yr("uniform highp float u_intensity;\r\nvarying vec2 v_extrude;\r\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\r\nvoid main() {\r\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);\r\nfloat val=weight*u_intensity*GAUSS_COEF*exp(d);\r\ngl_FragColor=vec4(val,1.0,1.0,1.0);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform float u_extrude_scale;\r\nuniform float u_opacity;\r\nuniform float u_intensity;\r\nattribute vec2 a_pos;\r\nvarying vec2 v_extrude;\r\n#pragma mapbox: define highp float weight\r\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\r\nvoid main(void) {\r\n#pragma mapbox: initialize highp float weight\r\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);\r\ngl_Position=u_matrix*pos;\r\n}"),We=yr("uniform sampler2D u_image;\r\nuniform sampler2D u_color_ramp;\r\nuniform float u_opacity;\r\nvarying vec2 v_pos;\r\nvoid main() {\r\nfloat t=texture2D(u_image,v_pos).r;\r\nvec4 color=texture2D(u_color_ramp,vec2(t,0.5));\r\ngl_FragColor=color*u_opacity;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(0.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_world;\r\nattribute vec2 a_pos;\r\nvarying vec2 v_pos;\r\nvoid main() {\r\ngl_Position=u_matrix*vec4(a_pos*u_world,0,1);\r\nv_pos.x=a_pos.x;\r\nv_pos.y=1.0-a_pos.y;\r\n}"),He=yr("varying float v_placed;\r\nvarying float v_notUsed;\r\nvoid main() {\r\nfloat alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {\r\ngl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;\r\n}\r\nif (v_notUsed > 0.5) {gl_FragColor*=.1;\r\n}\r\n}","attribute vec2 a_pos;\r\nattribute vec2 a_anchor_pos;\r\nattribute vec2 a_extrude;\r\nattribute vec2 a_placed;\r\nattribute vec2 a_shift;\r\nuniform mat4 u_matrix;\r\nuniform vec2 u_extrude_scale;\r\nuniform float u_camera_to_center_distance;\r\nvarying float v_placed;\r\nvarying float v_notUsed;\r\nvoid main() {\r\nvec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);\r\nhighp float camera_to_anchor_distance=projectedPoint.w;\r\nhighp float collision_perspective_ratio=clamp(\r\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);\r\ngl_Position=u_matrix*vec4(a_pos,0.0,1.0);\r\ngl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;\r\nv_placed=a_placed.x;\r\nv_notUsed=a_placed.y;\r\n}"),Ke=yr("varying float v_radius;\r\nvarying vec2 v_extrude;\r\nvarying float v_perspective_ratio;\r\nvarying float v_collision;\r\nvoid main() {\r\nfloat alpha=0.5*min(v_perspective_ratio,1.0);\r\nfloat stroke_radius=0.9*max(v_perspective_ratio,1.0);\r\nfloat distance_to_center=length(v_extrude);\r\nfloat distance_to_edge=abs(distance_to_center-v_radius);\r\nfloat opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);\r\nvec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);\r\ngl_FragColor=color*alpha*opacity_t;\r\n}","attribute vec2 a_pos;\r\nattribute float a_radius;\r\nattribute vec2 a_flags;\r\nuniform mat4 u_matrix;\r\nuniform mat4 u_inv_matrix;\r\nuniform vec2 u_viewport_size;\r\nuniform float u_camera_to_center_distance;\r\nvarying float v_radius;\r\nvarying vec2 v_extrude;\r\nvarying float v_perspective_ratio;\r\nvarying float v_collision;\r\nvec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);\r\nvec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);\r\nrayStart.xyz/=rayStart.w;\r\nrayEnd.xyz  /=rayEnd.w;\r\nhighp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);\r\nreturn mix(rayStart.xyz,rayEnd.xyz,t);\r\n}\r\nvoid main() {\r\nvec2 quadCenterPos=a_pos;\r\nfloat radius=a_radius;\r\nfloat collision=a_flags.x;\r\nfloat vertexIdx=a_flags.y;\r\nvec2 quadVertexOffset=vec2(\r\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));\r\nvec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);\r\nvec4 clipPos=u_matrix*vec4(tilePos,1.0);\r\nhighp float camera_to_anchor_distance=clipPos.w;\r\nhighp float collision_perspective_ratio=clamp(\r\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;\r\nv_radius=radius;\r\nv_extrude=quadVertexExtent*padding_factor;\r\nv_perspective_ratio=collision_perspective_ratio;\r\nv_collision=collision;\r\ngl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);\r\n}"),Je=yr("uniform highp vec4 u_color;\r\nuniform sampler2D u_overlay;\r\nvarying vec2 v_uv;\r\nvoid main() {\r\nvec4 overlay_color=texture2D(u_overlay,v_uv);\r\ngl_FragColor=mix(u_color,overlay_color,overlay_color.a);\r\n}","attribute vec2 a_pos;\r\nvarying vec2 v_uv;\r\nuniform mat4 u_matrix;\r\nuniform float u_overlay_scale;\r\nvoid main() {v_uv=a_pos/8192.0;\r\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);\r\n}"),$e=yr("#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize lowp float opacity\r\ngl_FragColor=color*opacity;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","attribute vec2 a_pos;\r\nuniform mat4 u_matrix;\r\n#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize lowp float opacity\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\n}"),Qe=yr("varying vec2 v_pos;\r\n#pragma mapbox: define highp vec4 outline_color\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 outline_color\r\n#pragma mapbox: initialize lowp float opacity\r\nfloat dist=length(v_pos-gl_FragCoord.xy);\r\nfloat alpha=1.0-smoothstep(0.0,1.0,dist);\r\ngl_FragColor=outline_color*(alpha*opacity);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","attribute vec2 a_pos;\r\nuniform mat4 u_matrix;\r\nuniform vec2 u_world;\r\nvarying vec2 v_pos;\r\n#pragma mapbox: define highp vec4 outline_color\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 outline_color\r\n#pragma mapbox: initialize lowp float opacity\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\r\n}"),tr=yr("uniform vec2 u_texsize;\r\nuniform sampler2D u_image;\r\nuniform float u_fade;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvarying vec2 v_pos;\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nvec2 imagecoord=mod(v_pos_a,1.0);\r\nvec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);\r\nvec4 color1=texture2D(u_image,pos);\r\nvec2 imagecoord_b=mod(v_pos_b,1.0);\r\nvec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);\r\nvec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);\r\nfloat alpha=1.0-smoothstep(0.0,1.0,dist);\r\ngl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_world;\r\nuniform vec2 u_pixel_coord_upper;\r\nuniform vec2 u_pixel_coord_lower;\r\nuniform vec3 u_scale;\r\nattribute vec2 a_pos;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvarying vec2 v_pos;\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nfloat tileRatio=u_scale.x;\r\nfloat fromScale=u_scale.y;\r\nfloat toScale=u_scale.z;\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\nvec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;\r\nvec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\r\nv_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);\r\nv_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);\r\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\r\n}"),er=yr("uniform vec2 u_texsize;\r\nuniform float u_fade;\r\nuniform sampler2D u_image;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nvec2 imagecoord=mod(v_pos_a,1.0);\r\nvec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);\r\nvec4 color1=texture2D(u_image,pos);\r\nvec2 imagecoord_b=mod(v_pos_b,1.0);\r\nvec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);\r\nvec4 color2=texture2D(u_image,pos2);\r\ngl_FragColor=mix(color1,color2,u_fade)*opacity;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_pixel_coord_upper;\r\nuniform vec2 u_pixel_coord_lower;\r\nuniform vec3 u_scale;\r\nattribute vec2 a_pos;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nfloat tileZoomRatio=u_scale.x;\r\nfloat fromScale=u_scale.y;\r\nfloat toScale=u_scale.z;\r\nvec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;\r\nvec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\nv_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);\r\nv_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\r\n}"),rr=yr("varying vec4 v_color;\r\nvoid main() {\r\ngl_FragColor=v_color;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec3 u_lightcolor;\r\nuniform lowp vec3 u_lightpos;\r\nuniform lowp float u_lightintensity;\r\nuniform float u_vertical_gradient;\r\nuniform lowp float u_opacity;\r\nattribute vec2 a_pos;\r\nattribute vec4 a_normal_ed;\r\nvarying vec4 v_color;\r\n#pragma mapbox: define highp float base\r\n#pragma mapbox: define highp float height\r\n#pragma mapbox: define highp vec4 color\r\nvoid main() {\r\n#pragma mapbox: initialize highp float base\r\n#pragma mapbox: initialize highp float height\r\n#pragma mapbox: initialize highp vec4 color\r\nvec3 normal=a_normal_ed.xyz;\r\nbase=max(0.0,base);\r\nheight=max(0.0,height);\r\nfloat t=mod(normal.x,2.0);\r\ngl_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;\r\nv_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);\r\ncolor+=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*=(\r\n(1.0-u_vertical_gradient)+\n(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));\r\n}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);\r\nv_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);\r\nv_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);\r\nv_color*=u_opacity;\r\n}"),ir=yr("uniform vec2 u_texsize;\r\nuniform float u_fade;\r\nuniform sampler2D u_image;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvarying vec4 v_lighting;\r\n#pragma mapbox: define lowp float base\r\n#pragma mapbox: define lowp float height\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float base\r\n#pragma mapbox: initialize lowp float height\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nvec2 imagecoord=mod(v_pos_a,1.0);\r\nvec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);\r\nvec4 color1=texture2D(u_image,pos);\r\nvec2 imagecoord_b=mod(v_pos_b,1.0);\r\nvec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);\r\nvec4 color2=texture2D(u_image,pos2);\r\nvec4 mixedColor=mix(color1,color2,u_fade);\r\ngl_FragColor=mixedColor*v_lighting;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_pixel_coord_upper;\r\nuniform vec2 u_pixel_coord_lower;\r\nuniform float u_height_factor;\r\nuniform vec3 u_scale;\r\nuniform float u_vertical_gradient;\r\nuniform lowp float u_opacity;\r\nuniform vec3 u_lightcolor;\r\nuniform lowp vec3 u_lightpos;\r\nuniform lowp float u_lightintensity;\r\nattribute vec2 a_pos;\r\nattribute vec4 a_normal_ed;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvarying vec4 v_lighting;\r\n#pragma mapbox: define lowp float base\r\n#pragma mapbox: define lowp float height\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float base\r\n#pragma mapbox: initialize lowp float height\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nfloat tileRatio=u_scale.x;\r\nfloat fromScale=u_scale.y;\r\nfloat toScale=u_scale.z;\r\nvec3 normal=a_normal_ed.xyz;\r\nfloat edgedistance=a_normal_ed.w;\r\nvec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;\r\nvec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\r\nbase=max(0.0,base);\r\nheight=max(0.0,height);\r\nfloat t=mod(normal.x,2.0);\r\nfloat z=t > 0.0 ? height : base;\r\ngl_Position=u_matrix*vec4(a_pos,z,1);\r\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\r\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);\r\nv_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);\r\nv_lighting=vec4(0.0,0.0,0.0,1.0);\r\nfloat directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);\r\ndirectional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);\r\nif (normal.y !=0.0) {directional*=(\r\n(1.0-u_vertical_gradient)+\n(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));\r\n}\r\nv_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\r\nv_lighting*=u_opacity;\r\n}"),nr=yr("varying vec4 v_color;\r\nvoid main() {\r\ngl_FragColor=v_color;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec3 u_lightcolor;\r\nuniform lowp vec3 u_lightpos;\r\nuniform lowp float u_lightintensity;\r\nuniform float u_vertical_gradient;\r\nuniform lowp float u_opacity;\r\nattribute vec2 a_pos;\r\nattribute vec4 a_normal_ed;\r\nvarying vec4 v_color;\r\n#pragma mapbox: define highp float base\r\n#pragma mapbox: define highp float height\r\n#pragma mapbox: define highp vec4 outline_color\r\nvoid main() {\r\n#pragma mapbox: initialize highp float base\r\n#pragma mapbox: initialize highp float height\r\n#pragma mapbox: initialize highp vec4 outline_color\r\nvec3 normal=a_normal_ed.xyz;\r\nbase=max(0.0,base);\r\nheight=max(0.0,height);\r\nfloat t=a_normal_ed.w;\r\nfloat nz=(normal.z/22.5)*(0.0001-0.25)+0.25;\r\ngl_Position=u_matrix*vec4(a_pos,t > 0.0 ? (height+nz) : (base+nz),1);\r\nv_color=outline_color*u_opacity;\r\n}"),or=yr("uniform vec2 u_texsize;\r\nuniform float u_fade;\r\nuniform sampler2D u_image;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvarying vec4 v_lighting;\r\n#pragma mapbox: define lowp float base\r\n#pragma mapbox: define lowp float height\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float base\r\n#pragma mapbox: initialize lowp float height\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nvec2 imagecoord=mod(v_pos_a,1.0);\r\nvec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);\r\nvec4 color1=texture2D(u_image,pos);\r\nvec2 imagecoord_b=mod(v_pos_b,1.0);\r\nvec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);\r\nvec4 color2=texture2D(u_image,pos2);\r\nvec4 mixedColor=mix(color1,color2,u_fade);\r\ngl_FragColor=mixedColor*v_lighting;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_pixel_coord_upper;\r\nuniform vec2 u_pixel_coord_lower;\r\nuniform float u_height_factor;\r\nuniform vec3 u_scale;\r\nuniform float u_vertical_gradient;\r\nuniform lowp float u_opacity;\r\nuniform vec3 u_lightcolor;\r\nuniform lowp vec3 u_lightpos;\r\nuniform lowp float u_lightintensity;\r\nattribute vec2 a_pos;\r\nattribute vec4 a_normal_ed;\r\nvarying vec2 v_pos_a;\r\nvarying vec2 v_pos_b;\r\nvarying vec4 v_lighting;\r\n#pragma mapbox: define lowp float base\r\n#pragma mapbox: define lowp float height\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float base\r\n#pragma mapbox: initialize lowp float height\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nfloat tileRatio=u_scale.x;\r\nfloat fromScale=u_scale.y;\r\nfloat toScale=u_scale.z;\r\nvec3 normal=a_normal_ed.xyz;\r\nfloat edgedistance=a_normal_ed.w;\r\nvec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;\r\nvec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\r\nbase=max(0.0,base);\r\nheight=max(0.0,height);\r\nfloat t=mod(normal.x,2.0);\r\nfloat z=t > 0.0 ? height : base;\r\ngl_Position=u_matrix*vec4(a_pos,z,1);\r\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\r\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);\r\nv_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);\r\nv_lighting=vec4(0.0,0.0,0.0,1.0);\r\nfloat directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);\r\ndirectional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);\r\nif (normal.y !=0.0) {directional*=(\r\n(1.0-u_vertical_gradient)+\n(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));\r\n}\r\nv_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\r\nv_lighting*=u_opacity;\r\n}"),ar=yr("#ifdef GL_ES\r\nprecision highp float;\r\n#endif\r\nuniform sampler2D u_image;\r\nvarying vec2 v_pos;\r\nuniform vec2 u_dimension;\r\nuniform float u_zoom;\r\nuniform vec4 u_unpack;\r\nfloat getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;\r\ndata.a=-1.0;\r\nreturn dot(data,u_unpack)/4.0;\r\n}\r\nvoid main() {\r\nvec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);\r\nfloat b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);\r\nfloat c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);\r\nfloat d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);\r\nfloat e=getElevation(v_pos,0.0);\r\nfloat f=getElevation(v_pos+vec2(epsilon.x,0),0.0);\r\nfloat g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);\r\nfloat h=getElevation(v_pos+vec2(0,epsilon.y),0.0);\r\nfloat 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;\r\nfloat exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;\r\nvec2 deriv=vec2(\r\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\r\n)/pow(2.0,exaggeration+(19.2562-u_zoom));\r\ngl_FragColor=clamp(vec4(\r\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_dimension;\r\nattribute vec2 a_pos;\r\nattribute vec2 a_texture_pos;\r\nvarying vec2 v_pos;\r\nvoid main() {\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\nhighp vec2 epsilon=1.0/u_dimension;\r\nfloat scale=(u_dimension.x-2.0)/u_dimension.x;\r\nv_pos=(a_texture_pos/8192.0)*scale+epsilon;\r\n}"),sr=yr("uniform sampler2D u_image;\r\nvarying vec2 v_pos;\r\nuniform vec2 u_latrange;\r\nuniform vec2 u_light;\r\nuniform vec4 u_shadow;\r\nuniform vec4 u_highlight;\r\nuniform vec4 u_accent;\r\n#define PI 3.141592653589793\r\nvoid main() {\r\nvec4 pixel=texture2D(u_image,v_pos);\r\nvec2 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);\r\nfloat aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);\r\nfloat intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;\r\nfloat maxValue=0.5*PI;\r\nfloat 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);\r\nfloat shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);\r\nvec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);\r\ngl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nattribute vec2 a_pos;\r\nattribute vec2 a_texture_pos;\r\nvarying vec2 v_pos;\r\nvoid main() {\r\ngl_Position=u_matrix*vec4(a_pos,0,1);\r\nv_pos=a_texture_pos/8192.0;\r\n}"),lr=yr("uniform lowp float u_device_pixel_ratio;\r\nvarying vec2 v_width2;\r\nvarying vec2 v_normal;\r\nvarying float v_gamma_scale;\r\n#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize lowp float blur\r\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;\r\nfloat alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\r\ngl_FragColor=color*(alpha*opacity);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","\n#define scale 0.015873016\r\nattribute vec2 a_pos_normal;\r\nattribute vec4 a_data;\r\nuniform mat4 u_matrix;\r\nuniform mediump float u_ratio;\r\nuniform vec2 u_units_to_pixels;\r\nuniform lowp float u_device_pixel_ratio;\r\nvarying vec2 v_normal;\r\nvarying vec2 v_width2;\r\nvarying float v_gamma_scale;\r\nvarying highp float v_linesofar;\r\n#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define mediump float gapwidth\r\n#pragma mapbox: define lowp float offset\r\n#pragma mapbox: define mediump float width\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump float gapwidth\r\n#pragma mapbox: initialize lowp float offset\r\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\r\nvec2 a_extrude=a_data.xy-128.0;\r\nfloat a_direction=mod(a_data.z,4.0)-1.0;\r\nv_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;\r\nvec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;\r\nnormal.y=normal.y*2.0-1.0;\r\nv_normal=normal;gapwidth=gapwidth/2.0;\r\nfloat halfwidth=width/2.0;\r\noffset=-1.0*offset;\r\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);\r\nfloat 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;\r\nmediump float t=1.0-abs(u);\r\nmediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);\r\nvec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);\r\ngl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);\r\nfloat extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);\r\nv_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\r\nv_width2=vec2(outset,inset);\r\n}"),ur=yr("uniform lowp float u_device_pixel_ratio;\r\nuniform sampler2D u_image;\r\nvarying vec2 v_width2;\r\nvarying vec2 v_normal;\r\nvarying float v_gamma_scale;\r\nvarying highp vec2 v_uv;\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float blur\r\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;\r\nfloat alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);\r\ngl_FragColor=color*(alpha*opacity);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","\n#define scale 0.015873016\r\nattribute vec2 a_pos_normal;\r\nattribute vec4 a_data;\r\nattribute float a_uv_x;\r\nattribute float a_split_index;\r\nuniform mat4 u_matrix;\r\nuniform mediump float u_ratio;\r\nuniform lowp float u_device_pixel_ratio;\r\nuniform vec2 u_units_to_pixels;\r\nuniform float u_image_height;\r\nvarying vec2 v_normal;\r\nvarying vec2 v_width2;\r\nvarying float v_gamma_scale;\r\nvarying highp vec2 v_uv;\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define mediump float gapwidth\r\n#pragma mapbox: define lowp float offset\r\n#pragma mapbox: define mediump float width\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump float gapwidth\r\n#pragma mapbox: initialize lowp float offset\r\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\r\nvec2 a_extrude=a_data.xy-128.0;\r\nfloat a_direction=mod(a_data.z,4.0)-1.0;\r\nhighp float texel_height=1.0/u_image_height;\r\nhighp float half_texel_height=0.5*texel_height;\r\nv_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);\r\nvec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;\r\nnormal.y=normal.y*2.0-1.0;\r\nv_normal=normal;gapwidth=gapwidth/2.0;\r\nfloat halfwidth=width/2.0;\r\noffset=-1.0*offset;\r\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);\r\nfloat 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;\r\nmediump float t=1.0-abs(u);\r\nmediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);\r\nvec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);\r\ngl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);\r\nfloat extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);\r\nv_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\r\nv_width2=vec2(outset,inset);\r\n}"),hr=yr("uniform lowp float u_device_pixel_ratio;\r\nuniform vec2 u_texsize;\r\nuniform float u_fade;\r\nuniform mediump vec3 u_scale;\r\nuniform sampler2D u_image;\r\nvarying vec2 v_normal;\r\nvarying vec2 v_width2;\r\nvarying float v_linesofar;\r\nvarying float v_gamma_scale;\r\nvarying float v_width;\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\nvec2 pattern_tl_a=pattern_from.xy;\r\nvec2 pattern_br_a=pattern_from.zw;\r\nvec2 pattern_tl_b=pattern_to.xy;\r\nvec2 pattern_br_b=pattern_to.zw;\r\nfloat tileZoomRatio=u_scale.x;\r\nfloat fromScale=u_scale.y;\r\nfloat toScale=u_scale.z;\r\nvec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;\r\nvec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\r\nvec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);\r\nvec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);\r\nfloat aspect_a=display_size_a.y/v_width;\r\nfloat 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;\r\nfloat alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\r\nfloat x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);\r\nfloat x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);\r\nfloat y=0.5*v_normal.y+0.5;\r\nvec2 texel_size=1.0/u_texsize;\r\nvec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));\r\nvec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));\r\nvec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\r\ngl_FragColor=color*alpha*opacity;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\r\nattribute vec2 a_pos_normal;\r\nattribute vec4 a_data;\r\nuniform mat4 u_matrix;\r\nuniform vec2 u_units_to_pixels;\r\nuniform mediump float u_ratio;\r\nuniform lowp float u_device_pixel_ratio;\r\nvarying vec2 v_normal;\r\nvarying vec2 v_width2;\r\nvarying float v_linesofar;\r\nvarying float v_gamma_scale;\r\nvarying float v_width;\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp float offset\r\n#pragma mapbox: define mediump float gapwidth\r\n#pragma mapbox: define mediump float width\r\n#pragma mapbox: define lowp float floorwidth\r\n#pragma mapbox: define lowp vec4 pattern_from\r\n#pragma mapbox: define lowp vec4 pattern_to\r\n#pragma mapbox: define lowp float pixel_ratio_from\r\n#pragma mapbox: define lowp float pixel_ratio_to\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize lowp float offset\r\n#pragma mapbox: initialize mediump float gapwidth\r\n#pragma mapbox: initialize mediump float width\r\n#pragma mapbox: initialize lowp float floorwidth\r\n#pragma mapbox: initialize mediump vec4 pattern_from\r\n#pragma mapbox: initialize mediump vec4 pattern_to\r\n#pragma mapbox: initialize lowp float pixel_ratio_from\r\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\r\nvec2 a_extrude=a_data.xy-128.0;\r\nfloat a_direction=mod(a_data.z,4.0)-1.0;\r\nfloat 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;\r\nnormal.y=normal.y*2.0-1.0;\r\nv_normal=normal;gapwidth=gapwidth/2.0;\r\nfloat halfwidth=width/2.0;\r\noffset=-1.0*offset;\r\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);\r\nfloat 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;\r\nmediump float t=1.0-abs(u);\r\nmediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);\r\nvec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);\r\ngl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);\r\nfloat extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);\r\nv_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\r\nv_linesofar=a_linesofar;\r\nv_width2=vec2(outset,inset);\r\nv_width=floorwidth;\r\n}"),pr=yr("uniform lowp float u_device_pixel_ratio;\r\nuniform sampler2D u_image;\r\nuniform float u_sdfgamma;\r\nuniform float u_mix;\r\nvarying vec2 v_normal;\r\nvarying vec2 v_width2;\r\nvarying vec2 v_tex_a;\r\nvarying vec2 v_tex_b;\r\nvarying float v_gamma_scale;\r\n#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define mediump float width\r\n#pragma mapbox: define lowp float floorwidth\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump float width\r\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;\r\nfloat alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\r\nfloat sdfdist_a=texture2D(u_image,v_tex_a).a;\r\nfloat sdfdist_b=texture2D(u_image,v_tex_b).a;\r\nfloat sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);\r\nalpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);\r\ngl_FragColor=color*(alpha*opacity);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\r\nattribute vec2 a_pos_normal;\r\nattribute vec4 a_data;\r\nuniform mat4 u_matrix;\r\nuniform mediump float u_ratio;\r\nuniform lowp float u_device_pixel_ratio;\r\nuniform vec2 u_patternscale_a;\r\nuniform float u_tex_y_a;\r\nuniform vec2 u_patternscale_b;\r\nuniform float u_tex_y_b;\r\nuniform vec2 u_units_to_pixels;\r\nvarying vec2 v_normal;\r\nvarying vec2 v_width2;\r\nvarying vec2 v_tex_a;\r\nvarying vec2 v_tex_b;\r\nvarying float v_gamma_scale;\r\n#pragma mapbox: define highp vec4 color\r\n#pragma mapbox: define lowp float blur\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define mediump float gapwidth\r\n#pragma mapbox: define lowp float offset\r\n#pragma mapbox: define mediump float width\r\n#pragma mapbox: define lowp float floorwidth\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 color\r\n#pragma mapbox: initialize lowp float blur\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize mediump float gapwidth\r\n#pragma mapbox: initialize lowp float offset\r\n#pragma mapbox: initialize mediump float width\r\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\r\nvec2 a_extrude=a_data.xy-128.0;\r\nfloat a_direction=mod(a_data.z,4.0)-1.0;\r\nfloat a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;\r\nvec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;\r\nnormal.y=normal.y*2.0-1.0;\r\nv_normal=normal;gapwidth=gapwidth/2.0;\r\nfloat halfwidth=width/2.0;\r\noffset=-1.0*offset;\r\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);\r\nfloat 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;\r\nmediump float t=1.0-abs(u);\r\nmediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);\r\nvec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);\r\ngl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);\r\nfloat extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);\r\nv_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\r\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);\r\nv_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);\r\nv_width2=vec2(outset,inset);\r\n}"),cr=yr("uniform float u_fade_t;\r\nuniform float u_opacity;\r\nuniform sampler2D u_image0;\r\nuniform sampler2D u_image1;\r\nvarying vec2 v_pos0;\r\nvarying vec2 v_pos1;\r\nuniform float u_brightness_low;\r\nuniform float u_brightness_high;\r\nuniform float u_saturation_factor;\r\nuniform float u_contrast_factor;\r\nuniform vec3 u_spin_weights;\r\nvoid main() {vec4 color0=texture2D(u_image0,v_pos0);\r\nvec4 color1=texture2D(u_image1,v_pos1);\r\nif (color0.a > 0.0) {\r\ncolor0.rgb=color0.rgb/color0.a;\r\n}\r\nif (color1.a > 0.0) {\r\ncolor1.rgb=color1.rgb/color1.a;\r\n}\r\nvec4 color=mix(color0,color1,u_fade_t);\r\ncolor.a*=u_opacity;\r\nvec3 rgb=color.rgb;rgb=vec3(\r\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;\r\nrgb+=(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);\r\nvec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);\r\ngl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","uniform mat4 u_matrix;\r\nuniform vec2 u_tl_parent;\r\nuniform float u_scale_parent;\r\nuniform float u_buffer_scale;\r\nattribute vec2 a_pos;\r\nattribute vec2 a_texture_pos;\r\nvarying vec2 v_pos0;\r\nvarying vec2 v_pos1;\r\nvoid main() {\r\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;\r\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\r\n}"),fr=yr("uniform sampler2D u_texture;\r\nvarying vec2 v_tex;\r\nvarying float v_fade_opacity;\r\n#pragma mapbox: define lowp float opacity\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float opacity\r\nlowp float alpha=opacity*v_fade_opacity;\r\ngl_FragColor=texture2D(u_texture,v_tex)*alpha;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","const float PI=3.141592653589793;\r\nattribute vec4 a_pos_offset;\r\nattribute vec4 a_data;\r\nattribute vec4 a_pixeloffset;\r\nattribute vec3 a_projected_pos;\r\nattribute float a_fade_opacity;\r\nuniform bool u_is_size_zoom_constant;\r\nuniform bool u_is_size_feature_constant;\r\nuniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;\r\nuniform highp float u_pitch;\r\nuniform bool u_rotate_symbol;\r\nuniform highp float u_aspect_ratio;\r\nuniform float u_fade_change;\r\nuniform mat4 u_matrix;\r\nuniform mat4 u_label_plane_matrix;\r\nuniform mat4 u_coord_matrix;\r\nuniform bool u_is_text;\r\nuniform bool u_pitch_with_map;\r\nuniform vec2 u_texsize;\r\nvarying vec2 v_tex;\r\nvarying float v_fade_opacity;\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp float height\r\nvoid main() {\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize lowp float height\r\nvec2 a_pos=a_pos_offset.xy;\r\nvec2 a_offset=a_pos_offset.zw;\r\nvec2 a_tex=a_data.xy;\r\nvec2 a_size=a_data.zw;\r\nfloat a_size_min=floor(a_size[0]*0.5);\r\nvec2 a_pxoffset=a_pixeloffset.xy;\r\nvec2 a_minFontScale=a_pixeloffset.zw/256.0;\r\nhighp float segment_angle=-a_projected_pos[2];\r\nfloat size;\r\nif (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\r\nsize=mix(a_size_min,a_size[1],u_size_t)/128.0;\r\n} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\r\nsize=a_size_min/128.0;\r\n} else {\r\nsize=u_size;\r\n}\r\nvec4 projectedPoint=u_matrix*vec4(a_pos,0,1);\r\nhighp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\r\ncamera_to_anchor_distance/u_camera_to_center_distance :\r\nu_camera_to_center_distance/camera_to_anchor_distance;\r\nhighp float perspective_ratio=clamp(\r\n0.5+0.5*distance_ratio,0.0,4.0);\r\nsize*=perspective_ratio;\r\nfloat fontScale=u_is_text ? size/24.0 : size;\r\nhighp float symbol_rotation=0.0;\r\nif (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);\r\nvec2 a=projectedPoint.xy/projectedPoint.w;\r\nvec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;\r\nsymbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);\r\n}\r\nhighp float angle_sin=sin(segment_angle+symbol_rotation);\r\nhighp float angle_cos=cos(segment_angle+symbol_rotation);\r\nmat2 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,height,1.0);\r\ngl_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);\r\nv_tex=a_tex/u_texsize;\r\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);\r\nfloat fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;\r\nv_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));\r\n}"),dr=yr("#define SDF_PX 8.0\r\nuniform bool u_is_halo;\r\nuniform sampler2D u_texture;\r\nuniform highp float u_gamma_scale;\r\nuniform lowp float u_device_pixel_ratio;\r\nuniform bool u_is_text;\r\nvarying vec2 v_data0;\r\nvarying vec3 v_data1;\r\n#pragma mapbox: define highp vec4 fill_color\r\n#pragma mapbox: define highp vec4 halo_color\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp float halo_width\r\n#pragma mapbox: define lowp float halo_blur\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 fill_color\r\n#pragma mapbox: initialize highp vec4 halo_color\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize lowp float halo_width\r\n#pragma mapbox: initialize lowp float halo_blur\r\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;\r\nvec2 tex=v_data0.xy;\r\nfloat gamma_scale=v_data1.x;\r\nfloat size=v_data1.y;\r\nfloat fade_opacity=v_data1[2];\r\nfloat fontScale=u_is_text ? size/24.0 : size;\r\nlowp vec4 color=fill_color;\r\nhighp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);\r\nlowp float buff=(256.0-64.0)/256.0;\r\nif (u_is_halo) {\r\ncolor=halo_color;\r\ngamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);\r\nbuff=(6.0-halo_width/fontScale)/SDF_PX;\r\n}\r\nlowp float dist=texture2D(u_texture,tex).a;\r\nhighp float gamma_scaled=gamma*gamma_scale;\r\nhighp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);\r\ngl_FragColor=color*(alpha*opacity*fade_opacity);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","const float PI=3.141592653589793;\r\nattribute vec4 a_pos_offset;\r\nattribute vec4 a_data;\r\nattribute vec4 a_pixeloffset;\r\nattribute vec3 a_projected_pos;\r\nattribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;\r\nuniform bool u_is_size_feature_constant;\r\nuniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;\r\nuniform mat4 u_label_plane_matrix;\r\nuniform mat4 u_coord_matrix;\r\nuniform bool u_is_text;\r\nuniform bool u_pitch_with_map;\r\nuniform highp float u_pitch;\r\nuniform bool u_rotate_symbol;\r\nuniform highp float u_aspect_ratio;\r\nuniform highp float u_camera_to_center_distance;\r\nuniform float u_fade_change;\r\nuniform vec2 u_texsize;\r\nvarying vec2 v_data0;\r\nvarying vec3 v_data1;\r\n#pragma mapbox: define highp vec4 fill_color\r\n#pragma mapbox: define highp vec4 halo_color\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp float halo_width\r\n#pragma mapbox: define lowp float halo_blur\r\n#pragma mapbox: define lowp float height\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 fill_color\r\n#pragma mapbox: initialize highp vec4 halo_color\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize lowp float halo_width\r\n#pragma mapbox: initialize lowp float halo_blur\r\n#pragma mapbox: initialize lowp float height\r\nvec2 a_pos=a_pos_offset.xy;\r\nvec2 a_offset=a_pos_offset.zw;\r\nvec2 a_tex=a_data.xy;\r\nvec2 a_size=a_data.zw;\r\nfloat a_size_min=floor(a_size[0]*0.5);\r\nvec2 a_pxoffset=a_pixeloffset.xy;\r\nhighp float segment_angle=-a_projected_pos[2];\r\nfloat size;\r\nif (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\r\nsize=mix(a_size_min,a_size[1],u_size_t)/128.0;\r\n} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\r\nsize=a_size_min/128.0;\r\n} else {\r\nsize=u_size;\r\n}\r\nvec4 projectedPoint=u_matrix*vec4(a_pos,0,1);\r\nhighp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\r\ncamera_to_anchor_distance/u_camera_to_center_distance :\r\nu_camera_to_center_distance/camera_to_anchor_distance;\r\nhighp float perspective_ratio=clamp(\r\n0.5+0.5*distance_ratio,0.0,4.0);\r\nsize*=perspective_ratio;\r\nfloat fontScale=u_is_text ? size/24.0 : size;\r\nhighp float symbol_rotation=0.0;\r\nif (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);\r\nvec2 a=projectedPoint.xy/projectedPoint.w;\r\nvec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;\r\nsymbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);\r\n}\r\nhighp float angle_sin=sin(segment_angle+symbol_rotation);\r\nhighp float angle_cos=cos(segment_angle+symbol_rotation);\r\nmat2 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,height,1.0);\r\ngl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);\r\nfloat gamma_scale=gl_Position.w;\r\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);\r\nfloat fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;\r\nfloat interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));\r\nv_data0=a_tex/u_texsize;\r\nv_data1=vec3(gamma_scale,size,interpolated_fade_opacity);\r\n}"),mr=yr("#define SDF_PX 8.0\r\n#define SDF 1.0\r\n#define ICON 0.0\r\nuniform bool u_is_halo;\r\nuniform sampler2D u_texture;\r\nuniform sampler2D u_texture_icon;\r\nuniform highp float u_gamma_scale;\r\nuniform lowp float u_device_pixel_ratio;\r\nvarying vec4 v_data0;\r\nvarying vec4 v_data1;\r\n#pragma mapbox: define highp vec4 fill_color\r\n#pragma mapbox: define highp vec4 halo_color\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp float halo_width\r\n#pragma mapbox: define lowp float halo_blur\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 fill_color\r\n#pragma mapbox: initialize highp vec4 halo_color\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize lowp float halo_width\r\n#pragma mapbox: initialize lowp float halo_blur\r\nfloat fade_opacity=v_data1[2];\r\nif (v_data1.w==ICON) {\r\nvec2 tex_icon=v_data0.zw;\r\nlowp float alpha=opacity*fade_opacity;\r\ngl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\nreturn;\r\n}\r\nvec2 tex=v_data0.xy;\r\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;\r\nfloat gamma_scale=v_data1.x;\r\nfloat size=v_data1.y;\r\nfloat fontScale=size/24.0;\r\nlowp vec4 color=fill_color;\r\nhighp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);\r\nlowp float buff=(256.0-64.0)/256.0;\r\nif (u_is_halo) {\r\ncolor=halo_color;\r\ngamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);\r\nbuff=(6.0-halo_width/fontScale)/SDF_PX;\r\n}\r\nlowp float dist=texture2D(u_texture,tex).a;\r\nhighp float gamma_scaled=gamma*gamma_scale;\r\nhighp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);\r\ngl_FragColor=color*(alpha*opacity*fade_opacity);\r\n#ifdef OVERDRAW_INSPECTOR\r\ngl_FragColor=vec4(1.0);\r\n#endif\r\n}","const float PI=3.141592653589793;\r\nattribute vec4 a_pos_offset;\r\nattribute vec4 a_data;\r\nattribute vec3 a_projected_pos;\r\nattribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;\r\nuniform bool u_is_size_feature_constant;\r\nuniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;\r\nuniform mat4 u_label_plane_matrix;\r\nuniform mat4 u_coord_matrix;\r\nuniform bool u_is_text;\r\nuniform bool u_pitch_with_map;\r\nuniform highp float u_pitch;\r\nuniform bool u_rotate_symbol;\r\nuniform highp float u_aspect_ratio;\r\nuniform highp float u_camera_to_center_distance;\r\nuniform float u_fade_change;\r\nuniform vec2 u_texsize;\r\nuniform vec2 u_texsize_icon;\r\nvarying vec4 v_data0;\r\nvarying vec4 v_data1;\r\n#pragma mapbox: define highp vec4 fill_color\r\n#pragma mapbox: define highp vec4 halo_color\r\n#pragma mapbox: define lowp float opacity\r\n#pragma mapbox: define lowp float halo_width\r\n#pragma mapbox: define lowp float halo_blur\r\n#pragma mapbox: define lowp float height\r\nvoid main() {\r\n#pragma mapbox: initialize highp vec4 fill_color\r\n#pragma mapbox: initialize highp vec4 halo_color\r\n#pragma mapbox: initialize lowp float opacity\r\n#pragma mapbox: initialize lowp float halo_width\r\n#pragma mapbox: initialize lowp float halo_blur\r\n#pragma mapbox: initialize lowp float height\r\nvec2 a_pos=a_pos_offset.xy;\r\nvec2 a_offset=a_pos_offset.zw;\r\nvec2 a_tex=a_data.xy;\r\nvec2 a_size=a_data.zw;\r\nfloat a_size_min=floor(a_size[0]*0.5);\r\nfloat is_sdf=a_size[0]-2.0*a_size_min;\r\nhighp float segment_angle=-a_projected_pos[2];\r\nfloat size;\r\nif (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\r\nsize=mix(a_size_min,a_size[1],u_size_t)/128.0;\r\n} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\r\nsize=a_size_min/128.0;\r\n} else {\r\nsize=u_size;\r\n}\r\nvec4 projectedPoint=u_matrix*vec4(a_pos,0,1);\r\nhighp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\r\ncamera_to_anchor_distance/u_camera_to_center_distance :\r\nu_camera_to_center_distance/camera_to_anchor_distance;\r\nhighp float perspective_ratio=clamp(\r\n0.5+0.5*distance_ratio,0.0,4.0);\r\nsize*=perspective_ratio;\r\nfloat fontScale=size/24.0;\r\nhighp float symbol_rotation=0.0;\r\nif (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);\r\nvec2 a=projectedPoint.xy/projectedPoint.w;\r\nvec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;\r\nsymbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);\r\n}\r\nhighp float angle_sin=sin(segment_angle+symbol_rotation);\r\nhighp float angle_cos=cos(segment_angle+symbol_rotation);\r\nmat2 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,height,1.0);\r\ngl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);\r\nfloat gamma_scale=gl_Position.w;\r\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);\r\nfloat fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;\r\nfloat interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));\r\nv_data0.xy=a_tex/u_texsize;\r\nv_data0.zw=a_tex/u_texsize_icon;\r\nv_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);\r\n}");function yr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=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(r,(function(t,e,r,i,n){return s[n]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+n+"\nvarying "+r+" "+i+" "+n+";\n#else\nuniform "+r+" "+i+" u_"+n+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+n+"\n    "+r+" "+i+" "+n+" = u_"+n+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,i,n){var o="float"===i?"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 "+r+" "+o+" a_"+n+";\nvarying "+r+" "+i+" "+n+";\n#else\nuniform "+r+" "+i+" u_"+n+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+n+"\n    "+n+" = a_"+n+";\n#else\n    "+r+" "+i+" "+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    "+r+" "+i+" "+n+" = u_"+n+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+n+"\nuniform lowp float u_"+n+"_t;\nattribute "+r+" "+o+" a_"+n+";\n#else\nuniform "+r+" "+i+" u_"+n+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+n+"\n    "+r+" "+i+" "+n+" = a_"+n+";\n#else\n    "+r+" "+i+" "+n+" = u_"+n+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+n+"\n    "+r+" "+i+" "+n+" = unpack_mix_"+a+"(a_"+n+", u_"+n+"_t);\n#else\n    "+r+" "+i+" "+n+" = u_"+n+";\n#endif\n"})),staticAttributes:i,staticUniforms:a}}var gr=Object.freeze({__proto__:null,prelude:je,background:qe,backgroundPattern:Ge,circle:Ze,clippingMask:Xe,heatmap:Ye,heatmapTexture:We,collisionBox:He,collisionCircle:Ke,debug:Je,fill:$e,fillOutline:Qe,fillOutlinePattern:tr,fillPattern:er,fillExtrusion:rr,fillExtrusionPattern:ir,fillExtrusionOutline:nr,fillExtrusionOutlinePattern:or,hillshadePrepare:ar,hillshade:sr,line:lr,lineGradient:ur,linePattern:hr,lineSDF:pr,raster:cr,symbolIcon:fr,symbolSDF:dr,symbolTextAndIcon:mr}),_r=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function vr(t){for(var e=[],r=0;r<t.length;r++)if(null!==t[r]){var i=t[r].split(" ");e.push(i.pop())}return e}_r.prototype.bind=function(t,e,r,i,n,o,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==i.length,u=0;!l&&u<i.length;u++)this.boundPaintVertexBuffers[u]!==i[u]&&(l=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===r&&!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,r,i,n,o,a,s)},_r.prototype.freshBind=function(t,e,r,i,n,o,a){var s,l=t.numAttributes,u=this.context,h=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=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=u.currentNumAttributes||0;for(var p=l;p<s;p++)h.disableVertexAttribArray(p)}e.enableAttributes(h,t);for(var c=0,f=r;c<f.length;c+=1)f[c].enableAttributes(h,t);o&&o.enableAttributes(h,t),a&&a.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,n);for(var d=0,m=r;d<m.length;d+=1){var y=m[d];y.bind(),y.setVertexAttribPointers(h,t,n)}o&&(o.bind(),o.setVertexAttribPointers(h,t,n)),i&&i.bind(),a&&(a.bind(),a.setVertexAttribPointers(h,t,n)),u.currentNumAttributes=l},_r.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var xr=function(t,e,r,i,n,o){var a=t.gl;this.program=a.createProgram();for(var s=vr(r.staticAttributes),l=i?i.getBinderAttributes():[],u=s.concat(l),h=r.staticUniforms?vr(r.staticUniforms):[],p=i?i.getBinderUniforms():[],c=[],f=0,d=h.concat(p);f<d.length;f+=1){var m=d[f];c.indexOf(m)<0&&c.push(m)}var y=i?i.defines():[];o&&y.push("#define OVERDRAW_INSPECTOR;");var g=y.concat(je.fragmentSource,r.fragmentSource).join("\n"),_=y.concat(je.vertexSource,r.vertexSource).join("\n"),v=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(v,g),a.compileShader(v),a.attachShader(this.program,v);var x=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(x,_),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(v);for(var I=0;I<c.length;I++){var S=c[I];if(S&&!b[S]){var T=a.getUniformLocation(this.program,S);T&&(b[S]=T)}}this.fixedUniforms=n(t,b),this.binderUniforms=i?i.getUniforms(t,b):[]}}};function br(t,e,r){var i=1/ue(r,1,e.transform.tileZoom),n=Math.pow(2,r.tileID.overscaledZ),o=r.tileSize*Math.pow(2,e.transform.tileZoom)/n,a=o*(r.tileID.canonical.x+r.tileID.wrap*n),s=o*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[i,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}xr.prototype.draw=function(t,e,r,i,n,o,a,s,l,u,h,p,c,f,d,m){var y,g=t.gl;if(!this.failedToCreate){for(var _ in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(i),t.setColorMode(n),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[_].set(a[_]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:c});for(var v=(y={},y[g.LINES]=2,y[g.TRIANGLES]=3,y[g.LINE_STRIP]=1,y)[e],x=0,b=h.get();x<b.length;x+=1){var w=b[x],I=w.vaos||(w.vaos={});(I[s]||(I[s]=new _r)).bind(t,this,l,f?f.getPaintVertexBuffers():[],u,w.vertexOffset,d,m),g.drawElements(e,w.primitiveLength*v,g.UNSIGNED_SHORT,w.primitiveOffset*v*2)}}};var wr=function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},Ir=function(e,r,i,n){var o=r.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,-r.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:+i,u_opacity:n}},Sr=function(e,r,i,n,o,a,s){return t.extend(Ir(e,r,i,n),br(a,r,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8})},Tr=function(t){return{u_matrix:t}},Er=function(e,r,i,n){return t.extend(Tr(e),br(i,r,n))},Pr=function(t,e){return{u_matrix:t,u_world:e}},Ar=function(e,r,i,n,o){return t.extend(Er(e,r,i,n),{u_world:o})},Lr=function(e,r,i,n){var o,a,s=e.transform;if("map"===n.paint.get("circle-pitch-alignment")){var l=ue(i,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(r.posMatrix,i,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}},Mr=function(t,e,r){var i=ue(r,1,e.zoom),n=Math.pow(2,e.zoom-r.tileID.overscaledZ),o=r.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:i,u_extrude_scale:[e.pixelsToGLUnits[0]/(i*n),e.pixelsToGLUnits[1]/(i*n)],u_overscale_factor:o}},kr=function(t,e,r){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:r.cameraToCenterDistance,u_viewport_size:[r.width,r.height]}},zr=function(t,e,r){return void 0===r&&(r=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:r}},Cr=function(t){return{u_matrix:t}},Dr=function(t,e,r,i){return{u_matrix:t,u_extrude_scale:ue(e,1,r),u_intensity:i}},Rr=function(e,r,i){var n=e.transform;return{u_matrix:Vr(e,r,i),u_ratio:1/ue(r,1,n.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Fr=function(e,r,i,n){return t.extend(Rr(e,r,i),{u_image:0,u_image_height:n})},Or=function(e,r,i,n){var o=e.transform,a=Nr(r,o);return{u_matrix:Vr(e,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:1/ue(r,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]]}},Br=function(e,r,i,n,o){var a=e.lineAtlas,s=Nr(r,e.transform),l="round"===i.layout.get("line-cap"),u=a.getDash(n.from,l),h=a.getDash(n.to,l),p=u.width*o.fromScale,c=h.width*o.toScale;return t.extend(Rr(e,r,i),{u_patternscale_a:[s/p,-u.height/2],u_patternscale_b:[s/c,-h.height/2],u_sdfgamma:a.width/(256*Math.min(p,c)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:o.t})};function Nr(t,e){return 1/ue(t,1,e.tileZoom)}function Vr(t,e,r){return t.translatePosMatrix(e.tileID.posMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}var Ur=function(t,e,r,i,n){return{u_matrix:t,u_tl_parent:e,u_scale_parent:r,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.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:jr(n.paint.get("raster-hue-rotate"))};var o,a};function jr(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var qr,Gr=function(t,e,r,i,n,o,a,s,l,u){var h=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:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:h.width/h.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:+i,u_texsize:u,u_texture:0}},Zr=function(e,r,i,n,o,a,s,l,u,h,p){var c=o.transform;return t.extend(Gr(e,r,i,n,o,a,s,l,u,h),{u_gamma_scale:n?Math.cos(c._pitch)*c.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+p})},Xr=function(e,r,i,n,o,a,s,l,u,h){return t.extend(Zr(e,r,i,n,o,a,s,l,!0,u,!0),{u_texsize_icon:h,u_texture_icon:1})},Yr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Wr=function(e,r,i,n,o,a){return t.extend(function(t,e,r,i){var n=r.imageManager.getPattern(t.from.toString()),o=r.imageManager.getPattern(t.to.toString()),a=r.imageManager.getPixelSize(),s=a.width,l=a.height,u=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,r.transform.tileZoom)/u,p=h*(i.tileID.canonical.x+i.tileID.wrap*u),c=h*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/ue(i,1,r.transform.tileZoom),u_pixel_coord_upper:[p>>16,c>>16],u_pixel_coord_lower:[65535&p,65535&c]}}(n,a,i,o),{u_matrix:e,u_opacity:r})},Hr={fillExtrusion:wr,fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionOutline:wr,fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image),u_image_height:new t.Uniform1f(e,r.u_image_height)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Kr(e,r,i,n,o,a,s){for(var l=e.context,u=l.gl,h=e.useProgram("collisionBox"),p=[],c=0,f=0,d=0;d<n.length;d++){var m=n[d],y=r.getTile(m),g=y.getBucket(i);if(g){var _=m.posMatrix;0===o[0]&&0===o[1]||(_=e.translatePosMatrix(m.posMatrix,y,o,a));var v=s?g.textCollisionBox:g.iconCollisionBox,x=g.collisionCircleArray;if(x.length>0){var b=t.create(),w=_;t.mul(b,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,g.placementViewportMatrix),p.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=c+=x.length/4}v&&h.draw(l,u.LINES,St.disabled,Tt.disabled,e.colorModeForRenderPass(),Pt.disabled,Mr(_,e.transform,y),i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,null,v.collisionVertexBuffer)}}if(s&&p.length){var I=e.useProgram("collisionCircle"),S=new t.StructArrayLayout2f1f2i16;S.resize(4*c),S._trim();for(var T=0,E=0,P=p;E<P.length;E+=1)for(var A=P[E],L=0;L<A.circleArray.length/4;L++){var M=4*L,k=A.circleArray[M+0],z=A.circleArray[M+1],C=A.circleArray[M+2],D=A.circleArray[M+3];S.emplace(T++,k,z,C,D,0),S.emplace(T++,k,z,C,D,1),S.emplace(T++,k,z,C,D,2),S.emplace(T++,k,z,C,D,3)}(!qr||qr.length<2*c)&&(qr=function(e){var r=2*e,i=new t.StructArrayLayout3ui6;i.resize(r),i._trim();for(var n=0;n<r;n++){var o=6*n;i.uint16[o+0]=4*n+0,i.uint16[o+1]=4*n+1,i.uint16[o+2]=4*n+2,i.uint16[o+3]=4*n+2,i.uint16[o+4]=4*n+3,i.uint16[o+5]=4*n+0}return i}(c));for(var R=l.createIndexBuffer(qr,!0),F=l.createVertexBuffer(S,t.collisionCircleLayout.members,!0),O=0,B=p;O<B.length;O+=1){var N=B[O],V=kr(N.transform,N.invTransform,e.transform);I.draw(l,u.TRIANGLES,St.disabled,Tt.disabled,e.colorModeForRenderPass(),Pt.disabled,V,i.id,F,R,t.SegmentVector.simpleSegment(0,2*N.circleOffset,N.circleArray.length,N.circleArray.length/2),null,e.transform.zoom,null,null,null)}F.destroy(),R.destroy()}}var Jr=t.identity(new Float32Array(16));function $r(e,r,i,n,o,a){var s=t.getAnchorAlignment(e),l=-(s.horizontalAlign-.5)*r,u=-(s.verticalAlign-.5)*i,h=t.evaluateVariableOffset(e,n);return new t.Point((l/o+h[0])*a,(u/o+h[1])*a)}function Qr(e,r,i,n,o,a,s,l,u,h,p){var c=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,m={};f.clear();for(var y=0;y<c.length;y++){var g=c.get(y),_=g.hidden||!g.crossTileID||e.allowVerticalPlacement&&!g.placedOrientation?null:n[g.crossTileID];if(_){var v=new t.Point(g.anchorX,g.anchorY),x=Kt(v,i?l:s),b=Jt(a.cameraToCenterDistance,x.signedDistanceFromCamera),w=o.evaluateSizeForFeature(e.textSizeData,h,g)*b/t.ONE_EM;i&&(w*=e.tilePixelRatio/u);for(var I=$r(_.anchor,_.width,_.height,_.textOffset,_.textBoxScale,w),S=i?Kt(v.add(I),s).point:x.point.add(r?I.rotate(-a.angle):I),T=e.allowVerticalPlacement&&g.placedOrientation===t.WritingMode.vertical?Math.PI/2:0,E=0;E<g.numGlyphs;E++)t.addDynamicAttributes(f,S,T);p&&g.associatedIconIndex>=0&&(m[g.associatedIconIndex]={shiftedAnchor:S,angle:T})}else ae(g.numGlyphs,f)}if(p){d.clear();for(var P=e.icon.placedSymbolArray,A=0;A<P.length;A++){var L=P.get(A);if(L.hidden)ae(L.numGlyphs,d);else{var M=m[A];if(M)for(var k=0;k<L.numGlyphs;k++)t.addDynamicAttributes(d,M.shiftedAnchor,M.angle);else ae(L.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function ti(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function ei(e,r,i,n,o,a,s,l,u,h,p,c){for(var f=e.context,d=f.gl,m=e.transform,y="map"===l,g="map"===u,_=y&&"point"!==i.layout.get("symbol-placement"),v=y&&!g&&!_,x=void 0!==i.layout.get("symbol-sort-key").constantOr(1),b=!1,w=e.depthModeForSublayer(0,St.ReadOnly),I=i.layout.get("text-variable-anchor"),S=[],T=0,E=n;T<E.length;T+=1){var P=E[T],A=r.getTile(P),L=A.getBucket(i);if(L){var M=o?L.text:L.icon;if(M&&M.segments.get().length){var k=M.programConfigurations.get(i.id),z=o||L.sdfIcons,C=o?L.textSizeData:L.iconSizeData,D=g||0!==m.pitch,R=e.useProgram(ti(z,o,L),k),F=t.evaluateSizeForZoom(C,m.zoom),O=void 0,B=[0,0],N=void 0,V=void 0,U=null,j=void 0;if(o)N=A.glyphAtlasTexture,V=d.LINEAR,O=A.glyphAtlasTexture.size,L.iconsInText&&(B=A.imageAtlasTexture.size,U=A.imageAtlasTexture,j=D||e.options.rotating||e.options.zooming||"composite"===C.kind||"camera"===C.kind?d.LINEAR:d.NEAREST);else{var q=1!==i.layout.get("icon-size").constantOr(0)||L.iconsNeedLinear;N=A.imageAtlasTexture,V=z||e.options.rotating||e.options.zooming||q||D?d.LINEAR:d.NEAREST,O=A.imageAtlasTexture.size}var G=ue(A,1,e.transform.zoom),Z=Wt(P.posMatrix,g,y,e.transform,G),X=Ht(P.posMatrix,g,y,e.transform,G),Y=I&&L.hasTextData(),W="none"!==i.layout.get("icon-text-fit")&&Y&&L.hasIconData();_&&Qt(L,P.posMatrix,e,o,Z,X,g,h);var H=e.translatePosMatrix(P.posMatrix,A,a,s),K=_||o&&I||W?Jr:Z,J=e.translatePosMatrix(X,A,a,s,!0),$=z&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),Q={program:R,buffers:M,uniformValues:z?L.iconsInText?Xr(C.kind,F,v,g,e,H,K,J,O,B):Zr(C.kind,F,v,g,e,H,K,J,o,O,!0):Gr(C.kind,F,v,g,e,H,K,J,o,O),atlasTexture:N,atlasTextureIcon:U,atlasInterpolation:V,atlasInterpolationIcon:j,isSDF:z,hasHalo:$};if(x&&L.canOverlap){b=!0;for(var tt=0,et=M.segments.get();tt<et.length;tt+=1){var rt=et[tt];S.push({segments:new t.SegmentVector([rt]),sortKey:rt.sortKey,state:Q})}}else S.push({segments:M.segments,sortKey:0,state:Q})}}}b&&S.sort((function(t,e){return t.sortKey-e.sortKey}));for(var it=0,nt=S;it<nt.length;it+=1){var ot=nt[it],at=ot.state;if(f.activeTexture.set(d.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,d.CLAMP_TO_EDGE),at.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),at.isSDF){var st=at.uniformValues;at.hasHalo&&(st.u_is_halo=1,ri(at.buffers,ot.segments,i,e,at.program,w,p,c,st)),st.u_is_halo=0}ri(at.buffers,ot.segments,i,e,at.program,w,p,c,at.uniformValues)}}function ri(t,e,r,i,n,o,a,s,l){var u=i.context;n.draw(u,u.gl.TRIANGLES,o,a,s,Pt.disabled,l,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,i.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function ii(t,e,r,i,n,o,a){var s,l,u,h,p,c=t.context.gl,f=r.paint.get("fill-pattern"),d=f&&f.constantOr(1),m=r.getCrossfadeParameters();a?(l=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",s=c.LINES):(l=d?"fillPattern":"fill",s=c.TRIANGLES);for(var y=0,g=i;y<g.length;y+=1){var _=g[y],v=e.getTile(_);if(!d||v.patternsLoaded()){var x=v.getBucket(r);if(x){var b=x.programConfigurations.get(r.id),w=t.useProgram(l,b);d&&(t.context.activeTexture.set(c.TEXTURE0),v.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),b.updatePaintBuffers(m));var I=f.constantOr(null);if(I&&v.imageAtlas){var S=v.imageAtlas,T=S.patternPositions[I.to.toString()],E=S.patternPositions[I.from.toString()];T&&E&&b.setConstantPatternPositions(T,E)}var P=t.translatePosMatrix(_.posMatrix,v,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(a){h=x.indexBuffer2,p=x.segments2;var A=[c.drawingBufferWidth,c.drawingBufferHeight];u="fillOutlinePattern"===l&&d?Ar(P,t,m,v,A):Pr(P,A)}else h=x.indexBuffer,p=x.segments,u=d?Er(P,t,m,v):Tr(P);w.draw(t.context,s,n,t.stencilModeForClipping(_),o,Pt.disabled,u,r.id,x.layoutVertexBuffer,h,p,r.paint,t.transform.zoom,b)}}}}function ni(t,e,r,i,n,o,a){for(var s=t.context,l=s.gl,u=r.paint.get("fill-extrusion-pattern"),h=u.constantOr(1),p=r.getCrossfadeParameters(),c=r.paint.get("fill-extrusion-opacity"),f=r.paint.get("fill-extrusion-outline-width"),d=0,m=i;d<m.length;d+=1){var y=m[d],g=e.getTile(y),_=g.getBucket(r);if(_){var v=_.programConfigurations.get(r.id),x=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",v);h&&(t.context.activeTexture.set(l.TEXTURE0),g.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),v.updatePaintBuffers(p));var b=u.constantOr(null);if(b&&g.imageAtlas){var w=g.imageAtlas,I=w.patternPositions[b.to.toString()],S=w.patternPositions[b.from.toString()];I&&S&&v.setConstantPatternPositions(I,S)}var T=t.translatePosMatrix(y.posMatrix,g,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),E=r.paint.get("fill-extrusion-vertical-gradient"),P=h?Sr(T,t,E,c,y,p,g):Ir(T,t,E,c);if(x.draw(s,s.gl.TRIANGLES,n,o,a,Pt.disabled,P,r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,r.paint,t.transform.zoom,v),!(f<=0)){var A=_.outlineProgramConfigurations.get(r.id);t.useProgram("fillExtrusionOutline",A).draw(s,s.gl.LINES,n,o,a,Pt.disabled,P,r.id,_.outlineVertexBuffer,_.outlineIndexBuffer,_.outlineSegments,r.paint,t.transform.zoom,A,null,null,2)}}}}function oi(e,r,i,n,o,a){var s=e.context,l=s.gl,u=r.fbo;if(u){var h=e.useProgram("hillshade");s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,u.colorAttachment.get());var p=function(e,r,i){var n=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),a=i.paint.get("hillshade-accent-color"),s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);var l,u,h,p=!e.options.moving;return{u_matrix:e.transform.calculatePosMatrix(r.tileID.toUnwrapped(),p),u_image:0,u_latrange:(l=r.tileID,u=Math.pow(2,l.canonical.z),h=l.canonical.y,[new t.MercatorCoordinate(0,h/u).toLngLat().lat,new t.MercatorCoordinate(0,(h+1)/u).toLngLat().lat]),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:o,u_accent:a}}(e,r,i);h.draw(s,l.TRIANGLES,n,o,a,Pt.disabled,p,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function ai(e,r,i,n,o,a){var s=e.context,l=s.gl,u=r.dem;if(u&&u.data){var h=u.dim,p=u.stride,c=u.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||e.getTileTexture(p),r.demTexture){var f=r.demTexture;f.update(c,{premultiply:!1}),f.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else r.demTexture=new t.Texture(s,c,l.RGBA,{premultiply:!1}),r.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);var d=r.fbo;if(!d){var m=new t.Texture(s,{width:h,height:h,data:null},l.RGBA);m.bind(l.LINEAR,l.CLAMP_TO_EDGE),(d=r.fbo=s.createFramebuffer(h,h,!0)).colorAttachment.set(m.texture)}s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,o,a,Pt.disabled,function(e,r){var i=r.stride,n=t.create();return t.ortho(n,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(n,n,[0,-t.EXTENT,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:r.getUnpackVector()}}(r.tileID,u),i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function si(e,r,i,n,o){var a=n.paint.get("raster-fade-duration");if(a>0){var s=t.browser.now(),l=(s-e.timeAdded)/a,u=r?(s-r.timeAdded)/a:-1,h=i.getSource(),p=o.coveringZoomLevel({tileSize:h.tileSize,roundZoom:h.roundZoom}),c=!r||Math.abs(r.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),f=c&&e.refreshedUponExpiration?1:t.clamp(c?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var li=new t.Color(1,0,0,1),ui=new t.Color(0,1,0,1),hi=new t.Color(0,0,1,1),pi=new t.Color(1,0,1,1),ci=new t.Color(0,1,1,1);function fi(t,e,r,i){mi(t,0,e+r/2,t.transform.width,r,i)}function di(t,e,r,i){mi(t,e-r/2,0,r,t.transform.height,i)}function mi(e,r,i,n,o,a){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(r*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}function yi(e,r,i){var n=e.context,o=n.gl,a=i.posMatrix,s=e.useProgram("debug"),l=St.disabled,u=Tt.disabled,h=e.colorModeForRenderPass();n.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(n,o.LINE_STRIP,l,u,h,Pt.disabled,zr(a,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var p=r.getTileByID(i.key).latestRawTileData,c=Math.floor((p&&p.byteLength||0)/1024),f=r.getTile(i).tileSize,d=512/Math.min(f,512)*(i.overscaledZ/e.transform.zoom)*.5,m=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(m+=" => "+i.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,i=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.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(r),t.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(e,m+" "+c+"kb"),s.draw(n,o.TRIANGLES,l,u,Et.alphaBlended,Pt.disabled,zr(a,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var gi={symbol:function(e,r,i,n,o){if("translucent"===e.renderPass){var a=Tt.disabled,s=e.colorModeForRenderPass();i.layout.get("text-variable-anchor")&&function(e,r,i,n,o,a,s){for(var l=r.transform,u="map"===o,h="map"===a,p=0,c=e;p<c.length;p+=1){var f=c[p],d=n.getTile(f),m=d.getBucket(i);if(m&&m.text&&m.text.segments.get().length){var y=t.evaluateSizeForZoom(m.textSizeData,l.zoom),g=ue(d,1,r.transform.zoom),_=Wt(f.posMatrix,h,u,r.transform,g),v="none"!==i.layout.get("icon-text-fit")&&m.hasIconData();if(y){var x=Math.pow(2,l.zoom-d.tileID.overscaledZ);Qr(m,u,h,s,t.symbolSize,l,_,f.posMatrix,x,y,v)}}}}(n,e,i,r,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),o),0!==i.paint.get("icon-opacity").constantOr(1)&&ei(e,r,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),a,s),0!==i.paint.get("text-opacity").constantOr(1)&&ei(e,r,i,n,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),a,s),r.map.showCollisionBoxes&&(Kr(e,r,i,n,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),!0),Kr(e,r,i,n,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),!1))}},circle:function(e,r,i,n){if("translucent"===e.renderPass){var o=i.paint.get("circle-opacity"),a=i.paint.get("circle-stroke-width"),s=i.paint.get("circle-stroke-opacity"),l=void 0!==i.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,h=u.gl,p=e.depthModeForSublayer(0,St.ReadOnly),c=Tt.disabled,f=e.colorModeForRenderPass(),d=[],m=0;m<n.length;m++){var y=n[m],g=r.getTile(y),_=g.getBucket(i);if(_){var v=_.programConfigurations.get(i.id),x={programConfiguration:v,program:e.useProgram("circle",v),layoutVertexBuffer:_.layoutVertexBuffer,indexBuffer:_.indexBuffer,uniformValues:Lr(e,y,g,i)};if(l)for(var b=0,w=_.segments.get();b<w.length;b+=1){var I=w[b];d.push({segments:new t.SegmentVector([I]),sortKey:I.sortKey,state:x})}else d.push({segments:_.segments,sortKey:0,state:x})}}l&&d.sort((function(t,e){return t.sortKey-e.sortKey}));for(var S=0,T=d;S<T.length;S+=1){var E=T[S],P=E.state;P.program.draw(u,h.TRIANGLES,p,c,f,Pt.disabled,P.uniformValues,i.id,P.layoutVertexBuffer,P.indexBuffer,E.segments,i.paint,e.transform.zoom,P.programConfiguration)}}}},heatmap:function(e,r,i,n){if(0!==i.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var o=e.context,a=o.gl,s=Tt.disabled,l=new Et([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,r){var i=t.gl;t.activeTexture.set(i.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var n=r.heatmapFbo;if(n)i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),t.bindFramebuffer.set(n.framebuffer);else{var o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),n=r.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,r,i){var n=t.gl;n.texImage2D(n.TEXTURE_2D,0,n.RGBA,e.width/4,e.height/4,0,n.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:n.UNSIGNED_BYTE,null),i.colorAttachment.set(r)}(t,e,o,n)}}(o,e,i),o.clear({color:t.Color.transparent});for(var u=0;u<n.length;u++){var h=n[u];if(!r.hasRenderableParent(h)){var p=r.getTile(h),c=p.getBucket(i);if(c){var f=c.programConfigurations.get(i.id);e.useProgram("heatmap",f).draw(o,a.TRIANGLES,St.disabled,s,l,Pt.disabled,Dr(h.posMatrix,p,e.transform.zoom,i.paint.get("heatmap-intensity")),i.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,i.paint,e.transform.zoom,f)}}}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,r){var i=e.context,n=i.gl,o=r.heatmapFbo;if(o){i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1);var a=r.colorRampTexture;a||(a=r.colorRampTexture=new t.Texture(i,r.colorRamp,n.RGBA)),a.bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,n.TRIANGLES,St.disabled,Tt.disabled,e.colorModeForRenderPass(),Pt.disabled,function(e,r){var i=t.create();t.ortho(i,0,e.width,e.height,0,0,1);var n=e.context.gl;return{u_matrix:i,u_world:[n.drawingBufferWidth,n.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:r.paint.get("heatmap-opacity")}}(e,r),r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom)}}(e,i))},line:function(e,r,i,n){if("translucent"===e.renderPass){var o=i.paint.get("line-opacity"),a=i.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=i.paint.get("line-dasharray"),h=i.paint.get("line-pattern"),p=h.constantOr(1),c=i.paint.get("line-gradient"),f=i.getCrossfadeParameters(),d=p?"linePattern":u?"lineSDF":c?"lineGradient":"line",m=e.context,y=m.gl,g=!0,_=0,v=n;_<v.length;_+=1){var x=v[_],b=r.getTile(x);if(!p||b.patternsLoaded()){var w=b.getBucket(i);if(w){var I=w.programConfigurations.get(i.id),S=e.context.program.get(),T=e.useProgram(d,I),E=g||T.program!==S,P=h.constantOr(null);if(P&&b.imageAtlas){var A=b.imageAtlas,L=A.patternPositions[P.to.toString()],M=A.patternPositions[P.from.toString()];L&&M&&I.setConstantPatternPositions(L,M)}var k=p?Or(e,b,i,f):u?Br(e,b,i,u,f):c?Fr(e,b,i,w.lineClipsArray.length):Rr(e,b,i);if(p)m.activeTexture.set(y.TEXTURE0),b.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),I.updatePaintBuffers(f);else if(u&&(E||e.lineAtlas.dirty))m.activeTexture.set(y.TEXTURE0),e.lineAtlas.bind(m);else if(c){var z=w.gradients[i.id],C=z.texture;if(i.gradientVersion!==z.version){var D=256;if(i.stepInterpolant){var R=r.getSource().maxzoom,F=x.canonical.z===R?Math.ceil(1<<e.transform.maxZoom-x.canonical.z):1;D=t.clamp(t.nextPowerOfTwo(w.maxLineLength/t.EXTENT*1024*F),256,m.maxTextureSize)}z.gradient=t.renderColorRamp({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:D,image:z.gradient||void 0,clips:w.lineClipsArray}),z.texture?z.texture.update(z.gradient):z.texture=new t.Texture(m,z.gradient,y.RGBA),z.version=i.gradientVersion,C=z.texture}m.activeTexture.set(y.TEXTURE0),C.bind(i.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}T.draw(m,y.TRIANGLES,s,e.stencilModeForClipping(x),l,Pt.disabled,k,i.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,i.paint,e.transform.zoom,I,w.layoutVertexBuffer2),g=!1}}}}},fill:function(e,r,i,n){var o=i.paint.get("fill-color"),a=i.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),l=i.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 h=e.depthModeForSublayer(1,"opaque"===e.renderPass?St.ReadWrite:St.ReadOnly);ii(e,r,i,n,h,s,!1)}if("translucent"===e.renderPass&&i.paint.get("fill-antialias")){var p=e.depthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,St.ReadOnly);ii(e,r,i,n,p,s,!0)}}},"fill-extrusion":function(t,e,r,i){var n=r.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||r.paint.get("fill-extrusion-pattern").constantOr(1))ni(t,e,r,i,o,Tt.disabled,Et.disabled),ni(t,e,r,i,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{var a=t.colorModeForRenderPass();ni(t,e,r,i,o,Tt.disabled,a)}}},hillshade:function(t,e,r,i){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(i):[{},i],l=s[0],u=0,h=s[1];u<h.length;u+=1){var p=h[u],c=e.getTile(p);c.needsHillshadePrepare&&"offscreen"===t.renderPass?ai(t,c,r,o,Tt.disabled,a):"translucent"===t.renderPass&&oi(t,c,r,o,l[p.overscaledZ],a)}n.viewport.set([0,0,t.width,t.height])}},raster:function(t,e,r,i){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity")&&i.length)for(var n=t.context,o=n.gl,a=e.getSource(),s=t.useProgram("raster"),l=t.colorModeForRenderPass(),u=a instanceof k?[{},i]:t.stencilConfigForOverlap(i),h=u[0],p=u[1],c=p[p.length-1].overscaledZ,f=!t.options.moving,d=0,m=p;d<m.length;d+=1){var y=m[d],g=t.depthModeForSublayer(y.overscaledZ-c,1===r.paint.get("raster-opacity")?St.ReadWrite:St.ReadOnly,o.LESS),_=e.getTile(y),v=t.transform.calculatePosMatrix(y.toUnwrapped(),f);_.registerFadeDuration(r.paint.get("raster-fade-duration"));var x=e.findLoadedParent(y,0),b=si(_,x,e,r,t.transform),w=void 0,I=void 0,S="nearest"===r.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;n.activeTexture.set(o.TEXTURE0),_.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,x.tileID.overscaledZ-_.tileID.overscaledZ),I=[_.tileID.canonical.x*w%1,_.tileID.canonical.y*w%1]):_.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);var T=Ur(v,I||[0,0],w||1,b,r);a instanceof k?s.draw(n,o.TRIANGLES,g,Tt.disabled,l,Pt.disabled,T,r.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(n,o.TRIANGLES,g,h[y.overscaledZ],l,Pt.disabled,T,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,r){var i=r.paint.get("background-color"),n=r.paint.get("background-opacity");if(0!==n){var o=t.context,a=o.gl,s=t.transform,l=s.tileSize,u=r.paint.get("background-pattern");if(!t.isPatternMissing(u)){var h=!u&&1===i.a&&1===n&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===h){var p=Tt.disabled,c=t.depthModeForSublayer(0,"opaque"===h?St.ReadWrite:St.ReadOnly),f=t.colorModeForRenderPass(),d=t.useProgram(u?"backgroundPattern":"background"),m=s.coveringTiles({tileSize:l});u&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));for(var y=r.getCrossfadeParameters(),g=0,_=m;g<_.length;g+=1){var v=_[g],x=t.transform.calculatePosMatrix(v.toUnwrapped()),b=u?Wr(x,n,t,u,{tileID:v,tileSize:l},y):Yr(x,n,i);d.draw(o,a.TRIANGLES,c,p,f,Pt.disabled,b,r.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}}}},debug:function(t,e,r){for(var i=0;i<r.length;i++)yi(t,e,r[i])},custom:function(t,e,r){var i=t.context,n=r.implementation;if("offscreen"===t.renderPass){var o=n.prerender;o&&(t.setCustomLayerDefaults(),i.setColorMode(t.colorModeForRenderPass()),o.call(n,i.gl,t.transform.customLayerMatrix()),i.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),i.setColorMode(t.colorModeForRenderPass()),i.setStencilMode(Tt.disabled);var a="3d"===n.renderingMode?new St(t.context.gl.LEQUAL,St.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,St.ReadOnly);i.setDepthMode(a),n.render(i.gl,t.transform.customLayerMatrix()),i.setDirty(),t.setBaseState(),i.bindFramebuffer.set(null)}}},_i=function(t,e){this.context=new At(t),this.transform=e,this._tileTextures={},this.setup(),this.numSublayers=Lt.maxUnderzooming+Lt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Re,this.gpuTimers={}};_i.prototype.resize=function(e,r){if(this.width=e*t.browser.devicePixelRatio,this.height=r*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var i=0,n=this.style._order;i<n.length;i+=1)this.style._layers[n[i]].resize()},_i.prototype.setup=function(){var e=this.context,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.tileExtentBuffer=e.createVertexBuffer(r,Ue.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var 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.debugBuffer=e.createVertexBuffer(i,Ue.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,M.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,Ue.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)},_i.prototype.clearStencil=function(){var e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var i=t.create();t.ortho(i,0,this.width,this.height,0,0,1),t.scale(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,r.TRIANGLES,St.disabled,this.stencilClearMode,Et.disabled,Pt.disabled,Cr(i),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},_i.prototype._renderTileClippingMasks=function(t,e){if(this.currentStencilSource!==t.source&&t.isTileClipped()&&e&&e.length){this.currentStencilSource=t.source;var r=this.context,i=r.gl;this.nextStencilID+e.length>256&&this.clearStencil(),r.setColorMode(Et.disabled),r.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(r,i.TRIANGLES,St.disabled,new Tt({func:i.ALWAYS,mask:0},l,255,i.KEEP,i.KEEP,i.REPLACE),Et.disabled,Pt.disabled,Cr(s.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},_i.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)},_i.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)},_i.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,i=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),n=i[i.length-1].overscaledZ,o=i[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:r.GEQUAL,mask:255},s+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[a,i]}return[(e={},e[n]=Tt.disabled,e),i]},_i.prototype.colorModeForRenderPass=function(){var e=this.context.gl;return this._showOverdrawInspector?new Et([e.CONSTANT_COLOR,e.ONE],new t.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?Et.unblended:Et.alphaBlended},_i.prototype.depthModeForSublayer=function(t,e,r){if(!this.opaquePassEnabledForLayer())return St.disabled;var i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new St(r||this.context.gl.LEQUAL,e,[i,i])},_i.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},_i.prototype.render=function(e,r){var i=this;this.style=e,this.options=r,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,h={},p={},c={};for(var f in o){var d=o[f];h[f]=d.getVisibleCoordinates(),p[f]=h[f].slice().reverse(),c[f]=d.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,g=n;y<g.length;y+=1){var _=this.style._layers[g[y]];if(_.hasOffscreenPass()&&!_.isHidden(this.transform.zoom)){var v=p[_.source];("custom"===_.type||v.length)&&this.renderLayer(this,o[_.source],_,v)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.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=h[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 I=this.style._layers[n[this.currentLayer]],S=o[I.source],T=("symbol"===I.type?c:p)[I.source];this._renderTileClippingMasks(I,h[I.source]),this.renderLayer(this,S,I,T)}this.options.showTileBoundaries&&(t.values(this.style._layers).forEach((function(t){t.source&&!t.isHidden(i.transform.zoom)&&(t.source!==(u&&u.id)&&(u=i.style.sourceCaches[t.source]),(!l||l.getSource().maxzoom<u.getSource().maxzoom)&&(l=u))})),l&&gi.debug(this,l,l.getVisibleCoordinates())),this.options.showPadding&&function(t){var e=t.transform.padding;fi(t,t.transform.height-(e.top||0),3,li),fi(t,e.bottom||0,3,ui),di(t,e.left||0,3,hi),di(t,t.transform.width-(e.right||0),3,pi);var r=t.transform.centerPoint;!function(t,e,r,i){mi(t,e-1,r-10,2,20,i),mi(t,e-10,r-1,20,2,i)}(t,r.x,t.transform.height-r.y,ci)}(this),this.context.setDefault()},_i.prototype.renderLayer=function(t,e,r,i){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||i.length)&&(this.id=r.id,this.gpuTimingStart(r),gi[r.type](t,e,r,i,this.style.placement.variableOffsets),this.gpuTimingEnd())},_i.prototype.gpuTimingStart=function(t){if(this.options.gpuTiming){var e=this.context.extTimerQuery,r=this.gpuTimers[t.id];r||(r=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),r.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,r.query)}},_i.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}},_i.prototype.collectGpuTimers=function(){var t=this.gpuTimers;return this.gpuTimers={},t},_i.prototype.queryGpuTimers=function(t){var e={};for(var r in t){var i=t[r],n=this.context.extTimerQuery,o=n.getQueryObjectEXT(i.query,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(i.query),e[r]=o}return e},_i.prototype.translatePosMatrix=function(e,r,i,n,o){if(!i[0]&&!i[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);i=[i[0]*l-i[1]*s,i[0]*s+i[1]*l]}var u=[o?i[0]:ue(r,i[0],this.transform.zoom),o?i[1]:ue(r,i[1],this.transform.zoom),0],h=new Float32Array(16);return t.translate(h,e,u),h},_i.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},_i.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},_i.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},_i.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new xr(this.context,t,gr[t],e,Hr[t],this._showOverdrawInspector)),this.cache[r]},_i.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()},_i.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)},_i.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))},_i.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var vi=function(t,e){this.points=t,this.planes=e};vi.fromInvProjectionMatrix=function(e,r,i){var n=Math.pow(2,i),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(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*n)})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],o[e[0]],o[e[1]]),i=t.sub([],o[e[2]],o[e[1]]),n=t.normalize([],t.cross([],r,i)),a=-t.dot(n,o[e[1]]);return n.concat(a)}));return new vi(o,a)};var xi=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};xi.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],i=t.clone$2(this.min),n=t.clone$2(this.max),o=0;o<r.length;o++)i[o]=r[o]?this.min[o]:this.center[o],n[o]=r[o]?this.center[o]:this.max[o];return n[2]=this.max[2],new xi(i,n)},xi.prototype.distanceX=function(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]},xi.prototype.distanceY=function(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]},xi.prototype.intersects=function(e){for(var r=[[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]],i=!0,n=0;n<e.planes.length;n++){for(var o=e.planes[n],a=0,s=0;s<r.length;s++)a+=t.dot$1(o,r[s])>=0;if(0===a)return 0;a!==r.length&&(i=!1)}if(i)return 2;for(var l=0;l<3;l++){for(var u=Number.MAX_VALUE,h=-Number.MAX_VALUE,p=0;p<e.points.length;p++){var c=e.points[p][l]-this.min[l];u=Math.min(u,c),h=Math.max(h,c)}if(h<0||u>this.max[l]-this.min[l])return 0}return 1};var bi=function(t,e,r,i){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(i)||i<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=r,this.right=i};bi.prototype.interpolate=function(e,r,i){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,i)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,i)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,i)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,i)),this},bi.prototype.getCenter=function(e,r){var i=t.clamp((this.left+e-this.right)/2,0,e),n=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(i,n)},bi.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},bi.prototype.clone=function(){return new bi(this.top,this.bottom,this.left,this.right)},bi.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var wi=function(e,r,i,n,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==i?0:i,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 bi,this._posMatrixCache={},this._alignedPosMatrixCache={}},Ii={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}};wi.prototype.clone=function(){var t=new wi(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},Ii.minZoom.get=function(){return this._minZoom},Ii.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Ii.maxZoom.get=function(){return this._maxZoom},Ii.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Ii.minPitch.get=function(){return this._minPitch},Ii.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Ii.maxPitch.get=function(){return this._maxPitch},Ii.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Ii.renderWorldCopies.get=function(){return this._renderWorldCopies},Ii.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Ii.worldSize.get=function(){return this.tileSize*this.scale},Ii.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Ii.size.get=function(){return new t.Point(this.width,this.height)},Ii.bearing.get=function(){return-this.angle/Math.PI*180},Ii.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Ii.pitch.get=function(){return this._pitch/Math.PI*180},Ii.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},Ii.fov.get=function(){return this._fov/Math.PI*180},Ii.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())},Ii.zoom.get=function(){return this._zoom},Ii.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())},Ii.center.get=function(){return this._center},Ii.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Ii.padding.get=function(){return this._edgeInsets.toJSON()},Ii.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Ii.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},wi.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},wi.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},wi.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)},wi.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var i=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(i.x,n.x,o.x,a.x)),l=Math.floor(Math.max(i.x,n.x,o.x,a.x)),u=s-1;u<=l+1;u++)0!==u&&r.push(new t.UnwrappedTileID(u,e));return r},wi.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),i=r;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);var n=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,r),a=[o*n.x,o*n.y,0],s=vi.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=r);var u=function(t){return{aabb:new xi([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},h=[],p=[],c=r,f=e.reparseOverscaled?i:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)h.push(u(-d)),h.push(u(d));for(h.push(u(0));h.length>0;){var m=h.pop(),y=m.x,g=m.y,_=m.fullyVisible;if(!_){var v=m.aabb.intersects(s);if(0===v)continue;_=2===v}var x=m.aabb.distanceX(a),b=m.aabb.distanceY(a),w=Math.max(Math.abs(x),Math.abs(b));if(m.zoom===c||w>3+(1<<c-m.zoom)-2&&m.zoom>=l)p.push({tileID:new t.OverscaledTileID(m.zoom===c?f:m.zoom,m.wrap,m.zoom,y,g),distanceSq:t.sqrLen([a[0]-.5-y,a[1]-.5-g])});else for(var I=0;I<4;I++){var S=(y<<1)+I%2,T=(g<<1)+(I>>1);h.push({aabb:m.aabb.quadrant(I),zoom:m.zoom+1,x:S,y:T,wrap:m.wrap,fullyVisible:_})}}return p.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},wi.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Ii.unmodified.get=function(){return this._unmodified},wi.prototype.zoomScale=function(t){return Math.pow(2,t)},wi.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},wi.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},wi.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Ii.point.get=function(){return this.project(this.center)},wi.prototype.setLocationAtPoint=function(e,r){var i=this.pointCoordinate(r),n=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(i.x-n.x),o.y-(i.y-n.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},wi.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},wi.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},wi.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},wi.prototype.coordinateLocation=function(t){return t.toLngLat()},wi.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],i=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(i,i,this.pixelMatrixInverse);var n=r[3],o=i[3],a=r[1]/n,s=i[1]/o,l=r[2]/n,u=i[2]/o,h=l===u?0:(0-l)/(u-l);return new t.MercatorCoordinate(t.number(r[0]/n,i[0]/o,h)/this.worldSize,t.number(a,s,h)/this.worldSize)},wi.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},wi.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)))},wi.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},wi.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])},wi.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var i=e.key,n=r?this._alignedPosMatrixCache:this._posMatrixCache;if(n[i])return n[i];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,r?this.alignedProjMatrix:this.projMatrix,l),n[i]=new Float32Array(l),n[i]},wi.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},wi.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,i=0,n=0,o=0,a=0,s=this._unmodified;if(this.latRange){var l=this.latRange;i=t.mercatorYfromLat(l[1])*this.worldSize,n=t.mercatorYfromLat(l[0])*this.worldSize}if(this.lngRange){var u=this.lngRange;o=t.mercatorXfromLng(u[0])*this.worldSize,a=t.mercatorXfromLng(u[1])*this.worldSize}var h=this.point;e=h.x,r=h.y,o&&(e=Math.max(o,e)),a&&(e=Math.min(a,e)),i&&(r=Math.max(i,r)),n&&(r=Math.min(n,r)),this.center=this.unproject(new t.Point(e,r)),this._unmodified=s,this._constraining=!1}},wi.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,i=this._fov*(.5+e.y/this.height),n=Math.sin(i)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-i,.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,h=new Float64Array(16);t.perspective(h,this._fov,this.width/this.height,u,l),h[8]=2*-e.x/this.width,h[9]=2*e.y/this.height,t.scale(h,h,[1,-1,1]),t.translate(h,h,[0,0,-this.cameraToCenterDistance]),t.rotateX(h,h,this._pitch),t.rotateZ(h,h,this.angle),t.translate(h,h,[-a,-s,0]),this.mercatorMatrix=t.scale([],h,[this.worldSize,this.worldSize,this.worldSize]),t.scale(h,h,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=h,this.invProjMatrix=t.invert([],this.projMatrix);var p=this.width%2/2,c=this.height%2/2,f=Math.cos(this.angle),d=Math.sin(this.angle),m=a-Math.round(a)+f*p+d*c,y=s-Math.round(s)+f*c+d*p,g=new Float64Array(h);if(t.translate(g,g,[m>.5?m-1:m,y>.5?y-1:y,0]),this.alignedProjMatrix=g,h=t.create(),t.scale(h,h,[this.width/2,-this.height/2,1]),t.translate(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=t.create(),t.scale(h,h,[1,-1,1]),t.translate(h,h,[-1,-1,0]),t.scale(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(h=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=h,this._posMatrixCache={},this._alignedPosMatrixCache={}}},wi.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},wi.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},wi.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var i=r.x,n=r.y,o=r.x,a=r.y,s=0,l=e;s<l.length;s+=1){var u=l[s];i=Math.min(i,u.x),n=Math.min(n,u.y),o=Math.max(o,u.x),a=Math.max(a,u.y)}return[new t.Point(i,n),new t.Point(o,n),new t.Point(o,a),new t.Point(i,a),new t.Point(i,n)]},wi.prototype.getCoverZoomByBounds=function(e){var r,i,n,o,a=[e.getWest(),e.getEast()],s=[e.getSouth(),e.getNorth()];return s&&(i=t.mercatorYfromLat(s[1])*this.worldSize,o=t.mercatorYfromLat(s[0])*this.worldSize-i),a&&(r=t.mercatorXfromLng(a[0])*this.worldSize,n=t.mercatorXfromLng(a[1])*this.worldSize-r),this.coveringZoomLevel({roundZoom:!0,tileSize:Math.min(n||0,o||0)})},Object.defineProperties(wi.prototype,Ii);var Si=function(e){var r,i,n,o;this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(r=this._updateHashUnthrottled.bind(this),i=!1,n=null,o=function(){n=null,i&&(r(),n=setTimeout(o,300),i=!1)},function(){return i=!0,n||o(),n})};Si.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Si.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Si.prototype.getHashString=function(e){var r=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),a=Math.round(r.lng*o)/o,s=Math.round(r.lat*o)/o,l=this._map.getBearing(),u=this._map.getPitch(),h="";if(h+=e?"/"+a+"/"+s+"/"+i:i+"/"+s+"/"+a,(l||u)&&(h+="/"+Math.round(10*l)/10),u&&(h+="/"+Math.round(u)),this._hashName){var p=this._hashName,c=!1,f=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===p?(c=!0,e+"="+h):t})).filter((function(t){return t}));return c||f.push(p+"="+h),"#"+f.join("&")}return"#"+h},Si.prototype._getCurrentHash=function(){var e,r=this,i=t.window.location.hash.replace("#","");return this._hashName?(i.split("&").map((function(t){return t.split("=")})).forEach((function(t){t[0]===r._hashName&&(e=t)})),(e&&e[1]||"").split("/")):i.split("/")},Si.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},Si.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,e)}catch(t){}};var Ti={linearity:.3,easing:t.bezier(0,0,.3,1)},Ei=t.extend({deceleration:2500,maxSpeed:1400},Ti),Pi=t.extend({deceleration:20,maxSpeed:1400},Ti),Ai=t.extend({deceleration:1e3,maxSpeed:360},Ti),Li=t.extend({deceleration:1e3,maxSpeed:90},Ti),Mi=function(t){this._map=t,this.clear()};function ki(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function zi(e,r,i){var n=i.maxSpeed,o=i.linearity,a=i.deceleration,s=t.clamp(e*o/(r/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:i.easing,duration:1e3*l,amount:s*(l/2)}}Mi.prototype.clear=function(){this._inertiaBuffer=[]},Mi.prototype.record=function(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})},Mi.prototype._drainInertiaBuffer=function(){for(var e=this._inertiaBuffer,r=t.browser.now();e.length>0&&r-e[0].time>160;)e.shift()},Mi.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},i=0,n=this._inertiaBuffer;i<n.length;i+=1){var o=n[i].settings;r.zoom+=o.zoomDelta||0,r.bearing+=o.bearingDelta||0,r.pitch+=o.pitchDelta||0,o.panDelta&&r.pan._add(o.panDelta),o.around&&(r.around=o.around),o.pinchAround&&(r.pinchAround=o.pinchAround)}var a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(r.pan.mag()){var l=zi(r.pan.mag(),a,t.extend({},Ei,e||{}));s.offset=r.pan.mult(l.amount/r.pan.mag()),s.center=this._map.transform.center,ki(s,l)}if(r.zoom){var u=zi(r.zoom,a,Pi);s.zoom=this._map.transform.zoom+u.amount,ki(s,u)}if(r.bearing){var h=zi(r.bearing,a,Ai);s.bearing=this._map.transform.bearing+t.clamp(h.amount,-179,179),ki(s,h)}if(r.pitch){var p=zi(r.pitch,a,Li);s.pitch=this._map.transform.pitch+p.amount,ki(s,p)}if(s.zoom||s.bearing){var c=void 0===r.pinchAround?r.around:r.pinchAround;s.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),t.extend(s,{noMoveStart:!0})}};var Ci=function(r){function i(i,n,o,a){void 0===a&&(a={});var s=e.mousePos(n.getCanvasContainer(),o),l=n.unproject(s);r.call(this,i,t.extend({point:s,lngLat:l,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var n={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,n),i}(t.Event),Di=function(r){function i(i,n,o){var a="touchend"===i?o.changedTouches:o.touches,s=e.touchPos(n.getCanvasContainer(),a),l=s.map((function(t){return n.unproject(t)})),u=s.reduce((function(t,e,r,i){return t.add(e.div(i.length))}),new t.Point(0,0)),h=n.unproject(u);r.call(this,i,{points:s,point:u,lngLats:l,lngLat:h,originalEvent:o}),this._defaultPrevented=!1}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var n={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,n),i}(t.Event),Ri=function(t){function e(e,r,i){t.call(this,e,{originalEvent:i}),this._defaultPrevented=!1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),Fi=function(t,e){this._map=t,this._clickTolerance=e.clickTolerance};Fi.prototype.reset=function(){delete this._mousedownPos},Fi.prototype.wheel=function(t){return this._firePreventable(new Ri(t.type,this._map,t))},Fi.prototype.mousedown=function(t,e){return this._mousedownPos=e,this._firePreventable(new Ci(t.type,this._map,t))},Fi.prototype.mouseup=function(t){this._map.fire(new Ci(t.type,this._map,t))},Fi.prototype.click=function(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Ci(t.type,this._map,t))},Fi.prototype.dblclick=function(t){return this._firePreventable(new Ci(t.type,this._map,t))},Fi.prototype.mouseover=function(t){this._map.fire(new Ci(t.type,this._map,t))},Fi.prototype.mouseout=function(t){this._map.fire(new Ci(t.type,this._map,t))},Fi.prototype.touchstart=function(t){return this._firePreventable(new Di(t.type,this._map,t))},Fi.prototype.touchmove=function(t){this._map.fire(new Di(t.type,this._map,t))},Fi.prototype.touchend=function(t){this._map.fire(new Di(t.type,this._map,t))},Fi.prototype.touchcancel=function(t){this._map.fire(new Di(t.type,this._map,t))},Fi.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},Fi.prototype.isEnabled=function(){return!0},Fi.prototype.isActive=function(){return!1},Fi.prototype.enable=function(){},Fi.prototype.disable=function(){};var Oi=function(t){this._map=t};Oi.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Oi.prototype.mousemove=function(t){this._map.fire(new Ci(t.type,this._map,t))},Oi.prototype.mousedown=function(){this._delayContextMenu=!0},Oi.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ci("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Oi.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Ci(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Oi.prototype.isEnabled=function(){return!0},Oi.prototype.isActive=function(){return!1},Oi.prototype.enable=function(){},Oi.prototype.disable=function(){};var Bi=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Ni(t,e){for(var r={},i=0;i<t.length;i++)r[t[i].identifier]=e[i];return r}Bi.prototype.isEnabled=function(){return!!this._enabled},Bi.prototype.isActive=function(){return!!this._active},Bi.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Bi.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Bi.prototype.mousedown=function(t,r){this.isEnabled()&&t.shiftKey&&0===t.button&&(e.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)},Bi.prototype.mousemoveWindow=function(t,r){if(this._active){var i=r;if(!(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)){var n=this._startPos;this._lastPos=i,this._box||(this._box=e.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var o=Math.min(n.x,i.x),a=Math.max(n.x,i.x),s=Math.min(n.y,i.y),l=Math.max(n.y,i.y);e.setTransform(this._box,"translate("+o+"px,"+s+"px)"),this._box.style.width=a-o+"px",this._box.style.height=l-s+"px"}}},Bi.prototype.mouseupWindow=function(r,i){var n=this;if(this._active&&0===r.button){var o=this._startPos,a=i;if(this.reset(),e.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:function(t){return t.fitScreenCoordinates(o,a,n._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",r)}},Bi.prototype.keydown=function(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))},Bi.prototype.reset=function(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(e.remove(this._box),this._box=null),e.enableDrag(),delete this._startPos,delete this._lastPos},Bi.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,{originalEvent:r}))};var Vi=function(t){this.reset(),this.numTouches=t.numTouches};Vi.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},Vi.prototype.touchstart=function(e,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),i=0,n=e;i<n.length;i+=1)r._add(n[i]);return r.div(e.length)}(r),this.touches=Ni(i,r)))},Vi.prototype.touchmove=function(t,e,r){if(!this.aborted&&this.centroid){var i=Ni(r,e);for(var n in this.touches){var o=i[n];(!o||o.dist(this.touches[n])>30)&&(this.aborted=!0)}}},Vi.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var i=!this.aborted&&this.centroid;if(this.reset(),i)return i}};var Ui=function(t){this.singleTap=new Vi(t),this.numTaps=t.numTaps,this.reset()};Ui.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Ui.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},Ui.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},Ui.prototype.touchend=function(t,e,r){var i=this.singleTap.touchend(t,e,r);if(i){var n=t.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(i)<30;if(n&&o||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}};var ji=function(){this._zoomIn=new Ui({numTouches:1,numTaps:2}),this._zoomOut=new Ui({numTouches:2,numTaps:1}),this.reset()};ji.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},ji.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},ji.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},ji.prototype.touchend=function(t,e,r){var i=this,n=this._zoomIn.touchend(t,e,r),o=this._zoomOut.touchend(t,e,r);return n?(this._active=!0,t.preventDefault(),setTimeout((function(){return i.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 i.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(o)},{originalEvent:t})}}):void 0},ji.prototype.touchcancel=function(){this.reset()},ji.prototype.enable=function(){this._enabled=!0},ji.prototype.disable=function(){this._enabled=!1,this.reset()},ji.prototype.isEnabled=function(){return this._enabled},ji.prototype.isActive=function(){return this._active};var qi={0:1,2:2},Gi=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};Gi.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Gi.prototype._correctButton=function(t,e){return!1},Gi.prototype._move=function(t,e){return{}},Gi.prototype.mousedown=function(t,r){if(!this._lastPoint){var i=e.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=r,this._eventButton=i)}},Gi.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r)if(t.preventDefault(),function(t,e){var r=qi[e];return void 0===t.buttons||(t.buttons&r)!==r}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(r,e)},Gi.prototype.mouseupWindow=function(t){this._lastPoint&&e.mouseButton(t)===this._eventButton&&(this._moved&&e.suppressClick(),this.reset())},Gi.prototype.enable=function(){this._enabled=!0},Gi.prototype.disable=function(){this._enabled=!1,this.reset()},Gi.prototype.isEnabled=function(){return this._enabled},Gi.prototype.isActive=function(){return this._active};var Zi=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,r){t.prototype.mousedown.call(this,e,r),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}(Gi),Xi=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 r=.8*(e.x-t.x);if(r)return this._active=!0,{bearingDelta:r}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Gi),Yi=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 r=-.5*(e.y-t.y);if(r)return this._active=!0,{pitchDelta:r}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Gi),Wi=function(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()};Wi.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new t.Point(0,0)},Wi.prototype.touchstart=function(t,e,r){return this._calculateTransform(t,e,r)},Wi.prototype.touchmove=function(t,e,r){if(this._active&&!(r.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,r)},Wi.prototype.touchend=function(t,e,r){this._calculateTransform(t,e,r),this._active&&r.length<this._minTouches&&this.reset()},Wi.prototype.touchcancel=function(){this.reset()},Wi.prototype._calculateTransform=function(e,r,i){i.length>0&&(this._active=!0);var n=Ni(i,r),o=new t.Point(0,0),a=new t.Point(0,0),s=0;for(var l in n){var u=n[l],h=this._touches[l];h&&(o._add(u),a._add(u.sub(h)),s++,n[l]=u)}if(this._touches=n,!(s<this._minTouches)&&a.mag()){var p=a.div(s);if(this._sum._add(p),!(this._sum.mag()<this._clickTolerance))return{around:o.div(s),panDelta:p}}},Wi.prototype.enable=function(){this._enabled=!0},Wi.prototype.disable=function(){this._enabled=!1,this.reset()},Wi.prototype.isEnabled=function(){return this._enabled},Wi.prototype.isActive=function(){return this._active};var Hi=function(){this.reset()};function Ki(t,e,r){for(var i=0;i<t.length;i++)if(t[i].identifier===r)return e[i]}function Ji(t,e){return Math.log(t/e)/Math.LN2}Hi.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Hi.prototype._start=function(t){},Hi.prototype._move=function(t,e,r){return{}},Hi.prototype.touchstart=function(t,e,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([e[0],e[1]]))},Hi.prototype.touchmove=function(t,e,r){if(this._firstTwoTouches){t.preventDefault();var i=this._firstTwoTouches,n=i[1],o=Ki(r,e,i[0]),a=Ki(r,e,n);if(o&&a){var s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}}},Hi.prototype.touchend=function(t,r,i){if(this._firstTwoTouches){var n=this._firstTwoTouches,o=n[1],a=Ki(i,r,n[0]),s=Ki(i,r,o);a&&s||(this._active&&e.suppressClick(),this.reset())}},Hi.prototype.touchcancel=function(){this.reset()},Hi.prototype.enable=function(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around},Hi.prototype.disable=function(){this._enabled=!1,this.reset()},Hi.prototype.isEnabled=function(){return this._enabled},Hi.prototype.isActive=function(){return this._active};var $i=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 r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ji(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ji(this._distance,r),pinchAround:e}},e}(Hi);function Qi(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 r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Qi(this._vector,r),pinchAround:e}},e.prototype._isBelowThreshold=function(t){this._minDiameter=Math.min(this._minDiameter,t.mag());var e=25/(Math.PI*this._minDiameter)*360,r=Qi(t,this._startVector);return Math.abs(r)<e},e}(Hi);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,r){var i=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var i=t.mag()>=2,n=e.mag()>=2;if(i||n){if(!i||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var o=t.y>0==e.y>0;return en(t)&&en(e)&&o}},e}(Hi),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.reset=function(){this._active=!1},on.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,i=0,n=0,o=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?i=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&&(i=0,n=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:an,zoom:r?Math.round(l)+r*(t.shiftKey?2:1):l,bearing:s.getBearing()+i*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,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,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 r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,i=t.browser.now(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,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(r){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 i=e.mousePos(this._el,r);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),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 r=this._map.transform;if(0!==this._delta){var i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==n&&(n=1/n);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*n))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,l=this._startZoom,u=this._easing,h=!1;if("wheel"===this._type&&l&&u){var p=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),c=u(p);a=t.number(l,s,c),p<1?this._frameId||(this._frameId=!0):h=!0}else a=s,h=!0;return this._active=!0,h&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!h,zoomDelta:a-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},sn.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var i=this._prevEase,n=(t.browser.now()-i.start)/i.duration,o=i.easing(n+.01)-i.easing(n),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},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.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.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 hn=function(){this._tap=new Ui({numTouches:1,numTaps:1}),this.reset()};hn.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},hn.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},hn.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var i=e[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,r)},hn.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},hn.prototype.touchcancel=function(){this.reset()},hn.prototype.enable=function(){this._enabled=!0},hn.prototype.disable=function(){this._enabled=!1,this.reset()},hn.prototype.isEnabled=function(){return this._enabled},hn.prototype.isActive=function(){return this._active};var pn=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};pn.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},pn.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},pn.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},pn.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var cn=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};cn.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},cn.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},cn.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},cn.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var fn=function(t,e,r,i){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0};fn.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")},fn.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},fn.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},fn.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},fn.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},fn.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var dn=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 gn=function(r,i){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Mi(r),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i),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];e.addEventListener(l,s[1],l===t.window.document?this.handleWindowEvent:this.handleEvent,s[2])}};gn.prototype.destroy=function(){for(var r=0,i=this._listeners;r<i.length;r+=1){var n=i[r],o=n[0];e.removeEventListener(o,n[1],o===t.window.document?this.handleWindowEvent:this.handleEvent,n[2])}},gn.prototype._addDefaultHandlers=function(t){var e=this._map,r=e.getCanvasContainer();this._add("mapEvent",new Fi(e,t));var i=e.boxZoom=new Bi(e,t);this._add("boxZoom",i);var n=new ji,o=new un;e.doubleClickZoom=new ln(o,n),this._add("tapZoom",n),this._add("clickZoom",o);var a=new hn;this._add("tapDragZoom",a);var s=e.touchPitch=new rn;this._add("touchPitch",s);var l=new Xi(t),u=new Yi(t);e.dragRotate=new cn(t,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);var h=new Zi(t),p=new Wi(t);e.dragPan=new pn(r,h,p),this._add("mousePan",h),this._add("touchPan",p,["touchZoom","touchRotate"]);var c=new tn,f=new $i;e.touchZoomRotate=new fn(r,f,c,a),this._add("touchRotate",c,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]);var d=e.scrollZoom=new sn(e,this);this._add("scrollZoom",d,["mousePan"]);var m=e.keyboard=new on;this._add("keyboard",m),this._add("blockableMapEvent",new Oi(e));for(var y=0,g=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];y<g.length;y+=1){var _=g[y];t.interactive&&t[_]&&e[_].enable(t[_])}},gn.prototype._add=function(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e},gn.prototype.stop=function(t){if(!this._updatingCamera){for(var e=0,r=this._handlers;e<r.length;e+=1)r[e].handler.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}},gn.prototype.isActive=function(){for(var t=0,e=this._handlers;t<e.length;t+=1)if(e[t].handler.isActive())return!0;return!1},gn.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},gn.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},gn.prototype.isMoving=function(){return Boolean(dn(this._eventsInProgress))||this.isZooming()},gn.prototype._blockedByActive=function(t,e,r){for(var i in t)if(i!==r&&(!e||e.indexOf(i)<0))return!0;return!1},gn.prototype.handleWindowEvent=function(t){this.handleEvent(t,t.type+"Window")},gn.prototype._getMapTouches=function(t){for(var e=[],r=0,i=t;r<i.length;r+=1){var n=i[r];this._el.contains(n.target)&&e.push(n)}return e},gn.prototype.handleEvent=function(t,r){if("blur"!==t.type){this._updatingCamera=!0;for(var i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},o={},a={},s=t.touches?this._getMapTouches(t.touches):void 0,l=s?e.touchPos(this._el,s):e.mousePos(this._el,t),u=0,h=this._handlers;u<h.length;u+=1){var p=h[u],c=p.handlerName,f=p.handler,d=p.allowed;if(f.isEnabled()){var m=void 0;this._blockedByActive(a,d,c)?f.reset():f[r||t.type]&&(m=f[r||t.type](t,l,s),this.mergeHandlerResult(n,o,m,c,i),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||f.isActive())&&(a[c]=f)}}var y={};for(var g in this._previousActiveHandlers)a[g]||(y[g]=i);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 _=n.cameraAnimation;_&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],_(this._map))}else this.stop(!0)},gn.prototype.mergeHandlerResult=function(e,r,i,n,o){if(i){t.extend(e,i);var a={handlerName:n,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(r.zoom=a),void 0!==i.panDelta&&(r.drag=a),void 0!==i.pitchDelta&&(r.pitch=a),void 0!==i.bearingDelta&&(r.rotate=a)}},gn.prototype._applyChanges=function(){for(var e={},r={},i={},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(r,l),t.extend(i,u)}this._updateMapTransform(e,r,i),this._changes=[]},gn.prototype._updateMapTransform=function(t,e,r){var i=this._map,n=i.transform;if(!yn(t))return this._fireEvents(e,r,!0);var o=t.panDelta,a=t.zoomDelta,s=t.bearingDelta,l=t.pitchDelta,u=t.around,h=t.pinchAround;void 0!==h&&(u=h),i._stop(!0),u=u||i.transform.centerPoint;var p=n.pointLocation(o?u.sub(o):u);s&&(n.bearing+=s),l&&(n.pitch+=l),a&&(n.zoom+=a),n.setLocationAtPoint(p,u),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)},gn.prototype._fireEvents=function(e,r,i){var n=this,o=dn(this._eventsInProgress),a=dn(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 h in a&&this._fireEvent("move",a.originalEvent),e)this._fireEvent(h,e[h].originalEvent);var p,c={};for(var f in this._eventsInProgress){var d=this._eventsInProgress[f],m=d.handlerName,y=d.originalEvent;this._handlersById[m].isActive()||(delete this._eventsInProgress[f],c[f+"end"]=p=r[m]||y)}for(var g in c)this._fireEvent(g,c[g]);var _=dn(this._eventsInProgress);if(i&&(o||a)&&!_){this._updatingCamera=!0;var v=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),x=function(t){return 0!==t&&-n._bearingSnap<t&&t<n._bearingSnap};v?(x(v.bearing||this._map.getBearing())&&(v.bearing=0),this._map.easeTo(v,{originalEvent:p})):(this._map.fire(new t.Event("moveend",{originalEvent:p})),x(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},gn.prototype._fireEvent=function(e,r){this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},gn.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()}))},gn.prototype._triggerRenderFrame=function(){void 0===this._frameId&&(this._frameId=this._requestFrame())};var _n=function(e){function r(r,i){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getCenter=function(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,i){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),i)},r.prototype.panTo=function(e,r,i){return this.easeTo(t.extend({center:e},r),i)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,i){return this.easeTo(t.extend({zoom:e},r),i)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.getPadding=function(){return this.transform.padding},r.prototype.setPadding=function(t,e){return this.jumpTo({padding:t},e),this},r.prototype.rotateTo=function(e,r,i){return this.easeTo(t.extend({bearing:e},r),i)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.resetNorthPitch=function(e,r){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},r.prototype.getPitch=function(){return this.transform.pitch},r.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},r.prototype.cameraForBounds=function(e,r){e=t.LngLatBounds.convert(e);var i=r&&r.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,r)},r.prototype._cameraForBoxAndBearing=function(e,r,i,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)),h=s.project(t.LngLat.convert(r)),p=u.rotate(-i*Math.PI/180),c=h.rotate(-i*Math.PI/180),f=new t.Point(Math.max(p.x,c.x),Math.max(p.y,c.y)),d=new t.Point(Math.min(p.x,c.x),Math.min(p.y,c.y)),m=f.sub(d),y=(s.width-(l.left+l.right+n.padding.left+n.padding.right))/m.x,g=(s.height-(l.top+l.bottom+n.padding.top+n.padding.bottom))/m.y;if(!(g<0||y<0)){var _=Math.min(s.scaleZoom(s.scale*Math.min(y,g)),n.maxZoom),v="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(i*Math.PI/180),b=v.add(x).mult(s.scale/s.zoomScale(_));return{center:s.unproject(u.add(h).div(2).sub(b)),zoom:_,bearing:i}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},r.prototype.fitBounds=function(t,e,r){return this._fitInternal(this.cameraForBounds(t,e),e,r)},r.prototype.fitScreenCoordinates=function(e,r,i,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(r)),i,n),n,o)},r.prototype._fitInternal=function(e,r,i){return e?(delete(r=t.extend(e,r)).padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this},r.prototype.jumpTo=function(e,r){this.stop();var i=this.transform,n=!1,o=!1,a=!1;return"zoom"in e&&i.zoom!==+e.zoom&&(n=!0,i.zoom=+e.zoom),void 0!==e.center&&(i.center=t.LngLat.convert(e.center)),"bearing"in e&&i.bearing!==+e.bearing&&(o=!0,i.bearing=+e.bearing),"pitch"in e&&i.pitch!==+e.pitch&&(a=!0,i.pitch=+e.pitch),null==e.padding||i.isPaddingEqual(e.padding)||(i.padding=e.padding),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),n&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),o&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),a&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var i=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,h="bearing"in e?this._normalizeBearing(e.bearing,a):a,p="pitch"in e?+e.pitch:s,c="padding"in e?e.padding:n.padding,f=t.Point.convert(e.offset),d=n.centerPoint.add(f),m=n.pointLocation(d),y=t.LngLat.convert(e.center||m);this._normalizeCenter(y);var g,_,v=n.project(m),x=n.project(y).sub(v),b=n.zoomScale(u-o);e.around&&(g=t.LngLat.convert(e.around),_=n.locationPoint(g));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!==h,this._pitching=this._pitching||p!==s,this._padding=!n.isPaddingEqual(c),this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,w),this._ease((function(e){if(i._zooming&&(n.zoom=t.number(o,u,e)),i._rotating&&(n.bearing=t.number(a,h,e)),i._pitching&&(n.pitch=t.number(s,p,e)),i._padding&&(n.interpolatePadding(l,c,e),d=n.centerPoint.add(f)),g)n.setLocationAtPoint(g,_);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),I=n.unproject(v.add(x.mult(e*w)).mult(m));n.setLocationAtPoint(n.renderWorldCopies?I.wrap():I,d)}i._fireMoveEvents(r)}),(function(t){i._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,i){void 0===i&&(i={}),this._moving=!0,r||i.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!i.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new t.Event("pitchstart",e))},r.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))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var i=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&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))}},r.prototype.flyTo=function(e,r){var i=this;if(!e.essential&&t.browser.prefersReducedMotion){var n=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,r)}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(),h="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,p="bearing"in e?this._normalizeBearing(e.bearing,s):s,c="pitch"in e?+e.pitch:l,f="padding"in e?e.padding:o.padding,d=o.zoomScale(h-a),m=t.Point.convert(e.offset),y=o.centerPoint.add(m),g=o.pointLocation(y),_=t.LngLat.convert(e.center||g);this._normalizeCenter(_);var v=o.project(g),x=o.project(_).sub(v),b=e.curve,w=Math.max(o.width,o.height),I=w/d,S=x.mag();if("minZoom"in e){var T=t.clamp(Math.min(e.minZoom,a,h),o.minZoom,o.maxZoom),E=w/o.zoomScale(T-a);b=Math.sqrt(E/S*2)}var P=b*b;function A(t){var e=(I*I-w*w+(t?-1:1)*P*P*S*S)/(2*(t?I:w)*P*S);return Math.log(Math.sqrt(e*e+1)-e)}function L(t){return(Math.exp(t)-Math.exp(-t))/2}function M(t){return(Math.exp(t)+Math.exp(-t))/2}var k=A(0),z=function(t){return M(k)/M(k+b*t)},C=function(t){return w*((M(k)*(L(e=k+b*t)/M(e))-L(k))/P)/S;var e},D=(A(1)-k)/b;if(Math.abs(S)<1e-6||!isFinite(D)){if(Math.abs(w-I)<1e-6)return this.easeTo(e,r);var R=I<w?-1:1;D=Math.abs(Math.log(I/w))/b,C=function(){return 0},z=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!==p,this._pitching=c!==l,this._padding=!o.isPaddingEqual(f),this._prepareEase(r,!1),this._ease((function(e){var n=e*D,d=1/z(n);o.zoom=1===e?h:a+o.scaleZoom(d),i._rotating&&(o.bearing=t.number(s,p,e)),i._pitching&&(o.pitch=t.number(l,c,e)),i._padding&&(o.interpolatePadding(u,f,e),y=o.centerPoint.add(m));var g=1===e?_:o.unproject(v.add(x.mult(C(n))).mult(d));o.setLocationAtPoint(o.renderWorldCopies?g.wrap():g,y),i._fireMoveEvents(r)}),(function(){return i._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var i=this.handlers;i&&i.stop(!1)}return this},r.prototype._ease=function(e,r,i){!1===i.animate||0===i.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.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()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var i=Math.abs(e-r);return Math.abs(e-360-r)<i&&(e-=360),Math.abs(e+360-r)<i&&(e+=360),e},r.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}},r}(t.Evented),vn=t.createCommonjsModule((function(t){function e(t){return!r(t)}function r(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,r=new Blob([""],{type:"text/javascript"}),i=URL.createObjectURL(r);try{e=new Worker(i),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(i),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 r=e.getImageData(0,0,1,1);return r&&r.width===t.width}()?(void 0===i[r=t&&t.failIfMajorPerformanceCaveat]&&(i[r]=function(t){var r=function(t){var r=document.createElement("canvas"),i=Object.create(e.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",i)||r.probablySupportsContext("experimental-webgl",i):r.supportsContext?r.supportsContext("webgl",i)||r.supportsContext("experimental-webgl",i):r.getContext("webgl",i)||r.getContext("experimental-webgl",i)}(t);if(!r)return!1;var i=r.createShader(r.VERTEX_SHADER);return!(!i||r.isContextLost())&&(r.shaderSource(i,"void main() {}"),r.compileShader(i),!0===r.getShaderParameter(i,r.COMPILE_STATUS))}(r)),i[r]?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 r}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e,window.mapboxgl.notSupportedReason=r);var i={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}})),xn=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};xn.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},xn.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,i=e?this._queue.concat(e):this._queue;r<i.length;r+=1){var n=i[r];if(n.id===t)return void(n.cancelled=!0)}},xn.prototype.run=function(t){void 0===t&&(t=0);var e=this._currentlyRunning=this._queue;this._queue=[];for(var r=0,i=e;r<i.length;r+=1){var n=i[r];if(!n.cancelled&&(n.callback(t),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},xn.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var bn={"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"},wn=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:70,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},En=function(r){function i(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>70)throw new Error("maxPitch must be less than or equal to 70");var n=new wi(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(r.call(this,n,e),this._width=e.width||400,this._height=e.height||300,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 xn,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},bn,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 gn(this,e),this._hash=e.hash&&new Si("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}),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))})),this.__options__=e}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var n={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&e.getDefaultPosition&&(r=e.getDefaultPosition()),void 0===r&&(r="hidden"),r.constructor===Object&&(e.setOffset(r),r="custom"),!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 i=e.onAdd(this,r);this._controls.push(e);var n=this._controlPositions[r];return-1!==r.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this},i.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 r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},i.prototype.resize=function(e){var r=this._containerDimensions(),i=r[0],n=r[1];this._resizeCanvas(i,n),this.transform.resize(i,n),this.painter.resize(i,n);var o=!this._moving;return o&&(this.stop(),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},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.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")},i.prototype.getMinZoom=function(){return this.transform.minZoom},i.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")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.getZoomByBounds=function(e){return this.transform.getCoverZoomByBounds(t.LngLatBounds.convert(e))},i.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")},i.prototype.getMinPitch=function(){return this.transform.minPitch},i.prototype.setMaxPitch=function(t){if((t=null==t?70:t)>70)throw new Error("maxPitch must be less than or equal to 70");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")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,r){var i,n=this;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(i){var a=n.getLayer(e)?n.queryRenderedFeatures(i.point,{layers:[e]}):[];a.length?o||(o=!0,r.call(n,new Ci(t,n,i.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(i){(n.getLayer(e)?n.queryRenderedFeatures(i.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(n,new Ci(t,n,i.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(n,new Ci(t,n,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(i={},i[t]=function(t){var i=n.getLayer(e)?n.queryRenderedFeatures(t.point,{layers:[e]}):[];i.length&&(t.features=i,r.call(n,t),delete t.features)},i)}},i.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},i.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},i.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)},i.prototype.queryRenderedFeatures=function(e,r){if(!this.style)return[];var i;if(void 0!==r||void 0===e||e instanceof t.Point||Array.isArray(e)||(r=e,e=void 0),r=r||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.Point||"number"==typeof e[0])i=[t.Point.convert(e)];else{var n=t.Point.convert(e[0]),o=t.Point.convert(e[1]);i=[n,new t.Point(o.x,n.y),o,new t.Point(n.x,o.y),n]}return this.style.queryRenderedFeatures(i,r,this.transform)},i.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},i.prototype.setStyle=function(e,r){return!1!==(r=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))},i.prototype._getUIString=function(t){var e=this._locale[t];if(null==e)throw new Error("Missing UI string '"+t+"'");return e},i.prototype._updateStyle=function(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new Ve(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)},i.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new Ve(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},i.prototype._diffStyle=function(e,r){var i=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?i.fire(new t.ErrorEvent(e)):n&&i._updateDiff(n,r)}))}else"object"==typeof e&&this._updateDiff(e,r)},i.prototype._updateDiff=function(e,r){try{this.style.setState(e)&&this._update(!0)}catch(i){t.warnOnce("Unable to perform style diff: "+(i.message||i.error||i)+".  Rebuilding the style from scratch."),this._updateStyle(e,r)}},i.prototype.getStyle=function(){if(this.style)return this.style.serialize()},i.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},i.prototype.addSource=function(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)},i.prototype.isSourceLoaded=function(e){var r=this.style&&this.style.sourceCaches[e];if(void 0!==r)return r.loaded();this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},i.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var r=t[e]._tiles;for(var i in r){var n=r[i];if("loaded"!==n.state&&"errored"!==n.state)return!1}}return!0},i.prototype.addSourceType=function(t,e,r){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,r)},i.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0)},i.prototype.getSource=function(t){return this.style.getSource(t)},i.prototype.addImage=function(e,r,i){void 0===i&&(i={});var n=i.pixelRatio;void 0===n&&(n=1);var o=i.sdf;void 0===o&&(o=!1);var a=i.stretchX,s=i.stretchY,l=i.content;if(this._lazyInitEmptyStyle(),r instanceof wn||Sn&&r instanceof Sn){var u=t.browser.getImageData(r);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===r.width||void 0===r.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 h=r;this.style.addImage(e,{data:new t.RGBAImage({width:r.width,height:r.height},new Uint8Array(r.data)),pixelRatio:n,stretchX:a,stretchY:s,content:l,sdf:o,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}},i.prototype.updateImage=function(e,r){var i=this.style.getImage(e);if(!i)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=r instanceof wn||Sn&&r instanceof Sn?t.browser.getImageData(r):r,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!==i.data.width||a!==i.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"))):(i.data.replace(s,!(r instanceof wn||Sn&&r instanceof Sn)),void this.style.updateImage(e,i))},i.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},i.prototype.removeImage=function(t){this.style.removeImage(t)},i.prototype.loadImage=function(e,r){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),r)},i.prototype.listImages=function(){return this.style.listImages()},i.prototype.addLayer=function(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)},i.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},i.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0)},i.prototype.getLayer=function(t){return this.style.getLayer(t)},i.prototype.setLayerZoomRange=function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0)},i.prototype.setFilter=function(t,e,r){return void 0===r&&(r={}),this.style.setFilter(t,e,r),this._update(!0)},i.prototype.getFilter=function(t){return this.style.getFilter(t)},i.prototype.setPaintProperty=function(t,e,r,i){return void 0===i&&(i={}),this.style.setPaintProperty(t,e,r,i),this._update(!0)},i.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},i.prototype.setLayoutProperty=function(t,e,r,i){return void 0===i&&(i={}),this.style.setLayoutProperty(t,e,r,i),this._update(!0)},i.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},i.prototype.setLight=function(t,e){return void 0===e&&(e={}),this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)},i.prototype.getLight=function(){return this.style.getLight()},i.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},i.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},i.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},i.prototype.getContainer=function(){return this._container},i.prototype.getCanvasContainer=function(){return this._canvasContainer},i.prototype.getCanvas=function(){return this._canvas},i.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.clientWidth||this._width,e=this._container.clientHeight||this._height),[t,e]},i.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/.")},i.prototype._setupContainer=function(){var t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=e.create("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();var r=this._canvasContainer=e.create("div","mapboxgl-canvas-container",t);this._interactive&&r.classList.add("mapboxgl-interactive"),this._canvas=e.create("canvas","mapboxgl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var i=this._containerDimensions();this._resizeCanvas(i[0],i[1]);var n=this._controlContainer=e.create("div","mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right","hidden","custom"].forEach((function(t){o[t]=e.create("div","mapboxgl-ctrl-"+t,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)},i.prototype._resizeCanvas=function(e,r){var i=t.browser.devicePixelRatio||1;this._canvas.width=i*e,this._canvas.height=i*r,this._canvas.style.width=e+"px",this._canvas.style.height=r+"px"},i.prototype._setupPainter=function(){var e=t.extend({},vn.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl",e)||this._canvas.getContext("experimental-webgl",e);r?(this.painter=new _i(r,this.transform),t.webpSupported.testSupport(r)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},i.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},i.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},i.prototype._onMapScroll=function(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},i.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},i.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},i.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},i.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},i.prototype._render=function(e){var r,i=this,n=0,o=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(r=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,r),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()}),h=u.crossFadingFactor();1===h&&h===this._crossFadingFactor||(a=!0,this._crossFadingFactor=h),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 p=t.browser.now()-n;o.endQueryEXT(o.TIME_ELAPSED_EXT,r),setTimeout((function(){var e=o.getQueryObjectEXT(r,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(r),i.fire(new t.Event("gpu-timing-frame",{cpuTime:p,gpuTime:e}))}),50)}if(this.listens("gpu-timing-layer")){var c=this.painter.collectGpuTimers();setTimeout((function(){var e=i.painter.queryGpuTimers(c);i.fire(new t.Event("gpu-timing-layer",{layerTimes:e}))}),50)}var f=this._sourcesDirty||this._styleDirty||this._placementDirty;return f||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||f||(this._fullyLoaded=!0),this}},i.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,r=this._controls;e<r.length;e+=1)r[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 i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.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"))},i.prototype.triggerRepaint=function(){var e=this;this.style&&!this._frame&&(this._frame=t.browser.frame((function(t){e._frame=null,e._render(t)})))},i.prototype._onWindowOnline=function(){this._update()},i.prototype._onWindowResize=function(t){this._trackResize&&this.resize({originalEvent:t})._update()},n.showTileBoundaries.get=function(){return!!this._showTileBoundaries},n.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},n.showPadding.get=function(){return!!this._showPadding},n.showPadding.set=function(t){this._showPadding!==t&&(this._showPadding=t,this._update())},n.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},n.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},n.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},n.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},n.repaint.get=function(){return!!this._repaint},n.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},n.vertices.get=function(){return!!this._vertices},n.vertices.set=function(t){this._vertices=t,this._update()},i.prototype._setCacheLimits=function(e,r){t.setCacheLimits(e,r)},n.version.get=function(){return t.version},Object.defineProperties(i.prototype,n),i}(_n);function Pn(t){t.parentNode&&t.parentNode.removeChild(t)}var An="https://route.map.brtbeacon.com",Ln="https://web.sdk.map.brtbeacon.com",Mn="https://a.brtbeacon.net",kn="brtbeaconSource",zn={mode:"online",tile:null,cbmApi:null},Cn=Math.PI/180,Dn=180/Math.PI;function Rn(t,e){var r=[t,e];t instanceof Array?r=t:t instanceof Object&&(r=[t.x,t.y]);var i=r[1]/20037508.342789*180;return{lng:r[0]/20037508.342789*180,lat:i=Dn*(2*Math.atan(Math.exp(i*Cn))-Math.PI/2)}}function Fn(t,e){var r=[t,e];t instanceof Array?r=t:t instanceof Object&&(r=[t.lng,t.lat]);var i=20037508.342789*r[0]/180,n=Math.log(Math.tan((90+r[1])*Cn/2))/Cn;return{x:i,y:n=20037508.342789*n/180}}function On(t){for(var e=[],r=0;r<t.length;r++){var i=Rn(t[r]);e.push([i.lng,i.lat])}return e}function Bn(){for(var t,e=arguments,r=arguments[0],i=1;i<arguments.length;i++)for(var n in t=e[i]?e[i]:[])r[n]=t[n];return r}function Nn(){return/(Android)/i.test(navigator.userAgent)?1:/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)?2:3}function Vn(t,e){e=e||1;var r=t.toLowerCase();if(r&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(r)){if(4===r.length){for(var i="#",n=1;n<4;n+=1)i+=r.slice(n,n+1).concat(r.slice(n,n+1));r=i}var o=[];for(n=1;n<7;n+=2)o.push(parseInt("0x"+r.slice(n,n+2)));return"rgba("+o.join(",")+", "+e+")"}return r}function Un(t,e){var r,i,n,o,a=0;if(e.length<3)return!1;for(var s=0;s<e.length;s++)s==e.length-1?(r=e[s][0],i=e[s][1],n=e[0][0],o=e[0][1]):(r=e[s][0],i=e[s][1],n=e[s+1][0],o=e[s+1][1]),(t[0]>=r&&t[0]<n||t[0]>=n&&t[0]<r)&&Math.abs(r-n)>0&&i-(i-o)*(r-t[0])/(r-n)<t[1]&&a++;return a%2!=0}function jn(t,e){t.constructor!=Array&&(t=[t.x,t.y]),e.constructor!=Array&&(e=[e.x,e.y]);var r=t[0],i=t[1],n=e[0],o=e[1],a=Math.round(Math.atan2(i-o,n-r)*(180/Math.PI));return a<0&&(a=360+a),{angle:a,distance:Math.sqrt((r-n)*(r-n)+(i-o)*(i-o))}}function qn(t,e,r){var i=(r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y);if(i<=0)return e;var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y);if(i>=n)return r;var o=i/n;return{x:e.x+(r.x-e.x)*o,y:e.y+(r.y-e.y)*o}}function Gn(t){for(var e,r,i=0,n=0;n<t.length-1;n++)e=Fn(t[n]),r=Fn(t[n+1]),i+=Math.sqrt((e.x-r.x)*(e.x-r.x)+(e.y-r.y)*(e.y-r.y));return i}function Zn(t,e,r,i){i=Bn({async:!0,type:"GET",responseType:""},i);var n="";for(var o in e)n+=o+"="+e[o]+"&";n&&"GET"==i.type&&(t+="?"+n,n=null);var a=new XMLHttpRequest;a.open(i.type,t,i.async),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.responseType&&(a.responseType=i.responseType),a.onreadystatechange=function(){if(4===a.readyState&&404!==a.status){var t;try{t="arraybuffer"===i.responseType?a.response:JSON.parse(a.responseText)}catch(e){t=a.responseText}r&&r(t)}},a.send(n)}var Xn=function(t){this.buildingID=t.id,this.cityID=t.cityID,this.name=t.name,this.nameEn=t.nameEn,this.address=t.address,this.addressEn=t.addressEn,this.longitude=t.longitude,this.latitude=t.latitude,this.initAngle=t.initAngle,this.offsetX=t.offsetX,this.offsetY=t.offsetY,this.routeURL=t.routeURL,this.status=t.status,this.maxZoom=t.tdMax,this.minZoom=t.tdMin,this.ROUTE_VERSION=t.ROUTE_VERSION,this.MAP_VERSION=t.MAP_VERSION,this.GROUND_FLOORS=(t.GROUND_FLOORS||"").split(",");for(var e=0;e<this.GROUND_FLOORS.length;e++)this.GROUND_FLOORS[e]=parseInt(this.GROUND_FLOORS[e])};Xn.prototype.toString=function(){return this.name+"("+this.buildingID+")"};var Yn=function(t){this.cityID=t.id,this.name=t.name,this.sname=t.sname,this.longitude=t.longitude,this.latitude=t.latitude,this.status=t.status};Yn.prototype.toString=function(){return this.name+"("+this.cityID+")"};var Wn=function(t){this.mapExtent={xmin:t.xmin,ymin:t.ymin,xmax:t.xmax,ymax:t.ymax},this.floorName=t.floorName,this.floorNumber=t.floorIndex,this.floorID=t.mapID,this.mapID=t.mapID,this.buildingID=t.buildingID,this.centerX=t.center_x,this.centerY=t.center_y,this.lnglatCenter=Rn(t.center_x,t.center_y),this.lnglatMin=Rn(t.xmin,t.ymin),this.lnglatMax=Rn(t.xmax,t.ymax)};Wn.prototype.getCenter=function(){return{x:this.centerX,y:this.centerY}},Wn.prototype.getBounds=function(t){var e=(this.mapExtent.xmax-this.mapExtent.xmin)*(t=t||0),r=(this.mapExtent.ymax-this.mapExtent.ymin)*t,i=Rn(this.mapExtent.xmin-e,this.mapExtent.ymin-r),n=Rn(this.mapExtent.xmax+e,this.mapExtent.ymax+r);return[i.lng,i.lat,n.lng,n.lat]};var Hn=function(t){this.building=new Xn(t.Buildings[0]),this.city=new Yn(t.Cities[0]),this.mapInfoArray=function(t){for(var e=new Array,r=0;r<t.length;++r){var i=new Wn(t[r]);e.push(i)}return e}(t.MapInfo)},Kn=function(t){var e=this;Zn("online"===zn.mode?Ln+"/web/mapinfo/getTargetCBM":zn.cbmApi,{buildingID:t.buildingID,token:t.token},(function(t){t.success?e._doneCallback&&e._doneCallback(new Hn(t)):e._failCallback&&e._failCallback(t)}))};function Jn(t){for(var e,r,i,n=0,o=0;o<t.length;o++)(r=((e=t[o]).mapExtent.xmax-e.mapExtent.xmin)*(e.mapExtent.ymax-e.mapExtent.ymin))>n&&(n=r,i=e.getBounds());return i}Kn.prototype.done=function(t){return this._doneCallback=t,this},Kn.prototype.fail=function(t){return this._failCallback=t,this};var $n=function(t){var e;t.addSource(kn,{tiles:(e=t._tileToken,[e.HOST+"/"+e.RELATIVE_URL+"/vectortile/"+e.BUILDING_ID+"/{z}/{x}/{y}.pbf"]),type:"vector",bounds:Jn(t.mapInfoArray)})},Qn=function(t){this.sourceID=t,this.styleLayers={}};Qn.prototype.hide=function(){for(var t in this.styleLayers)this.map.setLayoutProperty(t,"visibility","none");return this},Qn.prototype.show=function(){for(var t in this.styleLayers)this.map.setLayoutProperty(t,"visibility","visible");return this},Qn.prototype.addTo=function(t){for(var e in this.map=t,this.__initialize(t),this.styleLayers)this.map.addLayer(this.styleLayers[e]);return this},Qn.prototype.remove=function(){for(var t in this.styleLayers)this.map.removeLayer(t);return this},Qn.prototype.__initialize=function(){};var to=function(t){function e(e,r){t.call(this,kn),this._layerNumber=r,this._layerID=e+"-fill",this._outlineID=e+"-outline",this.styleLayers[this._layerID]={id:this._layerID,type:"fill",source:this.sourceID,"source-layer":"fill",layout:{},paint:{"fill-color":["get","fill-color"],"fill-opacity":["get","fill-opacity"]},filter:["all"]},this.styleLayers[this._outlineID]={id:this._outlineID,type:"line",layout:{"line-join":"round","line-cap":"round"},source:this.sourceID,"source-layer":"fill",paint:{"line-color":["get","outline-color"],"line-opacity":1,"line-width":["get","outline-width"]},filter:["all"]},this._modified=[]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.setFillColor=function(t,e,r){for(var i=0;i<t.length;i++){var n={};t[i].constructor===Array?(n.id=t[i][0],n.value=t[i][1]):(n.id=t[i],n.value=e),this._modified[n.id]=n.value}this._drawModifiedColor(r)},e.prototype.resetFillColor=function(t,e){if(t.length){for(var r=0;r<t.length;r++)for(var i in this._modified)i==t[r]&&delete this._modified[i];this._drawModifiedColor(e)}else this._modified=[],this.map.setPaintProperty(this._layerID,"fill-color",["get","fill-color"])},e.prototype._drawModifiedColor=function(t){var e=["match",["case",["==",this._layerNumber,["get","layer"]],["get",t],""]],r=0;for(var i in this._modified)e.push(i,this._modified[i]),r++;e.push(["get","fill-color"]),this.map.setPaintProperty(this._layerID,"fill-color",r?e:["get","fill-color"])},e.prototype.setFloor=function(t){for(var e in this.styleLayers){var r=["all",["==","layer",this._layerNumber]];2===this._layerNumber&&r.push(["!=","extrusion-opacity",0]),"all"===t||r.push(["==","floor",t]),this.map.setFilter(e,r)}return this},e}(Qn),eo=function(t){function e(e,r){t.call(this,kn),this._layerID=e+"-fill",this.styleLayers[this._layerID]={id:this._layerID,type:"fill-extrusion",source:this.sourceID,"source-layer":"fill",layout:{visibility:r.use3D?"visible":"none"},paint:{"fill-extrusion-opacity":r.extrusionOpacity,"fill-extrusion-color":["get","fill-color"],"fill-extrusion-base":["/",["get","extrusion-base"],10],"fill-extrusion-height":["/",["get","extrusion-height"],10],"fill-extrusion-outline-width":1.5,"fill-extrusion-outline-color":["get","outline-color"]},filter:["all"],minzoom:18},this._modified=[]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.setFillColor=function(t,e,r){for(var i=0;i<t.length;i++){var n={};t[i].constructor===Array?(n.id=t[i][0],n.value=t[i][1]):(n.id=t[i],n.value=e),this._modified[n.id]=n.value}this._drawModifiedColor(r)},e.prototype.resetFillColor=function(t,e){if(t.length){for(var r=0;r<t.length;r++)for(var i in this._modified)i==t[r]&&delete this._modified[i];this._drawModifiedColor(e)}else this._modified=[],this.map.setPaintProperty(this._layerID,"fill-extrusion-color",["get","fill-color"])},e.prototype._drawModifiedColor=function(t){var e=["match",["case",["any",["==",2,["get","layer"]],["==",3,["get","layer"]]],["get",t],""]],r=0;for(var i in this._modified)e.push(i,this._modified[i]),r++;e.push(["get","fill-color"]),this.map.setPaintProperty(this._layerID,"fill-extrusion-color",r?e:["get","fill-color"])},e.prototype.setFloor=function(t,e){for(var r in this.styleLayers){var i=["all",["has","extrusion"],["==","extrusion",!0],["any",["==","floor",t]]];e&&i[i.length-1].push(["==","layer",e]),this.map.setFilter(r,i)}return this},e}(Qn),ro=function(t){function e(e,r){t.call(this,kn),this._layerID=""+e;var i="en"===r.language,n={id:this._layerID,type:"symbol",source:this.sourceID,"source-layer":this._layerID,paint:{"text-color":["case",["to-boolean",["get","font-color"]],["get","font-color"],"#666666"],"text-halo-color":"#ffffff","text-halo-width":1,"icon-height":r.use3D?["/",["get","extrusion-height"],10]:0,"text-height":r.use3D?["/",["get","extrusion-height"],10]:0},layout:{"icon-image":["get","image-normal"],"icon-size":this._interpolateForIconSize(.35),"text-field":i?["get","EN"]:["get","NAME"],"text-size":this._interpolateForTextSize(12),"text-anchor":["case",["to-boolean",["get","image-normal"]],"top","center"],"text-offset":["case",["to-boolean",["get","image-normal"]],["literal",[0,.65]],["literal",[0,0]]],"text-padding":r.labelPadding,"text-optional":!0,"icon-allow-overlap":r.labelAllowOverlap,"text-allow-overlap":r.labelAllowOverlap},filter:["all"]};this.styleLayers[this._layerID]=n,this._labelHideArray=[]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._interpolateForIconSize=function(t){return t},e.prototype._interpolateForTextSize=function(t){return t},e.prototype._setLanguage=function(t){this.map.setLayoutProperty(this._layerID,"text-field","en"===t?["get","EN"]:["get","NAME"])},e.prototype._setFont=function(t){(t=t||{}).color&&this.map.setPaintProperty(this._layerID,"text-color",t.color),t.haloColor&&this.map.setPaintProperty(this._layerID,"text-halo-color",t.haloColor),t.haloWidth&&this.map.setPaintProperty(this._layerID,"text-halo-width",t.haloWidth),t.size&&this.map.setLayoutProperty(this._layerID,"text-size",this._interpolateForTextSize(t.size)),t.iconSize&&this.map.setLayoutProperty(this._layerID,"icon-size",this._interpolateForIconSize(t.iconSize))},e.prototype._hideLabel=function(t){t.constructor!==Array&&(t=[t]);for(var e=0;e<t.length;e++)this._labelHideArray[t[e]]=t[e];this._drawLabel()},e.prototype._showLabel=function(t){if(t.constructor!==Array&&(t=[t]),t.length){for(var e=0;e<t.length;e++)for(var r in this._labelHideArray)t[e]===r&&delete this._labelHideArray[r];this._drawLabel()}},e.prototype._drawLabel=function(){var t=["match",["get","POI_ID"]],e=["match",["get","POI_ID"]],r=0;for(var i in this._labelHideArray)t.push(i,""),e.push(i,""),r++;t.push(["get","NAME"]),e.push(["get","image-normal"]),r||(t=["get","NAME"],e=["get","image-normal"]),this.map.setLayoutProperty(this._layerID,"text-field",t),this.map.setLayoutProperty(this._layerID,"icon-image",e)},e.prototype.setFloor=function(t,e){for(var r in this.styleLayers){var i=["any",["==","floor",t]];e&&i.push(["==","layer",e]),this.map.setFilter(r,i)}return this},e}(Qn),io=function(t){function e(e,r){t.call(this,kn),this._layerID=""+e;var i={id:this._layerID,type:"symbol",source:this.sourceID,"source-layer":this._layerID,paint:{"text-color":["case",["to-boolean",["get","font-color"]],["get","font-color"],"#666666"],"text-halo-color":"#ffffff","text-halo-width":1,"icon-height":r.use3D?["/",["get","extrusion-height"],10]:0,"text-height":r.use3D?["/",["get","extrusion-height"],10]:0},layout:{"icon-image":["get","image-normal"],"icon-size":this._interpolateForIconSize(.5),"text-field":r.showFacilityLabel?["get","NAME"]:"","text-font":["microsoft yahei"],"text-size":10,"text-anchor":"top","text-offset":[0,1.1],"text-padding":0,"text-optional":!0,"icon-allow-overlap":r.facilityAllowOverlap},filter:["all"]};this.styleLayers[this._layerID]=i,this._modified=[]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._interpolateForIconSize=function(t){return t},e.prototype._setSize=function(t){t&&this.map.setLayoutProperty(this._layerID,"icon-size",this._interpolateForIconSize(t))},e.prototype._setFont=function(t){(t=t||{}).color&&this.map.setPaintProperty(this._layerID,"text-color",t.color),t.haloColor&&this.map.setPaintProperty(this._layerID,"text-halo-color",t.haloColor),t.haloWidth&&this.map.setPaintProperty(this._layerID,"text-halo-width",t.haloWidth),t.size&&this.map.setLayoutProperty(this._layerID,"text-size",t.size-2),t.iconSize&&this.map.setLayoutProperty(this._layerID,"icon-size",this._interpolateForIconSize(t.iconSize))},e.prototype._setImage=function(t,e){t.constructor!==Array&&(t=[t]);for(var r=0;r<t.length;r++){var i={};t[r].constructor===Array?(i.id=t[r][0],i.value=t[r][1]):(i.id=t[r],i.value=e),this._modified[i.id]=i.value}this._drawModifiedImage()},e.prototype._resetImage=function(t){if((t=t||[]).constructor!==Array&&(t=[t]),t.length){for(var e=0;e<t.length;e++)for(var r in this._modified)r==t[e]&&delete this._modified[r];this._drawModifiedImage()}else this._modified=[],this.map.setLayoutProperty(this._layerID,"icon-image",["get","image-normal"])},e.prototype._drawModifiedImage=function(){var t=["match",["get","POI_ID"]],e=0;for(var r in this._modified)t.push(r,this._modified[r]),e++;t.push(["get","image-normal"]),this.map.setLayoutProperty(this._layerID,"icon-image",e?t:["get","image-normal"])},e.prototype._showFacility=function(t,e){if(this._hideFilters=null,this._showFilters=null,this.show(),t&&e){"cid"==(t=t.toLowerCase())?t="CATEGORY_ID":"poiid"==t&&(t="POI_ID"),e.constructor!==Array&&(e=[e]),this._showFilters=[["==","layer",4]];for(var r=0;r<e.length;r++)this._showFilters.push(["==",t,e[r]])}this.setFloor(this._currentFloor)},e.prototype._hideFacility=function(t,e){if(this._hideFilters=null,this._showFilters=null,this.show(),t&&e){"cid"==(t=t.toLowerCase())?t="CATEGORY_ID":"poiid"==t&&(t="POI_ID"),e.constructor!==Array&&(e=[e]),this._hideFilters=[["==","layer",4]];for(var r=0;r<e.length;r++)this._hideFilters.push(["!=",t,e[r]])}else this.hide();this.setFloor(this._currentFloor)},e.prototype._setAllowOverlap=function(t){this.map.setLayoutProperty(this._layerID,"icon-allow-overlap",t)},e.prototype.setFloor=function(t){this._currentFloor=t;var e=["all",["==","floor",t]];for(var r in this._showFilters&&(e=e.concat(this._showFilters)),this._hideFilters&&(e=e.concat(this._hideFilters)),this.styleLayers)this.map.setFilter(r,e);return this},e}(Qn),no={meters:6371008.8,metres:6371008.8,millimeters:6371008800,millimetres:6371008800,centimeters:637100880,centimetres:637100880,kilometers:6371.0088,kilometres:6371.0088,miles:3958.761333810546,nauticalmiles:6371008.8/1852,inches:6371008.8*39.37,yards:6371008.8/1.0936,feet:20902260.511392,radians:1,degrees:6371008.8/111325};function oo(t,e,r){if(!fo(r=r||{}))throw new Error("options is invalid");var i=r.bbox,n=r.id;if(void 0===t)throw new Error("geometry is required");if(e&&e.constructor!==Object)throw new Error("properties must be an Object");i&&mo(i),n&&yo(n);var o={type:"Feature"};return n&&(o.id=n),i&&(o.bbox=i),o.properties=e||{},o.geometry=t,o}function ao(t,e,r){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!co(t[0])||!co(t[1]))throw new Error("coordinates must contain numbers");return oo({type:"Point",coordinates:t},e,r)}function so(t,e,r){if(!t)throw new Error("coordinates is required");if(t.length<2)throw new Error("coordinates must be an array of two or more positions");if(!co(t[0][1])||!co(t[0][1]))throw new Error("coordinates must contain numbers");return oo({type:"LineString",coordinates:t},e,r)}function lo(t,e){if(!fo(e=e||{}))throw new Error("options is invalid");var r=e.bbox,i=e.id;if(!t)throw new Error("No features passed");if(!Array.isArray(t))throw new Error("features must be an Array");r&&mo(r),i&&yo(i);var n={type:"FeatureCollection"};return i&&(n.id=i),r&&(n.bbox=r),n.features=t,n}function uo(t,e,r){if(!t)throw new Error("coordinates is required");return oo({type:"MultiLineString",coordinates:t},e,r)}function ho(t){if(null==t)throw new Error("radians is required");return t%(2*Math.PI)*180/Math.PI}function po(t){if(null==t)throw new Error("degrees is required");return t%360*Math.PI/180}function co(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function fo(t){return!!t&&t.constructor===Object}function mo(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!co(t))throw new Error("bbox must only contain numbers")}))}function yo(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}function go(t){if(!t)throw new Error("coord is required");if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates;if(Array.isArray(t)&&t.length>=2&&void 0===t[0].length&&void 0===t[1].length)return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function _o(t,e,r){if(!fo(r=r||{}))throw new Error("options is invalid");var i=r.units,n=go(t),o=go(e),a=po(o[1]-n[1]),s=po(o[0]-n[0]),l=po(n[1]),u=po(o[1]),h=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(l)*Math.cos(u);return function(t,e){if(null==t)throw new Error("radians is required");if(e&&"string"!=typeof e)throw new Error("units must be a string");var r=no[e||"kilometers"];if(!r)throw new Error(e+" units is invalid");return t*r}(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),i)}function vo(t,e,r){if(null!==t)for(var i,n,o,a,s,l,u,h,p=0,c=0,f=t.type,d="FeatureCollection"===f,m="Feature"===f,y=d?t.features.length:1,g=0;g<y;g++){s=(h=!!(u=d?t.features[g].geometry:m?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var _=0;_<s;_++){var v=0,x=0;if(null!==(a=h?u.geometries[_]:u)){l=a.coordinates;var b=a.type;switch(p=!r||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":e(l,c,g,v,x),c++,v++;break;case"LineString":case"MultiPoint":for(i=0;i<l.length;i++)e(l[i],c,g,v,x),c++,"MultiPoint"===b&&v++;"LineString"===b&&v++;break;case"Polygon":case"MultiLineString":for(i=0;i<l.length;i++){for(n=0;n<l[i].length-p;n++)e(l[i][n],c,g,v,x),c++;"MultiLineString"===b&&v++,"Polygon"===b&&x++}"Polygon"===b&&v++;break;case"MultiPolygon":for(i=0;i<l.length;i++){for("MultiPolygon"===b&&(x=0),n=0;n<l[i].length;n++){for(o=0;o<l[i][n].length-p;o++)e(l[i][n][o],c,g,v,x),c++;x++}v++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)vo(a.geometries[i],e,r);break;default:throw new Error("Unknown Geometry Type")}}}}}function xo(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)e(t.features[r],r)}function bo(t,e){!function(t,e){var r,i,n,o,a,s,l,u,h,p,c=0,f="FeatureCollection"===t.type,d="Feature"===t.type,m=f?t.features.length:1;for(r=0;r<m;r++){for(u=f?t.features[r].properties:d?t.properties:{},h=f?t.features[r].bbox:d?t.bbox:void 0,p=f?t.features[r].id:d?t.id:void 0,a=(l=!!(s=f?t.features[r].geometry:d?t.geometry:t)&&"GeometryCollection"===s.type)?s.geometries.length:1,n=0;n<a;n++)if(null!==(o=l?s.geometries[n]:s))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,c,u,h,p);break;case"GeometryCollection":for(i=0;i<o.geometries.length;i++)e(o.geometries[i],c,u,h,p);break;default:throw new Error("Unknown Geometry Type")}else e(null,c,u,h,p);c++}}(t,(function(t,r,i,n,o){var a,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return void e(oo(t,i,{bbox:n,id:o}),r,0)}switch(s){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}t.coordinates.forEach((function(t,n){e(oo({type:a,coordinates:t},i),r,n)}))}))}function wo(t,e){if(!fo(e=e||{}))throw new Error("options is invalid");if(!t)throw new Error("geojson is required");return function(t){var r=0;return function(t){bo(t,(function(t,i,n){if(t.geometry){var o=t.geometry.type;"Point"!==o&&"MultiPoint"!==o&&function(t,e){var r=void 0;vo(t,(function(t,i,n,o,a){r=0===i?t:e(r,t,0,0,0,a)}),void 0)}(t,(function(i,n,o,a,s,l){return function(t){r=function(t,r){var i=r.geometry.coordinates;return t+_o(i[0],i[1],e)}(r,t)}(so([i,n],t.properties)),n}))}}))}(t),r}(t)}function Io(t){if(!t)throw new Error("coord is required");if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates;if(Array.isArray(t)&&t.length>=2&&void 0===t[0].length&&void 0===t[1].length)return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function So(t,e,r){if(!fo(r=r||{}))throw new Error("options is invalid");if(!0===r.final)return function(t,e){return(So(e,t)+180)%360}(t,e);var i=Io(t),n=Io(e),o=po(i[0]),a=po(n[0]),s=po(i[1]),l=po(n[1]),u=Math.sin(a-o)*Math.cos(l),h=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(a-o);return ho(Math.atan2(u,h))}function To(t,e,r,i){if(!fo(i=i||{}))throw new Error("options is invalid");var n=i.units,o=i.properties,a=function(t){if(!t)throw new Error("coord is required");if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates;if(Array.isArray(t)&&t.length>=2&&void 0===t[0].length&&void 0===t[1].length)return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(t),s=po(a[0]),l=po(a[1]),u=po(r),h=function(t,e){if(null==t)throw new Error("distance is required");if(e&&"string"!=typeof e)throw new Error("units must be a string");var r=no[e||"kilometers"];if(!r)throw new Error(e+" units is invalid");return t/r}(e,n),p=Math.asin(Math.sin(l)*Math.cos(h)+Math.cos(l)*Math.sin(h)*Math.cos(u));return ao([ho(s+Math.atan2(Math.sin(u)*Math.sin(h)*Math.cos(l),Math.cos(h)-Math.sin(l)*Math.sin(p))),ho(p)],o)}function Eo(t,e,r,i){if(!fo(i=i||{}))throw new Error("options is invalid");var n,o=[];if("Feature"===t.type)n=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");n=t.coordinates}for(var a,s,l,u=0,h=0;h<n.length&&!(e>=u&&h===n.length-1);h++){if(u>e&&0===o.length){if(!(a=e-u))return o.push(n[h]),so(o);s=So(n[h],n[h-1])-180,l=To(n[h],a,s,i),o.push(l.geometry.coordinates)}if(u>=r)return(a=r-u)?(s=So(n[h],n[h-1])-180,l=To(n[h],a,s,i),o.push(l.geometry.coordinates),so(o)):(o.push(n[h]),so(o));if(u>=e&&o.push(n[h]),h===n.length-1)return so(o);u+=_o(n[h],n[h+1],i)}return so(n[n.length-1])}Number.isInteger=function(t){return Math.floor(t)===t};var Po={length:wo,lineChunk:function(t,e,r){if(!fo(r=r||{}))throw new Error("options is invalid");var i=r.units,n=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return bo(t,(function(t){n&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,i){var n=wo(t,{units:r});if(n<=e)return i(t);var o=n/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var a=0;a<o;a++)i(Eo(t,e*a,e*(a+1),{units:r}))}(t,e,i,(function(t){o.push(t)}))})),lo(o)},lineSliceAlong:Eo,bearing:So,point:ao},Ao=0,Lo=function(t){function e(e){t.call(this,""),this._defaultRouteColor="#3f83fe",this._passedRouteColor="#9cb5c9",this._stepsRouteColor=null,this._segmentRouteIndex=0,this.sourceID=e+"Source",this.SOURCE_DATA={type:"FeatureCollection",features:[]},this.passedID="PassedSource",this.PASSED_DATA={type:"FeatureCollection",features:[]},this.arrowID="ArrowSource",this.ARROW_DATA={type:"FeatureCollection",features:[]},this._routeID1=e+"-line-1";var r={id:this._routeID1,type:"line",source:this.sourceID,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#244b92","line-width":["interpolate",["linear"],["zoom"],15,6,22,10]}};this._routeID2=e+"-line-2";var i={id:this._routeID2,type:"line",source:this.sourceID,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this._getLineColor(this._defaultRouteColor),"line-width":["interpolate",["linear"],["zoom"],15,4,22,8]}};this._passedID=e+"-passed";var n={id:this._passedID,type:"line",source:this.passedID,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this._getLineColor(this._passedRouteColor),"line-width":["interpolate",["linear"],["zoom"],15,4,22,8]}};this._arrowID=e+"-arrow";var o={id:this._arrowID,type:"symbol",source:this.arrowID,layout:{"icon-image":"icon_route_arrow","icon-size":["interpolate",["linear"],["zoom"],15,.44,22,.88],"icon-rotate":["get","rotate"],"icon-ignore-placement":!0,"icon-allow-overlap":!0,"icon-rotation-alignment":"map"}};this.styleLayers[this._routeID1]=r,this.styleLayers[this._routeID2]=i,this.styleLayers[this._passedID]=n,this.styleLayers[this._arrowID]=o}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._getLineColor=function(t,e){return["case",["==",this._segmentRouteIndex,["get","index"]],t,e||Vn(t,.3)]},e.prototype._setShowRoute=function(t){this._segmentRouteIndex=t-1,this.map.setPaintProperty(this._routeID2,"line-color",this._getLineColor(this._defaultRouteColor,this._stepsRouteColor)),this.map.setPaintProperty(this._passedID,"line-color",this._getLineColor(this._passedRouteColor)),this.PASSED_DATA.features=[],this._resetPassed()},e.prototype.setFeatures=function(t){this.SOURCE_DATA.features=t,this.PASSED_DATA.features=[],this._reset(),this._resetPassed(),this._setArrowFeatures(t)},e.prototype.setPassedFeatures=function(t){this.PASSED_DATA.features=t,this._resetPassed()},e.prototype.setRouteColor=function(t,e,r){r&&(this._stepsRouteColor=r),t&&(this._defaultRouteColor=t,this.map.setPaintProperty(this._routeID2,"line-color",this._getLineColor(t,r))),e&&(this._passedRouteColor=e,this.map.setPaintProperty(this._passedID,"line-color",this._getLineColor(e)))},e.prototype._setArrowFeatures=function(t){var e=this;clearTimeout(this._arrowAnimFrame);var r=function(){e.ARROW_DATA.features=function(t,e,r){for(var i,n,o,a,s,l=[],u=.005*Math.max(Math.pow(22-r.getZoom(),1.3),.5),h=0;h<t.length;h++)if((i=t[h]).properties.index===e){if(s=Po.length(i),Ao>s)continue;try{n=Po.lineSliceAlong(i,Ao,s),o=Po.lineChunk(n,u)}catch(t){continue}o.features.forEach((function(t){a=Po.bearing(t.geometry.coordinates[0],t.geometry.coordinates[1]),l.push(Po.point(t.geometry.coordinates[0],{rotate:a,floor:i.properties.floor}))}))}return Ao=Ao>=u?Ao-u:Ao+u/80,l}(t,e._segmentRouteIndex,e.map),e._resetArrow(),e.map._options.routeAnimationFps&&(e._arrowAnimFrame=setTimeout(r,1e3/e.map._options.routeAnimationFps))};r()},e.prototype._reset=function(){this.map.getSource(this.sourceID).setData(this.SOURCE_DATA)},e.prototype._resetPassed=function(){this.map.getSource(this.passedID).setData(this.PASSED_DATA)},e.prototype._resetArrow=function(){this.map.getSource(this.arrowID).setData(this.ARROW_DATA)},e.prototype.clear=function(){this.SOURCE_DATA.features=[],this.PASSED_DATA.features=[],this.ARROW_DATA.features=[],this._reset(),this._resetPassed(),this._resetArrow(),clearTimeout(this._arrowAnimFrame)},e.prototype.addTo=function(t){for(var e in this.map=t,this.map.addSource(this.sourceID,{type:"geojson",data:this.SOURCE_DATA}),this.map.addSource(this.passedID,{type:"geojson",data:this.PASSED_DATA}),this.map.addSource(this.arrowID,{type:"geojson",data:this.ARROW_DATA}),this.styleLayers)this.map.addLayer(this.styleLayers[e]);return this},e.prototype.setFloor=function(t){for(var e in this.styleLayers)this.map.setFilter(e,["all",["==","floor",t]]);return this},e}(Qn),Mo=function(t){function e(e){t.call(this,"EditLabelSource"),this._DATA_={type:"FeatureCollection",features:[]},this._layerID=""+e;var r={id:this._layerID,type:"symbol",source:this.sourceID,paint:{"text-color":"#666666","text-halo-color":"#ffffff","text-halo-width":1},layout:{"icon-image":["get","image-normal"],"icon-size":this._interpolateForIconSize(.35),"text-field":["get","NAME"],"text-font":["microsoft yahei"],"text-size":this._interpolateForTextSize(12),"text-anchor":["case",["to-boolean",["get","image-normal"]],"top","center"],"text-offset":["case",["to-boolean",["get","image-normal"]],["literal",[0,.65]],["literal",[0,0]]],"text-padding":0,"text-optional":!0,"icon-allow-overlap":!0,"text-allow-overlap":!0},filter:["all"]};this.styleLayers[this._layerID]=r,this._modifiedText=[],this._modifiedImage=[]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.__initialize=function(t){t.addSource(this.sourceID,{type:"geojson",data:this._DATA_})},e.prototype._checkLabel=function(t){for(var e=0;e<this._DATA_.features.length;e++)if(t==this._DATA_.features[e].properties.POI_ID)return!0;return!1},e.prototype._addLabel=function(t){if(!this._checkLabel(t.POI_ID)){var e=this.map.coordsToLnglat(t.LABEL_X,t.LABEL_Y),r=function(t,e){return{type:"Feature",geometry:{type:"Point",coordinates:e},properties:t}}(t,[e.lng,e.lat]);this._DATA_.features.push(r),this._draw()}},e.prototype._removeLabel=function(t){t.constructor!==Array&&(t=[t]);for(var e=0;e<t.length;e++)for(var r=0;r<this._DATA_.features.length;r++)t[e]==this._DATA_.features[r].properties.POI_ID&&(this._DATA_.features.splice(r,1),this._resetLabelText(t[e]),this._resetLabelImage(t[e]));this._draw()},e.prototype._draw=function(){this.map.getSource(this.sourceID).setData(this._DATA_)},e.prototype._interpolateForIconSize=function(t){return t},e.prototype._interpolateForTextSize=function(t){return t},e.prototype._setFont=function(t){(t=t||{}).color&&this.map.setPaintProperty(this._layerID,"text-color",t.color),t.haloColor&&this.map.setPaintProperty(this._layerID,"text-halo-color",t.haloColor),t.haloWidth&&this.map.setPaintProperty(this._layerID,"text-halo-width",t.haloWidth),t.size&&this.map.setLayoutProperty(this._layerID,"text-size",this._interpolateForTextSize(t.size)),t.iconSize&&this.map.setLayoutProperty(this._layerID,"icon-size",this._interpolateForIconSize(t.iconSize))},e.prototype._setLabelImage=function(t,e){e=e||"",t.constructor!==Array&&(t=[t]);for(var r=0;r<t.length;r++){var i={};t[r].constructor===Array?(i.id=t[r][0],i.value=t[r][1]):(i.id=t[r],i.value=e),this._modifiedImage[i.id]=i.value}this._drawModifiedImage()},e.prototype._setLabelText=function(t,e){e=e||"",t.constructor!==Array&&(t=[t]);for(var r=0;r<t.length;r++){var i={};t[r].constructor===Array?(i.id=t[r][0],i.value=t[r][1]):(i.id=t[r],i.value=e),this._modifiedText[i.id]=i.value}this._drawModifiedText()},e.prototype._resetLabelImage=function(t){if((t=t||[]).constructor!==Array&&(t=[t]),t.length){for(var e=0;e<t.length;e++)for(var r in this._modifiedImage)r==t[e]&&delete this._modifiedImage[r];this._drawModifiedImage()}else this._modifiedImage=[],this.map.setLayoutProperty(this._layerID,"icon-image",["get","image-normal"]),this.map.setLayoutProperty(this._layerID,"text-anchor",["case",["to-boolean",["get","image-normal"]],"top","center"]),this.map.setLayoutProperty(this._layerID,"text-offset",["case",["to-boolean",["get","image-normal"]],["literal",[0,.65]],["literal",[0,0]]])},e.prototype._resetLabelText=function(t){if((t=t||[]).constructor!==Array&&(t=[t]),t.length){for(var e=0;e<t.length;e++)for(var r in this._modifiedText)r==t[e]&&delete this._modifiedText[r];this._drawModifiedText()}else this._modifiedText=[],this.map.setLayoutProperty(this._layerID,"text-field",["get","NAME"])},e.prototype._drawModifiedImage=function(){var t=["match",["get","POI_ID"]],e=["case",["any",["to-boolean",["get","image-normal"]]],"top","center"],r=["case",["any",["to-boolean",["get","image-normal"]]],["literal",[0,.65]],["literal",[0,0]]],i=0;for(var n in this._modifiedImage)t.push(n,this._modifiedImage[n]),e[1].push(["==",n,["get","POI_ID"]]),r[1].push(["==",n,["get","POI_ID"]]),i++;t.push(["get","image-normal"]),this.map.setLayoutProperty(this._layerID,"icon-image",i?t:["get","image-normal"]),this.map.setLayoutProperty(this._layerID,"text-anchor",e),this.map.setLayoutProperty(this._layerID,"text-offset",r)},e.prototype._drawModifiedText=function(){var t=["match",["get","POI_ID"]],e=0;for(var r in this._modifiedText)t.push(r,this._modifiedText[r]),e++;t.push(["get","NAME"]),this.map.setLayoutProperty(this._layerID,"text-field",e?t:["get","NAME"])},e.prototype.setFloor=function(t){for(var e in this.styleLayers)this.map.setFilter(e,["all",["==","floor",t]]);return this},e}(Qn),ko=function(t){this.map=t,this._groundLayer=new to("ground",8).addTo(t),this._floorLayer=new to("floor",1).addTo(t),this._shadeLayer=new to("shade",6).addTo(t),this._roomLayer=new to("room",2).addTo(t),this._assetLayer=new to("asset",3).addTo(t),this._routeLayer=new Lo("route").addTo(t),this._extrusionLayer=new eo("indoor",t._options).addTo(t),this._facilityLayer=new io("facility",t._options).addTo(t),this._labelLayer=new ro("label",t._options).addTo(t),t._options.openEditingMode&&(this._editLabelLayer=new Mo("edit-label").addTo(t))};ko.prototype.setFillColor=function(t,e,r){e=e||"#0099FF",r=r||"POI_ID",t.constructor!==Array&&(t=[t]),this._roomLayer.setFillColor(t,e,r),this._assetLayer.setFillColor(t,e,r),this._extrusionLayer.setFillColor(t,e,r)},ko.prototype.resetFillColor=function(t,e){e=e||"POI_ID",(t=t||[]).constructor!==Array&&(t=[t]),this._roomLayer.resetFillColor(t,e),this._assetLayer.resetFillColor(t,e),this._extrusionLayer.resetFillColor(t,e)},ko.prototype.showLayers=function(){this._groundLayer.show(),this._floorLayer.show(),this._shadeLayer.show(),this._roomLayer.show(),this._assetLayer.show(),this._routeLayer.show(),this._extrusionLayer.show(),this._facilityLayer.show(),this._labelLayer.show()},ko.prototype.hideLayers=function(){this._groundLayer.hide(),this._floorLayer.hide(),this._shadeLayer.hide(),this._roomLayer.hide(),this._assetLayer.hide(),this._routeLayer.hide(),this._extrusionLayer.hide(),this._facilityLayer.hide(),this._labelLayer.hide()},ko.prototype.setFloor=function(t){var e=this.map.building.GROUND_FLOORS.filter((function(e){return e==t}));e[0]?(this._groundLayer.show(),this._groundLayer.setFloor("all")):this._groundLayer.hide(),this._floorLayer.setFloor(t),this._shadeLayer.setFloor(t),this._roomLayer.setFloor(t),this._assetLayer.setFloor(t),this._routeLayer.setFloor(t),this._extrusionLayer.setFloor(t,!!e[0]&&8),this._facilityLayer.setFloor(t),this._labelLayer.setFloor(t,!!e[0]&&9),this._editLabelLayer&&this._editLabelLayer.setFloor(t)};var zo=function(){};zo.prototype.send=function(t,e){var r=this;return Zn(function(t){return An+"/TYRouteService/route/RouteService"+t}(e),t,(function(t){t.success?r._doneCallback&&r._doneCallback(t):r._failCallback&&r._failCallback(t)})),this},zo.prototype.done=function(t){return this._doneCallback=t,this},zo.prototype.fail=function(t){return this._failCallback=t,this};var Co=function(t){this._buildingID=t.buildingID,this._token=t.token};Co.prototype._resetOptions=function(){this._options={buildingID:this._buildingID,rearrangeStops:!1,sameFloorFirst:!0,isExit:!1}},Co.prototype.toPoint=function(t){var e="";if(t.x&&t.y)e=t.x+","+t.y+","+t.floor;else if(t.lng&&t.lat){var r=Fn(t);e=r.x+","+r.y+","+t.floor}return e},Co.prototype.toStart=function(t){var e=this.toPoint(t);return this._options.start=e,e},Co.prototype.toEnd=function(t){if(!this._options.isExit){var e=this.toPoint(t);return this._options.end=e,e}},Co.prototype.toStops=function(t){for(var e="",r=0;r<t.length;r++)e+=this.toPoint(t[r])+",";return e&&(this._options.stops=e.substring(0,e.lastIndexOf(","))),e},Co.prototype.toParams=function(t){if(this._options=Bn(this._options,t),t.ignore&&t.ignore.length>0){for(var e="",r=0;r<t.ignore.length;r++)e+=t.ignore[r]+",";this._options.ignore=e.substring(0,e.lastIndexOf(","))}if(t.directionPoints&&t.directionPoints.length){for(var i="",n=0;n<t.directionPoints.length;n++)i+=this.toPoint(t.directionPoints[n])+",";this._options.directionPoints=i.substring(0,i.lastIndexOf(","))}else delete this._options.directionPoints},Co.prototype.toFormat=function(t,e,r,i){return this._resetOptions(),this.toStart(t),this.toEnd(e),this.toStops(r),this.toParams(i),this._options};var Do=function(){this.type="Feature",this.properties={},this.geometry={type:"LineString",coordinates:[]}};Do.prototype.setProper=function(t,e){return this.properties[t]=e,this},Do.prototype.setCoords=function(t){return this.geometry.coordinates=t,this};var Ro=function(){this.start=null,this.end=null,this.route=null};Ro.prototype.transform=function(t,e){var r,i=[];for(r=0;r<e.details.length;r++)i.push(new Fo(e.details[r],t));return this.route=i,this.start=Oo(e.start),this.end=Oo(e.end),this};var Fo=function(t,e){for(var r,i,n=[],o=0;o<t.routeResult.length;o++){for(var a={nodes:[],mapInfo:e.getFloorInfoByIndex((r=t.routeResult[o]).floor),coordinates:[]},s=0;s<r.coordinates.length;s++)i=Rn(r.coordinates[s]),a.coordinates.push([i.lng,i.lat]);if(r.nodes)for(var l=0,u=void 0,h=void 0;l<r.nodes.length;l++)h=Rn((u=r.nodes[l]).x,u.y),u.lng=h.lng,u.lat=h.lat,a.nodes.push(u);n.push(a)}this.route=n,this.start=Oo(t.start),this.end=Oo(t.end)};function Oo(t){var e=Rn(t);return e.floor=t.floor,e}function Bo(t,e,r,i){var n=1-i,o=n*n*t;return(o+=2*n*i*e)+i*i*r}function No(t,e,r){return{x:(e[0]-t[0])*r,y:(e[1]-t[1])*r}}function Vo(t){for(var e=t.length-1,r=Rn(t[0]),i=[[r.lng,r.lat,0]],n=1;n<e;n++){var o=t[n-1],a=t[n],s=t[n+1],l=jn(o,a),u=jn(a,s);if(l.angle=l.angle>180?l.angle-360:l.angle,u.angle=u.angle>180?u.angle-360:u.angle,Math.abs(l.angle-u.angle)>15)for(var h=Math.min(Math.min(2,l.distance),u.distance)/2,p=No(o,a,(l.distance-h)/l.distance),c=p.x+o[0],f=p.y+o[1],d=No(a,s,h/u.distance),m=d.x+a[0],y=d.y+a[1],g=0;g<=1;g+=.1){var _=Rn(Bo(c,a[0],m,g),Bo(f,a[1],y,g));i.push([_.lng,_.lat,g>=.5?n:n-1])}else{var v=Rn(t[n]);i.push([v.lng,v.lat,n])}}var x=Rn(t[e]);return i.push([x.lng,x.lat,e]),i}function Uo(t,e,r,i){i=i||0;for(var n,o,a=1e8,s=-1,l=0,u=[],h=[],p=null,c=0,f=0,d=0;d<e.length;d++){var m=e[d];if(m.properties.index==r&&(s<0&&(s=d),m.properties.floor==t.floor))for(var y=m.geometry.coordinates,g=1;g<y.length;g++){var _=Fn(y[g-1]),v=Fn(y[g]),x=qn(t,_,v),b=Math.sqrt((t.x-x.x)*(t.x-x.x)+(t.y-x.y)*(t.y-x.y));if(b<a&&(a=b,p=x,c=g,f=y[g][2],n=_,o=v,l=d,u=y.slice(0,g),h=y.slice(g,y.length),b<.5))break}}var w={};if(p){if(i){n=p;for(var I=0;I<h.length;I++){o=Fn(h[I]);var S=Math.sqrt((n.x-o.x)*(n.x-o.x)+(n.y-o.y)*(n.y-o.y));if(S<i){if(n=o,I!==h.length-1){u.push(h[I]),i-=S;continue}i=S}p=jo(n,o,i,S),c+=I,f=h[I][2];break}}var T=jn(n,o),E=Rn(p);p.lng=E.lng,p.lat=E.lat,p.floor=t.floor,p.angle=T.angle,p.devDistance=a,p.indexs=[c-1,c],p.originIndex=f,p.featureIndex=r,w.result=p,u.push([p.lng,p.lat])}return u.length&&(w.passedFeatures=[],l&&(w.passedFeatures=e.slice(s,l)),w.passedFeatures.push((new Do).setProper("floor",t.floor).setProper("index",r).setCoords(u))),w}function jo(t,e,r,i){return{x:(e.x-t.x)*r/i+t.x||e.x,y:(e.y-t.y)*r/i+t.y||e.y}}var qo=function(t,e){this.map=t,this.params=e};qo.prototype.transform=function(t,e){var r={nodes:[]};if(e){var i=t.details[0].routeResult[0],n=i.coordinates[0],o=i.coordinates[1];Math.sqrt((n[0]-o[0])*(n[0]-o[0])+(n[1]-o[1])*(n[1]-o[1]))<e&&(t.start.x=o[0],t.start.y=o[1],i.coordinates.splice(0,1))}return t.details.forEach((function(t){t.routeResult.forEach((function(t){var e=[];t.coordinates.forEach((function(t,r){if(0===r)e.push(t);else{var i=e[e.length-1];i[0]===t[0]&&i[1]===t[1]||e.push(t)}})),t.coordinates=e,r.nodes=r.nodes.concat(t.nodes)}))})),r.origin={start:t.start,end:t.end,route:t.details},r.features=this._toFeatures(t.details),r.result=this._toResult(t),r},qo.prototype._toFeatures=function(t){for(var e=[],r=0;r<t.length;r++){for(var i=0;i<t[r].routeResult.length;i++){var n=t[r].routeResult[i],o=Vo(n.coordinates),a=[];if(n.nodes)for(var s=0,l=void 0,u=void 0;s<n.nodes.length;s++)u=Rn((l=n.nodes[s]).x,l.y),l.lng=u.lng,l.lat=u.lat,a.push(l);e.push((new Do).setProper("floor",n.floor).setProper("index",r).setProper("nodes",a).setProper("mode","floor").setCoords(o))}e[e.length-1].setProper("mode","stops")}return e[e.length-1].setProper("mode","ended"),e},qo.prototype._toResult=function(t){return(new Ro).transform(this.map,t)};var Go={read:function(t,e){return t.readFields(Go.callback,{allMapInfoArray:[],routeNodeV3List:[],routeLinkV3List:[]},e)},callback:function(t,e,r){1===t?e.allMapInfoArray.push(Zo.read(r,r.readVarint()+r.pos)):2===t?e.routeNodeV3List.push(Xo.read(r,r.readVarint()+r.pos)):3===t&&e.routeLinkV3List.push(Ho.read(r,r.readVarint()+r.pos))}},Zo={read:function(t,e){return t.readFields(Zo.callback,{mapId:null,floorNumber:null,sizeX:null,sizeY:null,xmin:null,ymin:null,xmax:null,ymax:null,floorName:null},e)},callback:function(t,e,r){1===t?e.mapId=r.readString():2===t?e.floorNumber=r.readVarint(!0):3===t?e.sizeX=r.readDouble():4===t?e.sizeY=r.readDouble():5===t?e.xmin=r.readDouble():6===t?e.ymin=r.readDouble():7===t?e.xmax=r.readDouble():8===t?e.ymax=r.readDouble():9===t&&(e.floorName=r.readString())}},Xo={read:function(t,e){return t.readFields(Xo.callback,{newNodeId:null,nodeName:"",categoryId:null,floor:null,level:0,isSwitching:null,switchingId:null,direction:null,nodeType:null,open:null,openTime:null,roomId:null,isTempNode:!1,coordinates:[],adjacencies:[],tempAdjacencies:[]},e)},callback:function(t,e,r){1===t?e.newNodeId=r.readString():2===t?e.nodeName=r.readString():3===t?e.categoryId=r.readString():4===t?e.floor=r.readVarint(!0):5===t?e.level=r.readVarint():6===t?e.isSwitching=r.readBoolean():7===t?e.switchingId=r.readVarint():8===t?e.direction=r.readVarint():9===t?e.nodeType=r.readVarint():10===t?e.open=r.readBoolean():11===t?e.openTime.push(Yo.read(r,r.readVarint()+r.pos)):12===t?e.roomId=r.readString():14===t&&e.coordinates.push(Ko.read(r,r.readVarint()+r.pos).xy)}},Yo={read:function(t,e){return t.readFields(Yo.callback,{start:null,end:null},e)},callback:function(t,e,r){1===t?e.start=Wo.read(r,r.readVarint()+r.pos):2===t&&(e.end=Wo.read(r,r.readVarint()+r.pos))}},Wo={read:function(t,e){return t.readFields(Wo.callback,{hour:null,minute:null,time:null},e)},callback:function(t,e,r){1===t?e.hour=r.readVarint():2===t?e.minute=r.readVarint():4===t&&(e.time=r.readVarint())}},Ho={read:function(t,e){return t.readFields(Ho.callback,{newLinkId:null,currentNodeId:null,nextNodeId:null,linkName:"",floor:null,level:0,length:null,virtual:null,oneWay:null,reverse:null,linkType:null,allowSnap:null,open:null,openTime:[],roomId:null,nextNode:{},coordinates:[]},e)},callback:function(t,e,r){1===t?e.newLinkId=r.readString():2===t?e.currentNodeId=r.readString():3===t?e.nextNodeId=r.readString():4===t?e.linkName=r.readString():5===t?e.floor=r.readVarint(!0):6===t?e.level=r.readVarint():7===t?e.length=r.readDouble():8===t?e.virtual=r.readVarint():9===t?e.oneWay=r.readVarint():10===t?e.reverse=r.readVarint():11===t?e.linkType=r.readString():12===t?e.allowSnap=r.readBoolean():13===t?e.open=r.readBoolean():14===t?e.openTime.push(Yo.read(r,r.readVarint()+r.pos)):15===t?e.roomId=r.readString():17===t&&e.coordinates.push(Ko.read(r,r.readVarint()+r.pos).xy)}},Ko={};function Jo(){this.dataStore=new Array,this.enqueue=function(t){this.dataStore.push(t)},this.dequeue=function(){return this.dataStore.shift()},this.front=function(){return this.dataStore[0]},this.back=function(){return this.dataStore[this.dataStore.length-1]},this.remove=function(t){this.dataStore.forEach((function(e,r,i){e.newNodeId==t&&i.splice(r,1)}))},this.removeV2=function(t){this.dataStore.forEach((function(e,r,i){e.nodeId==t&&i.splice(r,1)}))},this.toString=function(){for(var t="",e=0;e<this.dataStore.length;++e)t+=this.dataStore[e]+"\n";return t},this.empty=function(){return 0==this.dataStore.length}}function $o(){this.xToLongitude=function(t){return parseFloat(t)/6378137*(180/Math.PI)},this.yToLongitude=function(t){return(Math.PI/2-2*Math.atan(Math.exp(-1*parseFloat(t)/6378137)))*(180/Math.PI)},this.mercatorToLngLats=function(t){for(var e=[],r=0;r<t.length;r++)e.push(this.mercatorToLngLat(t[r]));return e},this.mercatorToLngLat=function(t){return[this.xToLongitude(t[0]),this.yToLongitude(t[1])]},this.lngToMercatorX=function(t){return parseFloat(t)*(6378137*Math.PI)/180},this.latToMercatorY=function(t){return Math.log(Math.tan((90+parseFloat(t))*(Math.PI/180)/2))/(Math.PI/180)*(6378137*Math.PI)/180},this.lngLatsToMercators=function(t){for(var e=[],r=0;r<t.length;r++)e.push(this.lngLatsToMercator(t[r]));return e},this.lngLatsToMercator=function(t){return[this.lngToMercatorX(t[0]),this.latToMercatorY(t[1])]}}function Qo(t){return!t||null==t||""==t||null==t||0==t.length||"null"==t||"''"==t}function ta(){this.init=function(t,e){this.completeResult=t,this.detailedResult=e},this.setStartPoint=function(t){this.startPoint=t},this.setEndPoint=function(t){this.endPoint=t},this.setStopPoints=function(t){this.stopPoints=t},this.buildJson=function(){var t={x:parseFloat(this.startPoint.x),y:parseFloat(this.startPoint.y),floor:parseInt(this.startPoint.floor)},e={x:parseFloat(this.endPoint.x),y:parseFloat(this.endPoint.y),floor:parseInt(this.endPoint.floor)},r=(new Date).getTime(),i=new Array;if(null!=this.stopPoints&&this.stopPoints.length>0)for(var n=0;n<this.stopPoints.length;++n)i.push({x:parseFloat(this.stopPoints[n].x),y:parseFloat(this.stopPoints[n].y),floor:parseInt(this.stopPoints[n].floor)});var o=new Array;if(null!=this.indices&&this.indices.length>0)for(var a=0;a<this.indices.length;++a)o.push(this.indices[a]);var s=new Array;if(null!=this.rearrangedPoints&&this.rearrangedPoints.length>0)for(var l=0;l<this.rearrangedPoints.length;++l)s.push({x:parseFloat(this.rearrangedPoints[l].x),y:parseFloat(this.rearrangedPoints[l].y),floor:parseInt(this.rearrangedPoints[l].floor)});var u=this.completeResult.buildJson();u.start=t,u.end=e;for(var h=new Array,p=0;p<this.detailedResult.length;++p){var c=this.detailedResult[p].buildJson();c.start=0==p?t:{x:parseFloat(this.rearrangedPoints[p-1].x),y:parseFloat(this.rearrangedPoints[p-1].y),floor:parseInt(this.rearrangedPoints[p-1].floor)},c.end=p==this.detailedResult.length-1?e:{x:parseFloat(this.rearrangedPoints[p].x),y:parseFloat(this.rearrangedPoints[p].y),floor:parseInt(this.rearrangedPoints[p].floor)},h.push(c)}return{code:r*parseInt(this.startPoint.x)+parseInt(this.startPoint.y),start:t,end:e,stops:i,indices:o,rearrangedStop:s,completeRoute:u,details:h}},this.buildJsonV1=function(){return this.completeResult.buildJson()},this.getIndices=function(){return this.indices},this.setIndices=function(t){this.indices=t},this.getRearrangedPoints=function(){return this.rearrangedPoints},this.setRearrangedPoints=function(t){this.rearrangedPoints=t}}Ko.read=function(t,e){return t.readFields(Ko.callback,{xy:[]},e)},Ko.callback=function(t,e,r){r.readPackedDouble(e.xy)};var ea={point:ao,lineString:so,multiLineString:uo,length:wo};function ra(){this.processElements=function(t,e,r,i){this.elementList=new Array,this.length=0,this.partIndex=0,this.startPoint=t,this.endPoint=e,this.elementList=r,this.info=i,null==this.elementNodeList&&(this.elementNodeList=new Array);for(var n=new Array,o=0;o<this.elementList.length;o++){var a=this.elementList[o];if(a.isStop)n.push([parseFloat(a.obj.x),parseFloat(a.obj.y)]);else if(a.isNode)Qo(a.obj.nodeName)||this.elementNodeList.push(a.obj);else{if("11111111"==a.obj.linkType)continue;for(var s=0;s<a.obj.coordinates.length;s++)n.push(a.obj.coordinates[s])}}0!=n.length&&(1==n.length&&n.push(n[0]),this.route=n,this.length=ea.length(ea.lineString((new $o).mercatorToLngLats(this.route)),{units:"meters"}))},this.getLength=function(){return this.length},this.buildElementNode=function(t){return{nodeID:t.newNodeId,x:t.coordinates[0][0],y:t.coordinates[0][1],floor:t.floor,name:t.nodeName,categoryID:t.categoryId,level:t.level,isSwitching:t.isSwitching,switchingID:t.switchingId,direction:t.direction,nodeType:t.nodeType,open:t.open,openTime:t.openTime,poiId:t.roomId}},this.buildJson=function(){for(var t=new Array,e=0;e<this.elementNodeList.length;++e)t.push(this.buildElementNode(this.elementNodeList[e]));return{partIndex:this.partIndex,floor:this.info.floorNumber,coordinates:this.route,nodes:t,length:this.length}},this.setPartIndex=function(t){this.partIndex=t},this.setPreviousPart=function(t){this.previousPart=t},this.isFirstPart=function(){return null==this.previousPart||null==this.previousPart},this.isMiddlePart=function(){return null!=this.previousPart&&null!=this.previousPart&&null!=this.nextPart&&null!=this.nextPart},this.isLastPart=function(){return null==this.nextPart||null==this.nextPart},this.setNextPart=function(t){this.nextPart=t},this.getMapInfo=function(){return this.info}}function ia(){this.init=function(t){this.allRoutePartArray=[],this.allFloorRoutePartDict={},null==this.allFloorRoutePartDict&&(this.allFloorRoutePartDict=new Array),this.allRoutePartArray=t;for(var e=0;e<t.length;++e){var r=t[e],i=r.getMapInfo().floorNumber,n=this.allFloorRoutePartDict[i+""];null==n&&(n=new Array),n.push(r)}},this.buildJson=function(){for(var t=new Array,e=0;e<this.allRoutePartArray.length;e++){var r=this.allRoutePartArray[e].buildJson();t.push(r)}return{routeResult:t}}}function na(){this.init=function(t,e,r,i){this.elements=new Array,this.startPoint=t,this.endPoint=e,this.elements=r,this.allMapInfoArray=i,this.routeResult=this.processV3()},this.processV3=function(){this.length=0;for(var t=new Array,e=new Array,r=0,i=new Array,n=0;n<this.elements.length;++n){var o=this.elements[n];null!=o&&null!=o&&(o.obj.floor!=r&&(r=o.obj.floor,i=new Array,t.push(i),e.push(r)),i.push(o))}if(null==e||null==e||0==e.length)return null;for(var a=new Array,s=0;s<e.length;s++){var l=t[s],u=this.searchMapInfo(this.allMapInfoArray,e[s]),h=new ra;h.processElements(this.startPoint,this.endPoint,l,u),this.length+=h.getLength(),a.push(h)}for(var p=a.length,c=0;c<p;c++){var f=a[c];c>0&&f.setPreviousPart(a[c-1]),c<p-1&&f.setNextPart(a[c+1]),f.setPartIndex(c)}var d=new ia;return d.init(a),d},this.searchMapInfo=function(t,e){for(var r=0;r<t.length;r++)if(t[r].floorNumber==e)return t[r];return null}}function oa(){this.init=function(t){this.stopID=t},this.getStopID=function(){return this.stopID},this.getPos=function(){return this.pos},this.setPos=function(t){this.pos=t}}function aa(){this.buildStops=function(t,e,r){this.startPoint=t,this.endPoint=e,this.stopPoints=r,this.stopArray=[],this.middleStopArray=[];var i=0;this.startStop=new oa,this.startStop.init(i++),this.startStop.setPos(this.startPoint),this.stopArray.push(void 0);for(var n=0;n<this.stopPoints.length;++n){var o=new oa;o.init(i++),o.setPos(this.stopPoints[n]),this.stopArray.push(o),this.middleStopArray.push(o)}this.endStop=new oa,this.endStop.init(i++),this.endStop.setPos(this.endPoint),this.stopArray.push(this.endStop)},this.getStopPoint=function(t){return(void 0)[t]},this.stopCount=function(){return this.stopPoints.length},this.getStartStop=function(){return this.startStop},this.getEndStop=function(){return this.endStop},this.getMiddleStops=function(){return this.middleStopArray}}var sa={point:ao,distance:_o};function la(){this.costOfLengthForSwitching=5,this.init=function(t){for(var e=t.allMapInfoArray,r=t.routeNodeV3List,i=t.routeLinkV3List,n=1,o={},a=0,s={},l=0;l<r.length;l++){var u=r[l];if(null!=u.level&&u.level>a&&(a=u.level),o[u.newNodeId]=u,u.isSwitching){var h=u.switchingId,p=s[h];null==p&&(p=[]),p.push(u),p.sort((function(t,e){return e.floor-t.floor})),s[h]=p}}for(var c={},f={},d=[],m=0;m<i.length;m++){var y=i[m];d.push(y),null!=y.level&&y.level>a&&(a=y.level);var g=c[y.floor];if(null==g&&(g=[]),g.push(y),c[y.floor]=g,!Qo(y.roomId)){var _=f[y.roomId];null==_&&(_=[]),_.push(y),f[y.roomId]=_}}for(var v in s)for(var x=s[v],b=0;b<x.length;++b)for(var w=x[b],I=0;I<x.length;++I)if(b!=I){var S=x[I];if(2!=w.direction&&1!=S.direction){var T=sa.point((new $o).mercatorToLngLat(w.coordinates[0])),E=sa.point((new $o).mercatorToLngLat(S.coordinates[0])),P={newLinkId:this.createVirtualLinkID(n++),currentNodeId:w.newNodeId,nextNodeId:S.newNodeId,linkName:"",floor:w.floor,level:0,length:sa.distance(T,E,{units:"meters"})+1*this.costOfLengthForSwitching,linkType:"11111111",allowSnap:!1,open:!0,openTime:[],roomId:"",coordinates:[],nextNode:S};w.adjacencies.push(P)}}var A={},L={};for(var M in c){for(var k=c[M],z=[],C=[],D=0;D<k.length;D++){var R=k[D];R.allowSnap&&Qo(R.roomId)&&0==R.level&&("10"!=R.linkType&&"11"!=R.linkType||z.push((new $o).mercatorToLngLats(R.coordinates)),"01"!=R.linkType&&"11"!=R.linkType||C.push((new $o).mercatorToLngLats(R.coordinates)))}z.length>0&&(L[M]=z),C.length>0&&(A[M]=C)}var F={},O={};for(var B in f){for(var N=f[B],V=void 0,U=void 0,j=0;j<N.length;j++){var q=N[j];if(q.allowSnap){if("10"==q.linkType||"11"==q.linkType){V||(V={});var G=V[q.floor];null==G&&(G=[]),G.push((new $o).mercatorToLngLats(q.coordinates)),V[q.floor]=G}if("01"==q.linkType||"11"==q.linkType){U||(U={});var Z=U[q.floor];null==Z&&(Z=[]),Z.push((new $o).mercatorToLngLats(q.coordinates)),U[q.floor]=Z}}}V&&(O[B]=V),U&&(F[B]=U)}var X={allMapInfoArray:e,tempNodeIndex:0,tempLinkIndex:0,virtualLinkIndex:0,allLinkList:d,carFlooRoutesMap:A,peopleFlooRoutesMap:L,carRoomRoutesMap:F,peopleRoomRoutesMap:O,roomIDLinkMap:f,maxRouteLevel:a,allNodeMap:o,allFloorLinksMap:c};return this.initLinkAndNode(X),X},this.initLinkAndNode=function(t){for(var e=0;e<t.allLinkList.length;e++){var r=t.allLinkList[e],i=t.allNodeMap[r.currentNodeId],n=t.allNodeMap[r.nextNodeId];null!=i&&i.adjacencies.push(r),null!=r&&(r.nextNode=n)}},this.distance=function(t,e){var r=t.coordinates[0][0],i=t.coordinates[0][1],n=e.coordinates[0][0],o=e.coordinates[0][1],a=r>n?r-n:n-r,s=i>o?i-o:o-i;return Math.sqrt(a*a+s*s)},this.createVirtualLinkID=function(t){return"VLK"+t}}function ua(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var i=r.ignoreBoundary;if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var n=function(t){if(!t)throw new Error("coord is required");if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates;if(Array.isArray(t)&&t.length>=2&&void 0===t[0].length&&void 0===t[1].length)return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(t),o=function(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),a=e.geometry?e.geometry.type:e.type,s=e.bbox;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(n,s))return!1;"Polygon"===a&&(o=[o]);for(var l=0,u=!1;l<o.length&&!u;l++)if(ha(n,o[l][0],i)){for(var h=!1,p=1;p<o[l].length&&!h;)ha(n,o[l][p],!i)&&(h=!0),p++;h||(u=!0)}return u}function ha(t,e,r){var i=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var n=0,o=e.length-1;n<e.length;o=n++){var a=e[n][0],s=e[n][1],l=e[o][0],u=e[o][1];if(t[1]*(a-l)+s*(l-t[0])+u*(t[0]-a)==0&&(a-t[0])*(l-t[0])<=0&&(s-t[1])*(u-t[1])<=0)return!r;s>t[1]!=u>t[1]&&t[0]<(l-a)*(t[1]-s)/(u-s)+a&&(i=!i)}return i}function pa(t){var e=[1/0,1/0,-1/0,-1/0];return vo(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function ca(t,e,r){var i=(r=r||{}).ignoreEndVertices;if(!fo(r))throw new Error("invalid options");if(!t)throw new Error("pt is required");if(!e)throw new Error("line is required");for(var n=function(t){if(!t)throw new Error("coord is required");if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates;if(Array.isArray(t)&&t.length>=2&&void 0===t[0].length&&void 0===t[1].length)return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(t),o=function(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),a=0;a<o.length-1;a++){var s=!1;if(i&&(0===a&&(s="start"),a===o.length-2&&(s="end"),0===a&&a+1===o.length-1&&(s="both")),fa(o[a],o[a+1],n,s))return!0}return!1}function fa(t,e,r,i){var n=r[0],o=r[1],a=t[0],s=t[1],l=e[0],u=e[1],h=l-a,p=u-s;return 0==(r[0]-a)*p-(r[1]-s)*h&&(i?"start"===i?Math.abs(h)>=Math.abs(p)?h>0?a<n&&n<=l:l<=n&&n<a:p>0?s<o&&o<=u:u<=o&&o<s:"end"===i?Math.abs(h)>=Math.abs(p)?h>0?a<=n&&n<l:l<n&&n<=a:p>0?s<=o&&o<u:u<o&&o<=s:"both"===i?Math.abs(h)>=Math.abs(p)?h>0?a<n&&n<l:l<n&&n<a:p>0?s<o&&o<u:u<o&&o<s:void 0:Math.abs(h)>=Math.abs(p)?h>0?a<=n&&n<=l:l<=n&&n<=a:p>0?s<=o&&o<=u:u<=o&&o<=s)}function da(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ma(t){if(!t)throw new Error("geojson is required");if(void 0!==t.geometry)return t.geometry;if(t.coordinates||t.geometries)return t;throw new Error("geojson must be a valid Feature or Geometry Object")}function ya(t,e){if(!t)throw new Error((e||"geojson")+" is required");if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error((e||"geojson")+" is invalid")}function ga(t,e){var r=ya(t),i=ya(e),n=ma(t),o=ma(e),a=da(t),s=da(e);switch(r){case"Point":if("Point"===i)return va(a,s);throw new Error("feature2 "+i+" geometry not supported");case"MultiPoint":switch(i){case"Point":return function(t,e){var r,i=!1;for(r=0;r<t.coordinates.length;r++)if(va(t.coordinates[r],e.coordinates)){i=!0;break}return i}(n,o);case"MultiPoint":return function(t,e){for(var r=0;r<e.coordinates.length;r++){for(var i=!1,n=0;n<t.coordinates.length;n++)if(va(e.coordinates[r],t.coordinates[n])){i=!0;break}if(!i)return!1}return!0}(n,o);default:throw new Error("feature2 "+i+" geometry not supported")}case"LineString":switch(i){case"Point":return ca(o,n,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var r=!1,i=0;i<e.coordinates.length;i++)if(ca({type:"Point",coordinates:e.coordinates[i]},t,{ignoreEndVertices:!0})&&(r=!0),!ca({type:"Point",coordinates:e.coordinates[i]},t,{ignoreEndVertices:!1}))return!1;return r}(n,o);case"MultiPoint":return function(t,e){for(var r=!1,i=0;i<e.coordinates.length;i++)if(ca(e.coordinates[i],t,{ignoreEndVertices:!0})&&(r=!0),!ca(e.coordinates[i],t))return!1;return!!r}(n,o);default:throw new Error("feature2 "+i+" geometry not supported")}case"Polygon":switch(i){case"Point":return ua(o,n,{ignoreBoundary:!0});case"LineString":return function(t,e){var r,i,n=!1,o=0;if(!_a(pa(t),pa(e)))return!1;for(;o<e.coordinates.length-1;o++)if(ua({type:"Point",coordinates:[((r=e.coordinates[o])[0]+(i=e.coordinates[o+1])[0])/2,(r[1]+i[1])/2]},t,{ignoreBoundary:!0})){n=!0;break}return n}(n,o);case"Polygon":return function(t,e){if(!_a(pa(t),pa(e)))return!1;for(var r=0;r<e.coordinates[0].length;r++)if(!ua(e.coordinates[0][r],t))return!1;return!0}(n,o);case"MultiPoint":return function(t,e){for(var r=0;r<e.coordinates.length;r++)if(!ua(e.coordinates[r],t,{ignoreBoundary:!0}))return!1;return!0}(n,o);default:throw new Error("feature2 "+i+" geometry not supported")}default:throw new Error("feature1 "+r+" geometry not supported")}}function _a(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function va(t,e){return t[0]===e[0]&&t[1]===e[1]}var xa=t.createCommonjsModule((function(t,e){function r(t,e,r){void 0===r&&(r={});var i={type:"Feature"};return(0===r.id||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=e||{},i.geometry=t,i}function i(t,e,i){return void 0===i&&(i={}),r({type:"Point",coordinates:t},e,i)}function n(t,e,i){void 0===i&&(i={});for(var n=0,o=t;n<o.length;n++){var a=o[n];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:t},e,i)}function o(t,e,i){if(void 0===i&&(i={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:t},e,i)}function a(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function s(t,e,i){return void 0===i&&(i={}),r({type:"MultiLineString",coordinates:t},e,i)}function l(t,e,i){return void 0===i&&(i={}),r({type:"MultiPoint",coordinates:t},e,i)}function u(t,e,i){return void 0===i&&(i={}),r({type:"MultiPolygon",coordinates:t},e,i)}function h(t,r){void 0===r&&(r="kilometers");var i=e.factors[r];if(!i)throw new Error(r+" units is invalid");return t*i}function p(t,r){void 0===r&&(r="kilometers");var i=e.factors[r];if(!i)throw new Error(r+" units is invalid");return t/i}function c(t){return t%(2*Math.PI)*180/Math.PI}function f(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)&&!/^\s*$/.test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:e.earthRadius/1.0936},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1/1.0936},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=r,e.geometry=function(t,e,r){switch(t){case"Point":return i(e).geometry;case"LineString":return o(e).geometry;case"Polygon":return n(e).geometry;case"MultiPoint":return l(e).geometry;case"MultiLineString":return s(e).geometry;case"MultiPolygon":return u(e).geometry;default:throw new Error(t+" is invalid")}},e.point=i,e.points=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return i(t,e)})),r)},e.polygon=n,e.polygons=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return n(t,e)})),r)},e.lineString=o,e.lineStrings=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return o(t,e)})),r)},e.featureCollection=a,e.multiLineString=s,e.multiPoint=l,e.multiPolygon=u,e.geometryCollection=function(t,e,i){return void 0===i&&(i={}),r({type:"GeometryCollection",geometries:t},e,i)},e.round=function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},e.radiansToLength=h,e.lengthToRadians=p,e.lengthToDegrees=function(t,e){return c(p(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=c,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return h(p(t,e),r)},e.convertArea=function(t,r,i){if(void 0===r&&(r="meters"),void 0===i&&(i="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=e.areaFactors[r];if(!n)throw new Error("invalid original units");var o=e.areaFactors[i];if(!o)throw new Error("invalid final units");return t/n*o},e.isNumber=f,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!f(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},e.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},e.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},e.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},e.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},e.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},e.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},e.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}}));t.unwrapExports(xa);var ba=t.createCommonjsModule((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getCoord=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")},e.getCoords=function(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},e.containsNumber=function t(e){if(e.length>1&&xa.isNumber(e[0])&&xa.isNumber(e[1]))return!0;if(Array.isArray(e[0])&&e[0].length)return t(e[0]);throw new Error("coordinates must only contain numbers")},e.geojsonType=function(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)},e.featureOf=function(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)},e.collectionOf=function(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var i=0,n=t.features;i<n.length;i++){var o=n[i];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}},e.getGeom=function(t){return"Feature"===t.type?t.geometry:t},e.getType=function(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}}));t.unwrapExports(ba);var wa=t.createCommonjsModule((function(t,e){function r(t,e,i){if(null!==t)for(var n,o,a,s,l,u,h,p,c=0,f=0,d=t.type,m="FeatureCollection"===d,y="Feature"===d,g=m?t.features.length:1,_=0;_<g;_++){l=(p=!!(h=m?t.features[_].geometry:y?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var v=0;v<l;v++){var x=0,b=0;if(null!==(s=p?h.geometries[v]:h)){u=s.coordinates;var w=s.type;switch(c=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(u,f,_,x,b))return!1;f++,x++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],f,_,x,b))return!1;f++,"MultiPoint"===w&&x++}"LineString"===w&&x++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(o=0;o<u[n].length-c;o++){if(!1===e(u[n][o],f,_,x,b))return!1;f++}"MultiLineString"===w&&x++,"Polygon"===w&&b++}"Polygon"===w&&x++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(b=0,o=0;o<u[n].length;o++){for(a=0;a<u[n][o].length-c;a++){if(!1===e(u[n][o][a],f,_,x,b))return!1;f++}b++}x++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===r(s.geometries[n],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function i(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function n(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function o(t,e){var r,i,n,o,a,s,l,u,h,p,c=0,f="FeatureCollection"===t.type,d="Feature"===t.type,m=f?t.features.length:1;for(r=0;r<m;r++){for(u=f?t.features[r].properties:d?t.properties:{},h=f?t.features[r].bbox:d?t.bbox:void 0,p=f?t.features[r].id:d?t.id:void 0,a=(l=!!(s=f?t.features[r].geometry:d?t.geometry:t)&&"GeometryCollection"===s.type)?s.geometries.length:1,n=0;n<a;n++)if(null!==(o=l?s.geometries[n]:s))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,c,u,h,p))return!1;break;case"GeometryCollection":for(i=0;i<o.geometries.length;i++)if(!1===e(o.geometries[i],c,u,h,p))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,c,u,h,p))return!1;c++}}function a(t,e){o(t,(function(t,r,i,n,o){var a,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==e(xa.feature(t,i,{bbox:n,id:o}),r,0)&&void 0}switch(s){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var l=0;l<t.coordinates.length;l++)if(!1===e(xa.feature({type:a,coordinates:t.coordinates[l]},i),r,l))return!1}))}function s(t,e){a(t,(function(t,i,n){var o=0;if(t.geometry){var a=t.geometry.type;if("Point"!==a&&"MultiPoint"!==a){var s,l=0,u=0,h=0;return!1!==r(t,(function(r,a,p,c,f){if(void 0===s||i>l||c>u||f>h)return s=r,l=i,u=c,h=f,void(o=0);var d=xa.lineString([s,r],t.properties);if(!1===e(d,i,n,f,o))return!1;o++,s=r}))&&void 0}}}))}function l(t,e){if(!t)throw new Error("geojson is required");a(t,(function(t,r,i){if(null!==t.geometry){var n=t.geometry.coordinates;switch(t.geometry.type){case"LineString":if(!1===e(t,r,i,0,0))return!1;break;case"Polygon":for(var o=0;o<n.length;o++)if(!1===e(xa.lineString(n[o],t.properties),r,i,o))return!1}}}))}Object.defineProperty(e,"__esModule",{value:!0}),e.coordEach=r,e.coordReduce=function(t,e,i,n){var o=i;return r(t,(function(t,r,n,a,s){o=0===r&&void 0===i?t:e(o,t,r,n,a,s)}),n),o},e.propEach=i,e.propReduce=function(t,e,r){var n=r;return i(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},e.featureEach=n,e.featureReduce=function(t,e,r){var i=r;return n(t,(function(t,n){i=0===n&&void 0===r?t:e(i,t,n)})),i},e.coordAll=function(t){var e=[];return r(t,(function(t){e.push(t)})),e},e.geomEach=o,e.geomReduce=function(t,e,r){var i=r;return o(t,(function(t,n,o,a,s){i=0===n&&void 0===r?t:e(i,t,n,o,a,s)})),i},e.flattenEach=a,e.flattenReduce=function(t,e,r){var i=r;return a(t,(function(t,n,o){i=0===n&&0===o&&void 0===r?t:e(i,t,n,o)})),i},e.segmentEach=s,e.segmentReduce=function(t,e,r){var i=r,n=!1;return s(t,(function(t,o,a,s,l){i=!1===n&&void 0===r?t:e(i,t,o,a,s,l),n=!0})),i},e.lineEach=l,e.lineReduce=function(t,e,r){var i=r;return l(t,(function(t,n,o,a){i=0===n&&void 0===r?t:e(i,t,n,o,a)})),i},e.findSegment=function(t,e){if(!xa.isObject(e=e||{}))throw new Error("options is invalid");var r,i=e.featureIndex||0,n=e.multiFeatureIndex||0,o=e.geometryIndex||0,a=e.segmentIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),s=s||t.features[i].properties,r=t.features[i].geometry;break;case"Feature":s=s||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return a<0&&(a=l.length+a-1),xa.lineString([l[a],l[a+1]],s,e);case"Polygon":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a-1),xa.lineString([l[o][a],l[o][a+1]],s,e);case"MultiLineString":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a-1),xa.lineString([l[n][a],l[n][a+1]],s,e);case"MultiPolygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),a<0&&(a=l[n][o].length-a-1),xa.lineString([l[n][o][a],l[n][o][a+1]],s,e)}throw new Error("geojson is invalid")},e.findPoint=function(t,e){if(!xa.isObject(e=e||{}))throw new Error("options is invalid");var r,i=e.featureIndex||0,n=e.multiFeatureIndex||0,o=e.geometryIndex||0,a=e.coordIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),s=s||t.features[i].properties,r=t.features[i].geometry;break;case"Feature":s=s||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":return xa.point(l,s,e);case"MultiPoint":return n<0&&(n=l.length+n),xa.point(l[n],s,e);case"LineString":return a<0&&(a=l.length+a),xa.point(l[a],s,e);case"Polygon":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a),xa.point(l[o][a],s,e);case"MultiLineString":return n<0&&(n=l.length+n),a<0&&(a=l[n].length+a),xa.point(l[n][a],s,e);case"MultiPolygon":return n<0&&(n=l.length+n),o<0&&(o=l[n].length+o),a<0&&(a=l[n][o].length-a),xa.point(l[n][o][a],s,e)}throw new Error("geojson is invalid")}}));t.unwrapExports(wa);var Ia=t.createCommonjsModule((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r){void 0===r&&(r={});var i=ba.getCoord(t),n=ba.getCoord(e),o=xa.degreesToRadians(n[1]-i[1]),a=xa.degreesToRadians(n[0]-i[0]),s=xa.degreesToRadians(i[1]),l=xa.degreesToRadians(n[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(l);return xa.radiansToLength(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),r.units)}}));t.unwrapExports(Ia);var Sa=t.createCommonjsModule((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r){void 0===r&&(r={});var i=ba.getCoord(t),n=ba.getCoord(e);n[0]+=n[0]-i[0]>180?-360:i[0]-n[0]>180?360:0;var o=function(t,e,r){var i=r=void 0===r?xa.earthRadius:Number(r),n=t[1]*Math.PI/180,o=e[1]*Math.PI/180,a=o-n,s=Math.abs(e[0]-t[0])*Math.PI/180;s>Math.PI&&(s-=2*Math.PI);var l=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),u=Math.abs(l)>1e-11?a/l:Math.cos(n);return Math.sqrt(a*a+u*u*s*s)*i}(i,n);return xa.convertLength(o,"meters",r.units)}}));t.unwrapExports(Sa);var Ta=t.createCommonjsModule((function(t,e){function r(t,e){return t[0]*e[0]+t[1]*e[1]}function i(t,e,r){return"planar"===r.method?Sa.default(t,e,r):Ia.default(t,e,r)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){if(void 0===n&&(n={}),n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=xa.point(t):"Point"===t.type?t=xa.feature(t):ba.featureOf(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=xa.lineString(e):"LineString"===e.type?e=xa.feature(e):ba.featureOf(e,"LineString","line");var o=1/0,a=t.geometry.coordinates;return wa.segmentEach(e,(function(t){var e=function(t,e,n,o){var a=[n[0]-e[0],n[1]-e[1]],s=r([t[0]-e[0],t[1]-e[1]],a);if(s<=0)return i(t,e,{method:o.method,units:"degrees"});var l=r(a,a);if(l<=s)return i(t,n,{method:o.method,units:"degrees"});var u=s/l;return i(t,[e[0]+u*a[0],e[1]+u*a[1]],{method:o.method,units:"degrees"})}(a,t.geometry.coordinates[0],t.geometry.coordinates[1],n);e<o&&(o=e)})),xa.convertLength(o,"degrees",n.units)}})),Ea=t.unwrapExports(Ta);function Pa(t,e,r,i,n){!function t(e,r,i,n,o){for(;n>i;){if(n-i>600){var a=n-i+1,s=r-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(i,Math.floor(r-s*u/a+h)),Math.min(n,Math.floor(r+(a-s)*u/a+h)),o)}var p=e[r],c=i,f=n;for(Aa(e,i,r),o(e[n],p)>0&&Aa(e,i,n);c<f;){for(Aa(e,c,f),c++,f--;o(e[c],p)<0;)c++;for(;o(e[f],p)>0;)f--}0===o(e[i],p)?Aa(e,i,f):Aa(e,++f,n),f<=r&&(i=f+1),r<=f&&(n=f-1)}}(t,e,r||0,i||t.length-1,n||La)}function Aa(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function La(t,e){return t<e?-1:t>e?1:0}function Ma(t,e){if(!(this instanceof Ma))return new Ma(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function ka(t,e,r){if(!r)return e.indexOf(t);for(var i=0;i<e.length;i++)if(r(t,e[i]))return i;return-1}function za(t,e){Ca(t,0,t.children.length,e,t)}function Ca(t,e,r,i,n){n||(n=Ua(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(var o,a=e;a<r;a++)o=t.children[a],Da(n,t.leaf?i(o):o);return n}function Da(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Ra(t,e){return t.minX-e.minX}function Fa(t,e){return t.minY-e.minY}function Oa(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ba(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Na(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Va(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Ua(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ja(t,e,r,i,n){for(var o,a=[e,r];a.length;)(r=a.pop())-(e=a.pop())<=i||(Pa(t,o=e+Math.ceil((r-e)/i/2)*i,e,r,n),a.push(e,o,o,r))}function qa(t){var e=[t[0],t[1]];return{type:"Feature",bbox:t,properties:{},geometry:{type:"Polygon",coordinates:[[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]]}}}function Ga(t){var e=[1/0,1/0,-1/0,-1/0];return vo(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function Za(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Xa(t){if(!t)throw new Error("geojson is required");var e=[];return bo(t,(function(t){!function(t,e){var r=[],i=t.geometry;switch(i.type){case"Polygon":r=Za(i);break;case"LineString":r=[Za(i)]}r.forEach((function(r){(function(t,e){var r=[];return t.reduce((function(t,i){var n,o,a,s,l,u,h=so([t,i],e);return h.bbox=[(a=(n=t)[0])<(l=(o=i)[0])?a:l,(s=n[1])<(u=o[1])?s:u,a>l?a:l,s>u?s:u],r.push(h),i})),r})(r,t.properties).forEach((function(t){t.id=e.length,e.push(t)}))}))}(t,e)})),lo(e)}function Ya(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Wa(t,e){var r={},i=[];if("LineString"===t.type&&(t=oo(t)),"LineString"===e.type&&(e=oo(e)),"Feature"===t.type&&"Feature"===e.type&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var n=Ha(t,e);return n&&i.push(n),lo(i)}var o=function(){var t=Ma(void 0);return t.insert=function(t){if(Array.isArray(t)){var e=t;(t=qa(e)).bbox=e}else t.bbox=t.bbox?t.bbox:Ga(t);return Ma.prototype.insert.call(this,t)},t.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){var r=qa(t);r.bbox=t,e.push(r)})):xo(t,(function(t){t.bbox=t.bbox?t.bbox:Ga(t),e.push(t)})),Ma.prototype.load.call(this,e)},t.remove=function(t){if(Array.isArray(t)){var e=t;(t=qa(e)).bbox=e}return Ma.prototype.remove.call(this,t)},t.clear=function(){return Ma.prototype.clear.call(this)},t.search=function(t){return{type:"FeatureCollection",features:Ma.prototype.search.call(this,this.toBBox(t))}},t.collides=function(t){return Ma.prototype.collides.call(this,this.toBBox(t))},t.all=function(){return{type:"FeatureCollection",features:Ma.prototype.all.call(this)}},t.toJSON=function(){return Ma.prototype.toJSON.call(this)},t.fromJSON=function(t){return Ma.prototype.fromJSON.call(this,t)},t.toBBox=function(t){var e;return{minX:(e=t.bbox?t.bbox:Array.isArray(t)&&4===t.length?t:Ga(t))[0],minY:e[1],maxX:e[2],maxY:e[3]}},t}();return o.load(Xa(e)),xo(Xa(t),(function(t){xo(o.search(t),(function(e){var n=Ha(t,e);if(n){var o=Ya(n).join(",");r[o]||(r[o]=!0,i.push(n))}}))})),lo(i)}function Ha(t,e){var r=Ya(t),i=Ya(e);if(2!==r.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==i.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=r[0][0],o=r[0][1],a=r[1][0],s=r[1][1],l=i[0][0],u=i[0][1],h=i[1][0],p=i[1][1],c=(p-u)*(a-n)-(h-l)*(s-o);if(0===c)return null;var f=((h-l)*(o-u)-(p-u)*(n-l))/c,d=((a-n)*(o-u)-(s-o)*(n-l))/c;return f>=0&&f<=1&&d>=0&&d<=1?ao([n+f*(a-n),o+f*(s-o)]):null}function Ka(t,e,r){if(!fo(r=r||{}))throw new Error("options is invalid");var i=t.geometry?t.geometry.type:t.type;if("LineString"!==i&&"MultiLineString"!==i)throw new Error("lines must be LineString or MultiLineString");var n=ao([1/0,1/0],{dist:1/0}),o=0;return bo(t,(function(t){for(var i=function(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(t),a=0;a<i.length-1;a++){var s=ao(i[a]);s.properties.dist=_o(e,s,r);var l=ao(i[a+1]);l.properties.dist=_o(e,l,r);var u=_o(s,l,r),h=Math.max(s.properties.dist,l.properties.dist),p=So(s,l),c=To(e,h,p+90,r),f=To(e,h,p-90,r),d=Wa(so([c.geometry.coordinates,f.geometry.coordinates]),so([s.geometry.coordinates,l.geometry.coordinates])),m=null;d.features.length>0&&((m=d.features[0]).properties.dist=_o(e,m,r),m.properties.location=o+_o(s,m,r)),s.properties.dist<n.properties.dist&&((n=s).properties.index=a,n.properties.location=o),l.properties.dist<n.properties.dist&&((n=l).properties.index=a+1,n.properties.location=o+u),m&&m.properties.dist<n.properties.dist&&((n=m).properties.index=a),o+=u}})),n}function Ja(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function $a(t,e){var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var i=function(t){if(!t)throw new Error("geojson is required");if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("geojson is invalid")}(t),n=[];switch(i){case"LineString":n=Qa(t);break;case"MultiLineString":case"Polygon":Ja(t).forEach((function(t){n.push(Qa(t))}));break;case"MultiPolygon":Ja(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(Qa(t))})),n.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};Ja(t).forEach((function(t){var e=t.join("-");o.hasOwnProperty(e)||(n.push(t),o[e]=!0)}));break;default:throw new Error(i+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=n,t):{type:i,coordinates:n}:!0===r?(t.geometry.coordinates=n,t):oo({type:i,coordinates:n},t.properties,t.bbox)}function Qa(t){var e,r,i,n,o=Ja(t);if(2===o.length&&((e=o[0])[0]!==(r=o[1])[0]||e[1]!==r[1]))return o;var a=[],s=o.length-1;a.push(o[0]);for(var l=1;l<s;l++)ts(o[l-1],n=o[l+1],i=o[l])||a.push(i);return a.push(n),a}function ts(t,e,r){var i=r[0],n=r[1],o=t[0],a=t[1],s=e[0],l=e[1],u=s-o,h=l-a;return 0==(i-o)*h-(n-a)*u&&(Math.abs(u)>=Math.abs(h)?u>0?o<=i&&i<=s:s<=i&&i<=o:h>0?a<=n&&n<=l:l<=n&&n<=a)}Ma.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],i=this.toBBox;if(!Va(t,e))return r;for(var n,o,a,s,l=[];e;){for(n=0,o=e.children.length;n<o;n++)a=e.children[n],Va(t,s=e.leaf?i(a):a)&&(e.leaf?r.push(a):Na(t,s)?this._all(a,r):l.push(a));e=l.pop()}return r},collides:function(t){var e=this.data,r=this.toBBox;if(!Va(t,e))return!1;for(var i,n,o,a,s=[];e;){for(i=0,n=e.children.length;i<n;i++)if(o=e.children[i],Va(t,a=e.leaf?r(o):o)){if(e.leaf||Na(t,a))return!0;s.push(o)}e=s.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,r=t.length;e<r;e++)this.insert(t[e]);return this}var i=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var n=this.data;this.data=i,i=n}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=Ua([]),this},remove:function(t,e){if(!t)return this;for(var r,i,n,o,a=this.data,s=this.toBBox(t),l=[],u=[];a||l.length;){if(a||(a=l.pop(),i=l[l.length-1],r=u.pop(),o=!0),a.leaf&&-1!==(n=ka(t,a.children,e)))return a.children.splice(n,1),l.push(a),this._condense(l),this;o||a.leaf||!Na(a,s)?i?(r++,a=i.children[r],o=!1):a=null:(l.push(a),u.push(r),r=0,i=a,a=a.children[0])}return this},toBBox:function(t){return t},compareMinX:Ra,compareMinY:Fa,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var r=[];t;)t.leaf?e.push.apply(e,t.children):r.push.apply(r,t.children),t=r.pop();return e},_build:function(t,e,r,i){var n,o=r-e+1,a=this._maxEntries;if(o<=a)return za(n=Ua(t.slice(e,r+1)),this.toBBox),n;i||(i=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,i-1))),(n=Ua([])).leaf=!1,n.height=i;var s,l,u,h,p=Math.ceil(o/a),c=p*Math.ceil(Math.sqrt(a));for(ja(t,e,r,c,this.compareMinX),s=e;s<=r;s+=c)for(ja(t,s,u=Math.min(s+c-1,r),p,this.compareMinY),l=s;l<=u;l+=p)h=Math.min(l+p-1,u),n.children.push(this._build(t,l,h,i-1));return za(n,this.toBBox),n},_chooseSubtree:function(t,e,r,i){for(var n,o,a,s,l,u,h,p,c,f;i.push(e),!e.leaf&&i.length-1!==r;){for(h=p=1/0,n=0,o=e.children.length;n<o;n++)l=Oa(a=e.children[n]),c=t,f=a,(u=(Math.max(f.maxX,c.maxX)-Math.min(f.minX,c.minX))*(Math.max(f.maxY,c.maxY)-Math.min(f.minY,c.minY))-l)<p?(p=u,h=l<h?l:h,s=a):u===p&&l<h&&(h=l,s=a);e=s||e.children[0]}return e},_insert:function(t,e,r){var i=r?t:(0,this.toBBox)(t),n=[],o=this._chooseSubtree(i,this.data,e,n);for(o.children.push(t),Da(o,i);e>=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(i,n,e)},_split:function(t,e){var r=t[e],i=r.children.length,n=this._minEntries;this._chooseSplitAxis(r,n,i);var o=this._chooseSplitIndex(r,n,i),a=Ua(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,za(r,this.toBBox),za(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(r,a)},_splitRoot:function(t,e){this.data=Ua([t,e]),this.data.height=t.height+1,this.data.leaf=!1,za(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var i,n,o,a,s,l,u,h,p,c,f,d,m,y;for(l=u=1/0,i=e;i<=r-e;i++)p=n=Ca(t,0,i,this.toBBox),c=o=Ca(t,i,r,this.toBBox),f=Math.max(p.minX,c.minX),d=Math.max(p.minY,c.minY),m=Math.min(p.maxX,c.maxX),y=Math.min(p.maxY,c.maxY),a=Math.max(0,m-f)*Math.max(0,y-d),s=Oa(n)+Oa(o),a<l?(l=a,h=i,u=s<u?s:u):a===l&&s<u&&(u=s,h=i);return h},_chooseSplitAxis:function(t,e,r){var i=t.leaf?this.compareMinX:Ra,n=t.leaf?this.compareMinY:Fa;this._allDistMargin(t,e,r,i)<this._allDistMargin(t,e,r,n)&&t.children.sort(i)},_allDistMargin:function(t,e,r,i){t.children.sort(i);var n,o,a=this.toBBox,s=Ca(t,0,e,a),l=Ca(t,r-e,r,a),u=Ba(s)+Ba(l);for(n=e;n<r-e;n++)o=t.children[n],Da(s,t.leaf?a(o):o),u+=Ba(s);for(n=r-e-1;n>=e;n--)o=t.children[n],Da(l,t.leaf?a(o):o),u+=Ba(l);return u},_adjustParentBBoxes:function(t,e,r){for(var i=r;i>=0;i--)Da(e[i],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():za(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};var es={point:ao,lineString:so,multiLineString:uo,length:wo,distance:_o,cleanCoords:$a,booleanContains:ga,pointToLineDistance:Ea,nearestPointOnLine:Ka};function rs(){this.__RouteSource__={},this.addSource=function(t){this.__RouteSource__=(new la).init(t||{})},this.requestRoute=function(t,e,r,i){return null==this.__RouteSource__.allLinkList||0==this.__RouteSource__.allLinkList.length||null==this.__RouteSource__.allNodeMap?null:this.requestRoute1(this.__RouteSource__,t,e,r,i)},this.requestRoute1=function(t,e,r,i,n){var o=null;if(null==i||0==i.length){var a=this.getShorestPathV3(t,e,r,n);if(null!=a&&null!=a){var s=a.routeResult,l=new Array;l.push(s),(o=new ta).init(s,l),o.setStartPoint(e),o.setEndPoint(r),o.setStopPoints(i)}}else{var u=new aa;u.buildStops(e,r,i);var h=new is;h.init(u,n,t),h.prepare();var p=h.calculateV3(n.rearrangeStops);if(null!=p&&null==p)return null;for(var c=h.getDetailedRouteV3(),f=c.routes,d=c.indices,m=new Array,y=new Array,g=0;g<d.length;++g){var _=d[g];y.push(i[_]),m.push(_)}if(null!=p&&null!=p){for(var v=new Array,x=0;x<f.length;x++)v.push(f[x]);(o=new ta).init(p,v),o.setStartPoint(e),o.setEndPoint(r),o.setStopPoints(i),o.setIndices(m),o.setRearrangedPoints(y)}}return o},this.getButhGetDistances=function(t,e,r,i){if(null==e||null==r||0==r.length)return null;var n=[];if(!this.validataFloor(t,e.floor))return null;for(var o=0;o<r.length;o++)if(!this.validataFloor(t,r[o].floor))return null;this.nodeReset(t,!0);var a=this.processTempNodeForStart(t,e,i);if(null==a)return null;for(var s=0;s<r.length;s++){var l=r[s],u=this.processTempNodeForEnd(t,l,i);if(null!=u){for(var h=0,p=0;p<=t.maxRouteLevel&&(this.nodeReset(t,!1),i.sameFloorFirst?(this.computePaths(a,u,e,l,p,i.ignoredList,i.linkType,!0),0==(h=this.getLinksByStartNode(a,u,e,l))&&(this.nodeReset(t,!1),this.computePaths(a,u,e,l,p,i.ignoredList,i.linkType,!1),h=this.getLinksByStartNode(a,u,e,l))):(this.computePaths(a,u,e,l,p,i.ignoredList,i.linkType,!1),h=this.getLinksByStartNode(a,u,e,l)),!(h>0));p++);this.resetTempNodeForEnd(t,l),l.distance=h,n.push(l)}else l.distance=-1,n.push(l)}return this.resetTempNodeForStart(t,e),n.sort((function(t,e){return t.distance-e.distance})),n},this.getLinksByStartNode=function(t,e,r,i){new Array;var n,o,a=new Array;if(this.getPath(a,e),0==(a=a.reverse()).length||a[0].newNodeId!=t.newNodeId)return 0;for(var s=0,l=0;l<a.length;l++){n||(n=a[l]),l==a.length-1&&(o=a[l]);var u=a[l];if(null!=u&&null!=u&&null!=u.previousNode&&null!=u.previousNode&&null!=u.previousNode.newNodeId)for(var h=0;h<u.previousNode.adjacencies.length;h++){var p=u.previousNode.adjacencies[h];if(p.nextNode.newNodeId==u.newNodeId){s+=p.length;break}}}var c=es.point((new $o).mercatorToLngLat([r.x,r.y])),f=es.point((new $o).mercatorToLngLat(n.coordinates[0]));s+=es.distance(c,f,{units:"meters"});var d=es.point((new $o).mercatorToLngLat([i.x,i.y])),m=es.point((new $o).mercatorToLngLat(o.coordinates[0]));return s+es.distance(d,m,{units:"meters"})},this.getShorestPathV3=function(t,e,r,i){var n;if(n=Qo(i)?0:i.linkType,!this.validataFloor(t,e.floor))return null;if(!this.validataFloor(t,r.floor))return null;this.nodeReset(t,!0);var o=this.processTempNodeForStart(t,e,i);if(null==o)return null;var a=this.processTempNodeForEnd(t,r,i);if(null==a)return this.resetTempNodeForEnd(t,r),null;for(var s=null,l=0;l<=t.maxRouteLevel&&(this.nodeReset(t,!1),i.useSameFloor?(this.computePaths(o,a,e,r,l,i.ignoredList,n,!0),null!=(s=this.getShorestPathToNodeV3(o,a,e,r))&&0!=s.length||(this.nodeReset(t,!1),this.computePaths(o,a,e,r,l,i.ignoredList,n,!1),s=this.getShorestPathToNodeV3(o,a,e,r))):(this.computePaths(o,a,e,r,l,i.ignoredList,n,!1),s=this.getShorestPathToNodeV3(o,a,e,r)),!(null!=s&&s.length>0));l++);if(this.resetTempNodeForEnd(t,r),this.resetTempNodeForStart(t,e),null==s||s.length<=2)return null;var u=new na;return u.init(e,r,s,t.allMapInfoArray),u},this.getShorestPathToNodeV3=function(t,e,r,i){var n=new Array,o=new Array;if(this.getPath(o,e),(o=o.reverse())[0].newNodeId!=t.newNodeId)return null;n.push({isNode:!0,isStop:!0,obj:r});for(var a=0;a<o.length;a++){var s=o[a];if(null!=s&&null!=s&&null!=s.previousNode&&null!=s.previousNode&&null!=s.previousNode.newNodeId){for(var l=0;l<s.previousNode.adjacencies.length;l++){var u=s.previousNode.adjacencies[l];if(u.nextNode.newNodeId==s.newNodeId){n.push({isNode:!1,isStop:!1,obj:u});break}}n.push({isNode:!0,isStop:!1,obj:s})}}return n.push({isNode:!0,isStop:!0,obj:i}),n},this.getPath=function(t,e){t.push(e),e.previousNode&&e.previousNode.newNodeId&&this.getPath(t,e.previousNode)},this.computePaths=function(t,e,r,i,n,o,a,s){var l=new Date;t.minDistance=0;var u=new Jo;for(u.enqueue(t);!u.empty();){var h=u.dequeue();if(h.open&&this.validataOpenTime(l.getHours(),l.getMinutes(),h.openTime)&&(!s||h.floor==t.floor||h.floor==i.floor)&&(Qo(h.categoryId)||!this.arrayContains(o,h.categoryId))&&null!=h.adjacencies&&null!=h.adjacencies&&0!=h.adjacencies.length)for(var p=0;p<h.adjacencies.length;p++){var c=h.adjacencies[p];if(c.open&&this.validataOpenTime(l.getHours(),l.getMinutes(),c.openTime)){if(n>=0&&c.level>n){var f=!1;if(Qo(c.roomId)||(f=c.roomId==t.roomId||c.roomId==e.roomId),!f)continue}if(!(s&&c.floor!=r.floor&&c.floor!=i.floor||c.linkType.length<=a||0==parseInt(c.linkType.substring(a,a+1)))){var d=c.nextNode;try{if(null!=d&&null!=d||(d=object.allNodeMap[c.nextNodeId]),n>=0&&d.level>n){var m=!1;if(Qo(d.roomId)||(m=d.roomId==t.roomId||d.roomId==e.roomId),!m)continue}var y=h.minDistance+c.length;y<d.minDistance&&(u.remove(d.newNodeId),d.minDistance=y,d.previousNode=h,d.isTempNode||u.enqueue(d))}catch(t){}}}}}},this.processTempNodeForEnd=function(t,e,r){var i=this;this.endPointLinkTempList=[],this.endPointNodeTempList=[],this.replacedEndLinkArray=[];var n=this.findNodeOnRouteNetwork(t,e,r);if(null==n||null==n||0==n.length)return null;if(n.isRouteNode)return n.node;var o=n.node,a=this.findTempLinksOnRouteNetwork(t,o);this.endPointNodeTempList.push(o),this.endPointLinkTempList=a.tempLinkArray,this.replacedEndLinkArray=a.replacedLinkArray;for(var s=0;s<this.endPointNodeTempList.length;s++){var l=this.endPointNodeTempList[s];t.allNodeMap[l.newNodeId]=l}for(var u=0;u<this.endPointLinkTempList.length;u++){var h=this.endPointLinkTempList[u];h.nextNode=t.allNodeMap[h.nextNodeId],t.allFloorLinksMap[e.floor].push(h),t.allNodeMap[h.currentNodeId].adjacencies.push(h)}for(var p=function(r){var n=i.replacedEndLinkArray[r];t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},c=0;c<i.replacedEndLinkArray.length;c++)p(c);return o},this.processTempNodeForStart=function(t,e,r){var i=this;this.startPointTempLinkList=[],this.endPointTempLinkList=[],this.replacedStartPointLinkList=[];var n=this.findNodeOnRouteNetwork(t,e,r);if(null==n||null==n||0==n.length)return null;if(n.isRouteNode)return n.node;var o=n.node,a=this.findTempLinksOnRouteNetwork(t,o);this.endPointTempLinkList.push(o),this.startPointTempLinkList=a.tempLinkArray,this.replacedStartPointLinkList=a.replacedLinkArray;for(var s=0;s<this.endPointTempLinkList.length;s++){var l=this.endPointTempLinkList[s];t.allNodeMap[l.newNodeId]=l}for(var u=0;u<this.startPointTempLinkList.length;u++){var h=this.startPointTempLinkList[u];h.nextNode=t.allNodeMap[h.nextNodeId],t.allFloorLinksMap[e.floor].push(h),t.allNodeMap[h.currentNodeId].adjacencies.push(h)}for(var p=function(r){var n=i.replacedStartPointLinkList[r];t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},c=0;c<i.replacedStartPointLinkList.length;c++)p(c);return o},this.findTempLinksOnRouteNetwork=function(t,e){var r=es.point((new $o).mercatorToLngLat(e.coordinates[0])),i=new Array,n=new Array,o=new Array,a=!1,s=new Array;if(!Qo(e.roomId)){var l=t.roomIDLinkMap[e.roomId];if(null!=l&&null!=l&&l.length>0){for(var u=0;u<l.length;u++){var h=l[u];if(h.floor==e.floor){var p=es.lineString((new $o).mercatorToLngLats(h.coordinates));if(!es.booleanContains(p,r)){var c=es.pointToLineDistance(r,p,{units:"meters"});if(c>.01||c<0){c<.3&&s.push(h);continue}}a=!0,this.initTempNodeLink(t,h,e,n,o)}}if(!a&&s.length>0)for(var f=0;f<s.length;f++)this.initTempNodeLink(t,s[f],e,n,o);return i.tempLinkArray=n,i.replacedLinkArray=o,i}}for(var d=t.allFloorLinksMap[e.floor],m=0;m<d.length;m++){var y=d[m];if(y.floor==e.floor&&"11111111"!=y.linkType){var g=es.lineString((new $o).mercatorToLngLats(y.coordinates));if(!es.booleanContains(g,r)){var _=es.pointToLineDistance(r,g,{units:"meters"});if(_>.01||_<0){_<.3&&s.push(y);continue}}a=!0,this.initTempNodeLink(t,y,e,n,o)}}if(!a&&s.length>0)for(var v=0;v<s.length;v++)this.initTempNodeLink(t,s[v],e,n,o);return i.tempLinkArray=n,i.replacedLinkArray=o,i},this.initTempNodeLink=function(t,e,r,i,n){var o=es.lineString((new $o).mercatorToLngLats(e.coordinates)),a=es.point((new $o).mercatorToLngLat(r.coordinates[0])),s=es.nearestPointOnLine(o,a,{units:"meters"});if(null==s||null==s)return null;var l=[],u=[];u.push(s.geometry.coordinates);for(var h=0;h<o.geometry.coordinates.length;h++)h<=s.properties.index?l.push(o.geometry.coordinates[h]):u.push(o.geometry.coordinates[h]);if(l.push(s.geometry.coordinates),1!=l.length&&1!=u.length){var p=es.lineString(l),c=es.lineString(u);if(l=(l=es.cleanCoords(p)).geometry.coordinates,u=(u=es.cleanCoords(c)).geometry.coordinates,1!=l.length&&1!=u.length){var f={};f.newLinkId=this.createTempLinkID(t),f.coordinates=(new $o).lngLatsToMercators(l),f.nextNode=null,f.currentNodeId=e.currentNodeId,f.nextNodeId=r.newNodeId,f.length=es.length(p,{units:"meters"}),f.linkName=e.linkName,f.floor=e.floor,f.level=e.level,f.roomId=e.roomId,f.open=e.open,f.openTime=e.openTime,f.allowSnap=e.allowSnap,f.linkType=e.linkType;var d={};d.newLinkId=this.createTempLinkID(t),d.coordinates=(new $o).lngLatsToMercators(u),d.nextNode=null,d.currentNodeId=r.newNodeId,d.nextNodeId=e.nextNodeId,d.length=es.length(c,{units:"meters"}),d.linkName=e.linkName,d.floor=e.floor,d.level=e.level,d.roomId=e.roomId,d.open=e.open,d.openTime=e.openTime,d.allowSnap=e.allowSnap,d.linkType=e.linkType,i.push(f),i.push(d),n.push(e)}}},this.findNodeOnRouteNetwork=function(t,e,r){var i,n={};if(!Qo(e.roomId)){if(1==r.linkType){var o=t.carRoomRoutesMap[e.roomId];i=o?o[e.floor]:void 0}if(0==r.linkType){var a=t.peopleRoomRoutesMap[e.roomId];i=a?a[e.floor]:void 0}}if(null!=i&&null!=i&&0!=i.length||(1==r.linkType&&(i=t.carFlooRoutesMap[e.floor]),0==r.linkType&&(i=t.peopleFlooRoutesMap[e.floor])),null==i||null==i||0==i.length)return null;var s=es.point([(new $o).xToLongitude(e.x),(new $o).yToLongitude(e.y)]),l=es.multiLineString(i),u=es.nearestPointOnLine(l,s,{units:"meters"});if(null==u||null==u)return null;for(var h in t.allNodeMap){var p=t.allNodeMap[h];if(p.floor==e.floor){var c=es.point((new $o).mercatorToLngLat(p.coordinates[0]));if(es.distance(u,c,{units:"meters"})<=.01)return n.isRouteNode=!0,p.isTempNode=!0,n.node=p,n}}var f={};return f.newNodeId=this.createTempNodeID(t),f.coordinates=[(new $o).lngLatsToMercator(u.geometry.coordinates)],f.minDistance=999999,f.previousNode={},f.floor=e.floor,f.open=!0,f.level=0,f.isTempNode=!0,f.direction=0,f.isSwitching=!1,f.nodeType=0,f.switchingId=0,f.openTime=[],f.adjacencies=[],f.roomId=Qo(e.roomId)?"":e.roomId,n.isRouteNode=!1,n.node=f,n},this.nodeReset=function(t,e){for(var r in t.allNodeMap)t.allNodeMap[r].minDistance=999999,t.allNodeMap[r].previousNode=null,e&&(t.allNodeMap[r].isTempNode=!1)},this.resetTempNodeForEnd=function(t,e){for(var r=this,i=0;i<this.replacedEndLinkArray.length;i++){var n=this.replacedEndLinkArray[i];t.allNodeMap[n.currentNodeId].adjacencies.push(n),t.allFloorLinksMap[e.floor].push(n)}for(var o=function(i){var n=r.endPointLinkTempList[i],o=t.allNodeMap[n.currentNodeId];o.adjacencies&&o.adjacencies.length>0&&t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},a=0;a<r.endPointLinkTempList.length;a++)o(a);for(var s=0;s<this.endPointNodeTempList.length;s++)delete t.allNodeMap[this.endPointNodeTempList[s].newNodeId];this.replacedEndLinkArray=[],this.endPointLinkTempList=[],this.endPointNodeTempList=[]},this.resetTempNodeForStart=function(t,e){for(var r=this,i=0;i<this.replacedStartPointLinkList.length;i++){var n=this.replacedStartPointLinkList[i];t.allNodeMap[n.currentNodeId].adjacencies.push(n),t.allFloorLinksMap[e.floor].push(n)}for(var o=function(i){var n=r.startPointTempLinkList[i],o=t.allNodeMap[n.currentNodeId];o.adjacencies&&o.adjacencies.length>0&&t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},a=0;a<r.startPointTempLinkList.length;a++)o(a);for(var s=0;s<this.endPointTempLinkList.length;s++)delete t.allNodeMap[this.endPointTempLinkList[s].newNodeId];this.replacedStartPointLinkList=[],this.startPointTempLinkList=[],this.endPointTempLinkList=[]},this.validataOpenTime=function(t,e,r){if(null==r||null==r||0==r.length)return!0;for(var i=0;i<r.length;i++){var n=60*parseInt(t)+parseInt(e);if(r[i].start.time<=n&&n<=r[i].end.time)return!0}return!1},this.validataFloor=function(t,e){for(var r=0;r<t.allMapInfoArray.length;r++)if(t.allMapInfoArray[r].floorNumber==e)return!0;return!1},this.createTempNodeID=function(t){return"TNE"+ ++t.tempNodeIndex},this.createTempLinkID=function(t){return"TLK"+ ++t.tempLinkIndex},this.arrayContains=function(t,e){if(0==t.length)return!1;for(var r=0,i=t.length;r<i;r++)if(t[r]==e)return!0;return!1}}function is(){this.init=function(t,e,r){this.routeParams=t,this.options=e,this.stopCount=t.stopCount(),this.largeDistance=1e7,this.minDistance=this.largeDistance,this.object=r},this.prepare=function(){this.resDict={};for(var t=this.routeParams.getMiddleStops(),e=new rs,r=0;r<t.length;++r){var i=this.routeParams.getStartStop(),n=t[r],o=e.getShorestPathV3(this.object,i.getPos(),n.getPos(),this.options);null!=o&&(this.resDict[this.getKey(i,n)]=o)}for(var a=0;a<t.length;++a){var s=this.routeParams.getEndStop(),l=t[a],u=e.getShorestPathV3(this.object,l.getPos(),s.getPos(),this.options);null!=u&&(this.resDict[this.getKey(l,s)]=u)}for(var h=0;h<t.length;++h)for(var p=0;p<t.length;++p)if(h!=p){var c=t[h],f=t[p],d=e.getShorestPathV3(this.object,c.getPos(),f.getPos(),this.options);null!=d&&(this.resDict[this.getKey(c,f)]=d)}},this.calculateV3=function(t){for(var e=this.routeParams.getMiddleStops(),r=new Array,i=0;i<e.length;++i)r[i]=i;if(this.minDistance=this.largeDistance,this.shortestRoute=[],t)this.fullArray(r,0,e.length-1);else{this.shortestRoute=new Array;for(var n=0;n<e.length;++n)this.shortestRoute.push(n);this.minDistance=this.getDistance(r)}return this.getShortestRouteLineV3()},this.getDetailedRouteV3=function(){var t={},e=this.shortestRoute,r=new Array,i=this.routeParams.getMiddleStops(),n=this.routeParams.getStartStop(),o=this.resDict[this.getKey(n,i[this.shortestRoute[0]])];null!=o&&r.push(o.routeResult);for(var a=0;a<this.stopCount-1;++a){var s=this.resDict[this.getKey(i[this.shortestRoute[a]],i[this.shortestRoute[a+1]])];null!=s&&r.push(s.routeResult)}var l=this.routeParams.getEndStop();return null!=(o=this.resDict[this.getKey(i[this.shortestRoute[this.stopCount-1]],l)])&&r.push(o.routeResult),t.indices=e,t.routes=r,t},this.getShortestRouteLineV3=function(){var t=new Array,e=this.routeParams.getStartStop(),r=this.routeParams.getEndStop(),i=this.routeParams.getMiddleStops();if(this.minDistance==this.largeDistance)return null;t.push(this.resDict[this.getKey(e,i[this.shortestRoute[0]])]);for(var n=0;n<this.stopCount-1;++n)t.push(this.resDict[this.getKey(i[this.shortestRoute[n]],i[this.shortestRoute[n+1]])]);t.push(this.resDict[this.getKey(i[this.shortestRoute[this.stopCount-1]],r)]);var o=new Array;if(null==t||0==t.length||null==t[0])return null;for(var a=0;a<t.length;a++)for(var s=0;s<t[a].elements.length;s++)o.push(t[a].elements[s]);var l=new na;return l.init(e.getPos(),r.getPos(),o,this.object.allMapInfoArray),l.routeResult},this.fullArray=function(t,e,r){if(e==r){var i=this.getDistance(t);if(i<this.minDistance){this.minDistance=i,this.shortestRoute=new Array;for(var n=0;n<this.stopCount;++n)this.shortestRoute.push(t[n])}}else for(var o=e;o<=r;++o)this.swap(t,e,o),this.fullArray(t,e+1,r),this.swap(t,e,o)},this.getDistance=function(t){var e=0,r=this.routeParams.getStartStop(),i=this.routeParams.getEndStop(),n=this.routeParams.getMiddleStops(),o=this.resDict[this.getKey(r,n[t[0]])];if(null==o||null==o)return this.largeDistance;e+=o.length;for(var a=0;a<this.stopCount-1;++a){var s=this.resDict[this.getKey(n[t[a]],n[t[a+1]])];if(null==s||null==s)return this.largeDistance;e+=s.length}return null==(o=this.resDict[this.getKey(n[t[this.stopCount-1]],i)])||null==o?this.largeDistance:e+=o.length},this.swap=function(t,e,r){var i=t[e];t[e]=t[r],t[r]=i},this.getKey=function(t,e){return null==t||null==e?"":t.getStopID()+"-"+e.getStopID()}}var ns={point:ao,lineString:so,multiLineString:uo,length:wo,distance:_o,cleanCoords:$a,booleanContains:ga,pointToLineDistance:Ea,nearestPointOnLine:Ka};function os(){this.__RouteSource__={},this.addSource=function(t){this.__RouteSource__=(new la).init(t||{})},this.requestRoute=function(t,e,r,i){return null==this.__RouteSource__.allLinkList||0==this.__RouteSource__.allLinkList.length||null==this.__RouteSource__.allNodeMap?null:this.requestRoute1(this.__RouteSource__,t,e,r,i)},this.requestRoute1=function(t,e,r,i,n){var o=null;if(null==i||0==i.length){var a=this.getShorestPathV3(t,e,r,n);if(null!=a&&null!=a){var s=a.routeResult,l=new Array;l.push(s),(o=new ta).init(s,l),o.setStartPoint(e),o.setEndPoint(r),o.setStopPoints(i)}}else{var u=new aa;u.buildStops(e,r,i);var h=new is;h.init(u,n,t),h.prepare();var p=h.calculateV3(n.rearrangeStops);if(null!=p&&null==p)return null;for(var c=h.getDetailedRouteV3(),f=c.routes,d=c.indices,m=new Array,y=new Array,g=0;g<d.length;++g){var _=d[g];y.push(i[_]),m.push(_)}if(null!=p&&null!=p){for(var v=new Array,x=0;x<f.length;x++)v.push(f[x]);(o=new ta).init(p,v),o.setStartPoint(e),o.setEndPoint(r),o.setStopPoints(i),o.setIndices(m),o.setRearrangedPoints(y)}}return o},this.getButhGetDistances=function(t,e,r,i){if(null==e||null==r||0==r.length)return null;var n=[];if(!this.validataFloor(t,e.floor))return null;for(var o=0;o<r.length;o++)if(!this.validataFloor(t,r[o].floor))return null;this.nodeReset(t,!0);var a=this.processTempNodeForStart(t,e,i);if(null==a)return null;for(var s=0;s<r.length;s++){var l=r[s],u=this.processTempNodeForEnd(t,l,i);if(null!=u){for(var h=0,p=0;p<=t.maxRouteLevel&&(this.nodeReset(t,!1),i.sameFloorFirst?(this.computePaths(a,u,e,l,p,i.ignoredList,i.linkType,!0),0==(h=this.getLinksByStartNode(a,u,e,l))&&(this.nodeReset(t,!1),this.computePaths(a,u,e,l,p,i.ignoredList,i.linkType,!1),h=this.getLinksByStartNode(a,u,e,l))):(this.computePaths(a,u,e,l,p,i.ignoredList,i.linkType,!1),h=this.getLinksByStartNode(a,u,e,l)),!(h>0));p++);this.resetTempNodeForEnd(t,l),l.distance=h,n.push(l)}else l.distance=-1,n.push(l)}return this.resetTempNodeForStart(t,e),n.sort((function(t,e){return t.distance-e.distance})),n},this.getLinksByStartNode=function(t,e,r,i){new Array;var n,o,a=new Array;if(this.getPath(a,e),0==(a=a.reverse()).length||a[0].newNodeId!=t.newNodeId)return 0;for(var s=0,l=0;l<a.length;l++){n||(n=a[l]),l==a.length-1&&(o=a[l]);var u=a[l];if(null!=u&&null!=u&&null!=u.previousNode&&null!=u.previousNode&&null!=u.previousNode.newNodeId)for(var h=0;h<u.previousNode.adjacencies.length;h++){var p=u.previousNode.adjacencies[h];if(p.nextNode.newNodeId==u.newNodeId){s+=p.length;break}}}var c=ns.point((new $o).mercatorToLngLat([r.x,r.y])),f=ns.point((new $o).mercatorToLngLat(n.coordinates[0]));s+=ns.distance(c,f,{units:"meters"});var d=ns.point((new $o).mercatorToLngLat([i.x,i.y])),m=ns.point((new $o).mercatorToLngLat(o.coordinates[0]));return s+ns.distance(d,m,{units:"meters"})},this.getShorestPathV3=function(t,e,r,i){var n;if(n=Qo(i)?0:i.linkType,!this.validataFloor(t,e.floor))return null;if(!this.validataFloor(t,r.floor))return null;this.nodeReset(t,!0);var o=this.processTempNodeForStart(t,e,i);if(!o||null==o)return null;var a=this.processTempNodeForEnd(t,r,i);if(!a||null==a)return this.resetTempNodeForEnd(t,r),null;for(var s=null,l=0;l<=t.maxRouteLevel&&(this.nodeReset(t,!1),i.useSameFloor?(this.computePaths(o,a,e,r,l,i.ignoredList,n,!0),null!=(s=this.getShorestPathToNodeV3(o,a,e,r))&&0!=s.length||(this.nodeReset(t,!1),this.computePaths(o,a,e,r,l,i.ignoredList,n,!1),s=this.getShorestPathToNodeV3(o,a,e,r))):(this.computePaths(o,a,e,r,l,i.ignoredList,n,!1),s=this.getShorestPathToNodeV3(o,a,e,r)),!(null!=s&&s.length>0));l++);if(this.resetTempNodeForEnd(t,r),this.resetTempNodeForStart(t,e),null==s||s.length<=2)return null;var u=new na;return u.init(e,r,s,t.allMapInfoArray),u},this.getShorestPathToNodeV3=function(t,e,r,i){var n=new Array,o=new Array;if(this.getPath(o,e),(o=o.reverse())[0].newNodeId!=t.newNodeId)return null;n.push({isNode:!0,isStop:!0,obj:r});for(var a=0;a<o.length;a++){var s=o[a];if(null!=s&&null!=s&&null!=s.previousNode&&null!=s.previousNode&&null!=s.previousNode.newNodeId){for(var l=0;l<s.previousNode.adjacencies.length;l++){var u=s.previousNode.adjacencies[l];if(u.nextNode.newNodeId==s.newNodeId){n.push({isNode:!1,isStop:!1,obj:u});break}}n.push({isNode:!0,isStop:!1,obj:s})}}return n.push({isNode:!0,isStop:!0,obj:i}),n},this.getPath=function(t,e){t.push(e),e.previousNode&&e.previousNode.newNodeId&&this.getPath(t,e.previousNode)},this.computePaths=function(t,e,r,i,n,o,a,s){var l=new Date;t.minDistance=0;var u=new Jo;for(u.enqueue(t);!u.empty();){var h=u.dequeue();if(h.open&&this.validataOpenTime(l.getHours(),l.getMinutes(),h.openTime)&&(!s||h.floor==t.floor||h.floor==i.floor)&&(Qo(h.categoryId)||!this.arrayContains(o,h.categoryId))&&null!=h.adjacencies&&null!=h.adjacencies&&0!=h.adjacencies.length){var p=null;if(null!=h.previousNode&&null!=h.previousNode)for(var c=0;c<h.previousNode.adjacencies.length;c++){var f=h.previousNode.adjacencies[c];f.nextNode.newNodeId==h.newNodeId&&(p=f.coordinates)}for(var d=0;d<h.adjacencies.length;d++){var m=h.adjacencies[d];if(m.open&&this.validataOpenTime(l.getHours(),l.getMinutes(),m.openTime)){if(n>=0&&m.level>n){var y=!1;if(Qo(m.roomId)||(y=m.roomId==t.roomId||m.roomId==e.roomId),!y)continue}if(!(s&&m.floor!=r.floor&&m.floor!=i.floor||m.linkType.length<=a||0==parseInt(m.linkType.substring(a,a+1)))){var g=m.nextNode;try{if(null!=g&&null!=g||(g=object.allNodeMap[m.nextNodeId]),n>=0&&g.level>n){var _=!1;if(Qo(g.roomId)||(_=g.roomId==t.roomId||g.roomId==e.roomId),!_)continue}var v=h.slc;null!=p&&(this.calculateStraightLink(p,m.coordinates)||(v+=1));var x=h.minDistance+m.length;(v<=g.slc||0==g.slc)&&x<g.minDistance&&(u.remove(g.newNodeId),g.minDistance=x,g.previousNode=h,g.slc=v,g.isTempNode||u.enqueue(g))}catch(t){}}}}}}},this.calculateStraightLink=function(t,e){try{var r=t[t.length-2],i=t[t.length-1],n=e[0],o=e[1],a=(Math.atan2(r[1]-i[1],r[0]-i[0])-Math.atan2(n[1]-o[1],n[0]-o[0]))*(180/Math.PI);return a<5&&a>-5||a<185&&a>175||a<-175&&a>-185||a<365&&a>355}catch(t){return!1}},this.processTempNodeForEnd=function(t,e,r){var i=this;this.endPointLinkTempList=[],this.endPointNodeTempList=[],this.replacedEndLinkArray=[];var n=this.findNodeOnRouteNetwork(t,e,r);if(null==n||null==n||0==n.length)return null;if(n.isRouteNode)return n.node;var o=n.node,a=this.findTempLinksOnRouteNetwork(t,o);this.endPointNodeTempList.push(o),this.endPointLinkTempList=a.tempLinkArray,this.replacedEndLinkArray=a.replacedLinkArray;for(var s=0;s<this.endPointNodeTempList.length;s++){var l=this.endPointNodeTempList[s];t.allNodeMap[l.newNodeId]=l}for(var u=0;u<this.endPointLinkTempList.length;u++){var h=this.endPointLinkTempList[u];h.nextNode=t.allNodeMap[h.nextNodeId],t.allFloorLinksMap[e.floor].push(h),t.allNodeMap[h.currentNodeId].adjacencies.push(h)}for(var p=function(r){var n=i.replacedEndLinkArray[r];t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},c=0;c<i.replacedEndLinkArray.length;c++)p(c);return o},this.processTempNodeForStart=function(t,e,r){var i=this;this.startPointTempLinkList=[],this.endPointTempLinkList=[],this.replacedStartPointLinkList=[];var n=this.findNodeOnRouteNetwork(t,e,r);if(null==n||null==n||0==n.length)return null;if(n.isRouteNode)return n.node;var o=n.node,a=this.findTempLinksOnRouteNetwork(t,o);this.endPointTempLinkList.push(o),this.startPointTempLinkList=a.tempLinkArray,this.replacedStartPointLinkList=a.replacedLinkArray;for(var s=0;s<this.endPointTempLinkList.length;s++){var l=this.endPointTempLinkList[s];t.allNodeMap[l.newNodeId]=l}for(var u=0;u<this.startPointTempLinkList.length;u++){var h=this.startPointTempLinkList[u];h.nextNode=t.allNodeMap[h.nextNodeId],t.allFloorLinksMap[e.floor].push(h),t.allNodeMap[h.currentNodeId].adjacencies.push(h)}for(var p=function(r){var n=i.replacedStartPointLinkList[r];t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},c=0;c<i.replacedStartPointLinkList.length;c++)p(c);return o},this.findTempLinksOnRouteNetwork=function(t,e){var r=ns.point((new $o).mercatorToLngLat(e.coordinates[0])),i=new Array,n=new Array,o=new Array,a=!1,s=new Array,l=null;Qo(e.roomId)||(l=t.roomIDLinkMap[e.roomId]),null==l&&(l=t.allFloorLinksMap[e.floor]);for(var u=0;u<l.length;u++){var h=l[u];if(h.floor==e.floor&&"11111111"!=h.linkType){var p=ns.lineString((new $o).mercatorToLngLats(h.coordinates));if(!ns.booleanContains(p,r)){var c=ns.pointToLineDistance(r,p,{units:"meters"});if(c>.01||c<0){c<.3&&s.push(h);continue}}a=!0,this.initTempNodeLink(t,h,e,n,o)}}if(!a&&s.length>0)for(var f=0;f<s.length;f++)this.initTempNodeLink(t,s[f],e,n,o);return i.tempLinkArray=n,i.replacedLinkArray=o,i},this.initTempNodeLink=function(t,e,r,i,n){var o=ns.lineString((new $o).mercatorToLngLats(e.coordinates)),a=ns.point((new $o).mercatorToLngLat(r.coordinates[0])),s=ns.nearestPointOnLine(o,a,{units:"meters"});if(null==s||null==s)return null;var l=[],u=[];u.push(s.geometry.coordinates);for(var h=0;h<o.geometry.coordinates.length;h++)h<=s.properties.index?l.push(o.geometry.coordinates[h]):u.push(o.geometry.coordinates[h]);if(l.push(s.geometry.coordinates),1!=l.length&&1!=u.length){var p=ns.lineString(l),c=ns.lineString(u);if(l=(l=ns.cleanCoords(p)).geometry.coordinates,u=(u=ns.cleanCoords(c)).geometry.coordinates,1!=l.length&&1!=u.length){var f={};f.newLinkId=this.createTempLinkID(t),f.coordinates=(new $o).lngLatsToMercators(l),f.nextNode=null,f.currentNodeId=e.currentNodeId,f.nextNodeId=r.newNodeId,f.length=ns.length(p,{units:"meters"}),f.linkName=e.linkName,f.floor=e.floor,f.level=e.level,f.roomId=e.roomId,f.open=e.open,f.openTime=e.openTime,f.allowSnap=e.allowSnap,f.linkType=e.linkType;var d={};d.newLinkId=this.createTempLinkID(t),d.coordinates=(new $o).lngLatsToMercators(u),d.nextNode=null,d.currentNodeId=r.newNodeId,d.nextNodeId=e.nextNodeId,d.length=ns.length(c,{units:"meters"}),d.linkName=e.linkName,d.floor=e.floor,d.level=e.level,f.roomId=e.roomId,d.open=e.open,d.openTime=e.openTime,d.allowSnap=e.allowSnap,d.linkType=e.linkType,i.push(f),i.push(d),n.push(e)}}},this.findNodeOnRouteNetwork=function(t,e,r){var i={},n=null;if(!Qo(e.roomId)){if(1==r.linkType){var o=t.carRoomRoutesMap[e.roomId];n=o?o[e.floor]:null}if(0==r.linkType){var a=t.peopleRoomRoutesMap[e.roomId];n=a?a[e.floor]:null}}if(null!=n&&null!=n&&0!=n.length||(1==r.linkType&&(n=t.carFlooRoutesMap[e.floor]),0==r.linkType&&(n=t.peopleFlooRoutesMap[e.floor])),null==n||null==n||0==n.length)return null;var s=ns.point([(new $o).xToLongitude(e.x),(new $o).yToLongitude(e.y)]),l=ns.multiLineString(n),u=ns.nearestPointOnLine(l,s,{units:"meters"});if(null==u||null==u)return null;for(var h in t.allNodeMap){var p=t.allNodeMap[h];if(p.floor==e.floor){var c=ns.point((new $o).mercatorToLngLat(p.coordinates[0]));if(ns.distance(u,c,{units:"meters"})<=.01)return i.isRouteNode=!0,p.isTempNode=!0,i.node=p,i}}var f={};return f.newNodeId=this.createTempNodeID(t),f.coordinates=[(new $o).lngLatsToMercator(u.geometry.coordinates)],f.minDistance=999999,f.previousNode={},f.floor=e.floor,f.open=!0,f.level=0,f.isTempNode=!0,f.direction=0,f.isSwitching=!1,f.nodeType=0,f.switchingId=0,f.openTime=[],f.adjacencies=[],f.roomId=Qo(e.roomId)?"":e.roomId,i.isRouteNode=!1,i.node=f,i},this.nodeReset=function(t,e){for(var r in t.allNodeMap)t.allNodeMap[r].minDistance=999999,t.allNodeMap[r].previousNode=null,t.allNodeMap[r].slc=0,e&&(t.allNodeMap[r].isTempNode=!1)},this.resetTempNodeForEnd=function(t,e){for(var r=this,i=0;i<this.replacedEndLinkArray.length;i++){var n=this.replacedEndLinkArray[i];t.allNodeMap[n.currentNodeId].adjacencies.push(n),t.allFloorLinksMap[e.floor].push(n)}for(var o=function(i){var n=r.endPointLinkTempList[i],o=t.allNodeMap[n.currentNodeId];o.adjacencies&&o.adjacencies.length>0&&t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},a=0;a<r.endPointLinkTempList.length;a++)o(a);for(var s=0;s<this.endPointNodeTempList.length;s++)delete t.allNodeMap[this.endPointNodeTempList[s].newNodeId];this.replacedEndLinkArray=[],this.endPointLinkTempList=[],this.endPointNodeTempList=[]},this.resetTempNodeForStart=function(t,e){for(var r=this,i=0;i<this.replacedStartPointLinkList.length;i++){var n=this.replacedStartPointLinkList[i];t.allNodeMap[n.currentNodeId].adjacencies.push(n),t.allFloorLinksMap[e.floor].push(n)}for(var o=function(i){var n=r.startPointTempLinkList[i],o=t.allNodeMap[n.currentNodeId];o.adjacencies&&o.adjacencies.length>0&&t.allNodeMap[n.currentNodeId].adjacencies.forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)})),t.allFloorLinksMap[e.floor].forEach((function(t,e,r){t.newLinkId==n.newLinkId&&r.splice(e,1)}))},a=0;a<r.startPointTempLinkList.length;a++)o(a);for(var s=0;s<this.endPointTempLinkList.length;s++)delete t.allNodeMap[this.endPointTempLinkList[s].newNodeId];this.replacedStartPointLinkList=[],this.startPointTempLinkList=[],this.endPointTempLinkList=[]},this.validataOpenTime=function(t,e,r){if(null==r||null==r||0==r.length)return!0;for(var i=0;i<r.length;i++){var n=60*parseInt(t)+parseInt(e);if(r[i].start.time<=n&&n<=r[i].end.time)return!0}return!1},this.validataFloor=function(t,e){for(var r=0;r<t.allMapInfoArray.length;r++)if(t.allMapInfoArray[r].floorNumber==e)return!0;return!1},this.createTempNodeID=function(t){return"TNE"+ ++t.tempNodeIndex},this.createTempLinkID=function(t){return"TLK"+ ++t.tempLinkIndex},this.arrayContains=function(t,e){if(0==t.length)return!1;for(var r=0,i=t.length;r<i;r++)if(t[r]==e)return!0;return!1}}var as={point:ao,distance:_o,multiLineString:uo,nearestPointOnLine:Ka},ss=function(){this.__ROUTES_SOURCE__={}};ss.prototype.addSource=function(t){for(var e=t.routeLinkV3List,r={},i=0;i<e.length;i++){var n=e[i],o=r[n.floor];null==o&&(o=[]),o.push(n),r[n.floor]=o}var a={},s={};for(var l in r){for(var u=r[l],h=[],p=[],c=0;c<u.length;c++){var f=u[c];"10"!=f.linkType&&"11"!=f.linkType||h.push(On(f.coordinates)),"01"!=f.linkType&&"11"!=f.linkType||p.push(On(f.coordinates))}h.length>0&&(s[l]=h),p.length>0&&(a[l]=p)}this.__ROUTES_SOURCE__={carFloorRoutesMap:a,peopleFloorRoutesMap:s}},ss.prototype.calculate=function(t,e,r,i){var n;if(void 0===i&&(i=0),1===i?n=this.__ROUTES_SOURCE__.carFloorRoutesMap[r]:0===i&&(n=this.__ROUTES_SOURCE__.peopleFloorRoutesMap[r]),n&&n.length>0){var o=as.point([t,e]),a=as.multiLineString(n),s=as.nearestPointOnLine(a,o,{units:"meters"});if(!s)return{lng:t,lat:e,floor:r};var l=as.distance(o,s,{units:"meters"});return{lng:s.geometry.coordinates[0],lat:s.geometry.coordinates[1],floor:r,distance:l}}return{lng:t,lat:e,floor:r}};var ls=function(e){var r,i=this;this.map=e,this._$v3Server=new os,this._$v3Adsorbent=new ss,Zn((r=e._tileToken).HOST+"/"+r.RELATIVE_URL+"/js/route.pbf",{},(function(e){if(e){var r=Go.read(new t.Protobuf(new Uint8Array(e)));i._$v3Server.addSource(r),i._$v3Adsorbent.addSource(r)}}),{responseType:"arraybuffer"})};function us(t){if(!t)return t;if(t.x&&t.y){if(!t.lng||!t.lat){var e=Rn(t.x,t.y);t.lng=e.lng,t.lat=e.lat}}else{var r=Fn(t.lng,t.lat);t.x=r.x,t.y=r.y}return t}ls.prototype.requestRoute=function(t,e,r,i){for(var n=this._formatPoint(t),o=this._formatPoint(e),a=[],s=0;s<r.length;s++)a.push(this._formatPoint(r[s]));var l={rearrangeStops:!!i.rearrangeStops,useSameFloor:!0,currentRouteLevel:0,linkType:i.vehicle?1:0,ignoredList:i.ignore||[]};void 0!==i.sameFloorFirst&&(l.useSameFloor=i.sameFloorFirst);var u=this._$v3Server.requestRoute(n,o,a,l);if(!u)return{success:!1};var h=u.buildJson();return h.success=!0,h},ls.prototype._formatPoint=function(t){var e={roomId:t.poiId||null,floor:t.floor};if(t.x&&t.y)e.x=t.x,e.y=t.y;else if(t.lng&&t.lat){var r=Fn(t);e.x=r.x,e.y=r.y}return e},ls.prototype._adsorbentAnalyze=function(t){return this._$v3Adsorbent.calculate(t[0],t[1],t[2])};var hs=function(t){this.map=t,this.map.RouteResult=null,this._routeLayer=t._layerGroup._routeLayer,this._request=new zo(t._options),(t._options.loadSyncRoutes||"online"!==zn.mode)&&(this._routeSync=new ls(t)),this._optFormat=new Co(t._options)};hs.prototype._requestRoute=function(t,e,r,i,n,o){var a=this;if(void 0===o&&(o={}),"online"===zn.mode){var s=this._optFormat.toFormat(t,e,r,o);this._request.send(s,s.version?s.version:this.map.building.ROUTE_VERSION?this.map.building.ROUTE_VERSION:"V2").done((function(t){a._successCallback(a._formatRoutes(t,r,o),i)})).fail((function(t){n&&n(t,"没有找到路径!"),a.map.fire("route.error",t)}))}else{var l=this._requestRouteSync(t,e,r,o);l.success?i&&i(l):n&&n(l)}},hs.prototype._requestRouteSync=function(t,e,r,i){if(void 0===r&&(r=[]),void 0===i&&(i={}),this._routeSync){var n=this._routeSync.requestRoute(t,e,r,i);return n.success?((n=this._formatRoutes(n,r,i)).success=!0,this._successCallback(n),n):(n.message="没有找到路径!",n)}},hs.prototype._formatRoutes=function(t,e,r){var i=new qo(this.map).transform(t,r.ignoreFirstMeters);return i.start=JSON.parse(JSON.stringify(i.result.start)),i.end=JSON.parse(JSON.stringify(i.result.end)),i.stops=JSON.parse(JSON.stringify(e)),i.mode=r.vehicle?"drive":"walk",i},hs.prototype._successCallback=function(t,e){this.map.RouteResult=t,this._routeLayer.setFeatures(t.features),this._routeLayer.setFloor(this.map.currentMapInfo.floorNumber),e&&e(t),this.map.fire("route.success",t)},hs.prototype._getRoute=function(){return this.map.RouteResult},hs.prototype._getDistance=function(t){return this.map.RouteResult?function(t,e){for(var r,i,n=0,o=1e6,a={},s=0;s<e.route.length;s++){r=e.route[s].route;for(var l=0;l<r.length;l++){1===(i=r[l]).coordinates.length&&i.coordinates.push(i.coordinates[0]);for(var u=1;u<i.coordinates.length;u++){var h=Fn(i.coordinates[u-1]),p=Fn(i.coordinates[u]);if(n+=Math.sqrt((h.x-p.x)*(h.x-p.x)+(h.y-p.y)*(h.y-p.y)),t&&t.floor===i.mapInfo.floorNumber){var c=qn(t,h,p),f=Math.round(Math.sqrt((t.x-c.x)*(t.x-c.x)+(t.y-c.y)*(t.y-c.y)));f<=o&&(o=f,a.passed=parseFloat((n-Math.sqrt((c.x-p.x)*(c.x-p.x)+(c.y-p.y)*(c.y-p.y))).toFixed(2)))}}}}return a.total=parseFloat(n.toFixed(2)),void 0!==a.passed&&(a.remaining=parseFloat((n-a.passed).toFixed(2))),a}(us(t),this.map.RouteResult.result):null},hs.prototype._getNearPoint=function(t,e){return this._lastPoint=us(t),this._nearResult=Uo(this._lastPoint,this.map.RouteResult.features,this._routeLayer._segmentRouteIndex,e),this._nearResult.result},hs.prototype._getCutLineByPointAndLength=function(t,e){return function(t,e,r,i){if(!i)return[];for(var n=[],o=[],a=e.route,s=1e8,l=0,u=void 0;l<a.length;l++){u=a[l].routeResult;for(var h=0,p=void 0;h<u.length;h++){if((p=u[h]).floor===t.floor)for(var c=p.coordinates,f=1,d=void 0,m=void 0,y=void 0,g=void 0;f<c.length&&(y=qn(t,{x:(d=c[f-1])[0],y:d[1]},{x:(m=c[f])[0],y:m[1]}),!((g=Math.sqrt((t.x-y.x)*(t.x-y.x)+(t.y-y.y)*(t.y-y.y)))<s&&(s=g,n=[[y.x,y.y]],o=c.slice(f,c.length),g<.5)));f++);if(s<.5)break}if(s<.5)break}if(o.length)for(var _=0,v=0,x=void 0,b=void 0,w=void 0,I=void 0,S=void 0;v<o.length;v++){if(0===v?(x=n[0],b=o[v]):(x=o[v-1],b=o[v]),w={x:x[0],y:x[1]},I={x:b[0],y:b[1]},!((_+=S=Math.sqrt((w.x-I.x)*(w.x-I.x)+(w.y-I.y)*(w.y-I.y)))<i)){var T={x:((P=I).x-(E=w).x)*(A=S-(_-i))/(L=S)+E.x,y:(P.y-E.y)*A/L+E.y};n.push([T.x,T.y]);break}n.push(b)}var E,P,A,L;return n}(us(t),this.map.RouteResult.origin,0,e)},hs.prototype._adsorbentAnalyze=function(t){if(this._routeSync)return this._routeSync._adsorbentAnalyze(t)},hs.prototype._showPassed=function(t){var e;return t?this._isNearResult(t)&&this._nearResult&&this._nearResult.result||(this._lastPoint=us(t),this._nearResult=Uo(this._lastPoint,this.map.RouteResult.features,this._routeLayer._segmentRouteIndex)):e=this.map.RouteResult.features,t&&this._nearResult&&this._nearResult.passedFeatures&&(e=this._nearResult.passedFeatures),e&&this.map._layerGroup._routeLayer.setPassedFeatures(e),this},hs.prototype._hidePassed=function(){this.map._layerGroup._routeLayer.setPassedFeatures([])},hs.prototype._isNearResult=function(t){if(this._lastPoint){var e=this._lastPoint,r=us(t);if(e.x===r.x&&e.y===r.y||e.lng===r.lng&&e.lat===r.lat)return!0;if(Math.sqrt((e.x-r.x)*(e.x-r.x)+(e.y-r.y)*(e.y-r.y))<.1)return!0}return!1},hs.prototype.clear=function(){this._lastPoint=null,this.map.RouteResult=null};var ps=function(){};ps.prototype.onAdd=function(t,e){return this._map=t,this._container=document.createElement("div"),this._container.className="brtmap-logo-ctrl",this._box=document.createElement("a"),this._box.className="brtmap-logo",-1!==e.indexOf("left")&&(this._container.style.float="left"),this._offset&&(this._container.style.position="absolute",this._container.style.margin="0",this._offset.top&&(this._container.style.top=parseFloat(this._offset.top)+"px"),this._offset.bottom&&(this._container.style.bottom=parseFloat(this._offset.bottom)+"px"),this._offset.left&&(this._container.style.left=parseFloat(this._offset.left)+"px"),this._offset.right&&(this._container.style.right=parseFloat(this._offset.right)+"px")),"hidden"==e&&(this._container.style.display="none"),this._container.appendChild(this._box),this._container},ps.prototype.onRemove=function(t){this._container&&this._container.parentNode&&this._container.parentNode.removeChild(this._container),this.__isRemove__=!0},ps.prototype.getDefaultPosition=function(){return"bottom-left"},ps.prototype.setOffset=function(t){this._offset=t};var cs=function(){};cs.prototype.onAdd=function(t,e){var r=this;return this._map=t,this._container=document.createElement("div"),this._container.className="brtmap-floor-ctrl",this._box=document.createElement("div"),this._box.className="ctrl-box",this._ul=document.createElement("ul"),this._ul.className="ctrl-ul",this._ul.setAttribute("show-align","down"),-1!==e.indexOf("bottom")&&this._ul.setAttribute("show-align","top"),-1!==e.indexOf("right")&&(this._container.style.float="right"),this._offset&&(this._container.style.position="absolute",this._container.style.margin="0",this._offset.top&&(this._container.style.top=parseFloat(this._offset.top)+"px"),this._offset.bottom&&(this._container.style.bottom=parseFloat(this._offset.bottom)+"px"),this._offset.left&&(this._container.style.left=parseFloat(this._offset.left)+"px"),this._offset.right&&(this._container.style.right=parseFloat(this._offset.right)+"px")),"hidden"==e&&(this._container.style.display="none"),this._liArray=new Array,this._container.appendChild(this._box),this._container.appendChild(this._ul),this.eachFloor(t.mapInfoArray),this._ulBlock=!1,this._box.addEventListener("click",(function(t){r._ulBlock?r._ulHide():r._ulShow(),t.stopPropagation()}),!1),this._map.on("floorend",(function(){if(!this.__isRemove__){for(var t in r._liArray){var e=r._liArray[t];e.getAttribute("floor-id")==r._map._targetFloorID?(e.className+=" active",r._box.innerHTML=r._map.currentMapInfo.floorName):e.className=""}r._ulHide()}})),document.addEventListener("click",(function(){r._ulHide()}),!1),this._container},cs.prototype.onRemove=function(t){this._container&&this._container.parentNode&&this._container.parentNode.removeChild(this._container),this.__isRemove__=!0},cs.prototype.eachFloor=function(t){var e=Object.create(t);for(var r in e.sort((function(t,e){return e.floorNumber-t.floorNumber})),e){var i=e[r];this._ul.appendChild(this._eachLI(i)),i.mapID==this._map._targetFloorID&&(this._box.innerHTML=i.floorName)}},cs.prototype._eachLI=function(t){var e=this,r=document.createElement("li");return r.innerHTML=t.floorName,r.setAttribute("floor-id",t.mapID),r.addEventListener("click",(function(r){e._ulHide(),t.mapID!=e._map._targetFloorID&&(e._map.setFloor(t.mapID),r.stopPropagation())}),!1),this._liArray.push(r),r},cs.prototype._ulShow=function(){this._ul.className+=" block",this._ulBlock=!0},cs.prototype._ulHide=function(){this._ul.className="ctrl-ul",this._ulBlock=!1},cs.prototype.getDefaultPosition=function(){return"top-left"},cs.prototype.setOffset=function(t){this._offset=t};var fs=function(){};fs.prototype.onAdd=function(t,e){var r=this;return this._map=t,this._container=document.createElement("div"),this._container.className="brtmap-zoom-ctrl",this._zoomIn=document.createElement("a"),this._zoomIn.className="ctrl-in",this._zoomIn.innerHTML="+",this._zoomOut=document.createElement("a"),this._zoomOut.className="ctrl-out",this._zoomOut.innerHTML="-",-1!==e.indexOf("left")&&(this._container.style.float="left"),this._offset&&(this._container.style.position="absolute",this._container.style.margin="0",this._offset.top&&(this._container.style.top=parseFloat(this._offset.top)+"px"),this._offset.bottom&&(this._container.style.bottom=parseFloat(this._offset.bottom)+"px"),this._offset.left&&(this._container.style.left=parseFloat(this._offset.left)+"px"),this._offset.right&&(this._container.style.right=parseFloat(this._offset.right)+"px")),"hidden"==e&&(this._container.style.display="none"),this._container.appendChild(this._zoomIn),this._container.appendChild(this._zoomOut),this._zoomIn.addEventListener("click",(function(t){r._map.zoomIn(),t.stopPropagation()}),!1),this._zoomOut.addEventListener("click",(function(t){r._map.zoomOut(),t.stopPropagation()}),!1),this._map.on("zoom",(function(){if(!this.__isRemove__){var t=r._map.getZoom(),e=r._map.getBaseZoom(),i=r._map.getMaxZoom();Math.floor(t)<=e?r._zoomOut.className+=" off":Math.ceil(t)>=i?r._zoomIn.className+=" off":(r._zoomIn.className="ctrl-in",r._zoomOut.className="ctrl-out")}})),this._container},fs.prototype.onRemove=function(t){this._container&&this._container.parentNode&&this._container.parentNode.removeChild(this._container),this.__isRemove__=!0},fs.prototype.getDefaultPosition=function(){return"bottom-right"},fs.prototype.setOffset=function(t){this._offset=t};var ds=function(t){this.map=t,this._logoControl=new ps,t.addControl(this._logoControl,t._options.logoPosition),this._floorControl=new cs(t.mapInfoArray),t.addControl(this._floorControl,t._options.floorPosition),this._zoomControl=new fs,t.addControl(this._zoomControl,t._options.zoomPosition)};ds.prototype.showLogoControl=function(){this._logoControl._container.style.display="block"},ds.prototype.hideLogoControl=function(){this._logoControl._container.style.display="none"},ds.prototype.showFloorControl=function(){this._floorControl._container.style.display="block"},ds.prototype.hideFloorControl=function(){this._floorControl._container.style.display="none"},ds.prototype.showZoomControl=function(){this._zoomControl._container.style.display="block"},ds.prototype.hideZoomControl=function(){this._zoomControl._container.style.display="none"};var ms=localStorage.getItem("deviceId");if(!ms||"undefined"==ms){var ys=(new Date).getTime();localStorage.setItem("deviceId",ys),ms=ys}var gs=sessionStorage.getItem("peopleId");if(!gs||"undefined"==gs){var _s=(new Date).getTime();sessionStorage.setItem("peopleId",_s),gs=_s}var vs=function(t){this.map=t};vs.prototype.initMap=function(t){Zn(Mn+"/acquisition/jsI",{ot:1,di:ms,pi:gs,dt:Nn(),bi:t,vm:"2.4.2",_t:(new Date).getTime()},null,{type:"POST"});var e=5;!function r(){"true"!=sessionStorage.getItem("isBrtLocation")&&(Zn(Mn+"/acquisition/jsI",{ot:5,di:ms,pi:gs,dt:Nn(),bi:t,d:e,_t:(new Date).getTime()},null,{type:"POST"}),e=30,window.setTimeout(r,1e3*e))}()},vs.prototype.initRoute=function(t,e,r){Zn(Mn+"/acquisition/jsI",{ot:2,di:ms,pi:gs,dt:Nn(),bi:t,poi:r&&r.POI_ID||"",_t:(new Date).getTime()},null,{type:"POST"})},vs.prototype.reportSearchKeyword=function(t,e){void 0===e&&(e=""),e&&Zn(Mn+"/acquisition/jsI",{ot:3,di:ms,pi:gs,dt:Nn(),bi:t,_t:(new Date).getTime(),k:e},null,{type:"POST"})};var xs=function(t){function e(e){var r=this;e=Object.assign({},{mode:"auto",language:"zh",buildingID:null,token:null,floorID:null,zoom:null,use3D:!0,report:!0,extrusionOpacity:1,showFacilityLabel:!0,facilityAllowOverlap:!1,labelAllowOverlap:!1,labelPadding:2,openEditingMode:!1,loadSyncRoutes:!0,floorSameZoom:!0,autoBounds:!0,routeAnimationFps:30,renderWorldCopies:!1,localIdeographFontFamily:"'Noto Sans', 'Noto Sans CJK SC', sans-serif"},e);var i,n,o=null;if((e.buildingID&&e.token||"online"!==zn.mode)&&function(t,e){"online"===zn.mode?Zn(Ln+"/web/3d/tile",{buildingID:t.buildingID,token:t.token},(function(t){t.success&&e&&e(t)}),{async:!1}):e&&e(zn.tile)}(e,(function(t){o=t})),e.style=(n={version:8,name:"brtmap",sources:{},layers:[],light:{anchor:"viewport",color:"white",intensity:.3,position:[4.5,330,9.2]}},(i="custom"===e.mode?null:o)&&(n.glyphs="https://map.brtbeacon.net/3D/public/glyphs/{fontstack}/{range}.pbf",n.sprite=i.HOST+"/"+i.RELATIVE_URL+"/symbol/BrtMapSprite"),n),t.call(this,e),this.__NOW_TIME__=+new Date,this._options=this.__options__,this._tileToken=o,this.$turf=Po,"custom"===e.mode){var a=function(t){r.__CBM__=t,r.fire("mapready")};e.buildingID&&e.token?new Kn(e).done((function(t){a(t)})):setTimeout((function(){a(null)}),50)}else this.building=null,this.city=null,this.mapInfoArray=null,this.currentMapInfo=null,this._targetFloorID=e.floorID,"online"!==zn.mode&&(this._options.report=!1),this._brtReport=new vs(this),this.on("load",(function(){new Kn(e).done((function(t){r._cbmReady(t)}))}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._cbmReady=function(t){var e=this;this.floorReady=!1,this.__CBM__=t,this.building=t.building,this.city=t.city,this.mapInfoArray=t.mapInfoArray,this._targetFloorID||(this._targetFloorID=this.mapInfoArray[0].floorID),this._control=new ds(this),this._tileSource=new $n(this),this._layerGroup=new ko(this),this._routeManager=new hs(this),this.setMaxZoom(Math.min(this.building.maxZoom,this._options.maxZoom||22)),this.setMinZoom(Math.max(this.building.minZoom,10)),this._options.zoom?this.setZoom(this._options.zoom):this._outerFloorCallback=function(){e.setZoom(e.getCoverZoom()),e.setCenter(Rn(e.currentMapInfo.getCenter()))},this.fire("mapready"),this.setFloor(this._targetFloorID),this._options.report&&this._brtReport.initMap(this.building.buildingID)},e.prototype._loadFloorData=function(t){this.floorReady=!1,this.fire("floorstart");var e=this.getZoom();this.currentMapInfo=t,this._layerGroup.setFloor(t.floorNumber);var r=t.getBounds();this._options.autoBounds&&this.setMaxBounds(r),this._options.floorSameZoom&&this.setZoom(e);var i=this.getCenter();i.lng>r[0]&&i.lat>r[1]&&i.lng<r[2]&&i.lat<r[3]||this.setCenter(Rn(t.getCenter())),this.floorReady=!0,this.fire("floorend"),this._outerFloorCallback&&(this._outerFloorCallback(),this._outerFloorCallback=null)},e.prototype.reportSearchKeyword=function(t){return this._brtReport.reportSearchKeyword(this._options.buildingID,t),this},e.prototype.setUse3D=function(t){return t?this._layerGroup._extrusionLayer.show():this._layerGroup._extrusionLayer.hide(),this},e.prototype.setLanguage=function(t){return this._layerGroup._labelLayer._setLanguage(t),this},e.prototype.setFloor=function(t,e){var r;e&&(this._outerFloorCallback=e),(r="number"==typeof t?this.getFloorInfoByIndex(t):this.getFloorInfoById(t))?(this._targetFloorID=t=r.floorID,this._loadFloorData(r)):this.fire("error",{description:"FloorID not exist: "+t})},e.prototype.getFloorInfoArray=function(){return this.mapInfoArray},e.prototype.getFloorInfoById=function(t){if(this.mapInfoArray)for(var e=null,r=0;r<this.mapInfoArray.length;r++)if((e=this.mapInfoArray[r]).floorID==t)return e;return null},e.prototype.getFloorInfoByIndex=function(t){if(this.mapInfoArray)for(var e=null,r=0;r<this.mapInfoArray.length;r++)if((e=this.mapInfoArray[r]).floorNumber==t)return e;return null},e.prototype.getBaseZoom=function(){return this.building.minZoom},e.prototype.getCoverZoom=function(){return this.getZoomByBounds(this.currentMapInfo.getBounds())},e.prototype.getMapPoi=function(t,e){e=e||function(t){return Math.floor(t.properties.CATEGORY_ID)>800},t.constructor===Array&&(t={lng:t[0],lat:t[1]});var r=this.querySourceFeatures(kn,{sourceLayer:"fill",filter:["==","floor",this.currentMapInfo.floorNumber]});r.sort((function(t,e){return e.properties.layer-t.properties.layer}));for(var i=[],n=[],o=[],a=[],s=0;s<r.length;s++){var l=r[s];i.indexOf(l.properties.POI_ID)>-1||Un([t.lng,t.lat],l.geometry.coordinates[0])&&e(l)&&(i.push(l.properties.POI_ID),3===l.properties.layer?o.push(l):2===l.properties.layer?n.push(l):6===l.properties.layer&&a.push(l))}return o.length?o[0]:n.length?n[0]:a.length?a[0]:null},e.prototype.getOnlinePoi=function(t,e,r){void 0===r&&(r=!0);var i=this.lnglatToCoords(t.lng,t.lat);i.floor=t.floor,i.layer=t.layer||"";var n=null;return Zn(Ln+"/web/mapinfo/getByFXy",{buildingID:this._options.buildingID,token:this._options.token,x:i.x,y:i.y,f:i.floor,layer:i.layer},(function(t){n=t,e&&e(n)}),{async:r}),n},e.prototype.requestRouteDistance=function(t,e,r,i){void 0===i&&(i=!0);var n="",o="";if(t.x&&t.y)n=t.x+","+t.y+","+t.floor;else if(t.lng&&t.lat){var a=this.lnglatToCoords(t.lng,t.lat);n=a.x+","+a.y+","+t.floor}if(e.x&&e.y)o=e.x+","+e.y+","+e.floor;else if(e.lng&&e.lat){var s=this.lnglatToCoords(e.lng,e.lat);o=s.x+","+s.y+","+e.floor}var l=null;return Zn(An+"/TYRouteService/route/getRouteLength33",{buildingID:this._options.buildingID,token:this._options.token,start:n,end:o},(function(t){l=t,r&&r(l)}),{async:i}),l},e.prototype.adsorbentAnalyze=function(t,e,r){var i=[t,e,r];return t instanceof Array?i=t:t instanceof Object&&(i=[t.lng,t.lat,t.floor]),this._routeManager._adsorbentAnalyze(i)},e.prototype.requestRoute=function(t,e,r,i,n,o){r&&r.constructor===Array?this._routeManager._requestRoute(t,e,r,i,n,o):this._routeManager._requestRoute(t,e,[],r,i,n),this._options.report&&e&&e.floor&&e.lng&&e.lat&&this._brtReport.initRoute(this.building.buildingID,e,this._reportEndPoi)},e.prototype.requestRouteSync=function(t,e,r,i){var n;return n=r&&r.constructor===Array?this._routeManager._requestRouteSync(t,e,r,i):this._routeManager._requestRouteSync(t,e,[],r),this._options.report&&this._brtReport.initRoute(this.building.buildingID,e,this._reportEndPoi),n},e.prototype.getRoute=function(){return this._routeManager._getRoute()},e.prototype.getRouteDistance=function(t){return this._routeManager._getDistance(t)},e.prototype.getNearPointByRoute=function(t,e){return this._routeManager._getNearPoint(t,e)},e.prototype.getCutLineByPointAndLength=function(t,e){return this._routeManager._getCutLineByPointAndLength(t,e)},e.prototype.setPassedPoint=function(t){this._routeManager._showPassed(t)},e.prototype.resetPassedPoint=function(){this._routeManager._hidePassed()},e.prototype.showRoute=function(t){return this.RouteResult&&this._layerGroup._routeLayer._setShowRoute(t=t>0&&t<=this.RouteResult.result.route.length?t:1),this},e.prototype.hideRoute=function(){},e.prototype.resetRoute=function(){this._routeManager.clear(),this._layerGroup._routeLayer.clear()},e.prototype.setReportEndPOI=function(t){this._reportEndPoi=t},e.prototype.setRouteColor=function(t,e,r){this._layerGroup._routeLayer.setRouteColor(t,e,r)},e.prototype.setFont=function(t,e){var r={};e?r[t]=e:r=t,this._layerGroup._labelLayer._setFont(r),this._layerGroup._facilityLayer._setFont(r)},e.prototype.showLabelLayer=function(t){t?this._layerGroup._labelLayer._showLabel(t):(this._layerGroup._labelLayer.show(),this._options.openEditingMode&&this._layerGroup._editLabelLayer.show())},e.prototype.hideLabelLayer=function(t){t?this._layerGroup._labelLayer._hideLabel(t):(this._layerGroup._labelLayer.hide(),this._options.openEditingMode&&this._layerGroup._editLabelLayer.hide())},e.prototype.setFillColor=function(t,e,r){this._layerGroup.setFillColor(t,e,r)},e.prototype.resetFillColor=function(t,e){this._layerGroup.resetFillColor(t,e)},e.prototype.showFacility=function(t,e){this._layerGroup._facilityLayer._showFacility(t,e)},e.prototype.hideFacility=function(t,e){this._layerGroup._facilityLayer._hideFacility(t,e)},e.prototype.setFacilitySize=function(t){this._layerGroup._facilityLayer._setSize(t)},e.prototype._setFacilityImage=function(t,e){this._options.openEditingMode&&this._layerGroup._facilityLayer._setImage(t,e)},e.prototype._resetFacilityImage=function(t){this._options.openEditingMode&&this._layerGroup._facilityLayer._resetImage(t)},e.prototype._addLabel=function(t){this._options.openEditingMode&&this._layerGroup._editLabelLayer._addLabel(t)},e.prototype._removeLabel=function(t){this._options.openEditingMode&&this._layerGroup._editLabelLayer._removeLabel(t)},e.prototype._setLabelText=function(t,e){this._options.openEditingMode&&this._layerGroup._editLabelLayer._setLabelText(t,e)},e.prototype._setLabelImage=function(t,e){this._options.openEditingMode&&this._layerGroup._editLabelLayer._setLabelImage(t,e)},e.prototype._resetLabelText=function(t){this._options.openEditingMode&&this._layerGroup._editLabelLayer._resetLabelText(t)},e.prototype._resetLabelImage=function(t){this._options.openEditingMode&&this._layerGroup._editLabelLayer._resetLabelImage(t)},e.prototype.setFacilityAllowOverlap=function(t){void 0!==t&&""!==t&&this._layerGroup._facilityLayer._setAllowOverlap(t)},e.prototype.showFloorControl=function(){this._control.showFloorControl()},e.prototype.hideFloorControl=function(){this._control.hideFloorControl()},e.prototype.showZoomControl=function(){this._control.showZoomControl()},e.prototype.hideZoomControl=function(){this._control.hideZoomControl()},e.prototype.lnglatToCoords=function(t,e){return Fn(t,e)},e.prototype.coordsToLnglat=function(t,e){return Rn(t,e)},e.prototype.lngLatToMercator=function(t,e){return Fn(t,e)},e.prototype.mercatorToLngLat=function(t,e){return Rn(t,e)},e}(En),bs=function(){this._listener={}};bs.prototype.on=function(t,e){return"string"==typeof t&&"function"==typeof e&&(this._listener[t]?this._listener[t].push(e):this._listener[t]=[e]),this},bs.prototype.off=function(t,e){var r=this._listener[t];if(r instanceof Array)if("function"==typeof e){for(var i=0,n=r.length;i<n;i++)if(r[i]===e){r.splice(i,1);break}}else if(key instanceof Array){i=0;for(var o=key.length;i<o;i++)this.off(t,key[o])}else delete this._listener[t];return this},bs.prototype.file=function(t,e){if(t&&this._listener[t])for(var r=0,i=this._listener[t].length;r<i;r++)this._listener[t]&&this._listener[t][r].call(this,e);return this};var ws={read:function(t,e){return t.readFields(ws.callback,{success:!1,description:"",count:0,datas:[]},e)},callback:function(t,e,r){1===t?e.success=r.readBoolean():2===t?e.description=r.readString():3===t?e.count=r.readVarint():4===t&&e.datas.push(Is.read(r,r.readVarint()+r.pos))}},Is={read:function(t,e){return t.readFields(Is.callback,{POI_ID:"",NAME:"",EN:"",CATEGORY_ID:"",LAYER:null,RETRIEVAL:"",LABEL_X:null,LABEL_Y:null,FLOOR_NUMBER:null,FLOOR_ID:"",FLOOR_NAME:"",ZONE_ID:"",PINYIN_NAME:"",PINYIN_RETRIEVAL:"",REGION:"",REGION_EN:"",ROOM_NUMBER:"",ICON_NAME:""},e)},callback:function(t,e,r){1===t?e.POI_ID=r.readString():2===t?e.NAME=r.readString():3===t?e.EN=r.readString():4===t?e.CATEGORY_ID=r.readString():5===t?e.LAYER=r.readVarint():6===t?e.RETRIEVAL=r.readString():7===t?e.LABEL_X=r.readDouble():8===t?e.LABEL_Y=r.readDouble():9===t?e.FLOOR_NUMBER=r.readVarint(!0):10===t?e.FLOOR_ID=r.readString():11===t?e.FLOOR_NAME=r.readString():12===t?e.ZONE_ID=r.readString():13===t?e.PINYIN_NAME=r.readString():14===t?e.PINYIN_RETRIEVAL=r.readString():15===t?e.REGION=r.readString():18===t?e.REGION_EN=r.readString():16===t?e.ROOM_NUMBER=r.readString():17===t&&(e.ICON_NAME=r.readString())}},Ss=function(e){function r(){e.call(this),this._synonymCache=null,this._poiCache=null,this._poiTypeCache=null,this._poiCategoryKeys=null}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.addTo=function(t){this.map=t;var e=this;return t._tileToken?e._request():t.on("load",(function(){e._request()})),this},r.prototype._request=function(){var e=this;Zn(this.map._tileToken.HOST+"/3D/public/js/poi_synonym_search.json",{},(function(t){t.success&&(e._synonymCache=t.datas,e._onload())})),Zn(function(t){return t.HOST+"/"+t.RELATIVE_URL+"/js/poi_search.pbf"}(this.map._tileToken),{},(function(r){if(r){var i=ws.read(new t.Protobuf(new Uint8Array(r)));e._poiCache=i.datas,e._onload()}}),{responseType:"arraybuffer"}),Zn(function(t){return t.HOST+"/"+t.RELATIVE_URL+"/js/PoiTypeList.json"}(this.map._tileToken),{},(function(t){t.success&&(e._poiTypeCache=t.datas,e._poiCategoryKeys=e._setKeyValueByCategory(),e._onload())}))},r.prototype._onload=function(){this._synonymCache&&this._poiCache&&this._poiTypeCache&&this.file("ready",this)},r.prototype.query=function(t,e){if(this._synonymCache&&this._poiCache){var r=[];if((t=Bn({floorId:"",type:"",value:""},t)).type=t.type.toLowerCase(),t.value=t.value.toLowerCase(),"name"==t.type){this._poiTypeCache&&(r=this._byNameToType(this._getPoiType(t.value)));var i=this._getSynonym(t.value);r=r.concat(this._byName(i,t.value))}else"poiid"==t.type?r=this._byPoiId(t.value):"cid"==t.type?r=this._byCid(t.value):"letter"==t.type?r=this._byLetter(t.value):""!=t.type&&""!=t.value||(r=this._byAll());t.floorId&&(r=r.filter((function(e){return!!e.LEVEL||e.FLOOR_ID==t.floorId}))),e&&e(r)}else e([])},r.prototype._setKeyValueByCategory=function(){return this._poiTypeCache?function t(e){for(var r={},i=0;i<e.length;i++){var n=e[i];n.value.length>=6?(r[n.value]=n.label,r[n.value+"-en"]=n.en):n.children.length&&(r=Bn(r,t(n.children)))}return r}(this._poiTypeCache):null},r.prototype._getPoiType=function(t){var e=function(r){for(var i=[],n=0;n<r.length;n++){var o=r[n];if(o.label.toLowerCase().indexOf(t)>-1||o.en&&o.en.toLowerCase().indexOf(t)>-1)i.push(o);else if(o.children.length){var a=e(o.children);a.length&&(i=i.concat(a))}}return i};return e(this._poiTypeCache)},r.prototype._byNameToType=function(t){var e=[];if(t.length){function l(t){for(var e=[],r=0;r<t.length;r++){var i=t[r];i.value.length>=6?e.push(i.value):i.children.length&&(e=e.concat(l(i.children)))}return e}for(var r=0;r<t.length;r++){var i=t[r];e.push({NAME:i.label,EN:i.en,CATEGORY_ID:i.value,LEVEL:i.value.length/2,arr:i.value.length>=6?[i.value]:l(i.children),children:[]})}for(var n=0;n<e.length;n++){for(var o=e[n],a=0;a<this._poiCache.length;a++){var s=this._poiCache[a];o.arr.indexOf(s.CATEGORY_ID)>-1&&(s.CATEGORY_NAME=this._poiCategoryKeys[s.CATEGORY_ID]||"",s.CATEGORY_EN=this._poiCategoryKeys[s.CATEGORY_ID+"-en"]||"",o.children.push(s))}delete o.arr}}return e},r.prototype._getSynonym=function(t){for(var e=[],r=0;r<this._synonymCache.length;r++){var i=this._synonymCache[r];i.s.toLowerCase().indexOf(t)>-1&&e.push(i.i)}return e},r.prototype._byName=function(t,e){for(var r=[],i=0;i<this._poiCache.length;i++){var n=this._poiCache[i];(n.EN||n.NAME)&&(t.indexOf(n.CATEGORY_ID)>-1||n.NAME.toLowerCase().indexOf(e)>-1||n.EN.toLowerCase().indexOf(e)>-1||n.RETRIEVAL.toLowerCase().indexOf(e)>-1||n.ROOM_NUMBER.toLowerCase().indexOf(e)>-1)&&(n.CATEGORY_NAME=this._poiCategoryKeys[n.CATEGORY_ID]||"",n.CATEGORY_EN=this._poiCategoryKeys[n.CATEGORY_ID+"-en"]||"",r.push(n))}return r},r.prototype._byPoiId=function(t){for(var e=[],r=0;r<this._poiCache.length;r++){var i=this._poiCache[r];i.POI_ID.toLowerCase().indexOf(t)>-1&&(i.CATEGORY_NAME=this._poiCategoryKeys[i.CATEGORY_ID]||"",i.CATEGORY_EN=this._poiCategoryKeys[i.CATEGORY_ID+"-en"]||"",e.push(i))}return e},r.prototype._byCid=function(t){for(var e=[],r=0;r<this._poiCache.length;r++){var i=this._poiCache[r];i.CATEGORY_ID.toLowerCase().indexOf(t)>-1&&(i.CATEGORY_NAME=this._poiCategoryKeys[i.CATEGORY_ID]||"",i.CATEGORY_EN=this._poiCategoryKeys[i.CATEGORY_ID+"-en"]||"",e.push(i))}return e},r.prototype._byLetter=function(t){for(var e=[],r=0;r<this._poiCache.length;r++){var i=this._poiCache[r];i.PINYIN_NAME&&i.PINYIN_NAME.toLowerCase().indexOf(t)>-1&&(i.CATEGORY_NAME=this._poiCategoryKeys[i.CATEGORY_ID]||"",i.CATEGORY_EN=this._poiCategoryKeys[i.CATEGORY_ID+"-en"]||"",e.push(i))}return e},r.prototype._byAll=function(){for(var t=[],e=0;e<this._poiCache.length;e++){var r=this._poiCache[e];r.CATEGORY_NAME=this._poiCategoryKeys[r.CATEGORY_ID]||"",r.CATEGORY_EN=this._poiCategoryKeys[r.CATEGORY_ID+"-en"]||"",t.push(r)}return t},r}(bs),Ts={init:!1,id:"brtmap-symbol-source",data:{type:"FeatureCollection",features:[]}},Es=function(){var t=this;this.__ENABLED__=!1;var e=function(){Ts.init&&t.__ENABLED__&&t.map.getSource(Ts.id).setData(Ts.data),setTimeout(e,1e3/30)};e()};Es.prototype.render=function(){var t=this;this.__ENABLED__=!0,this.__TIMER__&&clearTimeout(this.__TIMER__),this.__TIMER__=setTimeout((function(){t.__ENABLED__=!1}),200)},Es.prototype.addTo=function(t){var e=this;return this.map=t,this.__isAdd__||(this.__isAdd__=!0,this.__state__=0,Ts.data.features.push(this.feature||{}),Ts.init||(t.addSource(Ts.id,{type:"geojson",data:Ts.data}),Ts.init=!0,t.on("remove",(function(t){e.__isAdd__=!1,Ts.init=!1,Ts.data.features=[]}))),this.render(),this._initLayer&&this._initLayer(Ts.id),"Point"===this.feature.geometry.type?this.options.lnglat&&this.options.lnglat.length>1&&(this.floorId=this.map._targetFloorID,this.setVisibility(!0)):["Polygon","MultiLineString"].indexOf(this.feature.geometry.type)>-1&&this.options.lnglats&&this.options.lnglats.length>1&&(this.floorId=this.map._targetFloorID,this.setVisibility(!0)),this.__ready__()),this},Es.prototype.setLnglat=function(t,e,r){var i=this;void 0===r&&(r=!1),this.floorId=e?"number"==typeof e?this.map.getFloorInfoByIndex(e).mapID:e:this.map._targetFloorID;var n=t;if(t.constructor!==Array&&(n=[t.lng,t.lat]),"all"===this.floorId||this.floorId===this.map._targetFloorID){0===this.__state__&&this.setVisibility(!0);var o=JSON.parse(JSON.stringify(this.feature.geometry.coordinates));if(r&&o.length>1){this._animateTimer&&clearTimeout(this._animateTimer);var a=300;"object"==typeof r&&(a=r.duration||a);var s=+new Date,l=function(){var t=+new Date-s;if(t>a)return i.feature.geometry.coordinates=n,i.render(),clearTimeout(i._animateTimer),!1;i.feature.geometry.coordinates=[(n[0]-o[0])*t/a+o[0],(n[1]-o[1])*t/a+o[1]],i.render(),i._animateTimer=setTimeout(l,1e3/30)};l()}else this.feature.geometry.coordinates=n,this.render()}else this.feature.geometry.coordinates=n,this.render(),this.setVisibility(!1);return this},Es.prototype.setOffset=function(t,e){if(!t)return this;var r=[t,e];return t.constructor===Array&&(r=t),this.feature.properties.offset=r,this.render(),this},Es.prototype.setColor=function(t){return this.feature.properties.color=t,this.render(),this},Es.prototype.setOpacity=function(t){return this.feature.properties.opacity=t,this.render(),this},Es.prototype._setPaintProperty=function(t,e,r){return this.layerId&&this.map.setPaintProperty(this.layerId,t+"-"+e,r),this},Es.prototype.setProperty=function(t,e){if(t.constructor===Object)for(var r in t)this.feature.properties[r]=t[r];else this.feature.properties[t]=e;return this.render(),this},Es.prototype.on=function(t,e){return this._listeners||(this._listeners={}),this.layerId&&(this._listeners[t]=e,this.map.on(t,this.layerId,e)),this},Es.prototype.off=function(t,e){return this.layerId&&this.map.off(t,this.layerId,this._listeners[t]),this},Es.prototype.setVisibility=function(t){return this.layerId&&this.visible!==t&&(this.visible=t,this.map.setLayoutProperty(this.layerId,"visibility",t?"visible":"none")),this},Es.prototype.zIndex=function(){return this.layerId&&this.map.moveLayer(this.layerId),this},Es.prototype.show=function(){return this.__state__=0,this.setVisibility("all"===this.floorId||this.floorId===this.map._targetFloorID),this},Es.prototype.hide=function(){return this.__state__=-1,this.setVisibility(!1),this},Es.prototype.empty=function(){return this.setVisibility(!1),"Point"===this.feature.geometry.type?this.feature.geometry.coordinates=[]:["Polygon","MultiLineString"].indexOf(this.feature.geometry.type)>-1&&(this.feature.geometry.coordinates=[[]]),this.render(),this},Es.prototype.remove=function(){if(this.layerId){for(var t in this.map.off("floorstart",this._floorstart_callee),this.map.off("floorend",this._floorend_callee),this._listeners)this.off(t);this.map.removeLayer(this.layerId),this.layerId=null}},Es.prototype.__ready__=function(){var t=this;this._floorstart_callee=function(){t.setVisibility(!1)},this._floorend_callee=function(){0===t.__state__&&t.setVisibility("all"===t.floorId||t.floorId===t.map._targetFloorID)},this.map.on("floorstart",this._floorstart_callee),this.map.on("floorend",this._floorend_callee)};var Ps=function(t){function e(e){t.call(this),this.options=Object.assign({},{url:"",size:1,angle:0,offset:[0,0],lnglat:[],type:"auto"},e);var r=Math.floor(1e6*Math.random()),i=+new Date;this.layerId="brtmap_symbol_marker_layer_"+(i+r),this.imageId="brtmap_symbol_marker_image_"+(i+r),this.__imageURL__=this.options.url,this.__imageLoad__=!1,this.feature={type:"Feature",geometry:{type:"Point",coordinates:this.options.lnglat},properties:{id:this.layerId,offset:this.options.offset,angle:this.options.angle,size:this.options.size}}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._initLayer=function(t){var e=this;this.map.addLayer({id:this.layerId,type:"symbol",source:t,layout:{visibility:"none","icon-offset":["get","offset"],"icon-rotate":["get","angle"],"icon-size":["get","size"],"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-rotation-alignment":this.options.type},filter:["all",["==","id",this.layerId]]}),this.map.loadImage(this.__imageURL__,(function(t,r){e.__imageLoad__=!0,e.map.addImage(e.imageId,r),e.map.setLayoutProperty(e.layerId,"icon-image",e.imageId)}))},e.prototype.setRotate=function(t){return this.feature.properties.angle=t,this.render(),this},e.prototype.setURL=function(t){var e=this;if(this.__imageURL__!==t){this.__imageURL__=t;var r=function(){if(e.__imageLoad__)return e.__imageLoad__=!1,e.map.removeImage(e.imageId),e.map.loadImage(e.__imageURL__,(function(t,r){e.__imageLoad__=!0,e.map.addImage(e.imageId,r)})),!1;setTimeout(r,200)};r()}return this},e}(Es),As=function(t){this.options=Object.assign({},{content:"",className:"",lnglat:[],offset:[0,0],width:0,height:0,zIndex:0},t);var e=Math.floor(1e6*Math.random()),r=+new Date;this.layerId="brtmap_symbol_div_marker_"+(r+e),this.feature={type:"Feature",geometry:{type:"Point",coordinates:this.options.lnglat},properties:{}},this.el=document.createElement("div"),this.el.className="brtmap-div-marker "+this.options.className,"object"==typeof this.options.content?this.el.appendChild(this.options.content):this.el.innerHTML=this.options.content,this.el.style.display="none",this.el.style.left=this.options.offset[0]+"px",this.el.style.top=this.options.offset[1]+"px",this.options.width&&(this.el.style.width=this.options.width+"px"),this.options.height&&(this.el.style.height=this.options.height+"px"),this.options.zIndex&&(this.el.style.zIndex=this.options.zIndex)};As.prototype.addTo=function(t){var e=this;return this.map=t,this.__isAdd__||(this.__isAdd__=!0,this.__state__=0,this.__marker__=new brtmap.Marker(this.el).setLngLat([0,0]).addTo(this.map),this.options.lnglat.length>1&&(this.floorId=this.map._targetFloorID,this.setVisibility(!0),this.render()),this._floorstart_callee=function(){e.setVisibility(!1)},this._floorend_callee=function(){0===e.__state__&&e.feature.geometry.coordinates.length>1&&e.setVisibility("all"===e.floorId||e.floorId===e.map._targetFloorID)},this.map.on("floorstart",this._floorstart_callee),this.map.on("floorend",this._floorend_callee)),this},As.prototype.render=function(){this.__marker__.setLngLat(this.feature.geometry.coordinates)},As.prototype.setLnglat=function(t,e,r){var i=this;void 0===r&&(r=!1),this.floorId=e?"number"==typeof e?this.map.getFloorInfoByIndex(e).mapID:e:this.map._targetFloorID;var n=t;if(t.constructor!==Array&&(n=[t.lng,t.lat]),"all"===this.floorId||this.floorId===this.map._targetFloorID){0===this.__state__&&this.setVisibility(!0);var o=JSON.parse(JSON.stringify(this.feature.geometry.coordinates));if(r&&o.length>1){this._animateTimer&&clearTimeout(this._animateTimer);var a=300;"object"==typeof r&&(a=r.duration||a);var s=+new Date,l=function(){var t=+new Date-s;if(t>a)return i.feature.geometry.coordinates=n,i.render(),clearTimeout(i._animateTimer),!1;i.feature.geometry.coordinates=[(n[0]-o[0])*t/a+o[0],(n[1]-o[1])*t/a+o[1]],i.render(),i._animateTimer=setTimeout(l,1e3/30)};l()}else this.feature.geometry.coordinates=n,this.render()}else this.feature.geometry.coordinates=n,this.render(),this.setVisibility(!1);return this},As.prototype.setContent=function(t){return this.el.innerHTML=t,this},As.prototype.setAttr=function(t,e){return this.el.setAttribute(t,e),this},As.prototype.getAttr=function(t){return this.el.getAttribute(t)},As.prototype.addClass=function(t){return this.el.classList.add(t),this},As.prototype.removeClass=function(t){return this.el.classList.remove(t),this},As.prototype.on=function(t,e){return this.el.addEventListener(t,e,!1),this},As.prototype.off=function(t,e){return this.el.removeEventListener(t,e,!1),this},As.prototype.setVisibility=function(t){return this.el.style.display=t?"inline-block":"none",this},As.prototype.show=function(){return this.__state__=0,this.setVisibility("all"===this.floorId||this.floorId===this.map._targetFloorID),this},As.prototype.hide=function(){return this.__state__=-1,this.setVisibility(!1),this},As.prototype.empty=function(){return this.setVisibility(!1),this.feature.geometry.coordinates=[],this},As.prototype.remove=function(){this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.__marker__&&this.__marker__.remove(),this.map.off("floorstart",this._floorstart_callee),this.map.off("floorend",this._floorend_callee)};var Ls=function(t){this.options=Object.assign({},{text:"",color:"#333333",size:14,className:"",lnglat:[0,0],offset:[0,0],width:0,height:0,zIndex:0},t);var e=Math.floor(1e6*Math.random()),r=+new Date;this.layerId="brtmap_symbol_label_"+(r+e),this.feature={type:"Feature",geometry:{type:"Point",coordinates:this.options.lnglat},properties:{}},this.el=document.createElement("div"),this.el.className="brtmap-label-marker "+this.options.className,this.el.style.color=this.options.color,this.el.style.fontSize=parseFloat(this.options.size)+"px",this.el.innerHTML=this.options.text,this.el.style.display="none",this.el.style.left=this.options.offset[0]+"px",this.el.style.top=this.options.offset[1]+"px",this.options.width&&(this.el.style.width=this.options.width+"px"),this.options.height&&(this.el.style.height=this.options.height+"px"),this.options.zIndex&&(this.el.style.zIndex=this.options.zIndex)};Ls.prototype.addTo=function(t){var e=this;return this.map=t,this.__isAdd__||(this.__isAdd__=!0,this.__state__=0,this.__marker__=new brtmap.Marker(this.el).setLngLat([0,0]).addTo(this.map),this.options.lnglat.length>1&&(this.floorId=this.map._targetFloorID,this.setVisibility(!0),this.render()),this._floorstart_callee=function(){e.setVisibility(!1)},this._floorend_callee=function(){0===e.__state__&&e.feature.geometry.coordinates.length>1&&e.setVisibility(e.floorId===e.map._targetFloorID)},this.map.on("floorstart",this._floorstart_callee),this.map.on("floorend",this._floorend_callee)),this},Ls.prototype.render=function(){this.__marker__.setLngLat(this.feature.geometry.coordinates)},Ls.prototype.setLnglat=function(t,e,r){var i=this;void 0===r&&(r=!1),this.floorId=e?"number"==typeof e?this.map.getFloorInfoByIndex(e).mapID:e:this.map._targetFloorID;var n=t;if(t.constructor!==Array&&(n=[t.lng,t.lat]),this.floorId===this.map._targetFloorID){0===this.__state__&&this.setVisibility(!0);var o=JSON.parse(JSON.stringify(this.feature.geometry.coordinates));if(r&&o.length>1){this._animateTimer&&clearTimeout(this._animateTimer);var a=300;"object"==typeof r&&(a=r.duration||a);var s=+new Date,l=function(){var t=+new Date-s;if(t>a)return i.feature.geometry.coordinates=n,i.render(),clearTimeout(i._animateTimer),!1;i.feature.geometry.coordinates=[(n[0]-o[0])*t/a+o[0],(n[1]-o[1])*t/a+o[1]],i.render(),i._animateTimer=setTimeout(l,1e3/30)};l()}else this.feature.geometry.coordinates=n,this.render()}else this.feature.geometry.coordinates=n,this.render(),this.setVisibility(!1);return this},Ls.prototype.setText=function(t){return this.el.innerHTML=t,this.show(),this},Ls.prototype.setAttr=function(t,e){return this.el.setAttribute(t,e),this},Ls.prototype.getAttr=function(t){return this.el.getAttribute(t)},Ls.prototype.addClass=function(t){return this.el.className+=" "+t,this},Ls.prototype.removeClass=function(t){return this.el.className=this.el.className.replace(new RegExp(t),""),this},Ls.prototype.on=function(t,e){return this.el.addEventListener(t,e,!1),this},Ls.prototype.off=function(t,e){return this.el.removeEventListener(t,e,!1),this},Ls.prototype.setVisibility=function(t){return this.el.style.display=t?"inline-block":"none",this},Ls.prototype.show=function(){return this.__state__=0,this.setVisibility(this.floorId===this.map._targetFloorID),this},Ls.prototype.hide=function(){return this.__state__=-1,this.setVisibility(!1),this},Ls.prototype.empty=function(){return this.setVisibility(!1),this.feature.geometry.coordinates=[],this},Ls.prototype.remove=function(){this.el.parentNode&&this.el.parentNode.removeChild(this.el),this._marker.remove(),this._map.off("floorstart",this._floorstart_callee),this._map.off("floorend",this._floorend_callee)};var Ms=function(t){function e(e){t.call(this),this.options=Object.assign({},{radius:10,color:"#0099ff",opacity:.8,lnglat:[],type:"viewport"},e);var r=Math.floor(1e6*Math.random()),i=+new Date;this.layerId="brtmap_symbol_circle_layer_"+(i+r),this.feature={type:"Feature",geometry:{type:"Point",coordinates:this.options.lnglat},properties:{id:this.layerId,radius:this.options.radius,color:this.options.color,opacity:this.options.opacity}}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._initLayer=function(t){this.map.addLayer({id:this.layerId,source:t,type:"circle",layout:{visibility:"none"},paint:{"circle-radius":{type:"identity",property:"radius"},"circle-color":{type:"identity",property:"color"},"circle-opacity":{type:"identity",property:"opacity"},"circle-pitch-alignment":this.options.type},filter:["all",["==","id",this.layerId]]})},e.prototype.setRadius=function(t){return this.feature.properties.radius=t,this.render(),this},e}(Es),ks=function(t){function e(e){t.call(this),this.options=Object.assign({},{lnglats:[],color:"#0099FF",opacity:1,width:6,dasharray:[1]},e);var r=Math.floor(1e6*Math.random()),i=+new Date;this.layerId="brtmap_symbol_polyline_layer_"+(i+r),this.feature={type:"Feature",geometry:{type:"MultiLineString",coordinates:[this.options.lnglats]},properties:{id:this.layerId,width:this.options.width,color:this.options.color,opacity:this.options.opacity}}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._initLayer=function(t){delete this.setLnglat,delete this.setOffset,this.map.addLayer({id:this.layerId,type:"line",source:t,layout:{visibility:"none","line-join":"round","line-cap":"round"},paint:{"line-color":{type:"identity",property:"color"},"line-width":{type:"identity",property:"width"},"line-opacity":{type:"identity",property:"opacity"},"line-dasharray":this.options.dasharray},filter:["all",["==","id",this.layerId]]})},e.prototype.setLnglats=function(t,e){return this.floorId=e?"number"==typeof e?this.map.getFloorInfoByIndex(e).mapID:e:this.map._targetFloorID,this.feature.geometry.coordinates=[t],this.render(),t.length<=1?this.setVisibility(!1):this.floorId===this.map._targetFloorID?0===this.__state__&&this.setVisibility(!0):this.setVisibility(!1),this},e.prototype.setWidth=function(t){return this.feature.properties.width=t,this.render(),this},e}(Es),zs=function(t){function e(e){t.call(this),this.options=Object.assign({},{lnglats:[],color:"#0099FF",opacity:1},e);var r=Math.floor(1e6*Math.random()),i=+new Date;this.layerId="brtmap_symbol_polygon_layer_"+(i+r),this.feature={type:"Feature",geometry:{type:"Polygon",coordinates:[this.options.lnglats]},properties:{id:this.layerId,color:this.options.color,opacity:this.options.opacity}}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._initLayer=function(t){delete this.setLnglat,delete this.setOffset,this.map.addLayer({id:this.layerId,type:"fill",source:t,layout:{visibility:"none"},paint:{"fill-color":{type:"identity",property:"color"},"fill-opacity":{type:"identity",property:"opacity"}},filter:["all",["==","id",this.layerId]]})},e.prototype.setLnglats=function(t,e){return this.floorId=e?"number"==typeof e?this.map.getFloorInfoByIndex(e).mapID:e:this.map._targetFloorID,this.feature.geometry.coordinates=[t],this.render(),t.length<=1?this.setVisibility(!1):this.floorId===this.map._targetFloorID?0===this.__state__&&this.setVisibility(!0):this.setVisibility(!1),this},e}(Es),Cs=!1,Ds=1,Rs="brtmap_beacon_point",Fs=Rs+"_layer",Os={type:"FeatureCollection",features:[]},Bs={Marker:Ps,DivMarker:As,Label:Ls,Circle:Ms,Polyline:ks,Polygon:zs,BeaconPoint:function(t){function e(e){t.call(this),this._options=Bn({content:"",fontSize:12,fontColor:"#333333",pointSize:10,pointColor:"#0099FF",lnglat:[0,0],floorId:""},e),this._feature={id:Ds++,type:"Feature",geometry:{type:"Point",coordinates:this._options.lnglat},properties:{content:this._options.content,"font-size":this._options.fontSize,"font-color":this._options.fontColor,"point-size":this._options.pointSize,"point-color":this._options.pointColor,floorId:this._options.floorId}}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._initLayer=function(){Cs||(Cs=!0,this.map.addSource(Rs,{type:"geojson",data:Os}),this.map.addLayer({id:Fs,type:"symbol",source:Rs,paint:{"text-color":["get","font-color"],"text-halo-color":"#ffffff","text-halo-width":1},layout:{"text-font":["microsoft yahei"],"text-field":["get","content"],"text-size":["get","font-size"],"text-offset":[.65,-.18],"text-anchor":"left","text-padding":0,"text-allow-overlap":!0,"text-ignore-placement":!0}}),this.map.addLayer({id:Fs+"_2",type:"circle",source:Rs,paint:{"circle-radius":["/",["get","point-size"],2],"circle-color":["get","point-color"],"circle-opacity":1}}))},e.prototype._draw=function(){this.map.getSource(Rs).setData(Os)},e.prototype.setLnglat=function(t,e){return this._feature.properties.floorId=e||this.map._targetFloorID,t.constructor!==Array&&(t=[t.lng,t.lat]),this._feature.geometry.coordinates=t,this._draw(),this},e.prototype.empty=function(){this._feature.properties.floorId="",this._draw()},e.prototype.remove=function(){Fs&&(this.map.removeLayer(Fs),Fs=null)},e.prototype.resetLayer=function(){Cs=!1,Os.features=[]},e.prototype.addTo=function(t){var e=this;return this.map=t,Os.features.push(this._feature),this._initLayer(),this._draw(),this.map.on("floorend",(function(){e._setFloor()})),e._setFloor(),this},e.prototype._setFloor=function(){this.map.setFilter(Fs,["all",["==","floorId",this.map._targetFloorID]]),this.map.setFilter(Fs+"_2",["all",["==","floorId",this.map._targetFloorID]])},e}(bs)};function Ns(t){return t/5e4}function Vs(t,e){for(var r,i,n,o=[],a=0;a<t.length;a++)Po.lineChunk(r=t[a],e).features.forEach((function(t){i=Po.bearing(t.geometry.coordinates[0],t.geometry.coordinates[1]),o.push({lnglat:t.geometry.coordinates[0],floor:r.properties.floor,angle:i})})),i=Po.bearing(r.geometry.coordinates[(n=r.geometry.coordinates.length)-2],r.geometry.coordinates[n-1]),o.push({lnglat:r.geometry.coordinates[n-1],floor:r.properties.floor,angle:i});return o}!function(t){function e(e){t.call(this),this.options=Bn({marker:null,follow:!0,passed:!1,zoom:20,speed:5},e),this.animSpacing=Ns(this.options.speed)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.addTo=function(t){return this.map=t,this},e.prototype.setSpeed=function(t){return this._routeResult&&(this.animSpacing=Ns(t),this._simulateResult=Vs(this.map.RouteResult.features,this.animSpacing),this._simulateStep=function(t,e){for(var r=0,i=Fn(e.lnglat),n=0;n<t.length;n++){var o=Fn(t[n].lnglat);if(Math.sqrt((i.x-o.x)*(i.x-o.x)+(i.y-o.y)*(i.y-o.y))<.5){r=n;break}}return r}(this._simulateResult,this._currentItem)),this},e.prototype.enablePassed=function(){this.options.passed=!0},e.prototype.disablePassed=function(){this.options.passed=!1,this.map._routeManager._hidePassed()},e.prototype.enableFollow=function(){this.options.follow=!0},e.prototype.disableFollow=function(){this.options.follow=!1},e.prototype.start=function(){return this._routeResult&&this._routeResult==this.map.RouteResult||(this._routeResult=this.map.RouteResult,this._simulateResult=Vs(this.map.RouteResult.features,this.animSpacing),this._isChangeFloor=!1,this._isLastEaseToTime=0,this._simulateStep=0,this._currentItem=null,this.file("start-simulate",this._routeResult)),this._animate(),this},e.prototype.stop=function(){return clearTimeout(this._simTimeout),this},e.prototype.clear=function(){this.stop(),this._routeResult=null,this.map._routeManager._hidePassed(),this.file("end-simulate","destroy")},e.prototype._animate=function(){var t=this;if(this._routeResult!=this.map.RouteResult)return this.options.marker&&this.options.marker.empty(),void this.clear();if(this._simulateStep>=this._simulateResult.length)return this.file("end-simulate","end"),this._simulateStep=0,void(this.options.passed&&this.map._routeManager._showPassed());var e=this._simulateResult[this._simulateStep];if(this._currentItem=e,this.options.follow){var r=this.map.currentMapInfo;if(e.floor!==r.floorNumber)return r=this.map.getFloorInfoByIndex(e.floor),this.map.setFloor(r.mapID),this._simTimeout=setTimeout((function(){t._animate.apply(t)}),1e3),void(this._isChangeFloor=!0);if(this._isChangeFloor||0===this._simulateStep)return this._isChangeFloor=!1,this._simulateStep++,this.map.easeTo({center:e.lnglat,zoom:this.options.zoom}),void(this._simTimeout=setTimeout((function(){t._animate.apply(t)}),1e3));var i=(new Date).getTime();i-this._isLastEaseToTime>=200&&(this.map.easeTo({center:e.lnglat,bearing:e.angle,easing:function(t){return t},duration:200}),this._isLastEaseToTime=i)}if(this.options.marker){var n=this.map.getFloorInfoByIndex(e.floor);this.options.marker.setLnglat(e.lnglat,n.mapID).setRotate(e.angle)}this.options.passed&&this.map._routeManager._showPassed({lng:e.lnglat[0],lat:e.lnglat[1],floor:e.floor}),this.file("in-simulate",e),this._simulateStep++,this._simTimeout=setTimeout((function(){t._animate.apply(t)}),1e3/60)}}(bs);var Us=function(t){function e(e){t.call(this),this.options=Bn({filterDistance:3,filterAngle:25},e),this._routeResult=null}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.addTo=function(t){return this.map=t,this},e.prototype.getIndicateByPoint=function(t){return this._lastPoint=us(t),this._routeResult&&this._routeResult==this.map.RouteResult||(this._routeResult=this.map.RouteResult,this._formatRoute(this._routeResult)),this._lastPoint&&this._lineSegmentResult?this._getDirection(this._lastPoint):null},e.prototype.getLineSegment=function(){return this._lineSegmentResult},e.prototype._getDirection=function(t){var e,r,i,n,o,a,s,l,u,h,p,c,f,d={},m=0,y=1e6;for(e=0;e<this._lineSegmentResult.length;e++)if((a=this._lineSegmentResult[e]).floor===t.floor)for(r=0,o=a.detail.length;r<o;r++)for(s=a.detail[r],m++,p=0,f=!1,i=0;i<s.route.length-1;i++){if(p+=jn(u=this.map.lngLatToMercator((l=s.route)[i]),h=this.map.lngLatToMercator(l[i+1])).distance,c=qn(t,u,h),(n=Math.round(Math.sqrt((t.x-c.x)*(t.x-c.x)+(t.y-c.y)*(t.y-c.y))))<=y){if(y=n,d.current={floor:a.floor,passedLength:parseFloat((p-Math.sqrt((c.x-h.x)*(c.x-h.x)+(c.y-h.y)*(c.y-h.y))).toFixed(2)),direction:this._getLastSegmentDirection(a,s,m,e,r,o),start:s.start,end:s.end,nodes:s.nodes},a.detail[r+1]){var g=a.detail[r+1];d.next={floor:a.floor,totalLength:parseFloat(Gn(g.route).toFixed(2)),direction:this._getLastSegmentDirection(a,g,m+1,e,r+1,o),start:g.start,end:g.end,nodes:g.nodes}}else this._lineSegmentResult[e+1]&&(s=(a=this._lineSegmentResult[e+1]).detail[0],d.next={floor:a.floor,totalLength:parseFloat(Gn(s.route).toFixed(2)),direction:this._getLastSegmentDirection(a,s,m+1,e,0,a.detail.length),start:s.start,end:s.end,nodes:s.nodes});f=!0}f&&d.current&&(d.current.totalLength=parseFloat(p.toFixed(2)))}else m+=a.detail.length;return d},e.prototype._getLastSegmentDirection=function(t,e,r,i,n,o){return e.direction+(r>=this._lineSegmentLength?"-end":n===o-1?t.floor>this._lineSegmentResult[i+1].floor?"-down":"-up":"")},e.prototype._formatRoute=function(t){this._lineSegmentResult=[],this._lineSegmentLength=0;for(var e,r,i,n=t.result.route,o=0,a=0;a<n.length;a++){e=n[a].route;for(var s=0;s<e.length;s++){this._lineSegmentResult.push({detail:[],floor:(r=e[s]).mapInfo.floorNumber}),i=this._formatLineSegment(r.coordinates);for(var l=0;l<i.length-1;l++){var u=i[l],h=i[l+1],p=jn(u,h),c=0===l?"front":this._getTipsByAngle(p.angle-o),f=[],d=r.coordinates.slice(u.index,h.index+1);if(r.nodes.length)for(var m=0;m<r.nodes.length;m++)for(var y=r.nodes[m],g=1;g<d.length;g++){var _=qn(y,this.map.lngLatToMercator(d[g-1]),this.map.lngLatToMercator(d[g]));if(Math.sqrt((y.x-_.x)*(y.x-_.x)+(y.y-_.y)*(y.y-_.y))<.1){f.push(y);break}}this._lineSegmentResult[s].detail.push({start:this.map.mercatorToLngLat(u.x,u.y),end:this.map.mercatorToLngLat(h.x,h.y),route:d,nodes:f,direction:c}),this._lineSegmentLength++,o=p.angle}}}},e.prototype._formatLineSegment=function(t){var e=this.options.filterDistance,r=this.options.filterAngle,i=t.length-1,n=this.map.lngLatToMercator(t[0][0],t[0][1]);n.index=0;for(var o=[n],a=1;a<i;a++){var s=o[o.length-1],l=this.map.lngLatToMercator(t[a][0],t[a][1]),u=this.map.lngLatToMercator(t[a+1][0],t[a+1][1]),h=jn(s,l);if(!(Math.round(h.distance)<e)){var p=jn(l,u);if(h.angle=h.angle>180?h.angle-360:h.angle,p.angle=p.angle>180?p.angle-360:p.angle,Math.abs(h.angle-p.angle)>r){if(a===i-1&&Math.round(p.distance)<e)break;l.index=a,o.push(l)}}}return(n=this.map.lngLatToMercator(t[i][0],t[i][1])).index=i,o.push(n),o},e.prototype._getTipsByAngle=function(t){var e="front";return t>180?t-=360:t<-180&&(t=360-Math.abs(t)),t>-22.5&&t<22.5?e="front":t>22.5&&t<67.5?e="right-front":t>67.5&&t<112.5?e="right":t>112.5&&t<157.5?e="right-back":t>157.5&&t<-157.5?e="back":t>-157.5&&t<-112.5?e="left-back":t>-112.5&&t<-67.5?e="left":t>-67.5&&t<-22.5&&(e="left-front"),e},e}(bs),js=function(t){this.options=Bn({radius:[10,30],intensity:[1,5],opacity:.8,color:[.05,"#7888D8",.1,"#4DD835",.2,"#B9D126",.4,"#DEB92A",.6,"#DE6F2A",1,"#DB3023"]},t),this.$DATA_CACHE={type:"FeatureCollection",features:[]}};function qs(e,r,i){if(e=new t.LngLat(e.lng,e.lat),r){var n=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=i.locationPoint(e).distSqr(r);i.locationPoint(n).distSqr(r)<a?e=n:i.locationPoint(o).distSqr(r)<a&&(e=o)}for(;Math.abs(e.lng-i.center.lng)>180;){var s=i.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=i.width&&s.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e}js.prototype._initLayer=function(){this._layerId="brtmap-heatmap-layer-"+this.map.__NOW_TIME__,this._sourceId="brtmap-heatmap-source-"+this.map.__NOW_TIME__,this.map.addSource(this._sourceId,{type:"geojson",data:this.$DATA_CACHE}),this.map.addLayer({id:this._layerId,type:"heatmap",source:this._sourceId,paint:{"heatmap-weight":this._setWeight(100),"heatmap-intensity":this._setIntensity(this.options.intensity),"heatmap-color":this._setColor(this.options.color),"heatmap-radius":this._setRadius(this.options.radius),"heatmap-opacity":this.options.opacity}},"facility")},js.prototype._setWeight=function(t){return["interpolate",["linear"],["get","count"],0,0,t,1]},js.prototype._setIntensity=function(t){return t instanceof Array?1===t.length?t[0]:["interpolate",["linear"],["zoom"],15,t[0],22,t[1]]:t},js.prototype._setColor=function(t){return["interpolate",["linear"],["heatmap-density"],0,"rgba(255, 255, 255, 0)"].concat(t)},js.prototype._setRadius=function(t){return t instanceof Array?1===t.length?t[0]:["interpolate",["linear"],["zoom"],15,t[0],22,t[1]]:t},js.prototype._getFeature=function(t){var e=[];if(t.lng&&t.lat)e=[t.lng,t.lat];else if(t.x&&t.y){var r=Rn(t.x,t.y);e=[r.lng,r.lat]}return{type:"Feature",properties:{count:t.count},geometry:{type:"Point",coordinates:e}}},js.prototype.setData=function(t){t.max&&this.map.setPaintProperty(this._layerId,"heatmap-weight",this._setWeight(t.max));var e=[];if(t.data&&t.data.length)for(var r=0;r<t.data.length;r++)e.push(this._getFeature(t.data[r]));this.$DATA_CACHE.features=e,this._draw()},js.prototype._draw=function(){this.map.getSource(this._sourceId).setData(this.$DATA_CACHE)},js.prototype.addTo=function(t){return this.map=t,this._initLayer(),this};var Gs={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 Zs(t,e,r){var i=t.classList;for(var n in Gs)i.remove("mapboxgl-"+r+"-anchor-"+n);i.add("mapboxgl-"+r+"-anchor-"+e)}var Xs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ys=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Ws=function(r){function i(e){r.call(this),this.options=t.extend(Object.create(Xs),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i,i.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},i.prototype.isOpen=function(){return!!this._map},i.prototype.remove=function(){return this._content&&e.remove(this._content),this._container&&(e.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},i.prototype.getLngLat=function(){return this._lngLat},i.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},i.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},i.prototype.getElement=function(){return this._container},i.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},i.prototype.setHTML=function(e){var r,i=t.window.document.createDocumentFragment(),n=t.window.document.createElement("body");for(n.innerHTML=e;r=n.firstChild;)i.appendChild(r);return this.setDOMContent(i)},i.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},i.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},i.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=e.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},i.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},i.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},i.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},i.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},i.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=e.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))},i.prototype._onMouseUp=function(t){this._update(t.point)},i.prototype._onMouseMove=function(t){this._update(t.point)},i.prototype._onDrag=function(t){this._update(t.point)},i.prototype._update=function(r){var i=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=e.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=e.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return i._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=qs(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||r)){var n=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat),o=this.options.anchor,a=function e(r){if(r){if("number"==typeof r){var i=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(i,i),"top-right":new t.Point(-i,i),bottom:new t.Point(0,-r),"bottom-left":new t.Point(i,-i),"bottom-right":new t.Point(-i,-i),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var n=t.Point.convert(r);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(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.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 h=n.add(a[o]).round();e.setTransform(this._container,Gs[o]+" translate("+h.x+"px,"+h.y+"px)"),Zs(this._container,o,"popup")}},i.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Ys);t&&t.focus()}},i.prototype._onClose=function(){this.remove()},i}(t.Evented),Hs=function(r){function i(i,n){if(r.call(this),(i instanceof t.window.HTMLElement||n)&&(i=t.extend({element:i},n)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&"auto"!==i.pitchAlignment?i.pitchAlignment:this._rotationAlignment,i&&i.element)this._element=i.element,this._offset=t.Point.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=e.create("div"),this._element.setAttribute("aria-label","Map marker");var o=e.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=e.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=e.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");var l=e.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,h=[{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<h.length;u+=1){var p=h[u],c=e.createNS("http://www.w3.org/2000/svg","ellipse");c.setAttributeNS(null,"opacity","0.04"),c.setAttributeNS(null,"cx","10.5"),c.setAttributeNS(null,"cy","5.80029008"),c.setAttributeNS(null,"rx",p.rx),c.setAttributeNS(null,"ry",p.ry),l.appendChild(c)}var f=e.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill",this._color);var d=e.createNS("http://www.w3.org/2000/svg","path");d.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"),f.appendChild(d);var m=e.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"fill","#000000");var y=e.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 g=e.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(6.0, 7.0)"),g.setAttributeNS(null,"fill","#FFFFFF");var _=e.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(8.0, 8.0)");var v=e.createNS("http://www.w3.org/2000/svg","circle");v.setAttributeNS(null,"fill","#000000"),v.setAttributeNS(null,"opacity","0.25"),v.setAttributeNS(null,"cx","5.5"),v.setAttributeNS(null,"cy","5.5"),v.setAttributeNS(null,"r","5.4999962");var x=e.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"),_.appendChild(v),_.appendChild(x),s.appendChild(l),s.appendChild(f),s.appendChild(m),s.appendChild(g),s.appendChild(_),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(i&&i.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()})),Zs(this._element,this._anchor,"marker"),this._popup=null}return r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i,i.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},i.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),e.remove(this._element),this._popup&&this._popup.remove(),this},i.prototype.getLngLat=function(){return this._lngLat},i.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},i.prototype.getElement=function(){return this._element},i.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},i.prototype._onKeyPress=function(t){var e=t.code,r=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==r&&13!==r||this.togglePopup()},i.prototype._onMapClick=function(t){var e=t.originalEvent.target,r=this._element;this._popup&&(e===r||r.contains(e))&&this.togglePopup()},i.prototype.getPopup=function(){return this._popup},i.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},i.prototype._update=function(t){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=qs(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r="rotateZ("+this._rotation+"deg)":"map"===this._rotationAlignment&&(r="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i="rotateX("+this._map.getPitch()+"deg)"),t&&"moveend"!==t.type||(this._pos=this._pos.round()),e.setTransform(this._element,Gs[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+i+" "+r)}},i.prototype.getOffset=function(){return this._offset},i.prototype.setOffset=function(e){return this._offset=t.Point.convert(e),this._update(),this},i.prototype._onMove=function(e){if(!this._isDragging){var r=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=r}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")))},i.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"},i.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))},i.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},i.prototype.isDraggable=function(){return this._draggable},i.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},i.prototype.getRotation=function(){return this._rotation},i.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},i.prototype.getRotationAlignment=function(){return this._rotationAlignment},i.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},i.prototype.getPitchAlignment=function(){return this._pitchAlignment},i}(t.Evented),Ks={version:t.version,buildNow:"1629856568791",Configs:zn,Map:xs,Search:Ss,Symbol:Bs,NavIndicate:Us,Heatmap:js,Popup:Ws,Marker:Hs,Style:Ve,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point};return Ks})),r}));
//# sourceMappingURL=/sm/7d9ab016a02b4c0dc9ae4e3d8cb896b2b055509f33ff8b90cd9bbde26e6af49d.map