/*! For license information please see 483.cfd1db64.chunk.js.LICENSE.txt */ (self.webpackChunkfrontend1=self.webpackChunkfrontend1||[]).push([[483],{5483:function(e,t,i){var r=i(8416).default,n=i(6115).default,a=i(3515).default,o=i(1588).default,s=i(3808).default,l=i(4993).default,u=i(1589).default,c=i(861).default,h=i(7424).default,f=i(4704).default,d=i(6690).default,p=i(9728).default,v=i(1655).default,m=i(6389).default,y=i(3496).default;e.exports=function(){"use strict";var e,t,i;function _(r,n){if(e)if(t){var a="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",o={};e(o),i=n(o),"undefined"!==typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"})))}else t=n;else e=n}return _(["exports"],(function(e){var t,i,r,_="undefined"!=typeof self?self:{},g="2.14.1",x={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==t){var e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{t=null!={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.API_URL_REGEX?new RegExp({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.API_URL_REGEX):e}catch(_){t=e}}return t},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!x.API_URL)return null;try{var t=new URL(x.API_URL);return"api.mapbox.cn"===t.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===t.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},b={supported:!1,testSupport:function(e){!w&&r&&(k?T(e):i=e)}},w=!1,k=!1;function T(e){var t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.isContextLost())return;b.supported=!0}catch(e){}e.deleteTexture(t),w=!0}_.document&&((r=_.document.createElement("img")).onload=function(){i&&T(i),i=null,k=!0},r.onerror=function(){w=!0,i=null},r.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var E="01",S=M;function M(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}M.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?o=i:s=i,i=.5*(s-o)+o;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var A=I;function I(e,t){this.x=e,this.y=t}I.prototype={clone:function(){return new I(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},I.convert=function(e){return e instanceof I?e:Array.isArray(e)?new I(e[0],e[1]):e};var C=Math.PI/180,z=180/Math.PI;function P(e){return e*C}function D(e){return e*z}var L=[[0,0],[1,0],[1,1],[0,1]];function R(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function B(e,t,i,r){var n=new S(e,t,i,r);return function(e){return n.solve(e)}}var O=B(.25,.1,.25,1);function F(e,t,i){return Math.min(i,Math.max(t,e))}function U(e,t,i){return(i=F((i-e)/(t-e),0,1))*i*(3-2*i)}function V(e,t,i){var r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function N(e,t,i){if(!e.length)return i(null,[]);var r=e.length,n=new Array(e.length),a=null;e.forEach((function(e,o){t(e,(function(e,t){e&&(a=e),n[o]=t,0==--r&&i(a,n)}))}))}function j(e){var t=[];for(var i in e)t.push(e[i]);return t}function G(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function X(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function H(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Y(e,t){e.forEach((function(e){t[e]&&(t[e]=t[e].bind(t))}))}function K(e,t){return-1!==e.indexOf(t,e.length-t.length)}function J(e,t,i){var r={};for(var n in e)r[n]=t.call(i||this,e[n],n,e);return r}function $(e,t,i){var r={};for(var n in e)t.call(i||this,e[n],n,e)&&(r[n]=e[n]);return r}function Q(e){return Array.isArray(e)?e.map(Q):"object"==typeof e&&e?J(e,Q):e}var ee={};function te(e){ee[e]||("undefined"!=typeof console&&console.warn(e),ee[e]=!0)}function ie(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function re(e){for(var t,i,r=0,n=0,a=e.length,o=a-1;n@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(e,i,r,n){var a=r||n;return t[i]=!a||a.toLowerCase(),""})),t["max-age"]){var i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t}var oe=null;function se(e){if(null==oe){var t=e.navigator?e.navigator.userAgent:null;oe=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return oe}function le(e){try{var t=_[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function ue(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}var ce,he,fe="mapbox-tiles",de=500,pe=50;function ve(){try{return _.caches}catch(e){}}function me(){ve()&&!ce&&(ce=_.caches.open(fe))}function ye(e){var t=e.indexOf("?");if(t<0)return e;var i=function(e){var t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}(e),r=i.filter((function(e){var t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return r.length?"".concat(e.slice(0,t),"?").concat(r.join("&")):e.slice(0,t)}var _e=1/0,ge={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ge);var xe=function(e){v(i,e);var t=m(i);function i(e,r,n){var a;return d(this,i),401===r&&ze(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),(a=t.call(this,e)).status=r,a.url=n,a}return p(i,[{key:"toString",value:function(){return"".concat(this.name,": ").concat(this.message," (").concat(this.status,"): ").concat(this.url)}}]),i}(y(Error)),be=ne()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===_.location.protocol?_.parent:_).location.href},we=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(be())&&!/^\w+:/.test(i))){if(_.fetch&&_.Request&&_.AbortController&&_.Request.prototype.hasOwnProperty("signal"))return function(e,t){var i,r=new _.AbortController,n=new _.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:be(),referrerPolicy:e.referrerPolicy,signal:r.signal}),a=!1,o=!1,s=(i=n.url).indexOf("sku=")>0&&ze(i);"json"===e.type&&n.headers.set("Accept","application/json");var l=function(i,r,a){if(!o){if(i&&"SecurityError"!==i.message&&te(i),r&&a)return u(r);var l=Date.now();_.fetch(n).then((function(i){if(i.ok){var r=s?i.clone():null;return u(i,r,l)}return t(new xe(i.statusText,i.status,e.url))})).catch((function(i){"AbortError"!==i.name&&t(new Error("".concat(i.message," ").concat(e.url)))}))}},u=function(i,r,s){("arrayBuffer"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text()).then((function(e){o||(r&&s&&function(e,t,i){if(me(),ce){var r={status:t.status,statusText:t.statusText,headers:new _.Headers};t.headers.forEach((function(e,t){return r.headers.set(t,e)}));var n=ae(t.headers.get("Cache-Control")||"");if(!n["no-store"]){n["max-age"]&&r.headers.set("Expires",new Date(i+1e3*n["max-age"]).toUTCString());var a=r.headers.get("Expires");a&&(new Date(a).getTime()-i<42e4||function(e,t){if(void 0===he)try{new Response(new ReadableStream),he=!0}catch(e){he=!1}he?t(e.body):e.blob().then(t)}(t,(function(t){var i=new _.Response(t,r);me(),ce&&ce.then((function(t){return t.put(ye(e.url),i)})).catch((function(e){return te(e.message)}))})))}}}(n,r,s),a=!0,t(null,e,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((function(e){o||t(new Error(e.message))}))};return s?function(e,t){if(me(),!ce)return t(null);var i=ye(e.url);ce.then((function(e){e.match(i).then((function(r){var n=function(e){if(!e)return!1;var t=new Date(e.headers.get("Expires")||0),i=ae(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(r);e.delete(i),n&&e.put(i,r.clone()),t(null,r,n)})).catch(t)})).catch(t)}(n,l):l(null,null),{cancel:function(){o=!0,a||r.abort()}}}(e,t);if(ne()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var i;return function(e,t){var i=new _.XMLHttpRequest;for(var r in i.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(i.responseType="arraybuffer"),e.headers)i.setRequestHeader(r,e.headers[r]);return"json"===e.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===e.credentials,i.onerror=function(){t(new Error(i.statusText))},i.onload=function(){if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){var r=i.response;if("json"===e.type)try{r=JSON.parse(i.response)}catch(e){return t(e)}t(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else t(new xe(i.statusText,i.status,e.url))},i.send(e.body),{cancel:function(){return i.abort()}}}(e,t)},ke=function(e,t){return we(G(e,{type:"arrayBuffer"}),t)};function Te(e){var t=_.document.createElement("a");return t.href=e,t.protocol===_.document.location.protocol&&t.host===_.document.location.host}var Ee,Se,Me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";Ee=[],Se=0;var Ae=function e(t,i){if(b.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Se>=x.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:i,cancelled:!1,cancel:function(){this.cancelled=!0}};return Ee.push(r),r}Se++;var n=!1,a=function(){if(!n)for(n=!0,Se--;Ee.length&&Se=1&&_.localStorage.setItem(t,JSON.stringify(this.eventData))}catch(e){te("Unable to write to LocalStorage")}}},{key:"processRequests",value:function(e){}},{key:"postEvent",value:function(e,t,i,r){var n=this;if(x.EVENTS_URL){var a=Be(x.EVENTS_URL);a.params.push("access_token=".concat(r||x.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(e).toISOString()},s=t?G(o,t):o,l={url:Oe(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=function(e,t){return we(G(e,{method:"POST"}),t)}(l,(function(e){n.pendingRequest=null,i(e),n.saveEventData(),n.processRequests(r)}))}}},{key:"queueRequest",value:function(e,t){this.queue.push(e),this.processRequests(t)}}]),e}(),Ve=new(function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,"appUserTurnstile"))._customAccessToken=e,r}return p(i,[{key:"postTurnstileEvent",value:function(e,t){x.EVENTS_URL&&x.ACCESS_TOKEN&&Array.isArray(e)&&e.some((function(e){return Ce(e)||ze(e)}))&&this.queueRequest(Date.now(),t)}},{key:"processRequests",value:function(e){var t=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var i=Fe(x.ACCESS_TOKEN),r=i?i.u:x.ACCESS_TOKEN,n=r!==this.eventData.tokenU;H(this.anonId)||(this.anonId=W(),n=!0);var a=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(a),l=(a-this.eventData.lastSuccess)/864e5;n=n||l>=1||l<-1||o.getDate()!==s.getDate()}else n=!0;n?this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:g,skuId:E,"enabled.telemetry":!1,userId:this.anonId},(function(e){e||(t.eventData.lastSuccess=a,t.eventData.tokenU=r)}),e):this.processRequests()}}}]),i}(Ue)),Ne=Ve.postTurnstileEvent.bind(Ve),je=new(function(e){v(i,e);var t=m(i);function i(){var e;return d(this,i),(e=t.call(this,"map.load")).success={},e.skuToken="",e}return p(i,[{key:"postMapLoadEvent",value:function(e,t,i,r){this.skuToken=t,this.errorCb=r,x.EVENTS_URL&&(i||x.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(Ie)))}},{key:"processRequests",value:function(e){var t=this;if(!this.pendingRequest&&0!==this.queue.length){var i=this.queue.shift(),r=i.id,n=i.timestamp;r&&this.success[r]||(this.anonId||this.fetchEventData(),H(this.anonId)||(this.anonId=W()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:g,skuId:E,skuToken:this.skuToken,userId:this.anonId},(function(e){e?t.errorCb(e):r&&(t.success[r]=!0)}),e))}}}]),i}(Ue)),Ge=je.postMapLoadEvent.bind(je),Ze=new(function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.call(this,"gljs.performance")}return p(i,[{key:"postPerformanceEvent",value:function(e,t){x.EVENTS_URL&&(e||x.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}},{key:"processRequests",value:function(e){if(!this.pendingRequest&&0!==this.queue.length){var t,i=this.queue.shift(),r=i.timestamp,n=function(e){var t=_.performance.getEntriesByType("resource"),i=_.performance.getEntriesByType("mark"),r=function(e){var t={};if(e)for(var i in e)if("other"!==i){var r,n=f(e[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value,o="".concat(i,"ResolveRangeMin"),s="".concat(i,"ResolveRangeMax"),l="".concat(i,"RequestCount"),u="".concat(i,"RequestCachedCount");t[o]=Math.min(t[o]||1/0,a.startTime),t[s]=Math.max(t[s]||-1/0,a.responseEnd);var c=function(e){void 0===t[e]&&(t[e]=0),++t[e]};void 0!==a.transferSize&&0===a.transferSize&&c(u),c(l)}}catch(h){n.e(h)}finally{n.f()}}return t}(function(e,t){var i={};if(e){var r,n=f(e);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=t(a);void 0===i[o]&&(i[o]=[]),i[o].push(a)}}catch(s){n.e(s)}finally{n.f()}}return i}(t,Je)),n=_.devicePixelRatio,a=_.navigator.connection||_.navigator.mozConnection||_.navigator.webkitConnection,o={counters:[],metadata:[],attributes:[]},s=function(e,t,i){null!=i&&e.push({name:t,value:i.toString()})};for(var l in r)s(o.counters,l,r[l]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(s(o.counters,"interactionRangeMin",e.interactionRange[0]),s(o.counters,"interactionRangeMax",e.interactionRange[1])),i)for(var u=function(){var e=h[c],t=Ye[e],r=i.find((function(e){return e.name===t}));r&&s(o.counters,t,r.startTime)},c=0,h=Object.keys(Ye);c1&&void 0!==arguments[1]?arguments[1]:0,i=e.width,r=e.height;tt||(tt=_.document.createElement("canvas"));var n=tt.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>tt.width||r>tt.height)&&(tt.width=i,tt.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:function(e){return $e||($e=_.document.createElement("a")),$e.href=e,$e.href},get devicePixelRatio(){return _.devicePixelRatio},get prefersReducedMotion(){return!!_.matchMedia&&(null==Qe&&(Qe=_.matchMedia("(prefers-reduced-motion: reduce)")),Qe.matches)}};function at(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function ot(e,t,i){if(i&&i[e]){var r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}var st=p((function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};d(this,e),G(this,i),this.type=t})),lt=function(e){v(i,e);var t=m(i);function i(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return d(this,i),t.call(this,"error",G({error:e},r))}return p(i)}(st),ut=function(){function e(){d(this,e)}return p(e,[{key:"on",value:function(e,t){return this._listeners=this._listeners||{},at(e,t,this._listeners),this}},{key:"off",value:function(e,t){return ot(e,t,this._listeners),ot(e,t,this._oneTimeListeners),this}},{key:"once",value:function(e,t){var i=this;return t?(this._oneTimeListeners=this._oneTimeListeners||{},at(e,t,this._oneTimeListeners),this):new Promise((function(t){return i.once(e,t)}))}},{key:"fire",value:function(e,t){"string"==typeof e&&(e=new st(e,t||{}));var i=e.type;if(this.listens(i)){e.target=this;var r,n=this._listeners&&this._listeners[i]?this._listeners[i].slice():[],a=f(n);try{for(a.s();!(r=a.n()).done;)r.value.call(this,e)}catch(h){a.e(h)}finally{a.f()}var o,s=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[],l=f(s);try{for(l.s();!(o=l.n()).done;){var u=o.value;ot(i,u,this._oneTimeListeners),u.call(this,e)}}catch(h){l.e(h)}finally{l.f()}var c=this._eventedParent;c&&(G(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),c.fire(e))}else e instanceof lt&&console.error(e.error);return this}},{key:"listens",value:function(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}},{key:"setEventedParent",value:function(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}]),e}(),ct=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function ht(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:[];d(this,e),this.parent=t,this.bindings={};var r,n=f(i);try{for(n.s();!(r=n.n()).done;){var a=h(r.value,2),o=a[0],s=a[1];this.bindings[o]=s}}catch(l){n.e(l)}finally{n.f()}}return p(e,[{key:"concat",value:function(t){return new e(this,t)}},{key:"get",value:function(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}},{key:"has",value:function(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}]),e}(),yt=mt,_t={kind:"null"},gt={kind:"number"},xt={kind:"string"},bt={kind:"boolean"},wt={kind:"color"},kt={kind:"object"},Tt={kind:"value"},Et={kind:"collator"},St={kind:"formatted"},Mt={kind:"resolvedImage"};function At(e,t){return{kind:"array",itemType:e,N:t}}function It(e){if("array"===e.kind){var t=It(e.itemType);return"number"==typeof e.N?"array<".concat(t,", ").concat(e.N,">"):"value"===e.itemType.kind?"array":"array<".concat(t,">")}return e.kind}var Ct=[_t,gt,xt,bt,wt,St,kt,At(Tt),Mt];function zt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!zt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(var i=0,r=Ct;i255?255:e}function Ot(e){return Bt("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function Ft(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function Ut(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{Lt={}.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in Rt)return Rt[i].slice();if("#"===i[0])return 4===i.length?(t=parseInt(i.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===i.length&&(t=parseInt(i.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var r=i.indexOf("("),n=i.indexOf(")");if(-1!==r&&n+1===i.length){var a=i.substr(0,r),o=i.substr(r+1,n-(r+1)).split(","),s=1;switch(a){case"rgba":if(4!==o.length)return null;s=Ft(o.pop());case"rgb":return 3!==o.length?null:[Ot(o[0]),Ot(o[1]),Ot(o[2]),s];case"hsla":if(4!==o.length)return null;s=Ft(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,u=Ft(o[1]),c=Ft(o[2]),h=c<=.5?c*(u+1):c+u-c*u,f=2*c-h;return[Bt(255*Ut(f,h,l+1/3)),Bt(255*Ut(f,h,l)),Bt(255*Ut(f,h,l-1/3)),s];default:return null}}return null}}catch(e){}var Vt=function(){function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;d(this,e),this.r=t,this.g=i,this.b=r,this.a=n}return p(e,[{key:"toString",value:function(){var e=this.toArray(),t=h(e,4),i=t[0],r=t[1],n=t[2],a=t[3];return"rgba(".concat(Math.round(i),",").concat(Math.round(r),",").concat(Math.round(n),",").concat(a,")")}},{key:"toArray",value:function(){var e=this.r,t=this.g,i=this.b,r=this.a;return 0===r?[0,0,0,0]:[255*e/r,255*t/r,255*i/r,r]}},{key:"toArray01",value:function(){var e=this.r,t=this.g,i=this.b,r=this.a;return 0===r?[0,0,0,0]:[e/r,t/r,i/r,r]}},{key:"toArray01PremultipliedAlpha",value:function(){return[this.r,this.g,this.b,this.a]}}],[{key:"parse",value:function(t){if(t){if(t instanceof e)return t;if("string"==typeof t){var i=Lt(t);return i?new e(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}}}}]),e}();Vt.black=new Vt(0,0,0,1),Vt.white=new Vt(1,1,1,1),Vt.transparent=new Vt(0,0,0,0),Vt.red=new Vt(1,0,0,1),Vt.blue=new Vt(0,0,1,1);var Nt=Vt,jt=function(){function e(t,i,r){d(this,e),this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}return p(e,[{key:"compare",value:function(e,t){return this.collator.compare(e,t)}},{key:"resolvedLocale",value:function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}]),e}(),Gt=p((function e(t,i,r,n,a){d(this,e),this.text=t.normalize?t.normalize():t,this.image=i,this.scale=r,this.fontStack=n,this.textColor=a})),Zt=function(){function e(t){d(this,e),this.sections=t}return p(e,[{key:"isEmpty",value:function(){return 0===this.sections.length||!this.sections.some((function(e){return 0!==e.text.length||e.image&&0!==e.image.name.length}))}},{key:"toString",value:function(){return 0===this.sections.length?"":this.sections.map((function(e){return e.text})).join("")}},{key:"serialize",value:function(){var e,t=["format"],i=f(this.sections);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.image)t.push(["image",r.image.name]);else{t.push(r.text);var n={};r.fontStack&&(n["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(n["font-scale"]=r.scale),r.textColor&&(n["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(n)}}}catch(a){i.e(a)}finally{i.f()}return t}}],[{key:"fromString",value:function(t){return new e([new Gt(t,null,null,null,null)])}},{key:"factory",value:function(t){return t instanceof e?t:e.fromString(t)}}]),e}(),qt=function(){function e(t){d(this,e),this.name=t.name,this.available=t.available}return p(e,[{key:"toString",value:function(){return this.name}},{key:"serialize",value:function(){return["image",this.name]}}],[{key:"fromString",value:function(t){return t?new e({name:t,available:!1}):null}}]),e}();function Wt(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:"Invalid rgba value [".concat([e,t,i,r].join(", "),"]: 'a' must be between 0 and 1."):"Invalid rgba value [".concat(("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}function Xt(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Nt)return!0;if(e instanceof jt)return!0;if(e instanceof Zt)return!0;if(e instanceof qt)return!0;if(Array.isArray(e)){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(!Xt(t.value))return!1}catch(n){i.e(n)}finally{i.f()}return!0}if("object"==typeof e){for(var r in e)if(!Xt(e[r]))return!1;return!0}return!1}function Ht(e){if(null===e)return _t;if("string"==typeof e)return xt;if("boolean"==typeof e)return bt;if("number"==typeof e)return gt;if(e instanceof Nt)return wt;if(e instanceof jt)return Et;if(e instanceof Zt)return St;if(e instanceof qt)return Mt;if(Array.isArray(e)){var t,i,r=e.length,n=f(e);try{for(n.s();!(i=n.n()).done;){var a=Ht(i.value);if(t){if(t===a)continue;t=Tt;break}t=a}}catch(o){n.e(o)}finally{n.f()}return At(t||Tt,r)}return kt}function Yt(e){var t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Nt||e instanceof Zt||e instanceof qt?e.toString():JSON.stringify(e)}var Kt=function(){function e(t,i){d(this,e),this.type=t,this.value=i}return p(e,[{key:"evaluate",value:function(){return this.value}},{key:"eachChild",value:function(){}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Nt?["rgba"].concat(this.value.toArray()):this.value instanceof Zt?this.value.serialize():this.value}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("'literal' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!Xt(t[1]))return i.error("invalid value");var r=t[1],n=Ht(r),a=i.expectedType;return"array"!==n.kind||0!==n.N||!a||"array"!==a.kind||"number"==typeof a.N&&0!==a.N||(n=a),new e(n,r)}}]),e}(),Jt=Kt,$t=function(){function e(t){d(this,e),this.name="ExpressionEvaluationError",this.message=t}return p(e,[{key:"toJSON",value:function(){return this.message}}]),e}(),Qt={string:xt,number:gt,boolean:bt,object:kt},ei=function(){function e(t,i){d(this,e),this.type=t,this.args=i}return p(e,[{key:"evaluate",value:function(e){for(var t=0;t1)&&t.push(r)}}return t.concat(this.args.map((function(e){return e.serialize()})))}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expected at least one argument.");var r,n=1,a=t[0];if("array"===a){var o,s;if(t.length>2){var l=t[1];if("string"!=typeof l||!(l in Qt)||"object"===l)return i.error('The item type argument of "array" must be one of string, number, boolean',1);o=Qt[l],n++}else o=Tt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=At(o,s)}else r=Qt[a];for(var u=[];n-1),i}},{key:"eachChild",value:function(e){e(this.input)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return["image",this.input.serialize()]}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("Expected two arguments.");var r=i.parse(t[1],1,xt);return r?new e(r):i.error("No image name provided.")}}]),e}(),ni={"to-boolean":bt,"to-color":wt,"to-number":gt,"to-string":xt},ai=function(){function e(t,i){d(this,e),this.type=t,this.args=i}return p(e,[{key:"evaluate",value:function(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){var t,i,r,n=f(this.args);try{for(n.s();!(r=n.n()).done;){if(t=r.value.evaluate(e),i=null,t instanceof Nt)return t;if("string"==typeof t){var a=e.parseColor(t);if(a)return a}else if(Array.isArray(t)&&!(i=t.length<3||t.length>4?"Invalid rbga value ".concat(JSON.stringify(t),": expected an array containing either three or four numeric values."):Wt(t[0],t[1],t[2],t[3])))return new Nt(t[0]/255,t[1]/255,t[2]/255,t[3])}}catch(c){n.e(c)}finally{n.f()}throw new $t(i||"Could not parse color from value '".concat("string"==typeof t?t:String(JSON.stringify(t)),"'"))}if("number"===this.type.kind){var o,s=null,l=f(this.args);try{for(l.s();!(o=l.n()).done;){if(null===(s=o.value.evaluate(e)))return 0;var u=Number(s);if(!isNaN(u))return u}}catch(c){l.e(c)}finally{l.f()}throw new $t("Could not convert ".concat(JSON.stringify(s)," to number."))}return"formatted"===this.type.kind?Zt.fromString(Yt(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?qt.fromString(Yt(this.args[0].evaluate(e))):Yt(this.args[0].evaluate(e))}},{key:"eachChild",value:function(e){this.args.forEach(e)}},{key:"outputDefined",value:function(){return this.args.every((function(e){return e.outputDefined()}))}},{key:"serialize",value:function(){if("formatted"===this.type.kind)return new ii([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ri(this.args[0]).serialize();var e=["to-".concat(this.type.kind)];return this.eachChild((function(t){e.push(t.serialize())})),e}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return i.error("Expected one argument.");for(var n=ni[r],a=[],o=1;o=t[2]||e[1]<=t[1]||e[3]>=t[3])}function vi(e,t){var i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*fi),Math.round(r*n*fi)]}function mi(e,t,i){var r=e[0]-t[0],n=e[1]-t[1],a=e[0]-i[0],o=e[1]-i[1];return r*o-a*n==0&&r*a<=0&&n*o<=0}function yi(e,t){for(var i,r,n,a=!1,o=0,s=t.length;o(i=e)[1]!=(n=l[u+1])[1]>i[1]&&i[0]<(n[0]-r[0])*(i[1]-r[1])/(n[1]-r[1])+r[0]&&(a=!a)}return a}function _i(e,t){for(var i=0;i0&&s<0||o<0&&s>0}function xi(e,t,i){var r,n,a,o,s,l,u,c=f(i);try{for(c.s();!(r=c.n()).done;)for(var h=r.value,d=0;di[2]){var n=.5*r,a=e[0]-i[0]>n?-r:i[0]-e[0]>n?r:0;0===a&&(a=e[0]-i[2]>n?-r:i[2]-e[0]>n?r:0),e[0]+=a}di(t,e)}function Si(e,t,i,r){var n=Math.pow(2,r.z)*fi,a=[r.x*fi,r.y*fi],o=[];if(!e)return o;var s,l=f(e);try{for(l.s();!(s=l.n()).done;){var u,c=s.value,h=f(c);try{for(h.s();!(u=h.n()).done;){var d=u.value,p=[d.x+a[0],d.y+a[1]];Ei(p,t,i,n),o.push(p)}}catch(v){h.e(v)}finally{h.f()}}}catch(v){l.e(v)}finally{l.f()}return o}function Mi(e,t,i,r){var n=Math.pow(2,r.z)*fi,a=[r.x*fi,r.y*fi],o=[];if(!e)return o;var s,l,u=f(e);try{for(u.s();!(s=u.n()).done;){var c,h=s.value,d=[],p=f(h);try{for(p.s();!(c=p.n()).done;){var v=c.value,m=[v.x+a[0],v.y+a[1]];di(t,m),d.push(m)}}catch(w){p.e(w)}finally{p.f()}o.push(d)}}catch(w){u.e(w)}finally{u.f()}if(t[2]-t[0]<=n/2){(l=t)[0]=l[1]=1/0,l[2]=l[3]=-1/0;var y,_=f(o);try{for(_.s();!(y=_.n()).done;){var g,x=y.value,b=f(x);try{for(b.s();!(g=b.n()).done;)Ei(g.value,t,i,n)}catch(w){b.e(w)}finally{b.f()}}}catch(w){_.e(w)}finally{_.f()}}return o}var Ai=function(){function e(t,i){d(this,e),this.type=bt,this.geojson=t,this.geometries=i}return p(e,[{key:"evaluate",value:function(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){var a=ki(t.coordinates,r,n),o=Si(e.geometry(),i,r,n);if(!pi(i,r))return!1;var s,l=f(o);try{for(l.s();!(s=l.n()).done;)if(!yi(s.value,a))return!1}catch(p){l.e(p)}finally{l.f()}}if("MultiPolygon"===t.type){var u=Ti(t.coordinates,r,n),c=Si(e.geometry(),i,r,n);if(!pi(i,r))return!1;var h,d=f(c);try{for(d.s();!(h=d.n()).done;)if(!_i(h.value,u))return!1}catch(p){d.e(p)}finally{d.f()}}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){var a=ki(t.coordinates,r,n),o=Mi(e.geometry(),i,r,n);if(!pi(i,r))return!1;var s,l=f(o);try{for(l.s();!(s=l.n()).done;)if(!bi(s.value,a))return!1}catch(p){l.e(p)}finally{l.f()}}if("MultiPolygon"===t.type){var u=Ti(t.coordinates,r,n),c=Mi(e.geometry(),i,r,n);if(!pi(i,r))return!1;var h,d=f(c);try{for(d.s();!(h=d.n()).done;)if(!wi(h.value,u))return!1}catch(p){d.e(p)}finally{d.f()}}return!0}(e,this.geometries)}return!1}},{key:"eachChild",value:function(){}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){return["within",this.geojson]}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("'within' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(Xt(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;n=0)return!1;var i=!0;return e.eachChild((function(e){i&&!Pi(e,t)&&(i=!1)})),i}var Di=function(){function e(t,i){d(this,e),this.type=i.type,this.name=t,this.boundExpression=i}return p(e,[{key:"evaluate",value:function(e){return this.boundExpression.evaluate(e)}},{key:"eachChild",value:function(){}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return["var",this.name]}}],[{key:"parse",value:function(t,i){if(2!==t.length||"string"!=typeof t[1])return i.error("'var' expression requires exactly one string literal argument.");var r=t[1];return i.scope.has(r)?new e(r,i.scope.get(r)):i.error('Unknown variable "'.concat(r,'". Make sure "').concat(r,'" has been bound in an enclosing "let" expression before using it.'),1)}}]),e}(),Li=Di,Ri=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new yt,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];d(this,e),this.registry=t,this.path=i,this.key=i.map((function(e){return"[".concat(e,"]")})).join(""),this.scope=n,this.errors=a,this.expectedType=r}return p(e,[{key:"parse",value:function(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}},{key:"_parse",value:function(e,t){function i(e,t,i){return"assert"===i?new ti(t,[e]):"coerce"===i?new oi(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=e[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found ".concat(typeof r,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;var n=this.registry[r];if(n){var a=n.parse(e,this);if(!a)return null;if(this.expectedType){var o=this.expectedType,s=a.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else a=i(a,o,t.typeAnnotation||"coerce");else a=i(a,o,t.typeAnnotation||"assert")}if(!(a instanceof Jt)&&"resolvedImage"!==a.type.kind&&Oi(a)){var l=new li;try{a=new Jt(a.type,a.evaluate(l))}catch(e){return this.error(e.message),null}}return a}return this.error('Unknown expression "'.concat(r,'". If you wanted a literal array, use ["literal", [...]].'),0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found ".concat(typeof e," instead."))}},{key:"concat",value:function(t,i,r){var n="number"==typeof t?this.path.concat(t):this.path,a=r?this.scope.concat(r):this.scope;return new e(this.registry,n,i||null,a,this.errors)}},{key:"error",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;rt))throw new $t("Input is not a number.");o=s-1}return 0}var Ui=function(){function e(t,i,r){d(this,e),this.type=t,this.input=i,this.labels=[],this.outputs=[];var n,a=f(r);try{for(a.s();!(n=a.n()).done;){var o=h(n.value,2),s=o[0],l=o[1];this.labels.push(s),this.outputs.push(l)}}catch(u){a.e(u)}finally{a.f()}}return p(e,[{key:"evaluate",value:function(e){var t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);var r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);var n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[Fi(t,r)].evaluate(e)}},{key:"eachChild",value:function(e){e(this.input);var t,i=f(this.outputs);try{for(i.s();!(t=i.n()).done;)e(t.value)}catch(r){i.e(r)}finally{i.f()}}},{key:"outputDefined",value:function(){return this.outputs.every((function(e){return e.outputDefined()}))}},{key:"serialize",value:function(){for(var e=["step",this.input.serialize()],t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}],[{key:"parse",value:function(t,i){if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");var r=i.parse(t[1],1,gt);if(!r)return null;var n=[],a=null;i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);for(var o=1;o=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var h=i.parse(l,c,a);if(!h)return null;a=a||h.type,n.push([s,h])}return new e(a,r,n)}}]),e}(),Vi=Ui;function Ni(e,t,i){return e*(1-i)+t*i}var ji=Object.freeze({__proto__:null,number:Ni,color:function(e,t,i){return new Nt(Ni(e.r,t.r,i),Ni(e.g,t.g,i),Ni(e.b,t.b,i),Ni(e.a,t.a,i))},array:function(e,t,i){return e.map((function(e,r){return Ni(e,t[r],i)}))}}),Gi=.95047,Zi=1.08883,qi=4/29,Wi=6/29,Xi=3*Wi*Wi,Hi=Math.PI/180,Yi=180/Math.PI;function Ki(e){return e>.008856451679035631?Math.pow(e,1/3):e/Xi+qi}function Ji(e){return e>Wi?e*e*e:Xi*(e-qi)}function $i(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Qi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function er(e){var t=Qi(e.r),i=Qi(e.g),r=Qi(e.b),n=Ki((.4124564*t+.3575761*i+.1804375*r)/Gi),a=Ki((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*a-16,a:500*(n-a),b:200*(a-Ki((.0193339*t+.119192*i+.9503041*r)/Zi)),alpha:e.a}}function tr(e){var t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*Ji(t),i=Gi*Ji(i),r=Zi*Ji(r),new Nt($i(3.2404542*i-1.5371385*t-.4985314*r),$i(-.969266*i+1.8760108*t+.041556*r),$i(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function ir(e,t,i){var r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}var rr={forward:er,reverse:tr,interpolate:function(e,t,i){return{l:Ni(e.l,t.l,i),a:Ni(e.a,t.a,i),b:Ni(e.b,t.b,i),alpha:Ni(e.alpha,t.alpha,i)}}},nr={forward:function(e){var t=er(e),i=t.l,r=t.a,n=t.b,a=Math.atan2(n,r)*Yi;return{h:a<0?a+360:a,c:Math.sqrt(r*r+n*n),l:i,alpha:e.a}},reverse:function(e){var t=e.h*Hi,i=e.c;return tr({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:ir(e.h,t.h,i),c:Ni(e.c,t.c,i),l:Ni(e.l,t.l,i),alpha:Ni(e.alpha,t.alpha,i)}}},ar=Object.freeze({__proto__:null,lab:rr,hcl:nr}),or=function(){function e(t,i,r,n,a){d(this,e),this.type=t,this.operator=i,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];var o,s=f(a);try{for(s.s();!(o=s.n()).done;){var l=h(o.value,2),u=l[0],c=l[1];this.labels.push(u),this.outputs.push(c)}}catch(p){s.e(p)}finally{s.f()}}return p(e,[{key:"evaluate",value:function(t){var i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);var a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);var o=Fi(i,n),s=e.interpolationFactor(this.interpolation,n,i[o],i[o+1]),l=r[o].evaluate(t),u=r[o+1].evaluate(t);return"interpolate"===this.operator?ji[this.type.kind.toLowerCase()](l,u,s):"interpolate-hcl"===this.operator?nr.reverse(nr.interpolate(nr.forward(l),nr.forward(u),s)):rr.reverse(rr.interpolate(rr.forward(l),rr.forward(u),s))}},{key:"eachChild",value:function(e){e(this.input);var t,i=f(this.outputs);try{for(i.s();!(t=i.n()).done;)e(t.value)}catch(r){i.e(r)}finally{i.f()}}},{key:"outputDefined",value:function(){return this.outputs.every((function(e){return e.outputDefined()}))}},{key:"serialize",value:function(){var e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var t=[this.operator,e,this.input.serialize()],i=0;i1})))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:c}}if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(o=i.parse(o,2,gt)))return null;var h=[],f=null;"interpolate-hcl"===n||"interpolate-lab"===n?f=wt:i.expectedType&&"value"!==i.expectedType.kind&&(f=i.expectedType);for(var d=0;d=p)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',m);var _=i.parse(v,y,f);if(!_)return null;f=f||_.type,h.push([p,_])}return"number"===f.kind||"color"===f.kind||"array"===f.kind&&"number"===f.itemType.kind&&"number"==typeof f.N?new e(f,n,a,o,h):i.error("Type ".concat(It(f)," is not interpolatable."))}}]),e}();function sr(e,t,i,r){var n=r-i,a=e-i;return 0===n?0:1===t?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var lr=or,ur=function(){function e(t,i){d(this,e),this.type=t,this.args=i}return p(e,[{key:"evaluate",value:function(e){var t,i,r=null,n=0,a=f(this.args);try{for(a.s();!(i=a.n()).done;){var o=i.value;if(n++,(r=o.evaluate(e))&&r instanceof qt&&!r.available&&(t||(t=r),r=null,n===this.args.length))return t;if(null!==r)break}}catch(s){a.e(s)}finally{a.f()}return r}},{key:"eachChild",value:function(e){this.args.forEach(e)}},{key:"outputDefined",value:function(){return this.args.every((function(e){return e.outputDefined()}))}},{key:"serialize",value:function(){var e=["coalesce"];return this.eachChild((function(t){e.push(t.serialize())})),e}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expectected at least one argument.");var r=null,n=i.expectedType;n&&"value"!==n.kind&&(r=n);var a,o=[],s=f(t.slice(1));try{for(s.s();!(a=s.n()).done;){var l=a.value,u=i.parse(l,1+o.length,r,void 0,{typeAnnotation:"omit"});if(!u)return null;r=r||u.type,o.push(u)}}catch(h){s.e(h)}finally{s.f()}var c=n&&o.some((function(e){return zt(n,e.type)}));return new e(c?Tt:r,o)}}]),e}(),cr=ur,hr=function(){function e(t,i){d(this,e),this.type=i.type,this.bindings=[].concat(t),this.result=i}return p(e,[{key:"evaluate",value:function(e){return this.result.evaluate(e)}},{key:"eachChild",value:function(e){var t,i=f(this.bindings);try{for(i.s();!(t=i.n()).done;)e(t.value[1])}catch(r){i.e(r)}finally{i.f()}e(this.result)}},{key:"outputDefined",value:function(){return this.result.outputDefined()}},{key:"serialize",value:function(){var e,t=["let"],i=f(this.bindings);try{for(i.s();!(e=i.n()).done;){var r=h(e.value,2),n=r[0],a=r[1];t.push(n,a.serialize())}}catch(o){i.e(o)}finally{i.f()}return t.push(this.result.serialize()),t}}],[{key:"parse",value:function(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));for(var r=[],n=1;n=i.length)throw new $t("Array index out of bounds: ".concat(t," > ").concat(i.length-1,"."));if(t!==Math.floor(t))throw new $t("Array index must be an integer, but found ".concat(t," instead."));return i[t]}},{key:"eachChild",value:function(e){e(this.index),e(this.input)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return["at",this.index.serialize(),this.input.serialize()]}}],[{key:"parse",value:function(t,i){if(3!==t.length)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,gt),n=i.parse(t[2],2,At(i.expectedType||Tt));return r&&n?new e(n.type.itemType,r,n):null}}]),e}(),pr=dr,vr=function(){function e(t,i){d(this,e),this.type=bt,this.needle=t,this.haystack=i}return p(e,[{key:"evaluate",value:function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!Dt(t,["boolean","string","number","null"]))throw new $t("Expected first argument to be of type boolean, string, number or null, but found ".concat(It(Ht(t))," instead."));if(!Dt(i,["string","array"]))throw new $t("Expected second argument to be of type array or string, but found ".concat(It(Ht(i))," instead."));return i.indexOf(t)>=0}},{key:"eachChild",value:function(e){e(this.needle),e(this.haystack)}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){return["in",this.needle.serialize(),this.haystack.serialize()]}}],[{key:"parse",value:function(t,i){if(3!==t.length)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,Tt),n=i.parse(t[2],2,Tt);return r&&n?Pt(r.type,[bt,xt,gt,_t,Tt])?new e(r,n):i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(It(r.type)," instead")):null}}]),e}(),mr=vr,yr=function(){function e(t,i,r){d(this,e),this.type=gt,this.needle=t,this.haystack=i,this.fromIndex=r}return p(e,[{key:"evaluate",value:function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Dt(t,["boolean","string","number","null"]))throw new $t("Expected first argument to be of type boolean, string, number or null, but found ".concat(It(Ht(t))," instead."));if(!Dt(i,["string","array"]))throw new $t("Expected second argument to be of type array or string, but found ".concat(It(Ht(i))," instead."));if(this.fromIndex){var r=this.fromIndex.evaluate(e);return i.indexOf(t,r)}return i.indexOf(t)}},{key:"eachChild",value:function(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}],[{key:"parse",value:function(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,Tt),n=i.parse(t[2],2,Tt);if(!r||!n)return null;if(!Pt(r.type,[bt,xt,gt,_t,Tt]))return i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(It(r.type)," instead"));if(4===t.length){var a=i.parse(t[3],3,gt);return a?new e(r,n,a):null}return new e(r,n)}}]),e}(),_r=yr,gr=function(){function e(t,i,r,n,a,o){d(this,e),this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=a,this.otherwise=o}return p(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e);return(Ht(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}},{key:"eachChild",value:function(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}},{key:"outputDefined",value:function(){return this.outputs.every((function(e){return e.outputDefined()}))&&this.otherwise.outputDefined()}},{key:"serialize",value:function(){var e,t=this,i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),n=[],a={},o=f(r);try{for(o.s();!(e=o.n()).done;){var s=e.value,l=a[this.cases[s]];void 0===l?(a[this.cases[s]]=n.length,n.push([this.cases[s],[s]])):n[l][1].push(s)}}catch(y){o.e(y)}finally{o.f()}for(var u=function(e){return"number"===t.inputType.kind?Number(e):e},c=0,d=n;cNumber.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if("number"==typeof p&&Math.floor(p)!==p)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,Ht(p)))return null}else r=Ht(p);if(void 0!==a[String(p)])return c.error("Branch labels must be unique.");a[String(p)]=o.length}}catch(_){d.e(_)}finally{d.f()}var v=i.parse(u,s,n);if(!v)return null;n=n||v.type,o.push(v)}var m=i.parse(t[1],1,Tt);if(!m)return null;var y=i.parse(t[t.length-1],t.length-1,n);return y?"value"!==m.type.kind&&i.concat(1).checkSubtype(r,m.type)?null:new e(r,n,m,a,o,y):null}}]),e}(),xr=gr,br=function(){function e(t,i,r){d(this,e),this.type=t,this.branches=i,this.otherwise=r}return p(e,[{key:"evaluate",value:function(e){var t,i=f(this.branches);try{for(i.s();!(t=i.n()).done;){var r=h(t.value,2),n=r[0],a=r[1];if(n.evaluate(e))return a.evaluate(e)}}catch(o){i.e(o)}finally{i.f()}return this.otherwise.evaluate(e)}},{key:"eachChild",value:function(e){var t,i=f(this.branches);try{for(i.s();!(t=i.n()).done;){var r=h(t.value,2),n=r[0],a=r[1];e(n),e(a)}}catch(o){i.e(o)}finally{i.f()}e(this.otherwise)}},{key:"outputDefined",value:function(){return this.branches.every((function(e){var t=h(e,2);return t[0],t[1].outputDefined()}))&&this.otherwise.outputDefined()}},{key:"serialize",value:function(){var e=["case"];return this.eachChild((function(t){e.push(t.serialize())})),e}}],[{key:"parse",value:function(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=0)return i.error("Expected an odd number of arguments.");var r;i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);for(var n=[],a=1;a=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,Tt),n=i.parse(t[2],2,gt);if(!r||!n)return null;if(!Pt(r.type,[At(Tt),xt,Tt]))return i.error("Expected first argument to be of type array or string, but found ".concat(It(r.type)," instead"));if(4===t.length){var a=i.parse(t[3],3,gt);return a?new e(r.type,r,n,a):null}return new e(r.type,r,n)}}]),e}(),Tr=kr;function Er(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function Sr(e,t,i,r){return 0===r.compare(t,i)}function Mr(e,t,i){var r="=="!==e&&"!="!==e;return function(){function n(e,t,i){d(this,n),this.type=bt,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}return p(n,[{key:"evaluate",value:function(n){var a=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){var s=Ht(a),l=Ht(o);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new $t('Expected arguments for "'.concat(e,'" to be (string, string) or (number, number), but found (').concat(s.kind,", ").concat(l.kind,") instead."))}if(this.collator&&!r&&this.hasUntypedArgument){var u=Ht(a),c=Ht(o);if("string"!==u.kind||"string"!==c.kind)return t(n,a,o)}return this.collator?i(n,a,o,this.collator.evaluate(n)):t(n,a,o)}},{key:"eachChild",value:function(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){var t=[e];return this.eachChild((function(e){t.push(e.serialize())})),t}}],[{key:"parse",value:function(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");var i=e[0],a=t.parse(e[1],1,Tt);if(!a)return null;if(!Er(i,a.type))return t.concat(1).error('"'.concat(i,"\" comparisons are not supported for type '").concat(It(a.type),"'."));var o=t.parse(e[2],2,Tt);if(!o)return null;if(!Er(i,o.type))return t.concat(2).error('"'.concat(i,"\" comparisons are not supported for type '").concat(It(o.type),"'."));if(a.type.kind!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error("Cannot compare types '".concat(It(a.type),"' and '").concat(It(o.type),"'."));r&&("value"===a.type.kind&&"value"!==o.type.kind?a=new ti(o.type,[a]):"value"!==a.type.kind&&"value"===o.type.kind&&(o=new ti(a.type,[o])));var s=null;if(4===e.length){if("string"!==a.type.kind&&"string"!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(!(s=t.parse(e[3],3,Et)))return null}return new n(a,o,s)}}]),n}()}var Ar=Mr("==",(function(e,t,i){return t===i}),Sr),Ir=Mr("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!Sr(0,t,i,r)})),Cr=Mr("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),Pr=Mr("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),Dr=Mr(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0})),Lr=function(){function e(t,i,r,n,a,o){d(this,e),this.type=xt,this.number=t,this.locale=i,this.currency=r,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=o}return p(e,[{key:"evaluate",value:function(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}},{key:"eachChild",value:function(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}],[{key:"parse",value:function(t,i){if(3!==t.length)return i.error("Expected two arguments.");var r=i.parse(t[1],1,gt);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return i.error("NumberFormat options argument must be an object.");var a=null;if(n.locale&&!(a=i.parse(n.locale,1,xt)))return null;var o=null;if(n.currency&&!(o=i.parse(n.currency,1,xt)))return null;var s=null;if(n.unit&&!(s=i.parse(n.unit,1,xt)))return null;var l=null;if(n["min-fraction-digits"]&&!(l=i.parse(n["min-fraction-digits"],1,gt)))return null;var u=null;return n["max-fraction-digits"]&&!(u=i.parse(n["max-fraction-digits"],1,gt))?null:new e(r,a,o,s,l,u)}}]),e}(),Rr=function(){function e(t){d(this,e),this.type=gt,this.input=t}return p(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new $t("Expected value to be of type string or array, but found ".concat(It(Ht(t))," instead."))}},{key:"eachChild",value:function(e){e(this.input)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var e=["length"];return this.eachChild((function(t){e.push(t.serialize())})),e}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error("Expected argument of type string or array, but found ".concat(It(r.type)," instead.")):new e(r):null}}]),e}(),Br={"==":Ar,"!=":Ir,">":zr,"<":Cr,">=":Dr,"<=":Pr,array:ti,at:pr,boolean:ti,case:wr,coalesce:cr,collator:hi,format:ii,image:ri,in:mr,"index-of":_r,interpolate:lr,"interpolate-hcl":lr,"interpolate-lab":lr,length:Rr,let:fr,literal:Jt,match:xr,number:ti,"number-format":Lr,object:ti,slice:Tr,step:Vi,string:ti,"to-boolean":oi,"to-color":oi,"to-number":oi,"to-string":oi,var:Li,within:Ii};function Or(e,t){var i=h(t,4),r=i[0],n=i[1],a=i[2],o=i[3];r=r.evaluate(e),n=n.evaluate(e),a=a.evaluate(e);var s=o?o.evaluate(e):1,l=Wt(r,n,a,s);if(l)throw new $t(l);return new Nt(r/255*s,n/255*s,a/255*s,s)}function Fr(e,t){return e in t}function Ur(e,t){var i=t[e];return void 0===i?null:i}function Vr(e){return{type:e}}ci.register(Br,{error:[{kind:"error"},[xt],function(e,t){var i=h(t,1)[0];throw new $t(i.evaluate(e))}],typeof:[xt,[Tt],function(e,t){return It(Ht(h(t,1)[0].evaluate(e)))}],"to-rgba":[At(gt,4),[wt],function(e,t){return h(t,1)[0].evaluate(e).toArray()}],rgb:[wt,[gt,gt,gt],Or],rgba:[wt,[gt,gt,gt,gt],Or],has:{type:bt,overloads:[[[xt],function(e,t){return Fr(h(t,1)[0].evaluate(e),e.properties())}],[[xt,kt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return Fr(r.evaluate(e),n.evaluate(e))}]]},get:{type:Tt,overloads:[[[xt],function(e,t){return Ur(h(t,1)[0].evaluate(e),e.properties())}],[[xt,kt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return Ur(r.evaluate(e),n.evaluate(e))}]]},"feature-state":[Tt,[xt],function(e,t){return Ur(h(t,1)[0].evaluate(e),e.featureState||{})}],properties:[kt,[],function(e){return e.properties()}],"geometry-type":[xt,[],function(e){return e.geometryType()}],id:[Tt,[],function(e){return e.id()}],zoom:[gt,[],function(e){return e.globals.zoom}],pitch:[gt,[],function(e){return e.globals.pitch||0}],"distance-from-center":[gt,[],function(e){return e.distanceFromCenter()}],"heatmap-density":[gt,[],function(e){return e.globals.heatmapDensity||0}],"line-progress":[gt,[],function(e){return e.globals.lineProgress||0}],"sky-radial-progress":[gt,[],function(e){return e.globals.skyRadialProgress||0}],accumulated:[Tt,[],function(e){return void 0===e.globals.accumulated?null:e.globals.accumulated}],"+":[gt,Vr(gt),function(e,t){var i,r=0,n=f(t);try{for(n.s();!(i=n.n()).done;)r+=i.value.evaluate(e)}catch(a){n.e(a)}finally{n.f()}return r}],"*":[gt,Vr(gt),function(e,t){var i,r=1,n=f(t);try{for(n.s();!(i=n.n()).done;)r*=i.value.evaluate(e)}catch(a){n.e(a)}finally{n.f()}return r}],"-":{type:gt,overloads:[[[gt,gt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)-n.evaluate(e)}],[[gt],function(e,t){return-h(t,1)[0].evaluate(e)}]]},"/":[gt,[gt,gt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)/n.evaluate(e)}],"%":[gt,[gt,gt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)%n.evaluate(e)}],ln2:[gt,[],function(){return Math.LN2}],pi:[gt,[],function(){return Math.PI}],e:[gt,[],function(){return Math.E}],"^":[gt,[gt,gt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return Math.pow(r.evaluate(e),n.evaluate(e))}],sqrt:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.sqrt(i.evaluate(e))}],log10:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))/Math.LN10}],ln:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))}],log2:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))/Math.LN2}],sin:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.sin(i.evaluate(e))}],cos:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.cos(i.evaluate(e))}],tan:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.tan(i.evaluate(e))}],asin:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.asin(i.evaluate(e))}],acos:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.acos(i.evaluate(e))}],atan:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.atan(i.evaluate(e))}],min:[gt,Vr(gt),function(e,t){return Math.min.apply(Math,c(t.map((function(t){return t.evaluate(e)}))))}],max:[gt,Vr(gt),function(e,t){return Math.max.apply(Math,c(t.map((function(t){return t.evaluate(e)}))))}],abs:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.abs(i.evaluate(e))}],round:[gt,[gt],function(e,t){var i=h(t,1)[0].evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.floor(i.evaluate(e))}],ceil:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.ceil(i.evaluate(e))}],"filter-==":[bt,[xt,Tt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return e.properties()[r.value]===n.value}],"filter-id-==":[bt,[Tt],function(e,t){var i=h(t,1)[0];return e.id()===i.value}],"filter-type-==":[bt,[xt],function(e,t){var i=h(t,1)[0];return e.geometryType()===i.value}],"filter-<":[bt,[xt,Tt],function(e,t){var i=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a":[bt,[xt,Tt],function(e,t){var i=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a>o}],"filter-id->":[bt,[Tt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r>n}],"filter-<=":[bt,[xt,Tt],function(e,t){var i=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[bt,[Tt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r<=n}],"filter->=":[bt,[xt,Tt],function(e,t){var i=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[bt,[Tt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r>=n}],"filter-has":[bt,[Tt],function(e,t){return h(t,1)[0].value in e.properties()}],"filter-has-id":[bt,[],function(e){return null!==e.id()&&void 0!==e.id()}],"filter-type-in":[bt,[At(xt)],function(e,t){return h(t,1)[0].value.indexOf(e.geometryType())>=0}],"filter-id-in":[bt,[At(Tt)],function(e,t){return h(t,1)[0].value.indexOf(e.id())>=0}],"filter-in-small":[bt,[xt,At(Tt)],function(e,t){var i=h(t,2),r=i[0];return i[1].value.indexOf(e.properties()[r.value])>=0}],"filter-in-large":[bt,[xt,At(Tt)],function(e,t){var i=h(t,2),r=i[0],n=i[1];return function(e,t,i,r){for(;i<=r;){var n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:bt,overloads:[[[bt,bt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)&&n.evaluate(e)}],[Vr(bt),function(e,t){var i,r=f(t);try{for(r.s();!(i=r.n()).done;)if(!i.value.evaluate(e))return!1}catch(n){r.e(n)}finally{r.f()}return!0}]]},any:{type:bt,overloads:[[[bt,bt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)||n.evaluate(e)}],[Vr(bt),function(e,t){var i,r=f(t);try{for(r.s();!(i=r.n()).done;)if(i.value.evaluate(e))return!0}catch(n){r.e(n)}finally{r.f()}return!1}]]},"!":[bt,[bt],function(e,t){return!h(t,1)[0].evaluate(e)}],"is-supported-script":[bt,[xt],function(e,t){var i=h(t,1)[0],r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[xt,[xt],function(e,t){return h(t,1)[0].evaluate(e).toUpperCase()}],downcase:[xt,[xt],function(e,t){return h(t,1)[0].evaluate(e).toLowerCase()}],concat:[xt,Vr(Tt),function(e,t){return t.map((function(t){return Yt(t.evaluate(e))})).join("")}],"resolved-locale":[xt,[Et],function(e,t){return h(t,1)[0].evaluate(e).resolvedLocale()}]});var Nr=Br;function jr(e){return{result:"success",value:e}}function Gr(e){return{result:"error",value:e}}function Zr(e){return"data-driven"===e["property-type"]}function qr(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Wr(e){return!!e.expression&&e.expression.interpolated}function Xr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Hr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Yr(e){return e}function Kr(e,t){var i,r,n,a="color"===t.type,o=e.stops&&"object"==typeof e.stops[0][0],s=o||!(o||void 0!==e.property),l=e.type||(Wr(t)?"exponential":"interval");if(a&&((e=ht({},e)).stops&&(e.stops=e.stops.map((function(e){return[e[0],Nt.parse(e[1])]}))),e.default=Nt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!ar[e.colorSpace])throw new Error("Unknown color space: ".concat(e.colorSpace));if("exponential"===l)i=en;else if("interval"===l)i=Qr;else if("categorical"===l){i=$r,r=Object.create(null);var u,c=f(e.stops);try{for(c.s();!(u=c.n()).done;){var h=u.value;r[h[0]]=h[1]}}catch(T){c.e(T)}finally{c.f()}n=typeof e.stops[0][0]}else{if("identity"!==l)throw new Error('Unknown function type "'.concat(l,'"'));i=tn}if(o){for(var d={},p=[],v=0;v=e.stops[r-1][0])return e.stops[r-1][1];var n=Fi(e.stops.map((function(e){return e[0]})),i);return e.stops[n][1]}function en(e,t,i){var r=void 0!==e.base?e.base:1;if("number"!==Xr(i))return Jr(e.default,t.default);var n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];var a=Fi(e.stops.map((function(e){return e[0]})),i),o=function(e,t,i,r){var n=r-i,a=e-i;return 0===n?0:1===t?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=ji[t.type]||Yr;if(e.colorSpace&&"rgb"!==e.colorSpace){var c=ar[e.colorSpace];u=function(e,t){return c.reverse(c.interpolate(c.forward(e),c.forward(t),o))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var e=arguments.length,t=new Array(e),i=0;i0&&"string"==typeof e[0]&&e[0]in Nr}function an(e,t){var i=new Bi(Nr,[],t?function(e){var t={color:wt,string:xt,number:gt,enum:xt,boolean:bt,formatted:St,resolvedImage:Mt};return"array"===e.type?At(t[e.value]||Tt,e.length):t[e.type]}(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?jr(new rn(r,t)):Gr(i.errors)}var on=function(){function e(t,i){d(this,e),this.kind=t,this._styleExpression=i,this.isStateDependent="constant"!==t&&!zi(i.expression)}return p(e,[{key:"evaluateWithoutErrorHandling",value:function(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}},{key:"evaluate",value:function(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}}]),e}(),sn=function(){function e(t,i,r,n){d(this,e),this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==t&&!zi(i.expression),this.interpolationType=n}return p(e,[{key:"evaluateWithoutErrorHandling",value:function(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}},{key:"evaluate",value:function(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}},{key:"interpolationFactor",value:function(e,t,i){return this.interpolationType?lr.interpolationFactor(this.interpolationType,e,t,i):0}}]),e}();function ln(e,t){if("error"===(e=an(e,t)).result)return e;var i=e.value.expression,r=Ci(i);if(!r&&!Zr(t))return Gr([new vt("","data expressions not supported")]);var n=Pi(i,["zoom","pitch","distance-from-center"]);if(!n&&!qr(t))return Gr([new vt("","zoom expressions not supported")]);var a=cn(i);return a||n?a instanceof vt?Gr([a]):a instanceof lr&&!Wr(t)?Gr([new vt("",'"interpolate" expressions cannot be used with this property')]):jr(a?new sn(r?"camera":"composite",e.value,a.labels,a instanceof lr?a.interpolation:void 0):new on(r?"constant":"source",e.value)):Gr([new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}var un=function(){function e(t,i){d(this,e),this._parameters=t,this._specification=i,ht(this,Kr(this._parameters,this._specification))}return p(e,null,[{key:"deserialize",value:function(t){return new e(t._parameters,t._specification)}},{key:"serialize",value:function(e){return{_parameters:e._parameters,_specification:e._specification}}}]),e}();function cn(e){var t=null;if(e instanceof fr)t=cn(e.result);else if(e instanceof cr){var i,r=f(e.args);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(t=cn(n))break}}catch(a){r.e(a)}finally{r.f()}}else(e instanceof Vi||e instanceof lr)&&e.input instanceof ci&&"zoom"===e.input.name&&(t=e);return t instanceof vt||e.eachChild((function(e){var i=cn(e);i instanceof vt?t=i:!t&&i?t=new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new vt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}var hn=p((function e(t,i,r,n){d(this,e),this.message=(t?"".concat(t,": "):"")+r,n&&(this.identifier=n),null!=i&&i.__line__&&(this.line=i.__line__)}));function fn(e){var t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=[],l=Xr(i);if("object"!==l)return[new hn(t,i,"object expected, ".concat(l," found"))];for(var u in i){var c=u.split(".")[0],h=r[c]||r["*"],f=void 0;n[c]?f=n[c]:r[c]?f=Wn:n["*"]?f=n["*"]:r["*"]&&(f=Wn),f?s=s.concat(f({key:(t?"".concat(t,"."):t)+u,value:i[u],valueSpec:h,style:a,styleSpec:o,object:i,objectKey:u},i)):s.push(new hn(t,i[u],'unknown property "'.concat(u,'"')))}for(var d in r)n[d]||r[d].required&&void 0===r[d].default&&void 0===i[d]&&s.push(new hn(t,i,'missing required property "'.concat(d,'"')));return s}function dn(e){var t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,a=e.key,o=e.arrayElementValidator||Wn;if("array"!==Xr(t))return[new hn(a,t,"array expected, ".concat(Xr(t)," found"))];if(i.length&&t.length!==i.length)return[new hn(a,t,"array length ".concat(i.length," expected, length ").concat(t.length," found"))];if(i["min-length"]&&t.lengtho)return[new hn(t,i,"".concat(i," is greater than the maximum value ").concat(o))]}return[]}function vn(e){var t,i,r,n=e.valueSpec,a=ft(e.value.type),o={},s="categorical"!==a&&void 0===e.value.property,l=!s,u="array"===Xr(e.value.stops)&&"array"===Xr(e.value.stops[0])&&"object"===Xr(e.value.stops[0][0]),c=fn({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===a)return[new hn(e.key,e.value,'identity function may not have a "stops" property')];var t=[],i=e.value;return t=t.concat(dn({key:e.key,value:i,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Xr(i)&&0===i.length&&t.push(new hn(e.key,i,"array must have at least one stop")),t},default:function(e){return Wn({key:e.key,value:e.value,valueSpec:n,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&s&&c.push(new hn(e.key,e.value,'missing required property "property"')),"identity"===a||e.value.stops||c.push(new hn(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!Wr(e.valueSpec)&&c.push(new hn(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Zr(e.valueSpec)?c.push(new hn(e.key,e.value,"property functions not supported")):s&&!qr(e.valueSpec)&&c.push(new hn(e.key,e.value,"zoom functions not supported"))),"categorical"!==a&&!u||void 0!==e.value.property||c.push(new hn(e.key,e.value,'"property" property is required')),c;function h(e){var t=[],a=e.value,s=e.key;if("array"!==Xr(a))return[new hn(s,a,"array expected, ".concat(Xr(a)," found"))];if(2!==a.length)return[new hn(s,a,"array length 2 expected, length ".concat(a.length," found"))];if(u){if("object"!==Xr(a[0]))return[new hn(s,a,"object expected, ".concat(Xr(a[0])," found"))];if(void 0===a[0].zoom)return[new hn(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new hn(s,a,"object stop key must have value")];var l=ft(a[0].zoom);if("number"!=typeof l)return[new hn(s,a[0].zoom,"stop zoom values must be numbers")];if(r&&r>l)return[new hn(s,a[0].zoom,"stop zoom values must appear in ascending order")];l!==r&&(r=l,i=void 0,o={}),t=t.concat(fn({key:"".concat(s,"[0]"),value:a[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:pn,value:f}}))}else t=t.concat(f({key:"".concat(s,"[0]"),value:a[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},a));return nn(dt(a[1]))?t.concat([new hn("".concat(s,"[1]"),a[1],"expressions are not allowed in function stops.")]):t.concat(Wn({key:"".concat(s,"[1]"),value:a[1],valueSpec:n,style:e.style,styleSpec:e.styleSpec}))}function f(e,r){var s=Xr(e.value),l=ft(e.value),u=null!==e.value?e.value:r;if(t){if(s!==t)return[new hn(e.key,u,"".concat(s," stop domain type must match previous stop domain type ").concat(t))]}else t=s;if("number"!==s&&"string"!==s&&"boolean"!==s&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new hn(e.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){var c="number expected, ".concat(s," found");return Zr(n)&&void 0===a&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new hn(e.key,u,c)]}return"categorical"!==a||"number"!==s||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===s&&"number"==typeof l&&"number"==typeof i&&void 0!==i&&l=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":var t,i=f(e.slice(1));try{for(i.s();!(t=i.n()).done;){var r=t.value;if(!gn(r)&&"boolean"!=typeof r)return!1}}catch(n){i.e(n)}finally{i.f()}return!0;default:return!0}}function xn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fill";if(null==e)return{filter:function(){return!0},needGeometry:!1,needFeature:!1};gn(e)||(e=Mn(e));var i=e,r=!0;try{r=function(e){if(!kn(e))return e;var t=dt(e);return wn(t),t=bn(t)}(i)}catch(e){console.warn("Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n".concat(JSON.stringify(i,null,2),"\n "))}var n=ct["filter_".concat(t)],a=an(r,n),o=null;if("error"===a.result)throw new Error(a.value.map((function(e){return"".concat(e.key,": ").concat(e.message)})).join(", "));o=function(e,t,i){return a.value.evaluate(e,t,{},i)};var s=null,l=null;if(r!==i){var u=an(i,n);if("error"===u.result)throw new Error(u.value.map((function(e){return"".concat(e.key,": ").concat(e.message)})).join(", "));s=function(e,t,i,r,n){return u.value.evaluate(e,t,{},i,void 0,void 0,r,n)},l=!Ci(u.value.expression)}return{filter:o,dynamicFilter:s||void 0,needGeometry:Sn(r),needFeature:!!l}}function bn(e){if(!Array.isArray(e))return e;var t=function(e){if(Tn.has(e[0]))for(var t=1;t",">=","<","<=","to-boolean"]);function En(e,t){return et?1:0}function Sn(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var t=1;t"===i||"<="===i||">="===i?An(e[1],e[2],i):"any"===i?(t=e.slice(1),["any"].concat(t.map(Mn))):"all"===i?["all"].concat(e.slice(1).map(Mn)):"none"===i?["all"].concat(e.slice(1).map(Mn).map(zn)):"in"===i?In(e[1],e.slice(2)):"!in"===i?zn(In(e[1],e.slice(2))):"has"===i?Cn(e[1]):"!has"===i?zn(Cn(e[1])):"within"!==i||e}function An(e,t,i){switch(e){case"$type":return["filter-type-".concat(i),t];case"$id":return["filter-id-".concat(i),t];default:return["filter-".concat(i),e,t]}}function In(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((function(e){return typeof e!=typeof t[0]}))?["filter-in-large",e,["literal",t.sort(En)]]:["filter-in-small",e,["literal",t]]}}function Cn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function zn(e){return["!",e]}function Pn(e){return gn(dt(e.value))?mn(ht({},e,{expressionContext:"filter",valueSpec:e.styleSpec["filter_".concat(e.layerType||"fill")]})):Dn(e)}function Dn(e){var t=e.value,i=e.key;if("array"!==Xr(t))return[new hn(i,t,"array expected, ".concat(Xr(t)," found"))];var r,n=e.styleSpec,a=[];if(t.length<1)return[new hn(i,t,"filter array must have at least 1 element")];switch(a=a.concat(_n({key:"".concat(i,"[0]"),value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),ft(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===ft(t[1])&&a.push(new hn(i,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":3!==t.length&&a.push(new hn(i,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&"string"!==(r=Xr(t[1]))&&a.push(new hn("".concat(i,"[1]"),t[1],"string expected, ".concat(r," found")));for(var o=2;o1&&void 0!==arguments[1]?arguments[1]:ct;return Jn(Wn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Xn,"*":function(){return[]}}}))}var Yn=function(e){return Jn(Rn(e))},Kn=function(e){return Jn(Bn(e))};function Jn(e){return e.slice().sort((function(e,t){return e.line&&t.line?e.line-t.line:0}))}function $n(e,t){var i=!1;if(t&&t.length){var r,n=f(t);try{for(n.s();!(r=n.n()).done;){var a=r.value;e.fire(new lt(new Error(a.message))),i=!0}}catch(o){n.e(o)}finally{n.f()}}return i}var Qn=ea;function ea(e,t,i){var r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(var a=0;a=c[d+0]&&r>=c[d+1])?(o[f]=!0,a.push(u[f])):o[f]=!1}}},ea.prototype._forEachCell=function(e,t,i,r,n,a,o,s){for(var l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),c=this._convertToCellCoord(i),h=this._convertToCellCoord(r),f=l;f<=c;f++)for(var d=u;d<=h;d++){var p=this.d*d+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&n.call(this,e,t,i,r,p,a,o,s))return}},ea.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},ea.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},ea.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=3+this.cells.length+1+1,i=0,r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ta[t]={klass:e,omit:i.omit||[]}}for(var ra in ia(Object,"Object"),Qn.serialize=function(e,t){var i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}},Qn.deserialize=function(e){return new Qn(e.buffer)},Object.defineProperty(Qn,"name",{value:"Grid"}),ia(Qn,"Grid"),ia(Nt,"Color"),ia(Error,"Error"),ia(xe,"AJAXError"),ia(qt,"ResolvedImage"),ia(un,"StylePropertyFunction"),ia(rn,"StyleExpression",{omit:["_evaluator"]}),ia(sn,"ZoomDependentExpression"),ia(on,"ZoomConstantExpression"),ia(ci,"CompoundExpression",{omit:["_evaluate"]}),Nr)ta[Nr[ra]._classRegistryKey]||ia(Nr[ra],"Expression".concat(ra));function na(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function aa(e){return _.ImageBitmap&&e instanceof _.ImageBitmap}function oa(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(na(e)||aa(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){var i=e;return t&&t.push(i.buffer),i}if(e instanceof _.ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){var r,n=[],a=f(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;n.push(oa(o,t))}}catch(h){a.e(h)}finally{a.f()}return n}if("object"==typeof e){var s=e.constructor,l=s._classRegistryKey;if(!l)throw new Error("can't serialize object of unregistered class ".concat(l));var u=s.serialize?s.serialize(e,t):{};if(!s.serialize){for(var c in e)e.hasOwnProperty(c)&&(ta[l].omit.indexOf(c)>=0||(u[c]=oa(e[c],t)));e instanceof Error&&(u.message=e.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==l&&(u.$name=l),u}throw new Error("can't serialize object of type "+typeof e)}function sa(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||na(e)||aa(e)||ArrayBuffer.isView(e)||e instanceof _.ImageData)return e;if(Array.isArray(e))return e.map(sa);if("object"==typeof e){var t=e.$name||"Object",i=ta[t].klass;if(!i)throw new Error("can't deserialize unregistered class ".concat(t));if(i.deserialize)return i.deserialize(e);for(var r=Object.create(i.prototype),n=0,a=Object.keys(e);n=1536&&e<=1791},ua=function(e){return e>=1872&&e<=1919},ca=function(e){return e>=2208&&e<=2303},ha=function(e){return e>=11904&&e<=12031},fa=function(e){return e>=12032&&e<=12255},da=function(e){return e>=12272&&e<=12287},pa=function(e){return e>=12288&&e<=12351},va=function(e){return e>=12352&&e<=12447},ma=function(e){return e>=12448&&e<=12543},ya=function(e){return e>=12544&&e<=12591},_a=function(e){return e>=12704&&e<=12735},ga=function(e){return e>=12736&&e<=12783},xa=function(e){return e>=12784&&e<=12799},ba=function(e){return e>=12800&&e<=13055},wa=function(e){return e>=13056&&e<=13311},ka=function(e){return e>=13312&&e<=19903},Ta=function(e){return e>=19968&&e<=40959},Ea=function(e){return e>=40960&&e<=42127},Sa=function(e){return e>=42128&&e<=42191},Ma=function(e){return e>=44032&&e<=55215},Aa=function(e){return e>=63744&&e<=64255},Ia=function(e){return e>=64336&&e<=65023},Ca=function(e){return e>=65040&&e<=65055},za=function(e){return e>=65072&&e<=65103},Pa=function(e){return e>=65104&&e<=65135},Da=function(e){return e>=65136&&e<=65279},La=function(e){return e>=65280&&e<=65519};function Ra(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(Fa(t.value.charCodeAt(0)))return!0}catch(r){i.e(r)}finally{i.f()}return!1}function Ba(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(!Oa(t.value.charCodeAt(0)))return!1}catch(r){i.e(r)}finally{i.f()}return!0}function Oa(e){return!(la(e)||ua(e)||ca(e)||Ia(e)||Da(e))}function Fa(e){return!(746!==e&&747!==e&&(e<4352||!(_a(e)||ya(e)||za(e)&&!(e>=65097&&e<=65103)||Aa(e)||wa(e)||ha(e)||ga(e)||!(!pa(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||ka(e)||Ta(e)||ba(e)||function(e){return e>=12592&&e<=12687}(e)||function(e){return e>=43360&&e<=43391}(e)||function(e){return e>=55216&&e<=55295}(e)||function(e){return e>=4352&&e<=4607}(e)||Ma(e)||va(e)||da(e)||function(e){return e>=12688&&e<=12703}(e)||fa(e)||xa(e)||ma(e)&&12540!==e||!(!La(e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Pa(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||function(e){return e>=5120&&e<=5759}(e)||function(e){return e>=6320&&e<=6399}(e)||Ca(e)||function(e){return e>=19904&&e<=19967}(e)||Ea(e)||Sa(e))))}function Ua(e){return!(Fa(e)||function(e){return!!(function(e){return e>=128&&e<=255}(e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||function(e){return e>=8192&&e<=8303}(e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||function(e){return e>=8448&&e<=8527}(e)||function(e){return e>=8528&&e<=8591}(e)||function(e){return e>=8960&&e<=9215}(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||function(e){return e>=9216&&e<=9279}(e)&&9251!==e||function(e){return e>=9280&&e<=9311}(e)||function(e){return e>=9312&&e<=9471}(e)||function(e){return e>=9632&&e<=9727}(e)||function(e){return e>=9728&&e<=9983}(e)&&!(e>=9754&&e<=9759)||function(e){return e>=11008&&e<=11263}(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||pa(e)||ma(e)||function(e){return e>=57344&&e<=63743}(e)||za(e)||Pa(e)||La(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function Va(e){return e>=1424&&e<=2303||Ia(e)||Da(e)}function Na(e,t){return!(!t&&Va(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||function(e){return e>=6016&&e<=6143}(e))}function ja(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(Va(t.value.charCodeAt(0)))return!0}catch(r){i.e(r)}finally{i.f()}return!1}var Ga="deferred",Za="loading",qa="loaded",Wa=null,Xa="unavailable",Ha=null,Ya=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Xa="error"),Wa&&Wa(e)};function Ka(){Ja.fire(new st("pluginStateChange",{pluginStatus:Xa,pluginURL:Ha}))}var Ja=new ut,$a=function(){return Xa},Qa=function(){if(Xa!==Ga||!Ha)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Xa=Za,Ka(),Ha&&ke({url:Ha},(function(e){e?Ya(e):(Xa=qa,Ka())}))},eo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Xa===qa||null!=eo.applyArabicShaping},isLoading:function(){return Xa===Za},setState:function(e){Xa=e.pluginStatus,Ha=e.pluginURL},isParsed:function(){return null!=eo.applyArabicShaping&&null!=eo.processBidirectionalText&&null!=eo.processStyledBidirectionalText},getPluginURL:function(){return Ha}},to=function(){function e(t,i){d(this,e),this.zoom=t,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}return p(e,[{key:"isSupportedScript",value:function(e){return function(e,t){var i,r=f(e);try{for(r.s();!(i=r.n()).done;)if(!Na(i.value.charCodeAt(0),t))return!1}catch(n){r.e(n)}finally{r.f()}return!0}(e,eo.isLoaded())}}]),e}(),io=function(){function e(t,i){d(this,e),this.property=t,this.value=i,this.expression=function(e,t){if(Hr(e))return new un(e,t);if(nn(e)){var i=ln(e,t);if("error"===i.result)throw new Error(i.value.map((function(e){return"".concat(e.key,": ").concat(e.message)})).join(", "));return i.value}var r=e;return"string"==typeof e&&"color"===t.type&&(r=Nt.parse(e)),{kind:"constant",evaluate:function(){return r}}}(void 0===i?t.specification.default:i,t.specification)}return p(e,[{key:"isDataDriven",value:function(){return"source"===this.expression.kind||"composite"===this.expression.kind}},{key:"possiblyEvaluate",value:function(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}]),e}(),ro=function(){function e(t){d(this,e),this.property=t,this.value=new io(t,void 0)}return p(e,[{key:"transitioned",value:function(e,t){return new ao(this.property,this.value,t,G({},e.transition,this.transition),e.now)}},{key:"untransitioned",value:function(){return new ao(this.property,this.value,null,{},0)}}]),e}(),no=function(){function e(t){d(this,e),this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}return p(e,[{key:"getValue",value:function(e){return Q(this._values[e].value.value)}},{key:"setValue",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new ro(this._values[e].property)),this._values[e].value=new io(this._values[e].property,null===t?void 0:Q(t))}},{key:"getTransition",value:function(e){return Q(this._values[e].transition)}},{key:"setTransition",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new ro(this._values[e].property)),this._values[e].transition=Q(t)||void 0}},{key:"serialize",value:function(){for(var e={},t=0,i=Object.keys(this._values);tthis.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(rthis.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}},{key:"_refreshViews",value:function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}},{key:"destroy",value:function(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}],[{key:"serialize",value:function(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}},{key:"deserialize",value:function(e){var t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}}]),e}();function go(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=0,r=0;return{members:e.map((function(e){var n=mo[e.type].BYTES_PER_ELEMENT,a=i=xo(i,Math.max(t,n)),o=e.components||1;return r=Math.max(r,n),i+=n*o,{name:e.name,type:e.type,components:o,offset:a}})),size:xo(i,Math.max(r,t)),alignment:t}}function xo(e,t){return Math.ceil(e/t)*t}var bo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t){var i=this.length;return this.resize(i+1),this.emplace(i,e,t)}},{key:"emplace",value:function(e,t,i){var r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}]),i}(_o);bo.prototype.bytesPerElement=4,ia(bo,"StructArrayLayout2i4");var wo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i){var r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}},{key:"emplace",value:function(e,t,i,r){var n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}]),i}(_o);wo.prototype.bytesPerElement=6,ia(wo,"StructArrayLayout3i6");var ko=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=4*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,e}}]),i}(_o);ko.prototype.bytesPerElement=8,ia(ko,"StructArrayLayout4i8");var To=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o){var s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a,o)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s){var l=6*e,u=12*e,c=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[u+4]=r,this.uint8[u+5]=n,this.uint8[u+6]=a,this.uint8[u+7]=o,this.float32[c+2]=s,e}}]),i}(_o);To.prototype.bytesPerElement=12,ia(To,"StructArrayLayout2i4ub1f12");var Eo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=4*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,e}}]),i}(_o);Eo.prototype.bytesPerElement=16,ia(Eo,"StructArrayLayout4f16");var So=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}},{key:"emplace",value:function(e,t,i,r,n,a){var o=6*e,s=3*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,this.float32[s+2]=a,e}}]),i}(_o);So.prototype.bytesPerElement=12,ia(So,"StructArrayLayout4ui1f12");var Mo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=4*e;return this.uint16[a+0]=t,this.uint16[a+1]=i,this.uint16[a+2]=r,this.uint16[a+3]=n,e}}]),i}(_o);Mo.prototype.bytesPerElement=8,ia(Mo,"StructArrayLayout4ui8");var Ao=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a){var o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}},{key:"emplace",value:function(e,t,i,r,n,a,o){var s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}}]),i}(_o);Ao.prototype.bytesPerElement=12,ia(Ao,"StructArrayLayout6i12");var Io=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h){var f=this.length;return this.resize(f+1),this.emplace(f,e,t,i,r,n,a,o,s,l,u,c,h)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f){var d=12*e;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=f,e}}]),i}(_o);Io.prototype.bytesPerElement=24,ia(Io,"StructArrayLayout4i4ui4i24");var Co=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a){var o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}},{key:"emplace",value:function(e,t,i,r,n,a,o){var s=10*e,l=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.float32[l+2]=n,this.float32[l+3]=a,this.float32[l+4]=o,e}}]),i}(_o);Co.prototype.bytesPerElement=20,ia(Co,"StructArrayLayout3i3f20");var zo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e){var t=this.length;return this.resize(t+1),this.emplace(t,e)}},{key:"emplace",value:function(e,t){return this.uint32[1*e+0]=t,e}}]),i}(_o);zo.prototype.bytesPerElement=4,ia(zo,"StructArrayLayout1ul4");var Po=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,a,o,s,l,u,c,h,f)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d){var p=20*e,v=10*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.int16[p+4]=a,this.float32[v+3]=o,this.float32[v+4]=s,this.float32[v+5]=l,this.float32[v+6]=u,this.int16[p+14]=c,this.uint32[v+8]=h,this.uint16[p+18]=f,this.uint16[p+19]=d,e}}]),i}(_o);Po.prototype.bytesPerElement=40,ia(Po,"StructArrayLayout5i4f1i1ul2ui40");var Do=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o){var s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a,o)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s){var l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=a,this.int16[l+6]=o,this.int16[l+7]=s,e}}]),i}(_o);Do.prototype.bytesPerElement=16,ia(Do,"StructArrayLayout3i2i2i16");var Lo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}},{key:"emplace",value:function(e,t,i,r,n,a){var o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[s+6]=n,this.int16[s+7]=a,e}}]),i}(_o);Lo.prototype.bytesPerElement=16,ia(Lo,"StructArrayLayout2f1f2i16");var Ro=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=12*e,o=3*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[o+1]=r,this.float32[o+2]=n,e}}]),i}(_o);Ro.prototype.bytesPerElement=12,ia(Ro,"StructArrayLayout2ub2f12");var Bo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i){var r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}},{key:"emplace",value:function(e,t,i,r){var n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}]),i}(_o);Bo.prototype.bytesPerElement=12,ia(Bo,"StructArrayLayout3f12");var Oo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i){var r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}},{key:"emplace",value:function(e,t,i,r){var n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}]),i}(_o);Oo.prototype.bytesPerElement=6,ia(Oo,"StructArrayLayout3ui6");var Fo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x){var b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x,b){var w=30*e,k=15*e,T=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=r,this.float32[k+2]=n,this.float32[k+3]=a,this.uint16[w+8]=o,this.uint16[w+9]=s,this.uint32[k+5]=l,this.uint32[k+6]=u,this.uint32[k+7]=c,this.uint16[w+16]=h,this.uint16[w+17]=f,this.uint16[w+18]=d,this.float32[k+10]=p,this.float32[k+11]=v,this.uint8[T+48]=m,this.uint8[T+49]=y,this.uint8[T+50]=_,this.uint32[k+13]=g,this.int16[w+28]=x,this.uint8[T+58]=b,e}}]),i}(_o);Fo.prototype.bytesPerElement=60,ia(Fo,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");var Uo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x,b,w,k,T,E,S,M,A,I){var C=this.length;return this.resize(C+1),this.emplace(C,e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x,b,w,k,T,E,S,M,A,I)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x,b,w,k,T,E,S,M,A,I,C){var z=38*e,P=19*e;return this.int16[z+0]=t,this.int16[z+1]=i,this.int16[z+2]=r,this.float32[P+2]=n,this.float32[P+3]=a,this.int16[z+8]=o,this.int16[z+9]=s,this.int16[z+10]=l,this.int16[z+11]=u,this.int16[z+12]=c,this.int16[z+13]=h,this.uint16[z+14]=f,this.uint16[z+15]=d,this.uint16[z+16]=p,this.uint16[z+17]=v,this.uint16[z+18]=m,this.uint16[z+19]=y,this.uint16[z+20]=_,this.uint16[z+21]=g,this.uint16[z+22]=x,this.uint16[z+23]=b,this.uint16[z+24]=w,this.uint16[z+25]=k,this.uint16[z+26]=T,this.uint16[z+27]=E,this.uint16[z+28]=S,this.uint32[P+15]=M,this.float32[P+16]=A,this.float32[P+17]=I,this.float32[P+18]=C,e}}]),i}(_o);Uo.prototype.bytesPerElement=76,ia(Uo,"StructArrayLayout3i2f6i15ui1ul3f76");var Vo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e){var t=this.length;return this.resize(t+1),this.emplace(t,e)}},{key:"emplace",value:function(e,t){return this.float32[1*e+0]=t,e}}]),i}(_o);Vo.prototype.bytesPerElement=4,ia(Vo,"StructArrayLayout1f4");var No=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}},{key:"emplace",value:function(e,t,i,r,n,a){var o=5*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,this.float32[o+4]=a,e}}]),i}(_o);No.prototype.bytesPerElement=20,ia(No,"StructArrayLayout5f20");var jo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=6*e;return this.uint32[3*e+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,this.uint16[a+4]=n,e}}]),i}(_o);jo.prototype.bytesPerElement=12,ia(jo,"StructArrayLayout1ul3ui12");var Go=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t){var i=this.length;return this.resize(i+1),this.emplace(i,e,t)}},{key:"emplace",value:function(e,t,i){var r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}]),i}(_o);Go.prototype.bytesPerElement=4,ia(Go,"StructArrayLayout2ui4");var Zo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e){var t=this.length;return this.resize(t+1),this.emplace(t,e)}},{key:"emplace",value:function(e,t){return this.uint16[1*e+0]=t,e}}]),i}(_o);Zo.prototype.bytesPerElement=2,ia(Zo,"StructArrayLayout1ui2");var qo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t){var i=this.length;return this.resize(i+1),this.emplace(i,e,t)}},{key:"emplace",value:function(e,t,i){var r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}]),i}(_o);qo.prototype.bytesPerElement=8,ia(qo,"StructArrayLayout2f8");var Wo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"projectedAnchorX",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"projectedAnchorY",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"projectedAnchorZ",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"tileAnchorX",get:function(){return this._structArray.int16[this._pos2+3]}},{key:"tileAnchorY",get:function(){return this._structArray.int16[this._pos2+4]}},{key:"x1",get:function(){return this._structArray.float32[this._pos4+3]}},{key:"y1",get:function(){return this._structArray.float32[this._pos4+4]}},{key:"x2",get:function(){return this._structArray.float32[this._pos4+5]}},{key:"y2",get:function(){return this._structArray.float32[this._pos4+6]}},{key:"padding",get:function(){return this._structArray.int16[this._pos2+14]}},{key:"featureIndex",get:function(){return this._structArray.uint32[this._pos4+8]}},{key:"sourceLayerIndex",get:function(){return this._structArray.uint16[this._pos2+18]}},{key:"bucketIndex",get:function(){return this._structArray.uint16[this._pos2+19]}}]),i}(yo);Wo.prototype.size=40;var Xo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new Wo(this,e)}}]),i}(Po);ia(Xo,"CollisionBoxArray");var Ho=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"projectedAnchorX",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"projectedAnchorY",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"projectedAnchorZ",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"tileAnchorX",get:function(){return this._structArray.float32[this._pos4+2]}},{key:"tileAnchorY",get:function(){return this._structArray.float32[this._pos4+3]}},{key:"glyphStartIndex",get:function(){return this._structArray.uint16[this._pos2+8]}},{key:"numGlyphs",get:function(){return this._structArray.uint16[this._pos2+9]}},{key:"vertexStartIndex",get:function(){return this._structArray.uint32[this._pos4+5]}},{key:"lineStartIndex",get:function(){return this._structArray.uint32[this._pos4+6]}},{key:"lineLength",get:function(){return this._structArray.uint32[this._pos4+7]}},{key:"segment",get:function(){return this._structArray.uint16[this._pos2+16]}},{key:"lowerSize",get:function(){return this._structArray.uint16[this._pos2+17]}},{key:"upperSize",get:function(){return this._structArray.uint16[this._pos2+18]}},{key:"lineOffsetX",get:function(){return this._structArray.float32[this._pos4+10]}},{key:"lineOffsetY",get:function(){return this._structArray.float32[this._pos4+11]}},{key:"writingMode",get:function(){return this._structArray.uint8[this._pos1+48]}},{key:"placedOrientation",get:function(){return this._structArray.uint8[this._pos1+49]},set:function(e){this._structArray.uint8[this._pos1+49]=e}},{key:"hidden",get:function(){return this._structArray.uint8[this._pos1+50]},set:function(e){this._structArray.uint8[this._pos1+50]=e}},{key:"crossTileID",get:function(){return this._structArray.uint32[this._pos4+13]},set:function(e){this._structArray.uint32[this._pos4+13]=e}},{key:"associatedIconIndex",get:function(){return this._structArray.int16[this._pos2+28]}},{key:"flipState",get:function(){return this._structArray.uint8[this._pos1+58]},set:function(e){this._structArray.uint8[this._pos1+58]=e}}]),i}(yo);Ho.prototype.size=60;var Yo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new Ho(this,e)}}]),i}(Fo);ia(Yo,"PlacedSymbolArray");var Ko=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"projectedAnchorX",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"projectedAnchorY",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"projectedAnchorZ",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"tileAnchorX",get:function(){return this._structArray.float32[this._pos4+2]}},{key:"tileAnchorY",get:function(){return this._structArray.float32[this._pos4+3]}},{key:"rightJustifiedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+8]}},{key:"centerJustifiedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+9]}},{key:"leftJustifiedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+10]}},{key:"verticalPlacedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+11]}},{key:"placedIconSymbolIndex",get:function(){return this._structArray.int16[this._pos2+12]}},{key:"verticalPlacedIconSymbolIndex",get:function(){return this._structArray.int16[this._pos2+13]}},{key:"key",get:function(){return this._structArray.uint16[this._pos2+14]}},{key:"textBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+15]}},{key:"textBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+16]}},{key:"verticalTextBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+17]}},{key:"verticalTextBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+18]}},{key:"iconBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+19]}},{key:"iconBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+20]}},{key:"verticalIconBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+21]}},{key:"verticalIconBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+22]}},{key:"featureIndex",get:function(){return this._structArray.uint16[this._pos2+23]}},{key:"numHorizontalGlyphVertices",get:function(){return this._structArray.uint16[this._pos2+24]}},{key:"numVerticalGlyphVertices",get:function(){return this._structArray.uint16[this._pos2+25]}},{key:"numIconVertices",get:function(){return this._structArray.uint16[this._pos2+26]}},{key:"numVerticalIconVertices",get:function(){return this._structArray.uint16[this._pos2+27]}},{key:"useRuntimeCollisionCircles",get:function(){return this._structArray.uint16[this._pos2+28]}},{key:"crossTileID",get:function(){return this._structArray.uint32[this._pos4+15]},set:function(e){this._structArray.uint32[this._pos4+15]=e}},{key:"textOffset0",get:function(){return this._structArray.float32[this._pos4+16]}},{key:"textOffset1",get:function(){return this._structArray.float32[this._pos4+17]}},{key:"collisionCircleDiameter",get:function(){return this._structArray.float32[this._pos4+18]}}]),i}(yo);Ko.prototype.size=76;var Jo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new Ko(this,e)}}]),i}(Uo);ia(Jo,"SymbolInstanceArray");var $o=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"getoffsetX",value:function(e){return this.float32[1*e+0]}}]),i}(Vo);ia($o,"GlyphOffsetArray");var Qo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"getx",value:function(e){return this.int16[2*e+0]}},{key:"gety",value:function(e){return this.int16[2*e+1]}}]),i}(bo);ia(Qo,"SymbolLineVertexArray");var es=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"featureIndex",get:function(){return this._structArray.uint32[this._pos4+0]}},{key:"sourceLayerIndex",get:function(){return this._structArray.uint16[this._pos2+2]}},{key:"bucketIndex",get:function(){return this._structArray.uint16[this._pos2+3]}},{key:"layoutVertexArrayOffset",get:function(){return this._structArray.uint16[this._pos2+4]}}]),i}(yo);es.prototype.size=12;var ts=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new es(this,e)}}]),i}(jo);ia(ts,"FeatureIndexArray");var is=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"geta_centroid_pos0",value:function(e){return this.uint16[2*e+0]}},{key:"geta_centroid_pos1",value:function(e){return this.uint16[2*e+1]}}]),i}(Go);ia(is,"FillExtrusionCentroidArray");var rs=go([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),ns=go([{name:"a_dash",components:4,type:"Uint16"}]),as={},os={get exports(){return as},set exports(e){as=e}},ss={};({get exports(){return ss},set exports(e){ss=e}}).exports=function(e,t){var i,r,n,a,o,s,l,u;for(r=e.length-(i=3&e.length),n=t,o=3432918353,s=461845907,u=0;u>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=e.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};var ls={};({get exports(){return ls},set exports(e){ls=e}}).exports=function(e,t){for(var i,r=e.length,n=t^r,a=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:n^=(255&e.charCodeAt(a+2))<<16;case 2:n^=(255&e.charCodeAt(a+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(a)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0};var us=ss,cs=ls;os.exports=us,as.murmur3=us,as.murmur2=cs;var hs=function(){function e(){d(this,e),this.ids=[],this.positions=[],this.indexed=!1}return p(e,[{key:"add",value:function(e,t,i,r){this.ids.push(fs(e)),this.positions.push(t,i,r)}},{key:"getPositions",value:function(e){for(var t=fs(e),i=0,r=this.ids.length-1;i>1;this.ids[n]>=t?r=n:i=n+1}for(var a=[];this.ids[i]===t;)a.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return a}}],[{key:"serialize",value:function(e,t){var i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return ds(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}},{key:"deserialize",value:function(t){var i=new e;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}}]),e}();function fs(e){var t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:as(String(e))}function ds(e,t,i,r){for(;i>1],a=i-1,o=r+1;;){do{a++}while(e[a]n);if(a>=o)break;ps(e,a,o),ps(t,3*a,3*o),ps(t,3*a+1,3*o+1),ps(t,3*a+2,3*o+2)}o-i2&&void 0!==arguments[2]?arguments[2]:function(){return!0};d(this,e),this.binders={},this._buffers=[];var n=[];for(var a in t.paint._values)if(r(a)){var o=t.paint.get(a);if(o instanceof lo&&Zr(o.property.specification)){var s=zs(a,t.type),l=o.value,u=o.property.specification.type,c=!!o.property.useIntegerZoom,h="line-dasharray"===a||a.endsWith("pattern"),f="line-dasharray"===a&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==l.kind||f)if("source"===l.kind||f||h){var p=Ls(a,u,"source");this.binders[a]=h?new Ms(l,s,u,p,t.id):new Es(l,s,u,p),n.push("/a_".concat(a))}else{var v=Ls(a,u,"composite");this.binders[a]=new Ss(l,s,u,c,i,v),n.push("/z_".concat(a))}else this.binders[a]=h?new Ts(l.value,s):new ks(l.value,s,u),n.push("/u_".concat(a))}}this.cacheKey=n.sort().join("")}return p(e,[{key:"getMaxValue",value:function(e){var t=this.binders[e];return t instanceof Es||t instanceof Ss?t.maxValue:0}},{key:"populatePaintArrays",value:function(e,t,i,r,n,a){for(var o in this.binders){var s=this.binders[o];(s instanceof Es||s instanceof Ss||s instanceof Ms)&&s.populatePaintArray(e,t,i,r,n,a)}}},{key:"setConstantPatternPositions",value:function(e){for(var t in this.binders){var i=this.binders[t];i instanceof Ts&&i.setConstantPatternPositions(e)}}},{key:"updatePaintArrays",value:function(e,t,i,r,n,a){var o=!1;for(var s in e){var l,u=t.getPositions(s),c=f(u);try{for(c.s();!(l=c.n()).done;){var h=l.value,d=i.feature(h.index);for(var p in this.binders){var v=this.binders[p];if((v instanceof Es||v instanceof Ss||v instanceof Ms)&&!0===v.expression.isStateDependent){var m=r.paint.get(p);v.expression=m.value,v.updatePaintArray(h.start,h.end,d,e[s],n,a),o=!0}}}}catch(y){c.e(y)}finally{c.f()}}return o}},{key:"defines",value:function(){var e=[];for(var t in this.binders){var i=this.binders[t];(i instanceof ks||i instanceof Ts)&&e.push.apply(e,c(i.uniformNames.map((function(e){return"#define HAS_UNIFORM_".concat(e)}))))}return e}},{key:"getBinderAttributes",value:function(){var e=[];for(var t in this.binders){var i=this.binders[t];if(i instanceof Es||i instanceof Ss||i instanceof Ms)for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:function(){return!0};d(this,e),this.programConfigurations={};var n,a=f(t);try{for(a.s();!(n=a.n()).done;){var o=n.value;this.programConfigurations[o.id]=new As(o,i,r)}}catch(s){a.e(s)}finally{a.f()}this.needsUpload=!1,this._featureMap=new hs,this._bufferOffset=0}return p(e,[{key:"populatePaintArrays",value:function(e,t,i,r,n,a,o){for(var s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,t,r,n,a,o);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}},{key:"updatePaintArrays",value:function(e,t,i,r,n){var a,o=f(i);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(e,this._featureMap,t,s,r,n)||this.needsUpload}}catch(l){o.e(l)}finally{o.f()}}},{key:"get",value:function(e){return this.programConfigurations[e]}},{key:"upload",value:function(e){if(this.needsUpload){for(var t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}},{key:"destroy",value:function(){for(var e in this.programConfigurations)this.programConfigurations[e].destroy()}}]),e}(),Cs={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function zs(e,t){return Cs[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}var Ps={"line-pattern":{source:So,composite:So},"fill-pattern":{source:So,composite:So},"fill-extrusion-pattern":{source:So,composite:So},"line-dasharray":{source:Mo,composite:Mo}},Ds={color:{source:qo,composite:Eo},number:{source:Vo,composite:qo}};function Ls(e,t,i){var r=Ps[e];return r&&r[i]||Ds[t][i]}ia(ks,"ConstantBinder"),ia(Ts,"PatternConstantBinder"),ia(Es,"SourceExpressionBinder"),ia(Ms,"PatternCompositeBinder"),ia(Ss,"CompositeExpressionBinder"),ia(As,"ProgramConfiguration",{omit:["_buffers"]}),ia(Is,"ProgramConfigurationSet");var Rs="-transition",Bs=function(e){v(i,e);var t=m(i);function i(e,r){var n;if(d(this,i),(n=t.call(this)).id=e.id,n.type=e.type,n._featureFilter={filter:function(){return!0},needGeometry:!1,needFeature:!1},n._filterCompiled=!1,"custom"!==e.type&&(n.metadata=e.metadata,n.minzoom=e.minzoom,n.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(n.source=e.source,n.sourceLayer=e["source-layer"],n.filter=e.filter),r.layout&&(n._unevaluatedLayout=new so(r.layout)),r.paint)){for(var a in n._transitionablePaint=new no(r.paint),e.paint)n.setPaintProperty(a,e.paint[a],{validate:!1});for(var o in e.layout)n.setLayoutProperty(o,e.layout[o],{validate:!1});n._transitioningPaint=n._transitionablePaint.untransitioned(),n.paint=new uo(r.paint)}return l(n)}return p(i,[{key:"getLayoutProperty",value:function(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}},{key:"setLayoutProperty",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!=t&&this._validate(Kn,"layers.".concat(this.id,".layout.").concat(e),e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}},{key:"getPaintProperty",value:function(e){return K(e,Rs)?this._transitionablePaint.getTransition(e.slice(0,-Rs.length)):this._transitionablePaint.getValue(e)}},{key:"setPaintProperty",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!=t&&this._validate(Yn,"layers.".concat(this.id,".paint.").concat(e),e,t,i))return!1;if(K(e,Rs))return this._transitionablePaint.setTransition(e.slice(0,-Rs.length),t||void 0),!1;var r=this._transitionablePaint._values[e],n=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);var o=this._transitionablePaint._values[e].value,s=o.isDataDriven(),l=K(e,"pattern")||"line-dasharray"===e;return s||n||l||this._handleOverridablePaintPropertyUpdate(e,a,o)}},{key:"_handleSpecialPaintPropertyUpdate",value:function(e){}},{key:"getProgramIds",value:function(){return null}},{key:"getProgramConfiguration",value:function(e){return null}},{key:"_handleOverridablePaintPropertyUpdate",value:function(e,t,i){return!1}},{key:"isHidden",value:function(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}},{key:"updateTransitions",value:function(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}},{key:"hasTransition",value:function(){return this._transitioningPaint.hasTransition()}},{key:"recalculate",value:function(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}},{key:"serialize",value:function(){var e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),$(e,(function(e,t){return!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)}))}},{key:"_validate",value:function(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return(!n||!1!==n.validate)&&$n(this,e.call(Hn,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:ct,style:{glyphs:!0,sprite:!0}}))}},{key:"is3D",value:function(){return!1}},{key:"isSky",value:function(){return!1}},{key:"isTileClipped",value:function(){return!1}},{key:"hasOffscreenPass",value:function(){return!1}},{key:"resize",value:function(){}},{key:"isStateDependent",value:function(){for(var e in this.paint._values){var t=this.paint.get(e);if(t instanceof lo&&Zr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}},{key:"compileFilter",value:function(){this._filterCompiled||(this._featureFilter=xn(this.filter),this._filterCompiled=!0)}},{key:"invalidateCompiledFilter",value:function(){this._filterCompiled=!1}},{key:"dynamicFilter",value:function(){return this._featureFilter.dynamicFilter}},{key:"dynamicFilterNeedsFeature",value:function(){return this._featureFilter.needFeature}}]),i}(ut),Os=go([{name:"a_pos",components:2,type:"Int16"}],4),Fs=go([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),Us=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];d(this,e),this.segments=t}return p(e,[{key:"prepareSegment",value:function(t,i,r,n){var a=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&te("Max vertices per segment is ".concat(e.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!a||a.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n)&&(a={vertexOffset:i.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(a.sortKey=n),this.segments.push(a)),a}},{key:"get",value:function(){return this.segments}},{key:"destroy",value:function(){var e,t=f(this.segments);try{for(t.s();!(e=t.n()).done;){var i=e.value;for(var r in i.vaos)i.vaos[r].destroy()}}catch(n){t.e(n)}finally{t.f()}}}],[{key:"simpleSegment",value:function(t,i,r,n){return new e([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}]),e}();Us.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ia(Us,"SegmentVector");var Vs=8192,Ns=function(){function e(t,i){d(this,e),t&&(i?this.setSouthWest(t).setNorthEast(i):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}return p(e,[{key:"setNorthEast",value:function(e){return this._ne=e instanceof mu?new mu(e.lng,e.lat):mu.convert(e),this}},{key:"setSouthWest",value:function(e){return this._sw=e instanceof mu?new mu(e.lng,e.lat):mu.convert(e),this}},{key:"extend",value:function(t){var i,r,n=this._sw,a=this._ne;if(t instanceof mu)i=t,r=t;else{if(!(t instanceof e))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(e.convert(t)):this.extend(mu.convert(t)):"object"==typeof t&&null!==t&&t.hasOwnProperty("lat")&&(t.hasOwnProperty("lon")||t.hasOwnProperty("lng"))?this.extend(mu.convert(t)):this;if(i=t._sw,r=t._ne,!i||!r)return this}return n||a?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new mu(i.lng,i.lat),this._ne=new mu(r.lng,r.lat)),this}},{key:"getCenter",value:function(){return new mu((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}},{key:"getSouthWest",value:function(){return this._sw}},{key:"getNorthEast",value:function(){return this._ne}},{key:"getNorthWest",value:function(){return new mu(this.getWest(),this.getNorth())}},{key:"getSouthEast",value:function(){return new mu(this.getEast(),this.getSouth())}},{key:"getWest",value:function(){return this._sw.lng}},{key:"getSouth",value:function(){return this._sw.lat}},{key:"getEast",value:function(){return this._ne.lng}},{key:"getNorth",value:function(){return this._ne.lat}},{key:"toArray",value:function(){return[this._sw.toArray(),this._ne.toArray()]}},{key:"toString",value:function(){return"LngLatBounds(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}},{key:"isEmpty",value:function(){return!(this._sw&&this._ne)}},{key:"contains",value:function(e){var t=mu.convert(e),i=t.lng,r=t.lat,n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}}],[{key:"convert",value:function(t){return!t||t instanceof e?t:new e(t)}}]),e}(),js=1e-6,Gs="undefined"!=typeof Float32Array?Float32Array:Array;function Zs(){var e=new Gs(9);return Gs!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function qs(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=i[0],d=i[1],p=i[2],v=i[3],m=i[4],y=i[5],_=i[6],g=i[7],x=i[8];return e[0]=f*r+d*o+p*u,e[1]=f*n+d*s+p*c,e[2]=f*a+d*l+p*h,e[3]=v*r+m*o+y*u,e[4]=v*n+m*s+y*c,e[5]=v*a+m*l+y*h,e[6]=_*r+g*o+x*u,e[7]=_*n+g*s+x*c,e[8]=_*a+g*l+x*h,e}function Ws(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Xs(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],f=t[10],d=t[11],p=t[12],v=t[13],m=t[14],y=t[15],_=i*s-r*o,g=i*l-n*o,x=i*u-a*o,b=r*l-n*s,w=r*u-a*s,k=n*u-a*l,T=c*v-h*p,E=c*m-f*p,S=c*y-d*p,M=h*m-f*v,A=h*y-d*v,I=f*y-d*m,C=_*I-g*A+x*M+b*S-w*E+k*T;return C?(e[0]=(s*I-l*A+u*M)*(C=1/C),e[1]=(n*A-r*I-a*M)*C,e[2]=(v*k-m*w+y*b)*C,e[3]=(f*w-h*k-d*b)*C,e[4]=(l*S-o*I-u*E)*C,e[5]=(i*I-n*S+a*E)*C,e[6]=(m*x-p*k-y*g)*C,e[7]=(c*k-f*x+d*g)*C,e[8]=(o*A-s*S+u*T)*C,e[9]=(r*S-i*A-a*T)*C,e[10]=(p*w-v*x+y*_)*C,e[11]=(h*x-c*w-d*_)*C,e[12]=(s*E-o*M-l*T)*C,e[13]=(i*M-r*E+n*T)*C,e[14]=(v*g-p*b-m*_)*C,e[15]=(c*b-h*g+f*_)*C,e):null}function Hs(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],v=t[12],m=t[13],y=t[14],_=t[15],g=i[0],x=i[1],b=i[2],w=i[3];return e[0]=g*r+x*s+b*h+w*v,e[1]=g*n+x*l+b*f+w*m,e[2]=g*a+x*u+b*d+w*y,e[3]=g*o+x*c+b*p+w*_,e[4]=(g=i[4])*r+(x=i[5])*s+(b=i[6])*h+(w=i[7])*v,e[5]=g*n+x*l+b*f+w*m,e[6]=g*a+x*u+b*d+w*y,e[7]=g*o+x*c+b*p+w*_,e[8]=(g=i[8])*r+(x=i[9])*s+(b=i[10])*h+(w=i[11])*v,e[9]=g*n+x*l+b*f+w*m,e[10]=g*a+x*u+b*d+w*y,e[11]=g*o+x*c+b*p+w*_,e[12]=(g=i[12])*r+(x=i[13])*s+(b=i[14])*h+(w=i[15])*v,e[13]=g*n+x*l+b*f+w*m,e[14]=g*a+x*u+b*d+w*y,e[15]=g*o+x*c+b*p+w*_,e}function Ys(e,t,i){var r,n,a,o,s,l,u,c,h,f,d,p,v=i[0],m=i[1],y=i[2];return t===e?(e[12]=t[0]*v+t[4]*m+t[8]*y+t[12],e[13]=t[1]*v+t[5]*m+t[9]*y+t[13],e[14]=t[2]*v+t[6]*m+t[10]*y+t[14],e[15]=t[3]*v+t[7]*m+t[11]*y+t[15]):(n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],e[0]=r=t[0],e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=f,e[10]=d,e[11]=p,e[12]=r*v+s*m+h*y+t[12],e[13]=n*v+l*m+f*y+t[13],e[14]=a*v+u*m+d*y+t[14],e[15]=o*v+c*m+p*y+t[15]),e}function Ks(e,t,i){var r=i[0],n=i[1],a=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Js(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*r,e[5]=o*n+c*r,e[6]=s*n+h*r,e[7]=l*n+f*r,e[8]=u*n-a*r,e[9]=c*n-o*r,e[10]=h*n-s*r,e[11]=f*n-l*r,e}function $s(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],c=t[9],h=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*r,e[1]=o*n-c*r,e[2]=s*n-h*r,e[3]=l*n-f*r,e[8]=a*r+u*n,e[9]=o*r+c*n,e[10]=s*r+h*n,e[11]=l*r+f*n,e}function Qs(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function el(e,t,i){var r,n,a,o=i[0],s=i[1],l=i[2],u=Math.hypot(o,s,l);return u0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function pl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function vl(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2];return e[0]=n*l-a*s,e[1]=a*o-r*l,e[2]=r*s-n*o,e}function ml(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[3]*r+i[7]*n+i[11]*a+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*a+i[12])/(o=o||1),e[1]=(i[1]*r+i[5]*n+i[9]*a+i[13])/o,e[2]=(i[2]*r+i[6]*n+i[10]*a+i[14])/o,e}function yl(e,t,i){var r=i[0],n=i[1],a=i[2],o=t[0],s=t[1],l=t[2],u=n*l-a*s,c=a*o-r*l,h=r*s-n*o,f=n*h-a*c,d=a*u-r*h,p=r*c-n*u,v=2*i[3];return c*=v,h*=v,d*=2,p*=2,e[0]=o+(u*=v)+(f*=2),e[1]=s+c+d,e[2]=l+h+p,e}var _l,gl=sl,xl=ll,bl=nl;function wl(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function kl(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=i*o,e[1]=r*o,e[2]=n*o,e[3]=a*o,e}function Tl(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*a+i[12]*o,e[1]=i[1]*r+i[5]*n+i[9]*a+i[13]*o,e[2]=i[2]*r+i[6]*n+i[10]*a+i[14]*o,e[3]=i[3]*r+i[7]*n+i[11]*a+i[15]*o,e}function El(){var e=new Gs(4);return Gs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Sl(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ml(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-r*s,e}function Al(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l-a*s,e[1]=n*l+o*s,e[2]=a*l+r*s,e[3]=o*l-n*s,e}il(),_l=new Gs(4),Gs!=Float32Array&&(_l[0]=0,_l[1]=0,_l[2]=0,_l[3]=0);var Il=kl;il(),al(1,0,0),al(0,1,0),El(),El(),Zs();var Cl=go([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]).members,zl=go([{name:"a_pos_3",components:3,type:"Int16"}]),Pl=go([{name:"a_pos",type:"Int16",components:2}]),Dl=function(){function e(t,i){d(this,e),this.pos=t,this.dir=i}return p(e,[{key:"intersectsPlane",value:function(e,t,i){var r=pl(t,this.dir);if(Math.abs(r)<1e-6)return!1;var n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,i[2]=this.pos[2]+this.dir[2]*n,!0}},{key:"closestPointOnSphere",value:function(e,t,i){if(function(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(i-a)<=js*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=js*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=js*Math.max(1,Math.abs(n),Math.abs(s))}(this.pos,e)||0===t)return i[0]=i[1]=i[2]=0,!1;var r=h(this.dir,3),n=r[0],a=r[1],o=r[2],s=this.pos[0]-e[0],l=this.pos[1]-e[1],u=this.pos[2]-e[2],c=n*n+a*a+o*o,f=2*(s*n+l*a+u*o),d=f*f-4*c*(s*s+l*l+u*u-t*t);if(d<0){var p=Math.max(-f/2,0),v=s+n*p,m=l+a*p,y=u+o*p,_=Math.hypot(v,m,y);return i[0]=v*t/_,i[1]=m*t/_,i[2]=y*t/_,!1}var g=(-f-Math.sqrt(d))/(2*c);if(g<0){var x=Math.hypot(s,l,u);return i[0]=s*t/x,i[1]=l*t/x,i[2]=u*t/x,!1}return i[0]=s+n*g,i[1]=l+a*g,i[2]=u+o*g,!0}}]),e}(),Ll=function(){function e(t,i,r,n,a){d(this,e),this.TL=t,this.TR=i,this.BR=r,this.BL=n,this.horizon=a}return p(e,null,[{key:"fromInvProjectionMatrix",value:function(t,i,r){var n=[-1,1,1],a=[1,1,1],o=[1,-1,1],s=[-1,-1,1];return new e(ml(n,n,t),ml(a,a,t),ml(o,o,t),ml(s,s,t),i/r)}}]),e}(),Rl=function(){function e(t,i){d(this,e),this.points=t,this.planes=i}return p(e,null,[{key:"fromInvProjectionMatrix",value:function(t,i,r,n){var a=Math.pow(2,r),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(e){var r=Tl([],e,t),o=1/r[3]/i*a;return function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}(r,r,[o,o,n?1/r[3]:o,o])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var t=dl([],vl([],gl([],o[e[0]],o[e[1]]),gl([],o[e[2]],o[e[1]]))),i=-pl(t,o[e[1]]);return t.concat(i)}));return new e(o,s)}}]),e}(),Bl=function(){function e(t,i){d(this,e),this.min=t,this.max=i,this.center=hl([],ol([],this.min,this.max),.5)}return p(e,[{key:"quadrant",value:function(t){for(var i=[t%2==0,t<2],r=rl(this.min),n=rl(this.max),a=0;a=0;if(0===a)return 0;a!==t.length&&(i=!1)}if(i)return 2;for(var s=0;s<3;s++){for(var l=Number.MAX_VALUE,u=-Number.MAX_VALUE,c=0;cthis.max[s]-this.min[s])return 0}return 1}}],[{key:"fromPoints",value:function(t){var i,r=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0],a=f(t);try{for(a.s();!(i=a.n()).done;){var o=i.value;ul(r,r,o),cl(n,n,o)}}catch(s){a.e(s)}finally{a.f()}return new e(r,n)}},{key:"applyTransform",value:function(t,i){for(var r=t.getCorners(),n=0;n3&&void 0!==arguments[3])||arguments[3],n=hl([],e._camera.position,e.worldSize),a=[t,i,1,1];Tl(a,a,e.pixelMatrixInverse),wl(a,a,1/a[3]);var o=dl([],gl([],a,n)),s=e.globeMatrix,l=[s[12],s[13],s[14]],u=gl([],l,n),c=nl(u),h=dl([],u),f=e.worldSize/(2*Math.PI),d=pl(h,o),p=Math.asin(f/c);if(p1?null:function(e,t,i,r){var n=Math.sin(i);return e*(Math.sin((1-r)*i)/n)+t*(Math.sin(r*i)/n)}(e.a[t],e.b[t],e.angle,F(i,0,1))+e.center[t];var i}function Xl(e){if(e.z<=1)return jl[e.z+2*e.y+e.x];var t=Ql($l(e));return Bl.fromPoints(t)}function Hl(e,t,i){return hl(e,e,1-i),fl(e,e,t,i)}function Yl(e,t){var i=lu(t.zoom);if(0===i)return Xl(e);var r=$l(e),n=Ql(r),a=_u(r.getWest())*t.worldSize,o=_u(r.getEast())*t.worldSize,s=gu(r.getNorth())*t.worldSize,l=gu(r.getSouth())*t.worldSize,u=[a,s,0],c=[o,s,0],h=[a,l,0],f=[o,l,0],d=Xs([],t.globeMatrix);return ml(u,u,d),ml(c,c,d),ml(h,h,d),ml(f,f,d),n[0]=Hl(n[0],h,i),n[1]=Hl(n[1],f,i),n[2]=Hl(n[2],c,i),n[3]=Hl(n[3],u,i),Bl.fromPoints(n)}function Kl(e,t,i){var r,n=f(e);try{for(n.s();!(r=n.n()).done;){var a=r.value;ml(a,a,t),hl(a,a,i)}}catch(o){n.e(o)}finally{n.f()}}function Jl(e,t,i){var r=t/e.worldSize,n=e.globeMatrix;if(i.z<=1){var a=Xl(i).getCorners();return Kl(a,n,r),Bl.fromPoints(a)}var o=$l(i),s=Ql(o);Kl(s,n,r);var l=Number.MAX_VALUE,u=[-l,-l,-l],c=[l,l,l];if(o.contains(e.center)){var h,d=f(s);try{for(d.s();!(h=d.n()).done;){var p=h.value;ul(c,c,p),cl(u,u,p)}}catch(U){d.e(U)}finally{d.f()}u[2]=0;var v=e.point,m=[v.x*r,v.y*r,0];return ul(c,c,m),cl(u,u,m),new Bl(c,u)}var y=[n[12]*r,n[13]*r,n[14]*r],_=o.getCenter(),g=F(e.center.lat,-Tu,Tu),x=F(_.lat,-Tu,Tu),b=_u(e.center.lng),w=gu(g),k=b-_u(_.lng),T=w-gu(x);k>.5?k-=1:k<-.5&&(k+=1);var E=0;Math.abs(k)>Math.abs(T)?E=k>=0?1:3:(E=T>=0?0:2,fl(y,y,[n[4]*r,n[5]*r,n[6]*r],-Math.sin(P(T>=0?o.getSouth():o.getNorth()))*Ol));var S=s[E],M=s[(E+1)%4],A=new ql(S,M,y),I=[Wl(A,0)||S[0],Wl(A,1)||S[1],Wl(A,2)||S[2]],C=lu(e.zoom);if(C>0){for(var z=function(e,t,i,r,n){var a=e.x,o=e.y,s=1/(1<.5?f=-1:d<-.5&&(f=1),c=(c*t-(n*=t))*i+n,[[l=((l+f)*t-(r*=t))*i+r,h=(h*t-n)*i+n,0],[u=((u+f)*t-r)*i+r,h,0],[u,c,0],[l,c,0]]}(i,t,e._pixelsPerMercatorPixel,b,w),D=0;D3&&void 0!==arguments[3]?arguments[3]:Ol;return i=P(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function tu(e,t,i){return eu(Math.cos(P(e)),Math.sin(P(e)),t,i)}function iu(e,t,i,r){var n=1<Math.PI/2*1.01}var hu=P(85),fu=Math.cos(hu),du=Math.sin(hu),pu=6371008.8,vu=2*Math.PI*pu,mu=function(){function e(t,i){if(d(this,e),isNaN(t)||isNaN(i))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(i,")"));if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}return p(e,[{key:"wrap",value:function(){return new e(V(this.lng,-180,180),this.lat)}},{key:"toArray",value:function(){return[this.lng,this.lat]}},{key:"toString",value:function(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}},{key:"distanceTo",value:function(e){var t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return pu*Math.acos(Math.min(n,1))}},{key:"toBounds",value:function(){var t=360*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new Ns(new e(this.lng-i,this.lat-t),new e(this.lng+i,this.lat+t))}},{key:"toEcef",value:function(e){var t=Gl(e);return tu(this.lat,this.lng,Ol+t)}}],[{key:"convert",value:function(t){if(t instanceof e)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new e(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: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}]),e}();function yu(e){return vu*Math.cos(e*Math.PI/180)}function _u(e){return(180+e)/360}function gu(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function xu(e,t){return e/yu(t)}function bu(e){return 360*e-180}function wu(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function ku(e,t){return e*yu(wu(t))}var Tu=85.051129;function Eu(e){return 1/Math.cos(e*Math.PI/180)}var Su=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;d(this,e),this.x=+t,this.y=+i,this.z=+r}return p(e,[{key:"toLngLat",value:function(){return new mu(bu(this.x),wu(this.y))}},{key:"toAltitude",value:function(){return ku(this.z,this.y)}},{key:"meterInMercatorCoordinateUnits",value:function(){return 1/vu*Eu(wu(this.y))}}],[{key:"fromLngLat",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=mu.convert(t);return new e(_u(r.lng),gu(r.lat),xu(i,r.lat))}}]),e}();function Mu(e,t,i,r,n,a,o,s,l){var u=(t+r)/2,c=(i+n)/2,h=new A(u,c);s(h),function(e,t,i,r,n,a){var o=i-n,s=r-a;return Math.abs((r-t)*o-(i-e)*s)/Math.hypot(o,s)}(h.x,h.y,a.x,a.y,o.x,o.y)>=l?(Mu(e,t,i,u,c,a,h,s,l),Mu(e,u,c,r,n,h,o,s,l)):e.push(o)}function Au(e,t,i){var r=e[0],n=r.x,a=r.y;t(r);for(var o=[r],s=1;se.x+1||re.y+1)&&te("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Lu(e,t,i){var r=e.loadGeometry(),n=e.extent,a=Vs/n;if(t&&i&&i.projection.isReprojectedInTileSpace)for(var o=1<=n||y.y<0||y.y>=n||(h(y),v.push(y))}}catch(k){m.e(k)}finally{m.f()}r[d]=v}var _,g=f(r);try{for(g.s();!(_=g.n()).done;){var x,b=_.value,w=f(b);try{for(w.s();!(x=w.n()).done;)Du(x.value,a)}catch(k){w.e(k)}finally{w.f()}}}catch(k){g.e(k)}finally{g.f()}return r}function Ru(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Lu(e):[]}}function Bu(e,t,i,r,n){e.emplaceBack(2*t+(r+1)/2,2*i+(n+1)/2)}function Ou(e,t,i){var r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}var Fu=function(){function e(t){d(this,e),this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(e){return e.id})),this.index=t.index,this.hasPattern=!1,this.projection=t.projection,this.layoutVertexArray=new bo,this.indexArray=new Oo,this.segments=new Us,this.programConfigurations=new Is(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id}))}return p(e,[{key:"populate",value:function(e,t,i,r){var n=this.layers[0],a=[],o=null;"circle"===n.type&&(o=n.layout.get("circle-sort-key"));var s,l=f(e);try{for(l.s();!(s=l.n()).done;){var u=s.value,c=u.feature,h=u.id,d=u.index,p=u.sourceLayerIndex,v=this.layers[0]._featureFilter.needGeometry,m=Ru(c,v);if(this.layers[0]._featureFilter.filter(new to(this.zoom),m,i)){var y=o?o.evaluate(m,{},i):void 0,_={id:h,properties:c.properties,type:c.type,sourceLayerIndex:p,index:d,geometry:v?m.geometry:Lu(c,i,r),patterns:{},sortKey:y};a.push(_)}}}catch(M){l.e(M)}finally{l.f()}o&&a.sort((function(e,t){return e.sortKey-t.sortKey}));var g=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Ao,g=r.projection);for(var x=0,b=a;x=Vs||p<0||p>=Vs)){if(a){var v=a.projectTilePoint(d,p,n),m=a.upVector(n,d,p),y=this.globeExtVertexArray;Ou(y,v,m),Ou(y,v,m),Ou(y,v,m),Ou(y,v,m)}var _=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),g=_.vertexLength;Bu(this.layoutVertexArray,d,p,-1,-1),Bu(this.layoutVertexArray,d,p,1,-1),Bu(this.layoutVertexArray,d,p,1,1),Bu(this.layoutVertexArray,d,p,-1,1),this.indexArray.emplaceBack(g,g+1,g+2),this.indexArray.emplaceBack(g,g+2,g+3),_.vertexLength+=4,_.primitiveLength+=2}}}catch(x){c.e(x)}finally{c.f()}}}catch(x){s.e(x)}finally{s.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n)}}]),e}();function Uu(e,t){for(var i=0;i1){if(Gu(e,t))return!0;for(var r=0;r1?i:i.sub(t)._mult(n)._add(t))}function Xu(e,t){for(var i,r,n,a=!1,o=0;ot.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(a=!a);return a}function Hu(e,t){for(var i=!1,r=0,n=e.length-1;rt.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(i=!i)}return i}function Yu(e,t,i,r,n){var a,o=f(e);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(t<=s.x&&i<=s.y&&r>=s.x&&n>=s.y)return!0}}catch(d){o.e(d)}finally{o.f()}var l=[new A(t,i),new A(t,n),new A(r,n),new A(r,i)];if(e.length>2){var u,c=f(l);try{for(c.s();!(u=c.n()).done;)if(Hu(e,u.value))return!0}catch(d){c.e(d)}finally{c.f()}}for(var h=0;hn.x&&t.x>n.x||e.yn.y&&t.y>n.y)return!1;var a=ie(e,t,i[0]);return a!==ie(e,t,i[1])||a!==ie(e,t,i[2])||a!==ie(e,t,i[3])}function Ju(e,t,i){var r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function $u(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Qu(e,t,i,r,n){if(!t[0]&&!t[1])return e;var a=A.convert(t)._mult(n);"viewport"===i&&a._rotate(-r);for(var o=[],s=0;s0){var v=i.projection.upVector(c,u.x,u.y);d.x+=v[0]*h*f,d.y+=v[1]*h*f,d.z+=v[2]*h*f}var m=a?u:nc(d.x,d.y,d.z,r),y=a?e.tilespaceRays.map((function(e){return sc(e,f)})):e.queryGeometry.screenGeometry,_=Tl([],[d.x,d.y,d.z,1],r);if(!o&&a?l*=_[3]/i.cameraToCenterDistance:o&&!a&&(l*=i.cameraToCenterDistance/_[3]),a){var g=wu((t.y/Vs+c.y)/(1<e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");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 destination coordinates for image copy");for(var o=e.data,s=t.data,l=0;l80*i){r=a=e[0],n=o=e[1];for(var p=i;pa&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-r,o-n))?32767/u:0}return wc(f,d,i,r,n,u,0),d}function xc(e,t,i,r,n){var a,o;if(n===Zc(e,t,i,r)>0)for(a=t;a=t;a-=r)o=Nc(a,e[a],e[a+1],o);return o&&Rc(o,o.next)&&(jc(o),o=o.next),o}function bc(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!Rc(r,r.next)&&0!==Lc(r.prev,r,r.next))r=r.next;else{if(jc(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function wc(e,t,i,r,n,a,o){if(e){!o&&a&&function(e,t,i,r){var n=e;do{0===n.z&&(n.z=Cc(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,a,o,s,l,u=1;do{for(i=e,e=null,a=null,o=0;i;){for(o++,r=i,s=0,t=0;t0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;i=r}a.nextZ=null,u*=2}while(o>1)}(n)}(e,r,n,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Tc(e,r,n,a):kc(e))t.push(s.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),jc(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?wc(e=Ec(bc(e),t,i),t,i,r,n,a,2):2===o&&Sc(e,t,i,r,n,a):wc(bc(e),t,i,r,n,a,1);break}}}function kc(e){var t=e.prev,i=e,r=e.next;if(Lc(t,i,r)>=0)return!1;for(var n=t.x,a=i.x,o=r.x,s=t.y,l=i.y,u=r.y,c=na?n>o?n:o:a>o?a:o,d=s>l?s>u?s:u:l>u?l:u,p=r.next;p!==t;){if(p.x>=c&&p.x<=f&&p.y>=h&&p.y<=d&&Pc(n,s,a,l,o,u,p.x,p.y)&&Lc(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Tc(e,t,i,r){var n=e.prev,a=e,o=e.next;if(Lc(n,a,o)>=0)return!1;for(var s=n.x,l=a.x,u=o.x,c=n.y,h=a.y,f=o.y,d=sl?s>u?s:u:l>u?l:u,m=c>h?c>f?c:f:h>f?h:f,y=Cc(d,p,t,i,r),_=Cc(v,m,t,i,r),g=e.prevZ,x=e.nextZ;g&&g.z>=y&&x&&x.z<=_;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=m&&g!==n&&g!==o&&Pc(s,c,l,h,u,f,g.x,g.y)&&Lc(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,x.x>=d&&x.x<=v&&x.y>=p&&x.y<=m&&x!==n&&x!==o&&Pc(s,c,l,h,u,f,x.x,x.y)&&Lc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=m&&g!==n&&g!==o&&Pc(s,c,l,h,u,f,g.x,g.y)&&Lc(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=v&&x.y>=p&&x.y<=m&&x!==n&&x!==o&&Pc(s,c,l,h,u,f,x.x,x.y)&&Lc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ec(e,t,i){var r=e;do{var n=r.prev,a=r.next.next;!Rc(n,a)&&Bc(n,r,r.next,a)&&Uc(n,a)&&Uc(a,n)&&(t.push(n.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),jc(r),jc(r.next),r=e=a),r=r.next}while(r!==e);return bc(r)}function Sc(e,t,i,r,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Dc(o,s)){var l=Vc(o,s);return o=bc(o,o.next),l=bc(l,l.next),wc(o,t,i,r,n,a,0),void wc(l,t,i,r,n,a,0)}s=s.next}o=o.next}while(o!==e)}function Mc(e,t){return e.x-t.x}function Ac(e,t){var i=function(e,t){var i,r=t,n=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,i=r.x=r.x&&r.x>=c&&n!==r.x&&Pc(ai.x||r.x===i.x&&Ic(i,r)))&&(i=r,f=l)),r=r.next}while(r!==u);return i}(e,t);if(!i)return t;var r=Vc(i,e);return bc(r,r.next),bc(i,i.next)}function Ic(e,t){return Lc(e.prev,e,t.prev)<0&&Lc(t.next,e,e.next)<0}function Cc(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function zc(e){var t=e,i=e;do{(t.x=(e-o)*(a-s)&&(e-o)*(r-s)>=(i-o)*(t-s)&&(i-o)*(a-s)>=(n-o)*(r-s)}function Dc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&Bc(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Uc(e,t)&&Uc(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(Lc(e.prev,e,t.prev)||Lc(e,t.prev,t))||Rc(e,t)&&Lc(e.prev,e,e.next)>0&&Lc(t.prev,t,t.next)>0)}function Lc(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Rc(e,t){return e.x===t.x&&e.y===t.y}function Bc(e,t,i,r){var n=Fc(Lc(e,t,i)),a=Fc(Lc(e,t,r)),o=Fc(Lc(i,r,e)),s=Fc(Lc(i,r,t));return n!==a&&o!==s||!(0!==n||!Oc(e,i,t))||!(0!==a||!Oc(e,r,t))||!(0!==o||!Oc(i,e,r))||!(0!==s||!Oc(i,t,r))}function Oc(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Fc(e){return e>0?1:e<0?-1:0}function Uc(e,t){return Lc(e.prev,e,e.next)<0?Lc(e,t,e.next)>=0&&Lc(e,e.prev,t)>=0:Lc(e,t,e.prev)<0||Lc(e,e.next,t)<0}function Vc(e,t){var i=new Gc(e.i,e.x,e.y),r=new Gc(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function Nc(e,t,i,r){var n=new Gc(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function jc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Gc(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Zc(e,t,i,r){for(var n=0,a=t,o=i-r;ai;){if(r-i>600){var a=r-i+1,o=t-i+1,s=Math.log(a),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);Wc(e,t,Math.max(i,Math.floor(t-o*l/a+u)),Math.min(r,Math.floor(t+(a-o)*l/a+u)),n)}var c=e[t],h=i,f=r;for(Xc(e,i,t),n(e[r],c)>0&&Xc(e,i,r);h0;)f--}0===n(e[i],c)?Xc(e,i,f):Xc(e,++f,r),f<=t&&(i=f+1),t<=f&&(r=f-1)}}function Xc(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function Hc(e,t){return et?1:0}function Yc(e,t){var i=e.length;if(i<=1)return[e];for(var r,n,a=[],o=0;o1)for(var l=0;l0&&i.holes.push(r+=e[n-1].length)}return i};var Qc=function(){function e(t){d(this,e),this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(e){return e.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new bo,this.indexArray=new Oo,this.indexArray2=new Go,this.programConfigurations=new Is(t.layers,t.zoom),this.segments=new Us,this.segments2=new Us,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id})),this.projection=t.projection}return p(e,[{key:"populate",value:function(e,t,i,r){this.hasPattern=Jc("fill",this.layers,t);var n,a=this.layers[0].layout.get("fill-sort-key"),o=[],s=f(e);try{for(s.s();!(n=s.n()).done;){var l=n.value,u=l.feature,c=l.id,h=l.index,d=l.sourceLayerIndex,p=this.layers[0]._featureFilter.needGeometry,v=Ru(u,p);if(this.layers[0]._featureFilter.filter(new to(this.zoom),v,i)){var m=a?a.evaluate(v,{},i,t.availableImages):void 0,y={id:c,properties:u.properties,type:u.type,sourceLayerIndex:d,index:h,geometry:p?v.geometry:Lu(u,i,r),patterns:{},sortKey:m};o.push(y)}}}catch(E){s.e(E)}finally{s.f()}a&&o.sort((function(e,t){return e.sortKey-t.sortKey}));for(var _=0,g=o;_5&&void 0!==arguments[5]?arguments[5]:[],s=f(Yc(t,500));try{for(s.s();!(a=s.n()).done;){var l,u=a.value,c=0,h=f(u);try{for(h.s();!(l=h.n()).done;)c+=l.value.length}catch(E){h.e(E)}finally{h.f()}var d,p=this.segments.prepareSegment(c,this.layoutVertexArray,this.indexArray),v=p.vertexLength,m=[],y=[],_=f(u);try{for(_.s();!(d=_.n()).done;){var g=d.value;if(0!==g.length){g!==u[0]&&y.push(m.length/2);var x=this.segments2.prepareSegment(g.length,this.layoutVertexArray,this.indexArray2),b=x.vertexLength;this.layoutVertexArray.emplaceBack(g[0].x,g[0].y),this.indexArray2.emplaceBack(b+g.length-1,b),m.push(g[0].x),m.push(g[0].y);for(var w=1;w>3}if(n--,1===r||2===r)a+=e.readSVarint(),o+=e.readSVarint(),1===r&&(t&&s.push(t),t=[]),t.push(new sh(a,o));else{if(7!==r)throw new Error("unknown command "+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},uh.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,a=0,o=1/0,s=-1/0,l=1/0,u=-1/0;e.pos>3}if(r--,1===i||2===i)(n+=e.readSVarint())s&&(s=n),(a+=e.readSVarint())u&&(u=a);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,s,u]},uh.prototype.toGeoJSON=function(e,t,i){var r,n,a=this.extent*Math.pow(2,i),o=this.extent*e,s=this.extent*t,l=this.loadGeometry(),u=uh.types[this.type];function c(e){for(var t=0;t>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}ph.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new fh(this._pbf,t,this.extent,this._keys,this._values)};var mh=dh;function yh(e,t,i){if(3===e){var r=new mh(i,i.readVarint()+i.pos);r.length&&(t[r.name]=r)}}var _h=oh.VectorTile=function(e,t){this.layers=e.readFields(yh,{},t)},gh=oh.VectorTileFeature=lh;function xh(e,t,i,r){var n,a=[],o=0===r?function(e,t,i,r,n,a){e.push(new A(a,i+(a-t)/(r-t)*(n-i)))}:function(e,t,i,r,n,a){e.push(new A(t+(a-i)/(n-i)*(r-t),a))},s=f(e);try{for(s.s();!(n=s.n()).done;){var l,u=n.value,c=[],h=f(u);try{for(h.s();!(l=h.n()).done;){var d=l.value;if(!(d.length<=2)){for(var p=[],v=0;vt&&o(p,m,y,_,g,t):x>i?b=t&&o(p,m,y,_,g,t),b>i&&x<=i&&o(p,m,y,_,g,i)}var w=d[d.length-1],k=0===r?w.x:w.y;k>=t&&k<=i&&p.push(w),p.length&&(w=p[p.length-1],p[0].x===w.x&&p[0].y===w.y||p.push(p[0]),c.push(p))}}}catch(T){h.e(T)}finally{h.f()}c.length&&a.push(c)}}catch(T){s.e(T)}finally{s.f()}return a}oh.VectorTileLayer=dh;var bh=gh.types,wh=Math.pow(2,13);function kh(e,t,i,r,n,a,o,s){e.emplaceBack((t<<1)+o,(i<<1)+a,(Math.floor(r*wh)<<1)+n,Math.round(s))}function Th(e,t,i){var r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}var Eh=function(){function e(){d(this,e),this.acc=new A(0,0),this.polyCount=[]}return p(e,[{key:"startRing",value:function(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new A(e.x,e.y),this.max=new A(e.x,e.y))}},{key:"append",value:function(e,t){this.currentPolyCount.edges++,this.acc._add(e);var i=this.min,r=this.max;e.xr.x&&(r.x=e.x),e.yr.y&&(r.y=e.y),((0===e.x||e.x===Vs)&&e.x===t.x)!=((0===e.y||e.y===Vs)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,Ni(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Vs!=e.x>Vs&&this.addBorderIntersection(1,Ni(t.y,e.y,(Vs-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Ni(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Vs!=e.y>Vs&&this.addBorderIntersection(3,Ni(t.x,e.x,(Vs-t.y)/(e.y-t.y)))}},{key:"addBorderIntersection",value:function(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);var i=this.borders[e];ti[1]&&(i[1]=t)}},{key:"processBorderOverlap",value:function(e,t){if(e.x===t.x){if(e.y===t.y)return;var i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{var r=0===e.y?2:3;this.addBorderIntersection(r,t.x),this.addBorderIntersection(r,e.x)}}},{key:"centroid",value:function(){var e=this.polyCount.reduce((function(e,t){return e+t.edges}),0);return 0!==e?this.acc.div(e)._round():new A(0,0)}},{key:"span",value:function(){return new A(this.max.x-this.min.x,this.max.y-this.min.y)}},{key:"intersectsCount",value:function(){return this.borders.reduce((function(e,t){return e+ +(t[0]!==Number.MAX_VALUE)}),0)}}]),e}(),Sh=function(){function e(t){d(this,e),this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(e){return e.id})),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.layoutVertexArray=new ko,this.centroidVertexArray=new is,this.indexArray=new Oo,this.programConfigurations=new Is(t.layers,t.zoom),this.segments=new Us,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id})),this.enableTerrain=t.enableTerrain}return p(e,[{key:"populate",value:function(e,t,i,r){this.features=[],this.hasPattern=Jc("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(e){var t=Math.exp(Math.PI*(1-e.y/(1<=0;m--){var y=v[m];(0===y.length||(d=y[0]).every((function(e){return e.x<=0}))||d.every((function(e){return e.x>=Vs}))||d.every((function(e){return e.y<=0}))||d.every((function(e){return e.y>=Vs})))&&v.splice(m,1)}if(u)p=Lh(v,s,r);else{p=[];var _,g=f(v);try{for(g.s();!(_=g.n()).done;){var x=_.value;p.push({polygon:x,bounds:s})}}catch(Ce){g.e(Ce)}finally{g.f()}}var b,w=h?this.edgeRadius:0,k=f(p);try{for(k.s();!(b=k.n()).done;){var T,E=b.value,S=E.polygon,M=E.bounds,I=0,C=0,z=f(S);try{for(z.s();!(T=z.n()).done;){var P=T.value;h&&!P[0].equals(P[P.length-1])&&P.push(P[0]),C+=h?P.length-1:P.length}}catch(Ce){z.e(Ce)}finally{z.f()}var D=this.segments.prepareSegment((h?5:4)*C,this.layoutVertexArray,this.indexArray);if(h){var L=[],R=[];I=D.vertexLength;var B,O=f(S);try{for(O.s();!(B=O.n()).done;){var F=B.value,U=void 0,V=void 0;F.length&&F!==S[0]&&R.push(L.length/2),U=F[1].sub(F[0])._perp()._unit();for(var N=1;N4&&zh($[$.length-2],$[0],$[1]),re=w?Ah($[$.length-2],$[0],$[1],w):0;ee=$[1].sub($[0])._perp()._unit();for(var ne=!0,ae=1,oe=0;ae<$.length;ae++){var se=$[ae-1],le=$[ae],ue=$[ae===$.length-1?1:ae+1];if(c&&h&&c.currentPolyCount.top++,Ch(le,se,M))w&&(ee=ue.sub(le)._perp()._unit(),ne=!ne);else{c&&c.append(le,se);var ce=le.sub(se)._perp(),he=ce.x/(Math.abs(ce.x)+Math.abs(ce.y)),fe=ce.y>0?1:0,de=se.dist(le);if(oe+de>32768&&(oe=0),w){te=ue.sub(le)._perp()._unit();var pe=Ih(se,le,ue,Mh(ee,te),w);isNaN(pe)&&(pe=0);var ve=le.sub(se)._unit();se=se.add(ve.mult(re))._round(),le=le.add(ve.mult(-pe))._round(),re=pe,ee=te}var me=D.vertexLength,ye=$.length>4&&zh(se,le,ue),_e=Ph(oe,ie,ne);if(kh(this.layoutVertexArray,se.x,se.y,he,fe,0,0,_e),kh(this.layoutVertexArray,se.x,se.y,he,fe,0,1,_e),_e=Ph(oe+=de,ye,!ne),ie=ye,kh(this.layoutVertexArray,le.x,le.y,he,fe,0,0,_e),kh(this.layoutVertexArray,le.x,le.y,he,fe,0,1,_e),D.vertexLength+=4,this.indexArray.emplaceBack(me+0,me+1,me+2),this.indexArray.emplaceBack(me+1,me+3,me+2),D.primitiveLength+=2,w){var ge=I+(1===ae?$.length-2:ae-2),xe=1===ae?I:ge+1;if(this.indexArray.emplaceBack(me+1,ge,me+3),this.indexArray.emplaceBack(ge,xe,me+3),D.primitiveLength+=2,void 0===Q&&(Q=me),!Ch(ue,$[ae],M)){var be=ae===$.length-1?Q:D.vertexLength;this.indexArray.emplaceBack(me+2,me+3,be),this.indexArray.emplaceBack(me+3,be+1,be),this.indexArray.emplaceBack(me+3,xe,be+1),D.primitiveLength+=3}ne=!ne}if(u){var we=this.layoutVertexExtArray,ke=l.projectTilePoint(se.x,se.y,r),Te=l.projectTilePoint(le.x,le.y,r),Ee=l.upVector(r,se.x,se.y),Se=l.upVector(r,le.x,le.y);Th(we,ke,Ee),Th(we,ke,Ee),Th(we,Te,Se),Th(we,Te,Se)}}}h&&(I+=$.length-1)}}catch(Ce){J.e(Ce)}finally{J.f()}}}catch(Ce){k.e(Ce)}finally{k.f()}if(c&&c.polyCount.length>0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;for(var Me=c.borders,Ae=this.featuresOnBorder.push(c)-1,Ie=0;Ie<4;Ie++)Me[Ie][0]!==Number.MAX_VALUE&&this.borders[Ie].push(Ae)}this.encodeCentroid(c.borders?void 0:c.centroid(),c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,a,r)}},{key:"sortBorders",value:function(){for(var e=this,t=function(t){e.borders[t].sort((function(i,r){return e.featuresOnBorder[i].borders[t][0]-e.featuresOnBorder[r].borders[t][0]}))},i=0;i<4;i++)t(i)}},{key:"encodeCentroid",value:function(e,t){var i,r,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e)if(0!==e.y){var a=t.span()._mult(this.tileToMeter);i=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(a.x/10)),r=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(a.y/10))}else i=Math.ceil(7*(e.x+450)),r=0;else i=0,r=+n;var o,s=n?this.centroidVertexArray.length:t.vertexArrayOffset,l=f(t.polyCount);try{for(l.s();!(o=l.n()).done;){var u=o.value;n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*u.edges+u.top);for(var c=0;ci[1].x&&t.x>i[1].x||e.yi[1].y&&t.y>i[1].y}function zh(e,t,i){if(e.x<0||e.x>=Vs||t.x<0||t.x>=Vs||i.x<0||i.x>=Vs)return!1;var r=i.sub(t),n=r.perp(),a=e.sub(t);return(r.x*a.x+r.y*a.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(a.x*a.x+a.y*a.y))>-.866&&n.x*a.x+n.y*a.y<0}function Ph(e,t,i){var r=t?2|e:-3&e;return i?1|r:-2&r}function Dh(){var e=Math.PI/32,t=Math.tan(e),i=pu;return i*Math.sqrt(1+2*t*t)-i}function Lh(e,t,i){var r=1<4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,o=[];if(!e.length||!i||!r)return o;for(var s=function(e,t){var i,r=f(e);try{for(r.s();!(i=r.n()).done;){var n=i.value;o.push({polygon:n,bounds:t})}}catch(a){r.e(a)}finally{r.f()}},l=Math.ceil(Math.log2(i)),u=Math.ceil(Math.log2(r)),c=l-u,h=[],d=0;d0?0:1);for(var p=0;p_+1?m.push({polygons:E,bounds:M,depth:_+1}):s(E,M)}if(S.length){var I=[new A(0===g?T:x.x,1===g?T:x.y),b];h.length>_+1?m.push({polygons:S,bounds:I,depth:_+1}):s(S,I)}}return o}(e,t,Math.ceil((a-n)/11.25),Math.ceil((o-s)/11.25),1,(function(e,t,n){if(0===e)return.5*(t+n);var a=wu((i.y+t/Vs)/r);return(gu(.5*(wu((i.y+n/Vs)/r)+a))*r-i.y)*Vs}))}ia(Sh,"FillExtrusionBucket",{omit:["layers","features"]}),ia(Eh,"PartMetadata");var Rh=new po({"fill-extrusion-edge-radius":new co(ct["layout_fill-extrusion"]["fill-extrusion-edge-radius"])}),Bh={paint:new po({"fill-extrusion-opacity":new co(ct["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ho(ct["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new co(ct["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new co(ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ho(ct["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ho(ct["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ho(ct["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new co(ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new co(ct["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new co(ct["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:Rh};function Oh(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}var Fh=function(){function e(t,i,r){d(this,e),this.z=t,this.x=i,this.y=r,this.key=Nh(0,t,t,i,r)}return p(e,[{key:"equals",value:function(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}},{key:"url",value:function(e,t){var i=function(e,t,i){var r=Oh(256*e,256*(t=Math.pow(2,i)-t-1),i),n=Oh(256*(e+1),256*(t+1),i);return r[0]+","+r[1]+","+n[0]+","+n[1]}(this.x,this.y,this.z),r=function(e,t,i){for(var r,n="",a=e;a>0;a--)n+=(t&(r=1<this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}},{key:"calculateScaledKey",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Nh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);var i=this.canonical.z-e;return Nh(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}},{key:"isChildOf",value:function(e){if(e.wrap!==this.wrap)return!1;var t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}},{key:"children",value:function(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var i=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new e(i,this.wrap,i,r,n),new e(i,this.wrap,i,r+1,n),new e(i,this.wrap,i,r,n+1),new e(i,this.wrap,i,r+1,n+1)]}},{key:"isLessThan",value:function(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y=2&&e[l-1].equals(e[l-2]);)l--;for(var u=0;u0;if(k&&y>u){var E=c.dist(h);if(E>2*v){var S=c.sub(c.sub(h)._mult(v/E)._round());this.updateDistance(h,S),this.addCurrentVertex(S,d,0,0,m),h=S}}var M=h&&f,A=M?i:s?"butt":r;if(M&&"round"===A&&(bn&&(A="bevel"),"bevel"===A&&(b>2&&(A="flipbevel"),b100)_=p.mult(-1);else{var I=b*d.add(p).mag()/d.sub(p).mag();_._perp()._mult(I*(T?-1:1))}this.addCurrentVertex(c,_,0,0,m),this.addCurrentVertex(c,_.mult(-1),0,0,m)}else if("bevel"===A||"fakeround"===A){var C=-Math.sqrt(b*b-1),z=T?C:0,P=T?0:C;if(h&&this.addCurrentVertex(c,d,z,P,m),"fakeround"===A)for(var D=Math.round(180*w/Math.PI/20),L=1;L2*v){var V=c.add(f.sub(c)._mult(v/U)._round());this.updateDistance(c,V),this.addCurrentVertex(V,p,0,0,m),c=V}}}}}},{key:"addCurrentVertex",value:function(e,t,i,r,n){var a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,a,!1,i,n),this.addHalfVertex(e,o,s,a,!0,-r,n)}},{key:"addHalfVertex",value:function(e,t,i,r,n,a,o){var s=e.x,l=e.y;this.layoutVertexArray.emplaceBack((s<<1)+(r?1:0),(l<<1)+(n?1:0),Math.round(63*t)+128,Math.round(63*i)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);var u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),n?this.e2=u:this.e1=u}},{key:"updateScaledDistance",value:function(){if(this.lineClips){var e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}},{key:"updateDistance",value:function(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}]),e}();ia(Kh,"LineBucket",{omit:["layers","patternFeatures"]});var Jh=new po({"line-cap":new ho(ct.layout_line["line-cap"]),"line-join":new ho(ct.layout_line["line-join"]),"line-miter-limit":new co(ct.layout_line["line-miter-limit"]),"line-round-limit":new co(ct.layout_line["line-round-limit"]),"line-sort-key":new ho(ct.layout_line["line-sort-key"])}),$h={paint:new po({"line-opacity":new ho(ct.paint_line["line-opacity"]),"line-color":new ho(ct.paint_line["line-color"]),"line-translate":new co(ct.paint_line["line-translate"]),"line-translate-anchor":new co(ct.paint_line["line-translate-anchor"]),"line-width":new ho(ct.paint_line["line-width"]),"line-gap-width":new ho(ct.paint_line["line-gap-width"]),"line-offset":new ho(ct.paint_line["line-offset"]),"line-blur":new ho(ct.paint_line["line-blur"]),"line-dasharray":new ho(ct.paint_line["line-dasharray"]),"line-pattern":new ho(ct.paint_line["line-pattern"]),"line-gradient":new fo(ct.paint_line["line-gradient"]),"line-trim-offset":new co(ct.paint_line["line-trim-offset"])}),layout:Jh},Qh=new(function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"possiblyEvaluate",value:function(e,t){return t=new to(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),o(s(i.prototype),"possiblyEvaluate",this).call(this,e,t)}},{key:"evaluate",value:function(e,t,r,n){return t=G({},t,{zoom:Math.floor(t.zoom)}),o(s(i.prototype),"evaluate",this).call(this,e,t,r,n)}}]),i}(ho))($h.paint.properties["line-width"].specification);function ef(e,t){return t>0?t+2*e:e}Qh.useIntegerZoom=!0;var tf=go([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rf=go([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),nf=go([{name:"a_projected_pos",components:4,type:"Float32"}],4);go([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var af=go([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),of=go([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);go([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var sf=go([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lf=go([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);go([{name:"triangle",components:3,type:"Uint16"}]),go([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),go([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),go([{type:"Float32",name:"offsetX"}]),go([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var uf=24,cf=128;function hf(e,t){var i=t.expression;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new to(e+1))};if("source"===i.kind)return{kind:"source"};for(var r=i.zoomStops,n=i.interpolationType,a=0;a":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42","\u2190":"\u2191","\u2192":"\u2193"};function yf(e){return"\ufe36"===e||"\ufe48"===e||"\ufe38"===e||"\ufe44"===e||"\ufe42"===e||"\ufe3e"===e||"\ufe3c"===e||"\ufe3a"===e||"\ufe18"===e||"\ufe40"===e||"\ufe10"===e||"\ufe13"===e||"\ufe14"===e||"\uff40"===e||"\uffe3"===e||"\ufe11"===e||"\ufe12"===e}function _f(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f"===e}var gf=wf,xf=function(e,t,i,r,n){var a,o,s=8*n-r-1,l=(1<>1,c=-7,h=i?n-1:0,f=i?-1:1,d=e[t+h];for(h+=f,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),a-=u}return(d?-1:1)*o*Math.pow(2,a-r)},bf=function(e,t,i,r,n,a){var o,s,l,u=8*a-n-1,c=(1<>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(t*l-1)*Math.pow(2,n),o+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,n),o=0));n>=8;e[i+d]=255&s,d+=p,s/=256,n-=8);for(o=o<0;e[i+d]=255&o,d+=p,o/=256,u-=8);e[i+d-p]|=128*v};function wf(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}wf.Varint=0,wf.Fixed64=1,wf.Bytes=2,wf.Fixed32=5;var kf=4294967296,Tf=1/kf,Ef="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Sf(e){return e.type===wf.Bytes?e.readVarint()+e.pos:e.pos+1}function Mf(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Af(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function If(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function Vf(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Nf(e,t,i){t.glyphs=[],1===e&&i.readMessage(jf,t)}function jf(e,t,i){if(3===e){var r=i.readMessage(Gf,{}),n=r.id,a=r.bitmap,o=r.width,s=r.height,l=r.left,u=r.top,c=r.advance;t.glyphs.push({id:n,bitmap:new fc({width:o+6,height:s+6},a),metrics:{width:o,height:s,left:l,top:u,advance:c}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function Gf(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}function Zf(e){var t,i=0,r=0,n=f(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;i+=a.w*a.h,r=Math.max(r,a.w)}}catch(m){n.e(m)}finally{n.f()}e.sort((function(e,t){return t.h-e.h}));var o,s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],l=0,u=0,c=f(e);try{for(c.s();!(o=c.n()).done;)for(var h=o.value,d=s.length-1;d>=0;d--){var p=s[d];if(!(h.w>p.w||h.h>p.h)){if(h.x=p.x,h.y=p.y,u=Math.max(u,h.y+h.h),l=Math.max(l,h.x+h.w),h.w===p.w&&h.h===p.h){var v=s.pop();d>3,a=this.pos;this.type=7&r,e(n,t,this),this.pos===a&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ff(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Vf(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ff(this.buf,this.pos)+Ff(this.buf,this.pos+4)*kf;return this.pos+=8,e},readSFixed64:function(){var e=Ff(this.buf,this.pos)+Vf(this.buf,this.pos+4)*kf;return this.pos+=8,e},readFloat:function(){var e=xf(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=xf(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,a=i.buf;if(r=(112&(n=a[i.pos++]))>>4,n<128)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<3,n<128)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<10,n<128)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<17,n<128)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<24,n<128)return Mf(e,r,t);if(r|=(1&(n=a[i.pos++]))<<31,n<128)return Mf(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Ef?function(e,t,i){return Ef.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n239?4:l>223?3:l>191?2:1;if(n+c>i)break;1===c?l<128&&(u=l):2===c?128==(192&(a=e[n+1]))&&(u=(31&l)<<6|63&a)<=127&&(u=null):3===c?(o=e[n+2],128==(192&(a=e[n+1]))&&128==(192&o)&&((u=(15&l)<<12|(63&a)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=e[n+2],s=e[n+3],128==(192&(a=e[n+1]))&&128==(192&o)&&128==(192&s)&&((u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=c}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==wf.Bytes)return e.push(this.readVarint(t));var i=Sf(this);for(e=e||[];this.pos127;);else if(t===wf.Bytes)this.pos=this.readVarint()+this.pos;else if(t===wf.Fixed32)this.pos+=4;else{if(t!==wf.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,a=0;a55295&&r<57344){if(!n){r>56319||a+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&Af(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),bf(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),bf(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&Af(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,wf.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,If,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Cf,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Df,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,zf,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Pf,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Lf,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Rf,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Bf,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Of,t)},writeBytesField:function(e,t){this.writeTag(e,wf.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,wf.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,wf.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,wf.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,wf.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,wf.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,wf.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,wf.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,wf.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,wf.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var qf=function(){function e(t,i){var r=i.pixelRatio,n=i.version,a=i.stretchX,o=i.stretchY,s=i.content;d(this,e),this.paddedRect=t,this.pixelRatio=r,this.stretchX=a,this.stretchY=o,this.content=s,this.version=n}return p(e,[{key:"tl",get:function(){return[this.paddedRect.x+1,this.paddedRect.y+1]}},{key:"br",get:function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}},{key:"displaySize",get:function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}]),e}(),Wf=function(){function e(t,i){d(this,e);var r={},n={};this.haveRenderCallbacks=[];var a=[];this.addImages(t,r,a),this.addImages(i,n,a);var o=Zf(a),s=o.w,l=o.h,u=new dc({width:s||1,height:l||1});for(var c in t){var h=t[c],f=r[c].paddedRect;dc.copy(h.data,u,{x:0,y:0},{x:f.x+1,y:f.y+1},h.data)}for(var p in i){var v=i[p],m=n[p].paddedRect,y=m.x+1,_=m.y+1,g=v.data.width,x=v.data.height;dc.copy(v.data,u,{x:0,y:0},{x:y,y:_},v.data),dc.copy(v.data,u,{x:0,y:x-1},{x:y,y:_-1},{width:g,height:1}),dc.copy(v.data,u,{x:0,y:0},{x:y,y:_+x},{width:g,height:1}),dc.copy(v.data,u,{x:g-1,y:0},{x:y-1,y:_},{width:1,height:x}),dc.copy(v.data,u,{x:0,y:0},{x:y+g,y:_},{width:1,height:x})}this.image=u,this.iconPositions=r,this.patternPositions=n}return p(e,[{key:"addImages",value:function(e,t,i){for(var r in e){var n=e[r],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(a),t[r]=new qf(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}},{key:"patchUpdatedImages",value:function(e,t){for(var i in this.haveRenderCallbacks=this.haveRenderCallbacks.filter((function(t){return e.hasImage(t)})),e.dispatchRenderCallbacks(this.haveRenderCallbacks),e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}},{key:"patchUpdatedImage",value:function(e,t,i){if(e&&t&&e.version!==t.version){e.version=t.version;var r=h(e.tl,2),n=r[0],a=r[1];i.update(t.data,void 0,{x:n,y:a})}}}]),e}();ia(qf,"ImagePosition"),ia(Wf,"ImageAtlas");var Xf={horizontal:1,vertical:2,horizontalOnly:3},Hf=function(){function e(){d(this,e),this.scale=1,this.fontStack="",this.imageName=null}return p(e,null,[{key:"forText",value:function(t,i){var r=new e;return r.scale=t||1,r.fontStack=i,r}},{key:"forImage",value:function(t){var i=new e;return i.imageName=t,i}}]),e}(),Yf=function(){function e(){d(this,e),this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}return p(e,[{key:"length",value:function(){return this.text.length}},{key:"getSection",value:function(e){return this.sections[this.sectionIndex[e]]}},{key:"getSections",value:function(){return this.sections}},{key:"getSectionIndex",value:function(e){return this.sectionIndex[e]}},{key:"getCharCode",value:function(e){return this.text.charCodeAt(e)}},{key:"verticalizePunctuation",value:function(e){this.text=function(e,t){for(var i="",r=0;r=0&&r>=e&&Jf[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}},{key:"substring",value:function(t,i){var r=new e;return r.text=this.text.substring(t,i),r.sectionIndex=this.sectionIndex.slice(t,i),r.sections=this.sections,r}},{key:"toString",value:function(){return this.text}},{key:"getMaxScale",value:function(){var e=this;return this.sectionIndex.reduce((function(t,i){return Math.max(t,e.sections[i].scale)}),0)}},{key:"addTextSection",value:function(e,t){this.text+=e.text,this.sections.push(Hf.forText(e.scale,e.fontStack||t));for(var i=this.sections.length-1,r=0;r=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}],[{key:"fromFeature",value:function(t,i){for(var r=new e,n=0;n=0,c=0,h=0;h0&&J>R&&(R=J)}else{var $=i[U.fontStack];if(!$)continue;$[N]&&(Z=$[N]);var Q=t[U.fontStack];if(!Q)continue;var ee=Q.glyphs[N];if(!ee)continue;if(G=ee.metrics,W=8203!==N?uf:0,_){var te=void 0!==Q.ascender?Math.abs(Q.ascender):0,ie=void 0!==Q.descender?Math.abs(Q.descender):0,re=(te+ie)*j;B-i/2;){if(--o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;for(var l=[],u=0;sr;)u-=l.shift().angleDelta;if(u>n)return!1;o++,s+=c.dist(h)}return!0}function cd(e){for(var t=0,i=0;iu){var p=(u-l)/d,v=Ni(h.x,f.x,p),m=Ni(h.y,f.y,p),y=new ld(v,m,0,f.angleTo(h),c);return!o||ud(e,y,s,o,t)?y:void 0}l+=d}}function pd(e,t,i,r,n,a,o,s,l){var u=hd(r,a,o),c=fd(r,n),h=c*o,f=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&x=0&&b=0&&f+u<=c){var w=new ld(x,b,0,_,p);w._round(),r&&!ud(e,w,a,r,n)||d.push(w)}}h+=y}return s||d.length||o||(d=vd(e,h/2,i,r,n,a,o,!0,l)),d}function md(e,t,i,r,n){for(var a=[],o=0;o=r&&h.x>=r||(c.x>=r?c=new A(r,c.y+(r-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x>=r&&(h=new A(r,c.y+(r-c.x)/(h.x-c.x)*(h.y-c.y))._round()),c.y>=n&&h.y>=n||(c.y>=n?c=new A(c.x+(n-c.y)/(h.y-c.y)*(h.x-c.x),n)._round():h.y>=n&&(h=new A(c.x+(n-c.y)/(h.y-c.y)*(h.x-c.x),n)._round()),l&&c.equals(l[l.length-1])||(l=[c],a.push(l)),l.push(h)))))}return a}ia(ld,"Anchor");var yd=1e20;function _d(e,t,i,r,n,a,o,s,l){for(var u=t;u-1);a[++l]=s,o[l]=u,o[l+1]=yd}for(var f=0,d=0;f65535)i(new Error("glyphs > 65535 not supported"));else if(o.ranges[l])i(null,{stack:n,id:a,glyph:s});else{var c=o.requests[l];c||(c=o.requests[l]=[],e.loadGlyphRange(n,l,r.url,r.requestManager,(function(e,t){if(t){for(var i in o.ascender=t.ascender,o.descender=t.descender,t.glyphs)r._doesCharSupportLocalGlyph(+i)||(o.glyphs[+i]=t.glyphs[+i]);o.ranges[l]=!0}var n,a=f(c);try{for(a.s();!(n=a.n()).done;)(0,n.value)(e,t)}catch(u){a.e(u)}finally{a.f()}delete o.requests[l]}))),c.push((function(e,t){e?i(e):t&&i(null,{stack:n,id:a,glyph:t.glyphs[a]||null})}))}}else i(null,{stack:n,id:a,glyph:s})}),(function(e,t){if(e)i(e);else if(t){var n,a={},o=f(t);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=s.stack,c=s.id,h=s.glyph;void 0===a[l]&&(a[l]={}),void 0===a[l].glyphs&&(a[l].glyphs={}),a[l].glyphs[c]=h&&{id:h.id,bitmap:h.bitmap.clone(),metrics:h.metrics},a[l].ascender=r.entries[l].ascender,a[l].descender=r.entries[l].descender}}catch(u){o.e(u)}finally{o.f()}i(null,a)}}))}},{key:"_doesCharSupportLocalGlyph",value:function(e){return this.localGlyphMode!==xd.none&&(this.localGlyphMode===xd.all?!!this.localFontFamily:!!this.localFontFamily&&(Ta(e)||Ma(e)||va(e)||ma(e)||pa(e)))}},{key:"_tinySDF",value:function(t,i,r){var n=this.localFontFamily;if(n&&this._doesCharSupportLocalGlyph(r)){var a=t.tinySDF;if(!a){var o="400";/bold/i.test(i)?o="900":/medium/i.test(i)?o="500":/light/i.test(i)&&(o="200"),(a=t.tinySDF=new e.TinySDF({fontFamily:n,fontWeight:o,fontSize:48,buffer:6,radius:16})).fontWeight=o}if(this.localGlyphs[a.fontWeight][r])return this.localGlyphs[a.fontWeight][r];var s=String.fromCharCode(r),l=a.draw(s),u=l.data,c=l.width,h=l.height,f=l.glyphWidth,d=l.glyphHeight,p=l.glyphLeft,v=l.glyphTop,m=l.glyphAdvance;return this.localGlyphs[a.fontWeight][r]={id:r,bitmap:new fc({width:c,height:h},u),metrics:{width:f/2,height:d/2,left:p/2,top:v/2-27,advance:m/2,localGlyph:!0}}}}}]),e}();function wd(e,t,i,r){var n=[],a=e.image,o=a.pixelRatio,s=a.paddedRect.w-2,l=a.paddedRect.h-2,u=e.right-e.left,c=e.bottom-e.top,h=a.stretchX||[[0,s]],f=a.stretchY||[[0,l]],d=function(e,t){return e+t[1]-t[0]},p=h.reduce(d,0),v=f.reduce(d,0),m=s-p,y=l-v,_=0,g=p,x=0,b=v,w=0,k=m,T=0,E=y;if(a.content&&r){var S=a.content;_=kd(h,0,S[0]),x=kd(f,0,S[1]),g=kd(h,S[0],S[2]),b=kd(f,S[1],S[3]),w=S[0]-_,T=S[1]-x,k=S[2]-S[0]-g,E=S[3]-S[1]-b}var M=function(r,n,s,l){var h=Ed(r.stretch-_,g,u,e.left),f=Sd(r.fixed-w,k,r.stretch,p),d=Ed(n.stretch-x,b,c,e.top),m=Sd(n.fixed-T,E,n.stretch,v),y=Ed(s.stretch-_,g,u,e.left),S=Sd(s.fixed-w,k,s.stretch,p),M=Ed(l.stretch-x,b,c,e.top),I=Sd(l.fixed-T,E,l.stretch,v),C=new A(h,d),z=new A(y,d),P=new A(y,M),D=new A(h,M),L=new A(f/o,m/o),R=new A(S/o,I/o),B=t*Math.PI/180;if(B){var O=Math.sin(B),F=Math.cos(B),U=[F,-O,O,F];C._matMult(U),z._matMult(U),D._matMult(U),P._matMult(U)}var V=r.stretch+r.fixed,N=n.stretch+n.fixed;return{tl:C,tr:z,bl:D,br:P,tex:{x:a.paddedRect.x+1+V,y:a.paddedRect.y+1+N,w:s.stretch+s.fixed-V,h:l.stretch+l.fixed-N},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:R,minFontScaleX:k/o/u,minFontScaleY:E/o/c,isSDF:i}};if(r&&(a.stretchX||a.stretchY))for(var I=Td(h,m,p),C=Td(f,y,v),z=0;z0&&void 0!==arguments[0]?arguments[0]:{},i=t.fontSize,r=void 0===i?24:i,n=t.buffer,a=void 0===n?3:n,o=t.radius,s=void 0===o?8:o,l=t.cutoff,u=void 0===l?.25:l,c=t.fontFamily,h=void 0===c?"sans-serif":c,f=t.fontWeight,p=void 0===f?"normal":f,v=t.fontStyle,m=void 0===v?"normal":v;d(this,e),this.buffer=a,this.cutoff=u,this.radius=s;var y=this.size=r+4*a,_=this._createCanvas(y),g=this.ctx=_.getContext("2d",{willReadFrequently:!0});g.font="".concat(m," ").concat(p," ").concat(r,"px ").concat(h),g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}return p(e,[{key:"_createCanvas",value:function(e){var t=document.createElement("canvas");return t.width=t.height=e,t}},{key:"draw",value:function(e){var t=this.ctx.measureText(e),i=t.width,r=t.actualBoundingBoxAscent,n=t.actualBoundingBoxDescent,a=t.actualBoundingBoxLeft,o=t.actualBoundingBoxRight,s=Math.ceil(r),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-a))),u=Math.min(this.size-this.buffer,s+Math.ceil(n)),c=l+2*this.buffer,h=u+2*this.buffer,f=Math.max(c*h,0),d=new Uint8ClampedArray(f),p={data:d,width:c,height:h,glyphWidth:l,glyphHeight:u,glyphTop:s,glyphLeft:0,glyphAdvance:i};if(0===l||0===u)return p;var v=this.ctx,m=this.buffer,y=this.gridInner,_=this.gridOuter;v.clearRect(m,m,l,u),v.fillText(e,m,m+s);var g=v.getImageData(m,m,l,u);_.fill(yd,0,f),y.fill(0,0,f);for(var x=0;x0?T*T:0,y[k]=T<0?T*T:0}}}_d(_,0,0,c,h,c,this.f,this.v,this.z),_d(y,m,m,l,u,c,this.f,this.v,this.z);for(var E=0;E0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Id;if(d(this,e),this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}return p(e,[{key:"push",value:function(e){this.data.push(e),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(e){for(var t=this.data,i=this.compare,r=t[e];e>0;){var n=e-1>>1,a=t[n];if(i(r,a)>=0)break;t[e]=a,e=n}t[e]=r}},{key:"_down",value:function(e){for(var t=this.data,i=this.compare,r=this.length>>1,n=t[e];e=0)break;t[e]=o,e=a}t[e]=n}}]),e}();function Id(e,t){return et?1:0}function Cd(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=1/0,n=1/0,a=-1/0,o=-1/0,s=e[0],l=0;la)&&(a=u.x),(!l||u.y>o)&&(o=u.y)}var c=Math.min(a-r,o-n),h=c/2,f=new Ad([],zd);if(0===c)return new A(r,n);for(var d=r;dv.d||!v.d)&&(v=y,i&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,m)),y.max-v.d<=t||(h=y.h/2,f.push(new Pd(y.p.x-h,y.p.y-h,h,e)),f.push(new Pd(y.p.x+h,y.p.y-h,h,e)),f.push(new Pd(y.p.x-h,y.p.y+h,h,e)),f.push(new Pd(y.p.x+h,y.p.y+h,h,e)),m+=4)}return i&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(v.d))),v.p}function zd(e,t){return t.max-e.max}var Pd=p((function e(t,i,r,n){d(this,e),this.p=new A(t,i),this.h=r,this.d=function(e,t){for(var i=!1,r=1/0,n=0;ne.y!=c.y>e.y&&e.x<(c.x-u.x)*(e.y-u.y)/(c.y-u.y)+u.x&&(i=!i),r=Math.min(r,Wu(e,u,c))}return(i?1:-1)*Math.sqrt(r)}(this.p,n),this.max=this.d+this.h*Math.SQRT2})),Dd=Number.POSITIVE_INFINITY,Ld=Math.sqrt(2);function Rd(e,t){var i=h(t,2),r=i[0],n=i[1],a=0,o=0;if(n===Dd){r<0&&(r=0);var s=r/Ld;switch(e){case"top-right":case"top-left":o=s-7;break;case"bottom-right":case"bottom-left":o=7-s;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(e){case"top-right":case"bottom-right":a=-s;break;case"top-left":case"bottom-left":a=s;break;case"left":a=r;break;case"right":a=-r}}else{switch(r=Math.abs(r),n=Math.abs(n),e){case"top-right":case"top-left":case"top":o=n-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-n}switch(e){case"top-right":case"bottom-right":case"right":a=-r;break;case"top-left":case"bottom-left":case"left":a=r}}return[a,o]}function Bd(e,t,i,r,n,a,o,s,l,u){e.createArrays(),e.tilePixelRatio=Vs/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;var c=e.layers[0].layout,h=e.layers[0]._unevaluatedLayout._values,d={};if("composite"===e.textSizeData.kind){var p=e.textSizeData,v=p.minZoom,m=p.maxZoom;d.compositeTextSizes=[h["text-size"].possiblyEvaluate(new to(v),s),h["text-size"].possiblyEvaluate(new to(m),s)]}if("composite"===e.iconSizeData.kind){var y=e.iconSizeData,_=y.minZoom,g=y.maxZoom;d.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new to(_),s),h["icon-size"].possiblyEvaluate(new to(g),s)]}d.layoutTextSize=h["text-size"].possiblyEvaluate(new to(l+1),s),d.layoutIconSize=h["icon-size"].possiblyEvaluate(new to(l+1),s),d.textMaxSize=h["text-size"].possiblyEvaluate(new to(18),s);var x,b="map"===c.get("text-rotation-alignment")&&"point"!==c.get("symbol-placement"),w=c.get("text-size"),k=f(e.features);try{var T=function(){var a,l=x.value,h=c.get("text-font").evaluate(l,{},s).join(","),f=w.evaluate(l,{},s),p=d.layoutTextSize.evaluate(l,{},s),v=(d.layoutIconSize.evaluate(l,{},s),{horizontal:{},vertical:void 0}),m=l.text,y=[0,0];if(m){var _=m.toString(),g=c.get("text-letter-spacing").evaluate(l,{},s)*uf,k=c.get("text-line-height").evaluate(l,{},s)*uf,T=Ba(_)?g:0,E=c.get("text-anchor").evaluate(l,{},s),S=c.get("text-variable-anchor");if(!S){var M=c.get("text-radial-offset").evaluate(l,{},s);y=M?Rd(E,[M*uf,Dd]):c.get("text-offset").evaluate(l,{},s).map((function(e){return e*uf}))}var A=b?"center":c.get("text-justify").evaluate(l,{},s),I="point"===c.get("symbol-placement"),C=I?c.get("text-max-width").evaluate(l,{},s)*uf:1/0,z=function(r){e.allowVerticalPlacement&&Ra(_)&&(v.vertical=Kf(m,t,i,n,h,C,k,E,r,T,y,Xf.vertical,!0,p,f))};if(!b&&S){for(var P="auto"===A?S.map((function(e){return Od(e)})):[A],D=!1,L=0;L=0||!Ra(_)){var O=Kf(m,t,i,n,h,C,k,E,A,T,y,Xf.horizontal,!1,p,f);O&&(v.horizontal[A]=O)}z(I?"left":A)}}var F=!1;if(l.icon&&l.icon.name){var U=r[l.icon.name];U&&(a=od(n[l.icon.name],c.get("icon-offset").evaluate(l,{},s),c.get("icon-anchor").evaluate(l,{},s)),F=U.sdf,void 0===e.sdfIcons?e.sdfIcons=U.sdf:e.sdfIcons!==U.sdf&&te("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(U.pixelRatio!==e.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}var V=Nd(v.horizontal)||v.vertical;e.iconsInText||(e.iconsInText=!!V&&V.iconsInText),(V||a)&&Fd(e,l,v,a,r,d,p,0,y,F,o,s,u)};for(k.s();!(x=k.n()).done;)T()}catch(E){k.e(E)}finally{k.f()}a&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray)}function Od(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Fd(e,t,i,r,n,a,o,s,l,u,c,d,p){var v=a.textMaxSize.evaluate(t,{},d);void 0===v&&(v=o);var m,y,_=e.layers[0].layout,g=_.get("icon-offset").evaluate(t,{},d),x=Nd(i.horizontal)||i.vertical,b="globe"===p.name,w=o/24,k=e.tilePixelRatio*v/24,T=(m=e.overscaling,e.zoom>18&&m>2&&(m>>=1),Math.max(Vs/(512*m),1)*_.get("symbol-spacing")),E=_.get("text-padding")*e.tilePixelRatio,S=_.get("icon-padding")*e.tilePixelRatio,M=P(_.get("text-max-angle")),A="map"===_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),I="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),C=_.get("symbol-placement"),z=T/2,D=_.get("icon-text-fit");r&&"none"!==D&&(e.allowVerticalPlacement&&i.vertical&&(y=sd(r,i.vertical,D,_.get("icon-text-fit-padding"),g,w)),x&&(r=sd(r,x,D,_.get("icon-text-fit-padding"),g,w)));var L=function(o,s,f){if(!(s.x<0||s.x>=Vs||s.y<0||s.y>=Vs)){var v=null;if(b){var m=p.projectTilePoint(s.x,s.y,f),_=m.x,x=m.y,w=m.z;v={anchor:new ld(_,x,w,0,void 0),up:p.upVector(f,s.x,s.y)}}!function(e,t,i,r,n,a,o,s,l,u,c,f,d,p,v,m,y,_,g,x,b,w,k,T,E){var S,M,A,I,C,z,P,D,L,R=e.addToLineVertexArray(t,r),B=0,O=0,F=0,U=0,V=-1,N=-1,j={},G=as(""),Z=i?i.anchor:t,q=0,W=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?(S=l.layout.get("text-offset").evaluate(b,{},E).map((function(e){return e*uf})),q=(M=h(S,2))[0],W=M[1]):(q=l.layout.get("text-radial-offset").evaluate(b,{},E)*uf,W=Dd),e.allowVerticalPlacement&&n.vertical){var X=n.vertical;if(v)D=Gd(X),s&&(L=Gd(s));else{var H=l.layout.get("text-rotate").evaluate(b,{},E)+90;C=jd(u,Z,t,c,f,d,X,p,H,m),s&&(z=jd(u,Z,t,c,f,d,s,_,H))}}if(a){var Y=l.layout.get("icon-rotate").evaluate(b,{},E),K="none"!==l.layout.get("icon-text-fit"),J=wd(a,Y,k,K),$=s?wd(s,Y,k,K):void 0;I=jd(u,Z,t,c,f,d,a,_,Y),B=4*J.length;var Q=e.iconSizeData,ee=null;"source"===Q.kind?(ee=[cf*l.layout.get("icon-size").evaluate(b,{},E)])[0]>Ud&&te("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===Q.kind&&((ee=[cf*w.compositeIconSizes[0].evaluate(b,{},E),cf*w.compositeIconSizes[1].evaluate(b,{},E)])[0]>Ud||ee[1]>Ud)&&te("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".')),e.addSymbols(e.icon,J,ee,x,g,b,!1,i,t,R.lineStartIndex,R.lineLength,-1,T,E),V=e.icon.placedSymbolArray.length-1,$&&(O=4*$.length,e.addSymbols(e.icon,$,ee,x,g,b,Xf.vertical,i,t,R.lineStartIndex,R.lineLength,-1,T,E),N=e.icon.placedSymbolArray.length-1)}for(var ie in n.horizontal){var re=n.horizontal[ie];A||(G=as(re.text),v?P=Gd(re):A=jd(u,Z,t,c,f,d,re,p,l.layout.get("text-rotate").evaluate(b,{},E),m));var ne=1===re.positionedLines.length;if(F+=Vd(e,i,t,re,o,l,v,b,m,R,n.vertical?Xf.horizontal:Xf.horizontalOnly,ne?Object.keys(n.horizontal):[ie],j,V,w,T,E),ne)break}n.vertical&&(U+=Vd(e,i,t,n.vertical,o,l,v,b,m,R,Xf.vertical,["vertical"],j,N,w,T,E));var ae=-1,oe=function(e,t){return e?Math.max(e,t):t};ae=oe(P,ae),ae=oe(D,ae);var se=(ae=oe(L,ae))>-1?1:0;e.glyphOffsetArray.length>=wp.MAX_GLYPHS&&te("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey),e.symbolInstances.emplaceBack(Z.x,Z.y,Z.z,t.x,t.y,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical>=0?j.vertical:-1,V,N,G,void 0!==A?A:e.collisionBoxArray.length,void 0!==A?A+1:e.collisionBoxArray.length,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==I?I:e.collisionBoxArray.length,void 0!==I?I+1:e.collisionBoxArray.length,z||e.collisionBoxArray.length,z?z+1:e.collisionBoxArray.length,c,F,U,B,O,se,0,q,W,ae)}(e,s,v,o,i,r,n,y,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,E,A,l,0,S,I,g,t,a,u,c,d)}};if("line"===C){var R,B=f(md(t.geometry,0,0,Vs,Vs));try{for(B.s();!(R=B.n()).done;){var O,F=R.value,U=pd(F,T,M,i.vertical||x,r,24,k,e.overscaling,Vs),V=f(U);try{for(V.s();!(O=V.n()).done;){var N=O.value;x&&Zd(e,x.text,z,N)||L(F,N,d)}}catch(oe){V.e(oe)}finally{V.f()}}}catch(oe){B.e(oe)}finally{B.f()}}else if("line-center"===C){var j,G=f(t.geometry);try{for(G.s();!(j=G.n()).done;){var Z=j.value;if(Z.length>1){var q=dd(Z,M,i.vertical||x,r,24,k);q&&L(Z,q,d)}}}catch(oe){G.e(oe)}finally{G.f()}}else if("Polygon"===t.type){var W,X=f(Yc(t.geometry,0));try{for(X.s();!(W=X.n()).done;){var H=W.value,Y=Cd(H,16);L(H[0],new ld(Y.x,Y.y,0,0,void 0),d)}}catch(oe){X.e(oe)}finally{X.f()}}else if("LineString"===t.type){var K,J=f(t.geometry);try{for(J.s();!(K=J.n()).done;){var $=K.value;L($,new ld($[0].x,$[0].y,0,0,void 0),d)}}catch(oe){J.e(oe)}finally{J.f()}}else if("Point"===t.type){var Q,ee=f(t.geometry);try{for(ee.s();!(Q=ee.n()).done;){var ie,re=Q.value,ne=f(re);try{for(ne.s();!(ie=ne.n()).done;){var ae=ie.value;L([ae],new ld(ae.x,ae.y,0,0,void 0),d)}}catch(oe){ne.e(oe)}finally{ne.f()}}}catch(oe){ee.e(oe)}finally{ee.f()}}}var Ud=32640;function Vd(e,t,i,r,n,o,s,l,u,h,d,p,v,m,y,_,g){var x=function(e,t,i,r,n,o,s,l){var u=[];if(0===t.positionedLines.length)return u;var h,d=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,p=function(e){var t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i),v=Math.abs(t.top-t.bottom),m=f(t.positionedLines);try{for(m.s();!(h=m.n()).done;)v-=h.value.lineOffset}catch(oe){m.e(oe)}finally{m.f()}for(var y=t.positionedLines.length,_=v/y,g=t.top-i[1],x=0;xUd&&te("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===b.kind&&((w=[cf*y.compositeTextSizes[0].evaluate(l,{},g),cf*y.compositeTextSizes[1].evaluate(l,{},g)])[0]>Ud||w[1]>Ud)&&te("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".')),e.addSymbols(e.text,x,w,u,s,l,d,t,i,h.lineStartIndex,h.lineLength,m,_,g);var k,T=f(p);try{for(T.s();!(k=T.n()).done;)v[k.value]=e.text.placedSymbolArray.length-1}catch(E){T.e(E)}finally{T.f()}return 4*x.length}function Nd(e){for(var t in e)return e[t];return null}function jd(e,t,i,r,n,a,o,s,l,u){var c=o.top,h=o.bottom,f=o.left,d=o.right,p=o.collisionPadding;if(p&&(f-=p[0],c-=p[1],d+=p[2],h+=p[3]),l){var v=new A(f,c),m=new A(d,c),y=new A(f,h),_=new A(d,h),g=P(l),x=new A(0,0);u&&(x=new A(u[0],u[1])),v._rotateAround(g,x),m._rotateAround(g,x),y._rotateAround(g,x),_._rotateAround(g,x),f=Math.min(v.x,m.x,y.x,_.x),d=Math.max(v.x,m.x,y.x,_.x),c=Math.min(v.y,m.y,y.y,_.y),h=Math.max(v.y,m.y,y.y,_.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,f,c,d,h,s,r,n,a),e.length-1}function Gd(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);var t=e.bottom-e.top;return t>0?Math.max(10,t):null}function Zd(e,t,i,r){var n=e.compareText;if(t in n){for(var a=n[t],o=a.length-1;o>=0;o--)if(r.dist(a[o])g&&(x(e,u,r,n,s,l),x(u,i,s,l,a,o))}x(h,f,r,a,n,a),x(f,d,n,a,n,o),x(d,p,n,o,r,o),x(p,h,r,o,r,a),v-=g,m-=g,y+=g,_+=g;var b=1/Math.max(y-v,_-m);return{scale:b,x:v*b,y:m*b,x2:y*b,y2:_*b,projection:t}}var Xd=Ws(new Float32Array(16)),Hd=function(){function e(t){d(this,e),this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}return p(e,[{key:"project",value:function(e,t){return{x:0,y:0,z:0}}},{key:"unproject",value:function(e,t){return new mu(0,0)}},{key:"projectTilePoint",value:function(e,t,i){return{x:e,y:t,z:0}}},{key:"locationPoint",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e._coordinatePoint(e.locationCoordinate(t),i)}},{key:"pixelsPerMeter",value:function(e,t){return xu(1,e)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){return 1}},{key:"farthestPixelDistance",value:function(e){return qd(e,e.pixelsPerMeter)}},{key:"pointCoordinate",value:function(e,t,i,r){var n=e.horizonLineFromTop(!1),a=new A(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(a,r))}},{key:"pointCoordinate3D",value:function(e,t,i){var r=new A(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);var n=this.pointCoordinate(e,r.x,r.y,0);return[n.x,n.y,n.z]}},{key:"isPointAboveHorizon",value:function(e,t){if(e.elevation)return!this.pointCoordinate3D(e,t.x,t.y);var i=e.horizonLineFromTop();return t.y0?t<-rp+i&&(t=-rp+i):t>rp-i&&(t=rp-i);var a=n/Math.pow(np(t),r),o=a*Math.sin(r*e),s=n-a*Math.cos(r*e);return o=.5*(o/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:o,y:this.southernCenter?s:1-s,z:0}}},{key:"unproject",value:function(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;var i=this.n,r=this.f,n=r-t,a=Math.sign(n),o=Math.sign(i)*Math.sqrt(e*e+n*n),s=Math.atan2(e,Math.abs(n))*a;n*i<0&&(s-=Math.PI*Math.sign(e)*a);var l=F(D(s/i)+this.center[0],-180,180),u=F(D(2*Math.atan(Math.pow(r/o,1/i))-rp),-Tu,Tu);return new mu(l,this.southernCenter?-u:u)}}]),i}(Hd),op=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).wrap=!0,r.supportsWorldCopies=!0,r.supportsTerrain=!0,r.supportsFog=!0,r.supportsFreeCamera=!0,r.isReprojectedInTileSpace=!1,r.unsupportedLayers=[],r.range=null,r}return p(i,[{key:"project",value:function(e,t){return{x:_u(e),y:gu(t),z:0}}},{key:"unproject",value:function(e,t){var i=bu(e),r=wu(t);return new mu(i,r)}}]),i}(Hd),sp=P(Tu),lp=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"project",value:function(e,t){var i=(t=P(t))*t,r=i*i;return{x:.5*((e=P(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}},{key:"unproject",value:function(e,t){e=(2*e-.5)*Math.PI;var i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,a=i*i;do{var o=(a=i*i)*a;i=F(i-(n=(i*(1.007226+a*(.015085+o*(.028874*a-.044475-.005916*o)))-t)/(1.007226+a*(.045255+o*(.259866*a-.311325-.005916*11*o)))),-sp,sp)}while(Math.abs(n)>1e-6&&--r>0);var s=F(D(e/(.8707+(a=i*i)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))),-180,180),l=D(i);return new mu(s,l)}}]),i}(Hd),up=P(Tu),cp=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"project",value:function(e,t){t=P(t),e=P(e);var i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),a=Math.sin(n)/n,o=.5*(e*r+2*i*Math.sin(e/2)/a)||0,s=.5*(t+Math.sin(t)/a)||0;return{x:.5*(o/Math.PI+.5),y:1-.5*(s/Math.PI+1),z:0}}},{key:"unproject",value:function(e,t){var i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25,a=1e-6,o=0,s=0;do{var l=Math.cos(r),u=Math.sin(r),c=2*u*l,h=u*u,f=l*l,d=Math.cos(i/2),p=Math.sin(i/2),v=2*d*p,m=p*p,y=1-f*d*d,_=y?1/y:0,g=y?Math.acos(l*d)*Math.sqrt(1/y):0,x=.5*(2*g*l*p+2*i/Math.PI)-e,b=.5*(g*u+r)-t,w=.5*_*(f*m+g*l*d*h)+1/Math.PI,k=_*(v*c/4-g*u*p),T=.125*_*(c*p-g*u*f*v),E=.5*_*(h*d+g*m*l)+.5,S=k*T-E*w;s=(x*T-b*w)/S,i=F(i-(o=(b*k-x*E)/S),-Math.PI,Math.PI),r=F(r-s,-up,up)}while((Math.abs(o)>a||Math.abs(s)>a)&&--n>0);return new mu(D(i),D(r))}}]),i}(Hd),hp=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).center=e.center||[0,0],r.parallels=e.parallels||[0,0],r.cosPhi=Math.max(.01,Math.cos(P(r.parallels[0]))),r.scale=1/(2*Math.max(Math.PI*r.cosPhi,1/r.cosPhi)),r.wrap=!0,r.supportsWorldCopies=!0,r}return p(i,[{key:"project",value:function(e,t){var i=this.scale,r=this.cosPhi;return{x:P(e)*r*i+.5,y:-Math.sin(P(t))/r*i+.5,z:0}}},{key:"unproject",value:function(e,t){var i=this.scale,r=this.cosPhi,n=-(t-.5)/i,a=F(D((e-.5)/i)/r,-180,180),o=Math.asin(F(n*r,-1,1)),s=F(D(o),-Tu,Tu);return new mu(a,s)}}]),i}(Hd),fp=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).requiresDraping=!0,r.supportsWorldCopies=!1,r.supportsFog=!0,r.zAxisUnit="pixels",r.unsupportedLayers=["debug"],r.range=[3,5],r}return p(i,[{key:"projectTilePoint",value:function(e,t,i){var r=iu(e,t,i);return ml(r,r,au(Xl(i))),{x:r[0],y:r[1],z:r[2]}}},{key:"locationPoint",value:function(e,t){var i=tu(t.lat,t.lng),r=dl([],i),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;fl(i,i,r,xu(1,0)*Vs*n);var a=Ws(new Float64Array(16));return Hs(a,e.pixelMatrix,e.globeMatrix),ml(i,i,a),new A(i[0],i[1])}},{key:"pixelsPerMeter",value:function(e,t){return xu(1,0)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){var r=xu(1,e)*t,n=Ni(xu(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}},{key:"createTileMatrix",value:function(e,t,i){var r=ou(Xl(i.canonical));return Hs(new Float64Array(16),e.globeMatrix,r)}},{key:"createInversionMatrix",value:function(e,t){var i=e.center,r=au(Xl(t));return $s(r,r,P(i.lng)),Js(r,r,P(i.lat)),Ks(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}},{key:"pointCoordinate",value:function(e,t,i,r){return Zl(e,t,i,!0)||new Su(0,0)}},{key:"pointCoordinate3D",value:function(e,t,i){var r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}},{key:"isPointAboveHorizon",value:function(e,t){return!Zl(e,t.x,t.y,!1)}},{key:"farthestPixelDistance",value:function(e){var t=function(e,t){var i,r=e.cameraToCenterDistance,n=e._centerAltitude*t,a=e._camera,o=e._camera.forward(),s=ol([],hl([],o,-r),[0,0,n]),l=e.worldSize/(2*Math.PI),u=[0,0,-l],c=e.width/e.height,h=Math.tan(e.fovAboveCenter),f=hl([],a.up(),h),d=hl([],a.right(),h*c),p=dl([],ol([],ol([],o,f),d)),v=[];if(new Dl(s,p).closestPointOnSphere(u,l,v)){var m=ol([],v,u),y=gl([],m,s);i=Math.cos(e.fovAboveCenter)*nl(y)}else{var _=gl([],s,u),g=gl([],u,s);dl(g,g);var x=nl(_)-l;i=Math.sqrt(x*(x+2*l));var b=Math.acos(i/(l+x))-Math.acos(pl(o,g));i*=Math.cos(b)}return 1.01*i}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=lu(e.zoom);if(i>0){var r=qd(e,xu(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),a=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ni(t,r+n*(1-Math.cos(a)),Math.pow(i,10))}return t}},{key:"upVector",value:function(e,t,i){return iu(t,i,e,1)}},{key:"upVectorScale",value:function(e){return{metersToTile:Gl(ru(Xl(e)))}}}]),i}(op);function dp(e){var t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new op(e);case"equirectangular":return new ip(e);case"naturalEarth":return new lp(e);case"equalEarth":return new tp(e);case"winkelTripel":return new cp(e);case"albers":return i?new hp(e):new Yd(e);case"lambertConformalConic":return i?new hp(e):new ap(e);case"globe":return new fp(e)}throw new Error("Invalid projection name: ".concat(e.name))}var pp=gh.types,vp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function mp(e,t,i,r,n,a,o,s,l,u,c,h,f){var d=s?Math.min(Ud,Math.round(s[0])):0,p=s?Math.min(Ud,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),a,o,(d<<1)+(l?1:0),p,16*u,16*c,256*h,256*f)}function yp(e,t,i,r,n,a,o){e.emplaceBack(t,i,r,n,a,o)}function _p(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function gp(e){var t,i=f(e.sections);try{for(i.s();!(t=i.n()).done;)if(ja(t.value.text))return!0}catch(r){i.e(r)}finally{i.f()}return!1}var xp=function(){function e(t){d(this,e),this.layoutVertexArray=new Io,this.indexArray=new Oo,this.programConfigurations=t,this.segments=new Us,this.dynamicLayoutVertexArray=new Eo,this.opacityVertexArray=new zo,this.placedSymbolArray=new Yo,this.globeExtVertexArray=new Co}return p(e,[{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}},{key:"upload",value:function(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,tf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,nf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,vp,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,rf.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}]),e}();ia(xp,"SymbolBuffers");var bp=function(){function e(t,i,r){d(this,e),this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new r,this.segments=new Us,this.collisionVertexArray=new Ro,this.collisionVertexArrayExt=new Bo}return p(e,[{key:"upload",value:function(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,af.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,of.members,!0)}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}]),e}();ia(bp,"CollisionBuffers");var wp=function(){function e(t){d(this,e),this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(e){return e.id})),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ws([]),this.placementViewportMatrix=Ws([]);var i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hf(this.zoom,i["text-size"]),this.iconSizeData=hf(this.zoom,i["icon-size"]);var r=this.layers[0].layout,n=r.get("symbol-sort-key"),a=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"!==a&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map((function(e){return Xf[e]})),this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id})),this.sourceID=t.sourceID,this.projection=t.projection}return p(e,[{key:"createArrays",value:function(){this.text=new xp(new Is(this.layers,this.zoom,(function(e){return/^text/.test(e)}))),this.icon=new xp(new Is(this.layers,this.zoom,(function(e){return/^icon/.test(e)}))),this.glyphOffsetArray=new $o,this.lineVertexArray=new Qo,this.symbolInstances=new Jo}},{key:"calculateGlyphDependencies",value:function(e,t,i,r,n){for(var a=0;a0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],h||d){var v,m=t.iconDependencies,y=t.glyphDependencies,_=t.availableImages,g=new to(this.zoom),x=f(e);try{var b=function(){var e,t,u=v.value,c=u.feature,x=u.id,b=u.index,w=u.sourceLayerIndex,k=a._featureFilter.needGeometry,T=Ru(c,k);if(!a._featureFilter.filter(g,T,i))return"continue";if(k||(T.geometry=Lu(c,i,r)),s&&1!==c.type&&i.z<=5)for(var E=T.geometry,S=.98078528056,M=function(e,t){return pl(iu(e.x,e.y,i,1),iu(t.x,t.y,i,1))=0;var R,B=f(e.sections);try{for(B.s();!(R=B.n()).done;){var O=R.value;if(O.image)m[O.image.name]=!0;else{var F=Ra(e.toString()),U=O.fontStack||D,V=y[U]=y[U]||{};n.calculateGlyphDependencies(O.text,V,L,n.allowVerticalPlacement,F)}}}catch(N){B.e(N)}finally{B.f()}}};for(x.s();!(v=x.n()).done;)b()}catch(w){x.e(w)}finally{x.f()}"line"===o.get("symbol-placement")&&(this.features=function(e){var t={},i={},r=[],n=0;function a(t){r.push(e[t]),n++}function o(e,t,n){var a=i[e];return delete i[e],i[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(n[0]),a}function s(e,i,n){var a=t[i];return delete t[i],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=n[0].concat(r[a].geometry[0]),a}function l(e,t,i){var r=i?t[0][t[0].length-1]:t[0][0];return"".concat(e,":").concat(r.x,":").concat(r.y)}for(var u=0;u=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),a=ff(this.textSizeData,e,n)/uf;return this.tilePixelRatio*a}},{key:"getSymbolInstanceIconSize",value:function(e,t,i){var r=this.icon.placedSymbolArray.get(i),n=ff(this.iconSizeData,e,r);return this.tilePixelRatio*n}},{key:"_commitDebugCollisionVertexUpdate",value:function(e,t,i){e.emplaceBack(t,-i,-i),e.emplaceBack(t,i,-i),e.emplaceBack(t,i,i),e.emplaceBack(t,-i,i)}},{key:"_updateTextDebugCollisionBoxes",value:function(e,t,i,r,n,a){for(var o=r;o0}},{key:"hasIconData",value:function(){return this.icon.segments.get().length>0}},{key:"hasDebugData",value:function(){return this.textCollisionBox&&this.iconCollisionBox}},{key:"hasTextCollisionBoxData",value:function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}},{key:"hasIconCollisionBoxData",value:function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}},{key:"addIndicesForPlacedSymbol",value:function(e,t){for(var i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs,n=i.vertexStartIndex;n1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];var t,i=f(this.symbolInstanceIndexes);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex);var a=n.rightJustifiedTextSymbolIndex,o=n.centerJustifiedTextSymbolIndex,s=n.leftJustifiedTextSymbolIndex,l=n.verticalPlacedTextSymbolIndex,u=n.placedIconSymbolIndex,c=n.verticalPlacedIconSymbolIndex;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),o>=0&&o!==a&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&s!==o&&s!==a&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&this.addIndicesForPlacedSymbol(this.text,l),u>=0&&this.addIndicesForPlacedSymbol(this.icon,u),c>=0&&this.addIndicesForPlacedSymbol(this.icon,c)}}catch(h){i.e(h)}finally{i.f()}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}]),e}();ia(wp,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),wp.MAX_GLYPHS=65535,wp.addDynamicAttributes=_p;var kp=new po({"symbol-placement":new co(ct.layout_symbol["symbol-placement"]),"symbol-spacing":new co(ct.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new co(ct.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ho(ct.layout_symbol["symbol-sort-key"]),"symbol-z-order":new co(ct.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new co(ct.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new co(ct.layout_symbol["icon-ignore-placement"]),"icon-optional":new co(ct.layout_symbol["icon-optional"]),"icon-rotation-alignment":new co(ct.layout_symbol["icon-rotation-alignment"]),"icon-size":new ho(ct.layout_symbol["icon-size"]),"icon-text-fit":new co(ct.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new co(ct.layout_symbol["icon-text-fit-padding"]),"icon-image":new ho(ct.layout_symbol["icon-image"]),"icon-rotate":new ho(ct.layout_symbol["icon-rotate"]),"icon-padding":new co(ct.layout_symbol["icon-padding"]),"icon-keep-upright":new co(ct.layout_symbol["icon-keep-upright"]),"icon-offset":new ho(ct.layout_symbol["icon-offset"]),"icon-anchor":new ho(ct.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new co(ct.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new co(ct.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new co(ct.layout_symbol["text-rotation-alignment"]),"text-field":new ho(ct.layout_symbol["text-field"]),"text-font":new ho(ct.layout_symbol["text-font"]),"text-size":new ho(ct.layout_symbol["text-size"]),"text-max-width":new ho(ct.layout_symbol["text-max-width"]),"text-line-height":new ho(ct.layout_symbol["text-line-height"]),"text-letter-spacing":new ho(ct.layout_symbol["text-letter-spacing"]),"text-justify":new ho(ct.layout_symbol["text-justify"]),"text-radial-offset":new ho(ct.layout_symbol["text-radial-offset"]),"text-variable-anchor":new co(ct.layout_symbol["text-variable-anchor"]),"text-anchor":new ho(ct.layout_symbol["text-anchor"]),"text-max-angle":new co(ct.layout_symbol["text-max-angle"]),"text-writing-mode":new co(ct.layout_symbol["text-writing-mode"]),"text-rotate":new ho(ct.layout_symbol["text-rotate"]),"text-padding":new co(ct.layout_symbol["text-padding"]),"text-keep-upright":new co(ct.layout_symbol["text-keep-upright"]),"text-transform":new ho(ct.layout_symbol["text-transform"]),"text-offset":new ho(ct.layout_symbol["text-offset"]),"text-allow-overlap":new co(ct.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new co(ct.layout_symbol["text-ignore-placement"]),"text-optional":new co(ct.layout_symbol["text-optional"])}),Tp={paint:new po({"icon-opacity":new ho(ct.paint_symbol["icon-opacity"]),"icon-color":new ho(ct.paint_symbol["icon-color"]),"icon-halo-color":new ho(ct.paint_symbol["icon-halo-color"]),"icon-halo-width":new ho(ct.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ho(ct.paint_symbol["icon-halo-blur"]),"icon-translate":new co(ct.paint_symbol["icon-translate"]),"icon-translate-anchor":new co(ct.paint_symbol["icon-translate-anchor"]),"text-opacity":new ho(ct.paint_symbol["text-opacity"]),"text-color":new ho(ct.paint_symbol["text-color"],{runtimeType:wt,getOverride:function(e){return e.textColor},hasOverride:function(e){return!!e.textColor}}),"text-halo-color":new ho(ct.paint_symbol["text-halo-color"]),"text-halo-width":new ho(ct.paint_symbol["text-halo-width"]),"text-halo-blur":new ho(ct.paint_symbol["text-halo-blur"]),"text-translate":new co(ct.paint_symbol["text-translate"]),"text-translate-anchor":new co(ct.paint_symbol["text-translate-anchor"])}),layout:kp},Ep=function(){function e(t){d(this,e),this.type=t.property.overrides?t.property.overrides.runtimeType:_t,this.defaultValue=t}return p(e,[{key:"evaluate",value:function(e){if(e.formattedSection){var t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}},{key:"eachChild",value:function(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return null}}]),e}();ia(Ep,"FormatSectionOverride",{omit:["defaultValue"]});var Sp=function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,Tp)}return p(i,[{key:"recalculate",value:function(e,t){o(s(i.prototype),"recalculate",this).call(this,e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));var r=this.layout.get("text-writing-mode");if(r){var n,a=[],l=f(r);try{for(l.s();!(n=l.n()).done;){var u=n.value;a.indexOf(u)<0&&a.push(u)}}catch(c){l.e(c)}finally{l.f()}this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}},{key:"getValueAndResolveTokens",value:function(e,t,i,r){var n=this.layout.get(e).evaluate(t,{},i,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||nn(a.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,(function(t,i){return i in e?String(e[i]):""}))}(t.properties,n)}},{key:"createBucket",value:function(e){return new wp(e)}},{key:"queryRadius",value:function(){return 0}},{key:"queryIntersectsFeature",value:function(){return!1}},{key:"_setPaintOverrides",value:function(){var e,t=f(Tp.paint.overridableProperties);try{for(t.s();!(e=t.n()).done;){var r=e.value;if(i.hasPaintOverride(this.layout,r)){var n=this.paint.get(r),a=new Ep(n),o=new rn(a,n.property.specification),s=null;s="constant"===n.value.kind||"source"===n.value.kind?new on("source",o):new sn("composite",o,n.value.zoomStops,n.value._interpolationType),this.paint._values[r]=new lo(n.property,s,n.parameters)}}}catch(l){t.e(l)}finally{t.f()}}},{key:"_handleOverridablePaintPropertyUpdate",value:function(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven())&&i.hasPaintOverride(this.layout,e)}},{key:"getProgramConfiguration",value:function(e){return new As(this,e)}}],[{key:"hasPaintOverride",value:function(e,t){var i=e.get("text-field"),r=Tp.paint.properties[t],n=!1,a=function(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;){var a=t.value;if(r.overrides&&r.overrides.hasOverride(a))return void(n=!0)}}catch(o){i.e(o)}finally{i.f()}};if("constant"===i.value.kind&&i.value.value instanceof Zt)a(i.value.value.sections);else if("source"===i.value.kind){var o=function e(t){n||(t instanceof Jt&&Ht(t.value)===St?a(t.value.sections):t instanceof ii?a(t.sections):t.eachChild(e))},s=i.value;s._styleExpression&&o(s._styleExpression.expression)}return n}}]),i}(Bs),Mp={paint:new po({"background-color":new co(ct.paint_background["background-color"]),"background-pattern":new co(ct.paint_background["background-pattern"]),"background-opacity":new co(ct.paint_background["background-opacity"])})},Ap={paint:new po({"raster-opacity":new co(ct.paint_raster["raster-opacity"]),"raster-hue-rotate":new co(ct.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new co(ct.paint_raster["raster-brightness-min"]),"raster-brightness-max":new co(ct.paint_raster["raster-brightness-max"]),"raster-saturation":new co(ct.paint_raster["raster-saturation"]),"raster-contrast":new co(ct.paint_raster["raster-contrast"]),"raster-resampling":new co(ct.paint_raster["raster-resampling"]),"raster-fade-duration":new co(ct.paint_raster["raster-fade-duration"])})},Ip=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e,{})).implementation=e,r}return p(i,[{key:"is3D",value:function(){return"3d"===this.implementation.renderingMode}},{key:"hasOffscreenPass",value:function(){return void 0!==this.implementation.prerender}},{key:"isLayerDraped",value:function(){return void 0!==this.implementation.renderToTile}},{key:"shouldRedrape",value:function(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}},{key:"recalculate",value:function(){}},{key:"updateTransitions",value:function(){}},{key:"hasTransition",value:function(){return!1}},{key:"serialize",value:function(){}},{key:"onAdd",value:function(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}},{key:"onRemove",value:function(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}]),i}(Bs),Cp={paint:new po({"sky-type":new co(ct.paint_sky["sky-type"]),"sky-atmosphere-sun":new co(ct.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new co(ct.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new co(ct.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new co(ct.paint_sky["sky-gradient-radius"]),"sky-gradient":new fo(ct.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new co(ct.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new co(ct.paint_sky["sky-atmosphere-color"]),"sky-opacity":new co(ct.paint_sky["sky-opacity"])})};function zp(e,t,i){var r=[0,0,1],n=Sl([]);return Al(n,n,i?-P(e)+Math.PI:P(e)),Ml(n,n,-P(t)),yl(r,r,n),dl(r,r)}for(var Pp={circle:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,ic)}return p(i,[{key:"createBucket",value:function(e){return new Fu(e)}},{key:"queryRadius",value:function(e){var t=e;return Ju("circle-radius",this,t)+Ju("circle-stroke-width",this,t)+$u(this.paint.get("circle-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s){var l=ec(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return rc(e,r,a,o,s,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}},{key:"getProgramIds",value:function(){return["circle"]}},{key:"getProgramConfiguration",value:function(e){return new As(this,e)}}]),i}(Bs),heatmap:function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e,pc))._updateColorRamp(),r}return p(i,[{key:"createBucket",value:function(e){return new lc(e)}},{key:"_handleSpecialPaintPropertyUpdate",value:function(e){"heatmap-color"===e&&this._updateColorRamp()}},{key:"_updateColorRamp",value:function(){this.colorRamp=vc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}},{key:"resize",value:function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}},{key:"queryRadius",value:function(e){return Ju("heatmap-radius",this,e)}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s){var l=this.paint.get("heatmap-radius").evaluate(t,i);return rc(e,r,a,o,s,!0,!0,new A(0,0),l)}},{key:"hasOffscreenPass",value:function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},{key:"getProgramIds",value:function(){return["heatmap","heatmapTexture"]}},{key:"getProgramConfiguration",value:function(e){return new As(this,e)}}]),i}(Bs),hillshade:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,mc)}return p(i,[{key:"hasOffscreenPass",value:function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},{key:"getProgramIds",value:function(){return["hillshade","hillshadePrepare"]}}]),i}(Bs),fill:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,th)}return p(i,[{key:"getProgramIds",value:function(){var e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}},{key:"getProgramConfiguration",value:function(e){return new As(this,e)}},{key:"recalculate",value:function(e,t){o(s(i.prototype),"recalculate",this).call(this,e,t);var r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}},{key:"createBucket",value:function(e){return new Qc(e)}},{key:"queryRadius",value:function(){return $u(this.paint.get("fill-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a){return!e.queryGeometry.isAboveHorizon&&Nu(Qu(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),r)}},{key:"isTileClipped",value:function(){return!0}}]),i}(Bs),"fill-extrusion":function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,Bh)}return p(i,[{key:"createBucket",value:function(e){return new Sh(e)}},{key:"queryRadius",value:function(){return $u(this.paint.get("fill-extrusion-translate"))}},{key:"is3D",value:function(){return!0}},{key:"getProgramIds",value:function(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}},{key:"getProgramConfiguration",value:function(e){return new As(this,e)}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s,l){var u=ec(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),c=this.paint.get("fill-extrusion-height").evaluate(t,i),d=this.paint.get("fill-extrusion-base").evaluate(t,i),p=[0,0],v=s&&a.elevation,m=a.elevation?a.elevation.exaggeration():1,y=e.tile.getBucket(this);if(v&&y instanceof Sh){var _=y.centroidVertexArray,g=l+1;g<_.length&&(p[0]=_.geta_centroid_pos0(g),p[1]=_.geta_centroid_pos1(g))}if(0===p[0]&&1===p[1])return!1;"globe"===a.projection.name&&(r=Lh([r],[new A(0,0),new A(Vs,Vs)],e.tileID.canonical).map((function(e){return e.polygon})).flat());var x=function(e,t,i,r,n,a,o,s,l,u,c){return"globe"===e.projection.name?function(e,t,i,r,n,a,o,s,l,u,c){var h=[],d=[],p=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,v=[0,0,0,1],m=[0,0,0,1],y=function(e,t,i,r){e[0]=t,e[1]=i,e[2]=r,e[3]=1},_=Dh();i>0&&(i+=_),r+=_;var g,x=f(t);try{for(x.s();!(g=x.n()).done;){var b,w=g.value,k=[],T=[],E=f(w);try{for(E.s();!(b=E.n()).done;){var S=b.value,M=S.x+n.x,A=S.y+n.y,I=e.projection.projectTilePoint(M,A,c),C=e.projection.upVector(c,S.x,S.y),z=i,P=r;if(o){var D=qh(M,A,i,r,o,s,l,u);z+=D.base,P+=D.top}0!==i?y(v,I.x+C[0]*p*z,I.y+C[1]*p*z,I.z+C[2]*p*z):y(v,I.x,I.y,I.z),y(m,I.x+C[0]*p*P,I.y+C[1]*p*P,I.z+C[2]*p*P),ml(v,v,a),ml(m,m,a),k.push(new jh(v[0],v[1],v[2])),T.push(new jh(m[0],m[1],m[2]))}}catch(L){E.e(L)}finally{E.f()}h.push(k),d.push(T)}}catch(L){x.e(L)}finally{x.f()}return[h,d]}(e,t,i,r,n,a,o,s,l,u,c):o?function(e,t,i,r,n,a,o,s,l){var u,c=[],h=[],d=[0,0,0,1],p=f(e);try{for(p.s();!(u=p.n()).done;){var v,m=u.value,y=[],_=[],g=f(m);try{for(g.s();!(v=g.n()).done;){var x=v.value,b=x.x+r.x,w=x.y+r.y,k=qh(b,w,t,i,a,o,s,l);d[0]=b,d[1]=w,d[2]=k.base,d[3]=1,Tl(d,d,n),d[3]=Math.max(d[3],1e-5);var T=new jh(d[0]/d[3],d[1]/d[3],d[2]/d[3]);d[0]=b,d[1]=w,d[2]=k.top,d[3]=1,Tl(d,d,n),d[3]=Math.max(d[3],1e-5);var E=new jh(d[0]/d[3],d[1]/d[3],d[2]/d[3]);y.push(T),_.push(E)}}catch(S){g.e(S)}finally{g.f()}c.push(y),h.push(_)}}catch(S){p.e(S)}finally{p.f()}return[c,h]}(t,i,r,n,a,o,s,l,u):function(e,t,i,r,n){var a,o=[],s=[],l=n[8]*t,u=n[9]*t,c=n[10]*t,h=n[11]*t,d=n[8]*i,p=n[9]*i,v=n[10]*i,m=n[11]*i,y=f(e);try{for(y.s();!(a=y.n()).done;){var _,g=a.value,x=[],b=[],w=f(g);try{for(w.s();!(_=w.n()).done;){var k=_.value,T=k.x+r.x,E=k.y+r.y,S=n[0]*T+n[4]*E+n[12],M=n[1]*T+n[5]*E+n[13],A=n[2]*T+n[6]*E+n[14],I=n[3]*T+n[7]*E+n[15],C=S+l,z=M+u,P=A+c,D=Math.max(I+h,1e-5),L=S+d,R=M+p,B=A+v,O=Math.max(I+m,1e-5);x.push(new jh(C/D,z/D,P/D)),b.push(new jh(L/O,R/O,B/O))}}catch(F){w.e(F)}finally{w.f()}o.push(x),s.push(b)}}catch(F){y.e(F)}finally{y.f()}return[o,s]}(t,i,r,n,a)}(a,r,d,c,u,o,v?s:null,p,m,a.center.lat,e.tileID.canonical),b=h(x,2),w=b[0],k=b[1],T=e.queryGeometry;return function(e,t,i){var r=1/0;Nu(i,t)&&(r=Zh(i,t[0]));for(var n=0;n=3)for(var a=0;a>=1)>1;){var Kp=Zp+Wp>>1,Jp=qp+Xp>>1;1&Gp?(Wp=Zp,Xp=qp,Zp=Hp,qp=Yp):(Zp=Wp,qp=Xp,Wp=Hp,Xp=Yp),Hp=Kp,Yp=Jp}var $p=4*jp;Np[$p+0]=Zp,Np[$p+1]=qp,Np[$p+2]=Wp,Np[$p+3]=Xp}var Qp=new Uint16Array(2178),ev=new Uint8Array(1089),tv=new Uint16Array(1089);function iv(e){return 0===e?-.03125:32===e?.03125:0}var rv=go([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),nv={type:2,extent:Vs,loadGeometry:function(){return[[new A(0,0),new A(8193,0),new A(8193,8193),new A(0,8193),new A(0,0)]]}},av=function(){function e(t,i,r,n,a){d(this,e),this.tileID=t,this.uid=q(),this.uses=0,this.tileSize=i,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=a,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}return p(e,[{key:"registerFadeDuration",value:function(e){var t=e+this.timeAdded;tr)n=!1;else if(t)if(this.expirationTime=0;c--){var h=4*c,f=Np[h+0],d=Np[h+1],p=Np[h+2],v=Np[h+3],m=f+p>>1,y=d+v>>1,_=m+y-d,g=y+f-m,x=d*Vp+f,b=v*Vp+p,w=y*Vp+m,k=Math.hypot((Qp[2*x+0]+Qp[2*b+0])/2-Qp[2*w+0],(Qp[2*x+1]+Qp[2*b+1])/2-Qp[2*w+1])>=16;if(ev[w]=ev[w]||(k?1:0),c<1022){var T=(d+g>>1)*Vp+(f+_>>1),E=(v+g>>1)*Vp+(p+_>>1);ev[w]=ev[w]||ev[T]||ev[E]}}var S=new ko,M=new Oo,A=0;function I(e,t){var i=t*Vp+e;return 0===tv[i]&&(S.emplaceBack(Qp[2*i+0],Qp[2*i+1],e*Vs/Up,t*Vs/Up),tv[i]=++A),tv[i]-1}function C(e,t,i,r,n,a){var o=e+i>>1,s=t+r>>1;if(Math.abs(e-n)+Math.abs(t-a)>1&&ev[s*Vp+o])C(n,a,e,t,o,s),C(i,r,n,a,o,s);else{var l=I(e,t),u=I(i,r),c=I(n,a);M.emplaceBack(l,u,c)}}return C(0,0,Up,Up,Up,0),C(Up,Up,0,0,0,Up),{vertices:S,indices:M}}(this.tileID.canonical,t);i=a.vertices,r=a.indices}else{i=new ko,r=new Oo;var o,s=f(n);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=l.x,c=l.y;i.emplaceBack(u,c,0,0)}}catch(p){s.e(p)}finally{s.f()}for(var h=_c(i.int16,void 0,4),d=0;d0&&(r=Xs(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,n,t,a,r,o),this._makeGlobeTileDebugTextBuffer(e,n,t,a,r,o)}}},{key:"_globePoint",value:function(e,t,i,r,n,a,o){var s=iu(e,t,i);if(a){var l=1<.5?f=-1:h<-.5&&(f=1);var d=(e/Vs+i.x)/l+f,p=(t/Vs+i.y)/l;d=(d-u)*r._pixelsPerMercatorPixel+u,p=(p-c)*r._pixelsPerMercatorPixel+c;var v=[d*r.worldSize,p*r.worldSize,0];ml(v,v,a),s=Hl(s,v,o)}return ml(s,s,n)}},{key:"_makeGlobeTileDebugBorderBuffer",value:function(e,t,i,r,n,a){var o=this,s=new bo,l=new Zo,u=new wo,c=function(e,c,h,f,d){for(var p=(h-e)/(d-1),v=(f-c)/(d-1),m=s.length,y=0;yt[o])return null}else{var s=1/r[o],l=(e[o]-i[o])*s,u=(t[o]-i[o])*s;if(l>u){var c=l;l=u,u=c}if(l>n&&(n=l),ua)return null}return n}function uv(e,t,i,r,n,a,o,s,l,u,c){var h=r-e,f=n-t,d=a-i,p=o-e,v=s-t,m=l-i,y=c[1]*m-c[2]*v,_=c[2]*p-c[0]*m,g=c[0]*v-c[1]*p,x=h*y+f*_+d*g;if(Math.abs(x)<1e-15)return null;var b=1/x,w=u[0]-e,k=u[1]-t,T=u[2]-i,E=(w*y+k*_+T*g)*b;if(E<0||E>1)return null;var S=k*d-T*f,M=T*h-w*d,A=w*f-k*h,I=(c[0]*S+c[1]*M+c[2]*A)*b;return I<0||E+I>1?null:(p*S+v*M+m*A)*b}function cv(e,t,i){return(e-t)/(i-t)}function hv(e,t,i,r,n,a,o,s,l){var u=1<=1;r/=2){var d=i[i.length-1];o=new sv(r);for(var p=0;p6&&void 0!==arguments[6]?arguments[6]:1;return lv([e,t,-100],[i,r,this.maximums[0]*o],n,a)}},{key:"raycast",value:function(e,t,i,r,n,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;if(!this.nodeCount)return null;var s=this.raycastRoot(e,t,i,r,n,a,o);if(null==s)return null;for(var l=[],u=[],c=[],h=[],f=[{idx:0,t:s,nodex:0,nodey:0,depth:0}];f.length>0;){var d=f.pop(),p=d.idx,v=d.t,m=d.nodex,y=d.nodey,_=d.depth;if(this.leaves[p]){hv(m,y,_,e,t,i,r,c,h);var g=1<<_,x=(m+0)/g,b=(m+1)/g,w=(y+0)/g,k=(y+1)/g,T=pv(x,w,this.dem)*o,E=pv(b,w,this.dem)*o,S=pv(b,k,this.dem)*o,M=pv(x,k,this.dem)*o,A=uv(c[0],c[1],T,h[0],c[1],E,h[0],h[1],S,n,a),I=uv(h[0],h[1],S,c[0],h[1],M,c[0],c[1],T,n,a),C=Math.min(null!==A?A:Number.MAX_VALUE,null!==I?I:Number.MAX_VALUE);if(C!==Number.MAX_VALUE)return C;var z=fl([],n,a,v);if(dv(T,E,M,S,cv(z[0],c[0],h[0]),cv(z[1],c[1],h[1]))>=z[2])return v}else{for(var P=0,D=0;D=l[u[O]]&&(u.splice(O,0,D),B=!0);B||(u[P]=D),P++}}for(var F=0;F3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(d(this,e),this.uid=t,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return te('"'.concat(r,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));this.stride=i.height;var o=this.dim=i.height-2,s=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.encoding=r||"mapbox",this.borderReady=n,!n){for(var l=0;l2&&void 0!==arguments[2]&&arguments[2]&&(e=F(e,-1,this.dim),t=F(t,-1,this.dim));var i=4*this._idx(e,t);return("terrarium"===this.encoding?yv:mv)(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}},{key:"unpackVector",get:function(){return vv[this.encoding]}},{key:"_idx",value:function(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}},{key:"getPixels",value:function(){return new dc({width:this.stride,height:this.stride},this.pixels)}},{key:"backfillBorder",value:function(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");var r=t*this.dim,n=t*this.dim+this.dim,a=i*this.dim,o=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:a=o-1;break;case 1:o=a+1}for(var s=-t*this.dim,l=-i*this.dim,u=a;uthis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}},{key:"has",value:function(e){return e.wrapped().key in this.data}},{key:"getAndRemove",value:function(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}},{key:"_getAndRemoveByKey",value:function(e){var t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}},{key:"getByKey",value:function(e){var t=this.data[e];return t?t[0].value:null}},{key:"get",value:function(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}},{key:"remove",value:function(e,t){if(!this.has(e))return this;var i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}},{key:"setMaxSize",value:function(e){for(this.max=e;this.order.length>this.max;){var t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}},{key:"filter",value:function(e){var t=[];for(var i in this.data){var r,n=f(this.data[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value;e(a.value)||t.push(a)}}catch(u){n.e(u)}finally{n.f()}}for(var o=0,s=t;o1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[a]&&(e.neighboringTiles[a].backfilled=!0)))}}}},{key:"getTile",value:function(e){return this.getTileByID(e.key)}},{key:"getTileByID",value:function(e){return this._tiles[e]}},{key:"_retainLoadedChildren",value:function(e,t,i,r){for(var n in this._tiles){var a=this._tiles[n];if(!(r[n]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>i)){for(var o=a.tileID;a&&a.tileID.overscaledZ>t+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(o=s)}for(var l=o;l.overscaledZ>t;)if(e[(l=l.scaledTo(l.overscaledZ-1)).key]){r[o.key]=o;break}}}}},{key:"findLoadedParent",value:function(e,t){if(e.key in this._loadedParentTiles){var i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(var r=e.overscaledZ-1;r>=t;r--){var n=e.scaledTo(r),a=this._getLoadedTile(n);if(a)return a}}},{key:"_getLoadedTile",value:function(e){var t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}},{key:"updateCacheSize",value:function(e,t){t=t||this._source.tileSize;var i=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,n=Math.floor(i*r*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(o)}},{key:"handleWrapJump",value:function(e){var t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){var i={};for(var r in this._tiles){var n=this._tiles[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),i[n.tileID.key]=n}for(var a in this._tiles=i,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var o in this._tiles)this._setTileReloadTimer(+o,this._tiles[o])}}},{key:"update",value:function(e,t,r){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused&&!this.transform.freezeTileCoverage&&(!this.usedForTerrain||r)){var a;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new Vh(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(a=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(a=a.filter((function(e){return n._source.hasTile(e)})))):a=[];var o=this._updateRetainedTiles(a);if(Iv(this._source.type)&&0!==a.length){for(var s={},l={},u=0,c=Object.keys(o);um;){g=g.scaledTo(g.overscaledZ-1);var x=this._tiles[g.key];if(x&&x.hasData()&&l[g.key]){o[y]=_.tileID;break}}}for(var b in s)o[b]||(this._coveredTiles[b]=!0,o[b]=s[b])}for(var w in o)this._tiles[w].clearFadeHold();var k,T=function(e,t){var i=[];for(var r in e)r in t||i.push(r);return i}(this._tiles,o),E=f(T);try{for(E.s();!(k=E.n()).done;){var S=k.value,M=this._tiles[S];M.hasSymbolBuckets&&!M.holdingForFade()?M.setHoldDuration(this.map._fadeDuration):M.hasSymbolBuckets&&!M.symbolFadeFinished()||this._removeTile(+S)}}catch(A){E.e(A)}finally{E.f()}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}}},{key:"releaseSymbolFadeTiles",value:function(){for(var e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}},{key:"_updateRetainedTiles",value:function(e){var t={};if(0===e.length)return t;var r,n={},a=e.reduce((function(e,t){return Math.min(e,t.overscaledZ)}),1/0),o=e[0].overscaledZ,s=Math.max(o-i.maxOverzooming,this._source.minzoom),l=Math.max(o+i.maxUnderzooming,this._source.minzoom),u={},c=f(e);try{for(c.s();!(r=c.n()).done;){var h=r.value,d=this._addTile(h);t[h.key]=h,d.hasData()||a=this._source.maxzoom){var _=m.children(this._source.maxzoom)[0],g=this.getTile(_);if(g&&g.hasData()){t[_.key]=_;continue}}else{var x=m.children(this._source.maxzoom);if(t[x[0].key]&&t[x[1].key]&&t[x[2].key]&&t[x[3].key])continue}for(var b=y.wasRequested(),w=m.overscaledZ-1;w>=s;--w){var k=m.scaledTo(w);if(n[k.key])break;if(n[k.key]=!0,!(y=this.getTile(k))&&b&&(y=this._addTile(k)),y&&(t[k.key]=k,b=y.wasRequested(),y.hasData()))break}}}}catch(T){v.e(T)}finally{v.f()}return t}},{key:"_updateLoadedParentTileCache",value:function(){for(var e in this._loadedParentTiles={},this._tiles){for(var t=[],i=void 0,r=this._tiles[e].tileID;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);var n=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(n))break;r=n}for(var a=0,o=t;a0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}},{key:"clearTiles",value:function(){for(var e in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}},{key:"tilesIn",value:function(e,t,i){var r=[],n=this.transform;if(!n)return r;var a="globe"===n.projection.name,o=_u(n.center.lng);for(var s in this._tiles){var l=this._tiles[s];if(i&&l.clearQueryDebugViz(),!l.holdingForFade()){var u=void 0;if(a){var h=l.tileID.canonical;if(0===h.z){var d=[Math.abs(F.apply(void 0,[o].concat(c(Cv(h,-1))))-o),Math.abs(F.apply(void 0,[o].concat(c(Cv(h,1))))-o)];u=[0,2*d.indexOf(Math.min.apply(Math,d))-1]}else{var p=[Math.abs(F.apply(void 0,[o].concat(c(Cv(h,-1))))-o),Math.abs(F.apply(void 0,[o].concat(c(Cv(h,0))))-o),Math.abs(F.apply(void 0,[o].concat(c(Cv(h,1))))-o)];u=[p.indexOf(Math.min.apply(Math,p))-1]}}else u=[0];var v,m=f(u);try{for(m.s();!(v=m.n()).done;){var y=v.value,_=e.containsTile(l,n,t,y);_&&r.push(_)}}catch(g){m.e(g)}finally{m.f()}}}return r}},{key:"getVisibleCoordinates",value:function(e){var t,i=this,r=this.getRenderableIds(e).map((function(e){return i._tiles[e].tileID})),n=f(r);try{for(n.s();!(t=n.n()).done;){var a=t.value;a.projMatrix=this.transform.calculateProjMatrix(a.toUnwrapped())}}catch(o){n.e(o)}finally{n.f()}return r}},{key:"hasTransition",value:function(){if(this._source.hasTransition())return!0;if(Iv(this._source.type))for(var e in this._tiles){var t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=nt.now())return!0}return!1}},{key:"setFeatureState",value:function(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}},{key:"removeFeatureState",value:function(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}},{key:"getFeatureState",value:function(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}},{key:"setDependencies",value:function(e,t,i){var r=this._tiles[e];r&&r.setDependencies(t,i)}},{key:"reloadTilesForDependencies",value:function(e,t){for(var i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter((function(i){return!i.hasDependency(e,t)}))}},{key:"_preloadTiles",value:function(e,t){var i,r=this,n=new Map,a=Array.isArray(e)?e:[e],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize,l=f(a);try{for(l.s();!(i=l.n()).done;){var u,c=i.value,h=c.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),d=f(h);try{for(d.s();!(u=d.n()).done;){var p=u.value;n.set(p.key,p)}}catch(v){d.e(v)}finally{d.f()}this.usedForTerrain&&c.updateElevation(!1)}}catch(v){l.e(v)}finally{l.f()}N(Array.from(n.values()),(function(e,t){var i=new av(e,r._source.tileSize*e.overscaleFactor(),r.transform.tileZoom,r.map.painter,r._isRaster);r._loadTile(i,(function(e){"raster-dem"===r._source.type&&i.dem&&r._backfillDEM(i),t(e,i)}))}),t)}}]),i}(ut);function Av(e,t){var i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Iv(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function Cv(e,t){var i=1<5&&void 0!==arguments[5]?arguments[5]:0,o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n,a);for(var s=this.grid,l=0;l=0&&c[3]>=0&&s.insert(o,c[0],c[1],c[2],c[3])}}},{key:"loadVTLayers",value:function(){if(!this.vtLayers)for(var e in this.vtLayers=new _h(new gf(this.rawTileData)).layers,this.sourceLayerCoder=new Bp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}},{key:"query",value:function(e,t,i,r){var n=this;this.loadVTLayers();var a=e.params||{},o=xn(a.filter),s=e.tileResult,l=e.transform,u=s.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(function(e,t,i,r){return Yu(s.bufferedTilespaceGeometry,e,t,i,r)}));c.sort(Lv);var h=null;l.elevation&&c.length>0&&(h=zv.create(l.elevation,this.tileID));for(var f,d={},p=function(){var l=c[v];if(l===f)return"continue";f=l;var u=n.featureIndexArray.get(l),p=null;n.loadMatchingFeature(d,u,o,a.layers,a.availableImages,t,i,r,(function(t,i,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return p||(p=Lu(t,n.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(s,t,r,p,n.z,e.transform,e.pixelPosMatrix,h,a)}))},v=0;v=0)return!0;return!1}(r,d)){var p=this.sourceLayerCoder.decode(h),v=this.vtLayers[p].feature(u);if(i.needGeometry){var m=Ru(v,!0);if(!i.filter(new to(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!i.filter(new to(this.tileID.overscaledZ),v))return;for(var y=this.getId(v,p),_=0;_1&&(s=e[++o]);var u=Math.abs(l-s.left),c=Math.abs(l-s.right),h=Math.min(u,c),f=void 0,d=n/i*(r+1);if(s.isDash){var p=r-Math.abs(d);f=Math.sqrt(h*h+p*p)}else f=r-Math.sqrt(h*h+d*d);this.image.data[a+l]=Math.max(0,Math.min(255,f+128))}}},{key:"addRegularDash",value:function(e,t){for(var i=e.length-1;i>=0;--i){var r=e[i],n=e[i+1];r.zeroLength?e.splice(i,1):n&&n.isDash===r.isDash&&(n.left=r.left,e.splice(i,1))}var a=e[0],o=e[e.length-1];a.isDash===o.isDash&&(a.left=o.left-this.width,o.right=a.right+this.width);for(var s=this.width*this.nextRow,l=0,u=e[l],c=0;c1&&(u=e[++l]);var h=Math.abs(c-u.left),f=Math.abs(c-u.right),d=Math.min(h,f);this.image.data[s+c]=Math.max(0,Math.min(255,(u.isDash?d:-d)+t+128))}}},{key:"addDash",value:function(e,t){var i=this.getKey(e,t);if(this.positions[i])return this.positions[i];var r="round"===t,n=r?7:0,a=2*n+1;if(this.nextRow+a>this.height)return te("LineAtlas out of space"),null;0===e.length&&e.push(1);for(var o=0,s=0;s=z.maxzoom||"none"!==z.visibility&&(Fv(C,this.zoom,i),(d[z.id]=z.createBucket({index:s.bucketLayerIDs.length,layers:C,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:i})).populate(T,v,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(C.map((function(e){return e.id}))))}}catch(O){I.e(O)}finally{I.f()}}}}p.trim();var P={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},D=J(v.glyphDependencies,(function(e){return Object.keys(e).map(Number)}));Object.keys(D).length?r.send("getGlyphs",{uid:this.uid,stacks:D},(function(e,t){l||(l=e,u=t,B.call(a))}),void 0,!1,P):u={};var L=Object.keys(v.iconDependencies);L.length?r.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"icons"},(function(e,t){l||(l=e,c=t,B.call(a))}),void 0,!1,P):c={};var R=Object.keys(v.patternDependencies);function B(){if(l)return n(l);if(u&&c&&h){var e=new Bv(u),t=new Wf(c,h);for(var r in d){var a=d[r];a instanceof wp?(Fv(a.layers,this.zoom,i),Bd(a,u,e.positions,c,t.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):a.hasPattern&&(a instanceof Kh||a instanceof Qc||a instanceof Sh)&&(Fv(a.layers,this.zoom,i),a.addFeatures(v,this.tileID.canonical,t.patternPositions,i,this.tileTransform))}this.status="done",n(null,{buckets:j(d).filter((function(e){return!e.isEmpty()})),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:p,imageAtlas:t,glyphMap:this.returnDependencies?u:null,iconMap:this.returnDependencies?c:null,glyphPositions:this.returnDependencies?e.positions:null})}}R.length?r.send("getImages",{icons:R,source:this.source,tileID:this.tileID,type:"patterns"},(function(e,t){l||(l=e,h=t,B.call(a))}),void 0,!1,P):h={},B.call(this)}}]),e}();function Fv(e,t,i){var r,n=new to(t),a=f(e);try{for(a.s();!(r=a.n()).done;)r.value.recalculate(n,i)}catch(o){a.e(o)}finally{a.f()}}var Uv=function(){function e(t){d(this,e),this.entries={},this.scheduler=t}return p(e,[{key:"request",value:function(e,t,i,r){var n=this,a=this.entries[e]=this.entries[e]||{callbacks:[]};if(a.result){var o=h(a.result,2),s=o[0],l=o[1];return this.scheduler?this.scheduler.add((function(){r(s,l)}),t):r(s,l),function(){}}return a.callbacks.push(r),a.cancel||(a.cancel=i((function(i,r){a.result=[i,r];var o,s=f(a.callbacks);try{var l=function(){var e=o.value;n.scheduler?n.scheduler.add((function(){e(i,r)}),t):e(i,r)};for(s.s();!(o=s.n()).done;)l()}catch(u){s.e(u)}finally{s.f()}setTimeout((function(){return delete n.entries[e]}),3e3)}))),function(){a.result||(a.callbacks=a.callbacks.filter((function(e){return e!==r})),a.callbacks.length||(a.cancel(),delete n.entries[e]))}}}]),e}();function Vv(e,t,i){var r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(function(t){var r=ke(e.request,(function(e,r,n,a){e?t(e):r&&t(null,{vectorTile:i?void 0:new _h(new gf(r)),rawData:r,cacheControl:n,expires:a})}));return function(){r.cancel(),t()}}),t)}e.ARRAY_TYPE=Gs,e.AUTH_ERR_MSG=Ie,e.Aabb=Bl,e.Actor=function(){function e(t,i,r){d(this,e),this.target=t,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},Y(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=ne()?t:_,this.scheduler=new Rp}return p(e,[{key:"send",value:function(e,t,i,r){var n=this,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5?arguments[5]:void 0,s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=o,this.callbacks[s]=i);var l=se(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:r,mustQueue:a,sourceMapId:this.mapId,data:oa(t,l)},l),{cancel:function(){i&&delete n.callbacks[s],n.target.postMessage({id:s,type:"",targetMapId:r,sourceMapId:n.mapId})}}}},{key:"receive",value:function(e){var t=this,i=e.data,r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId))if(""===i.type){var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n.cancel()}else if(i.mustQueue||ne()){var a=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add((function(){return t.processTask(r,i)}),a&&a.metadata||{type:"message"})}else this.processTask(r,i)}},{key:"processTask",value:function(e,t){var i=this;if(""===t.type){var r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(sa(t.error)):r(null,sa(t.data)))}else{var n=se(this.globalScope)?void 0:[],a=t.hasCallback?function(t,r){delete i.cancelCallbacks[e],i.target.postMessage({id:e,type:"",sourceMapId:i.mapId,error:t?oa(t):null,data:oa(r,n)},n)}:function(e){},o=sa(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,o,a);else if(this.parent.getWorkerSource){var s=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,s[0],o.source)[s[1]](o,a)}else a(new Error("Could not find function ".concat(t.type)))}}},{key:"remove",value:function(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}]),e}(),e.CanonicalTileID=Fh,e.Color=Nt,e.ColorMode=kv,e.CullFaceMode=Sv,e.DEMData=_v,e.DataConstantProperty=co,e.DedupedRequest=Uv,e.DepthMode=xv,e.EXTENT=Vs,e.Elevation=function(){function e(){d(this,e)}return p(e,[{key:"isDataAvailableAtPoint",value:function(e){var t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;var i=t.getSource().maxzoom,r=1<1&&void 0!==arguments[1]?arguments[1]:0;return this.getAtPoint(e,t)||0}},{key:"getAtPoint",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.isUsingMockSource())return null;null==t&&(t=null);var r=this._source();if(!r)return t;if(e.y<0||e.y>1)return t;var n=r.getSource().maxzoom,a=1<this._skuTokenExpiresAt}},{key:"transformRequest",value:function(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}},{key:"normalizeStyleURL",value:function(e,t){if(!Ce(e))return e;var i=Be(e);return i.path="/styles/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||t)}},{key:"normalizeGlyphsURL",value:function(e,t){if(!Ce(e))return e;var i=Be(e);return i.path="/fonts/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||t)}},{key:"normalizeSourceURL",value:function(e,t,i,r){if(!Ce(e))return e;var n=Be(e);return n.path="/v4/".concat(n.authority,".json"),n.params.push("secure"),i&&n.params.push("language=".concat(i)),r&&n.params.push("worldview=".concat(r)),this._makeAPIURL(n,this._customAccessToken||t)}},{key:"normalizeSpriteURL",value:function(e,t,i,r){var n=Be(e);return Ce(e)?(n.path="/styles/v1".concat(n.path,"/sprite").concat(t).concat(i),this._makeAPIURL(n,this._customAccessToken||r)):(n.path+="".concat(t).concat(i),Oe(n))}},{key:"normalizeTileURL",value:function(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!Ce(e))return e;var r=Be(e);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,"".concat(t||i&&"raster"!==r.authority&&512===i?"@2x":"").concat(b.supported?".webp":"$1")),"raster"===r.authority?r.path="/".concat(x.RASTER_URL_PREFIX).concat(r.path):(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/".concat(x.TILE_URL_VERSION).concat(r.path));var n=this._customAccessToken||function(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;){var r=t.value.match(/^access_token=(.*)$/);if(r)return r[1]}}catch(n){i.e(n)}finally{i.f()}return null}(r.params)||x.ACCESS_TOKEN;return x.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&r.params.push("sku=".concat(this._skuToken)),this._makeAPIURL(r,n)}},{key:"canonicalizeTileURL",value:function(e,t){var i=Be(e);if(!i.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!i.path.match(/\.[\w]+$/))return e;var r="mapbox://";i.path.match(/^\/raster\/v1\//)?r+="raster/".concat(i.path.replace("/".concat(x.RASTER_URL_PREFIX,"/"),"")):r+="tiles/".concat(i.path.replace("/".concat(x.TILE_URL_VERSION,"/"),""));var n=i.params;return t&&(n=n.filter((function(e){return!e.match(/^access_token=/)}))),n.length&&(r+="?".concat(n.join("&"))),r}},{key:"canonicalizeTileset",value:function(e,t){var i,r=!!t&&Ce(t),n=[],a=f(e.tiles||[]);try{for(a.s();!(i=a.n()).done;){var o=i.value;ze(o)?n.push(this.canonicalizeTileURL(o,r)):n.push(o)}}catch(s){a.e(s)}finally{a.f()}return n}},{key:"_makeAPIURL",value:function(e,t){var i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",r=Be(x.API_URL);if(e.protocol=r.protocol,e.authority=r.authority,"http"===e.protocol){var n=e.params.indexOf("secure");n>=0&&e.params.splice(n,1)}if("/"!==r.path&&(e.path="".concat(r.path).concat(e.path)),!x.REQUIRE_ACCESS_TOKEN)return Oe(e);if(t=t||x.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error("An API access token is required to use Mapbox GL. ".concat(i));if("s"===t[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ".concat(i))}return e.params=e.params.filter((function(e){return-1===e.indexOf("access_token")})),e.params.push("access_token=".concat(t||"")),Oe(e)}}]),e}(),e.ResourceType=ge,e.SegmentVector=Us,e.SourceCache=Mv,e.StencilMode=wv,e.StructArrayLayout1ui2=Zo,e.StructArrayLayout2f1f2i16=Lo,e.StructArrayLayout2i4=bo,e.StructArrayLayout2ui4=Go,e.StructArrayLayout3f12=Bo,e.StructArrayLayout3ui6=Oo,e.StructArrayLayout4i8=ko,e.StructArrayLayout5f20=No,e.Texture=Dp,e.Tile=av,e.Transitionable=no,e.Uniform1f=ms,e.Uniform1i=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=0,r}return p(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}}]),i}(vs),e.Uniform2f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=[0,0],r}return p(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}}]),i}(vs),e.Uniform3f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=[0,0,0],r}return p(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}}]),i}(vs),e.Uniform4f=ys,e.UniformColor=_s,e.UniformMatrix2f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=bs,r}return p(i,[{key:"set",value:function(e,t,i){if(this.fetchUniformLocation(e,t))for(var r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}}]),i}(vs),e.UniformMatrix3f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=xs,r}return p(i,[{key:"set",value:function(e,t,i){if(this.fetchUniformLocation(e,t))for(var r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}]),i}(vs),e.UniformMatrix4f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=gs,r}return p(i,[{key:"set",value:function(e,t,i){if(this.fetchUniformLocation(e,t)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(var r=1;r<16;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}}]),i}(vs),e.UnwrappedTileID=Uh,e.ValidationError=hn,e.VectorTileFeature=gh,e.VectorTileWorkerSource=function(e){v(i,e);var t=m(i);function i(e,r,n,a,o){var s;return d(this,i),(s=t.call(this)).actor=e,s.layerIndex=r,s.availableImages=n,s.loadVectorData=o||Vv,s.loading={},s.loaded={},s.deduped=new Uv(e.scheduler),s.isSpriteLoaded=a,s.scheduler=e.scheduler,s}return p(i,[{key:"loadTile",value:function(e,t){var i=this,r=e.uid,n=e&&e.request,a=n&&n.collectResourceTiming,o=this.loading[r]=new Ov(e);o.abort=this.loadVectorData(e,(function(s,l){var u=!i.loading[r];if(delete i.loading[r],u||s||!l)return o.status="done",u||(i.loaded[r]=o),t(s);var c=l.rawData,h={};l.expires&&(h.expires=l.expires),l.cacheControl&&(h.cacheControl=l.cacheControl),o.vectorTile=l.vectorTile||new _h(new gf(c));var f=function(){o.parse(o.vectorTile,i.layerIndex,i.availableImages,i.actor,(function(e,i){if(e||!i)return t(e);var r={};if(a){var o=rt(n);o.length>0&&(r.resourceTiming=JSON.parse(JSON.stringify(o)))}t(null,G({rawTileData:c.slice(0)},i,h,r))}))};i.isSpriteLoaded?f():i.once("isSpriteLoaded",(function(){i.scheduler?i.scheduler.add(f,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):f()})),i.loaded=i.loaded||{},i.loaded[r]=o}))}},{key:"reloadTile",value:function(e,t){var i=this,r=this.loaded,n=e.uid,a=this;if(r&&r[n]){var o=r[n];o.showCollisionBoxes=e.showCollisionBoxes,o.enableTerrain=!!e.enableTerrain,o.projection=e.projection,o.tileTransform=Wd(e.tileID.canonical,e.projection);var s=function(e,r){var n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,a.layerIndex,i.availableImages,a.actor,n)),t(e,r)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}}},{key:"abortTile",value:function(e,t){var i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}},{key:"removeTile",value:function(e,t){var i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}]),i}(ut),e.WritingMode=Xf,e.ZoomDependentExpression=sn,e.add=ol,e.addDynamicAttributes=_p,e.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-s*u,e[1]=n*u-r*c,e[2]=r*s-n*o,e[3]=s*l-a*c,e[4]=i*c-n*l,e[5]=n*a-i*s,e[6]=a*u-o*l,e[7]=r*l-i*u,e[8]=i*o-r*a,e},e.asyncAll=N,e.bezier=B,e.bindAll=Y,e.boundsAttributes=rv,e.bufferConvexPolygon=function(e,t){for(var i=[],r=0;rpe&&(e.getActor().send("enforceCacheSizeLimit",de),_e=0)},e.calculateGlobeLabelMatrix=function(e,t){var i=e.point,r=su(i.x,i.y,e.worldSize/e._pixelsPerMercatorPixel,0,0);return Hs(r,r,ou(Xl(t)))},e.calculateGlobeMatrix=function(e){var t=e.point,i=t.x,r=t.y,n=e._center,a=n.lng,o=n.lat;return su(i,r,e.worldSize,a,o)},e.calculateGlobeMercatorMatrix=function(e){var t=e.pixelsPerMeter,i=t/xu(1,e.center.lat),r=Ws(new Float64Array(16));return Ys(r,r,[e.point.x,e.point.y,0]),Ks(r,r,[i,i,t]),Float32Array.from(r)},e.circumferenceAtLatitude=yu,e.clamp=F,e.clearTileCache=function(e){if(ve()){var t=_.caches.delete(fe);e&&t.catch(e).then((function(){return e()}))}},e.clipLine=md,e.clone=function(e){var t=new Gs(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=Q,e.collisionCircleLayout=lf,e.config=x,e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.create=function(){var e=new Gs(16);return Gs!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=Zs,e.createExpression=an,e.createLayout=go,e.createStyleLayer=function(e){return"custom"===e.type?new Ip(e):new Pp[e.type](e)},e.cross=vl,e.degToRad=P,e.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},e.div=function(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e},e.dot=pl,e.earthRadius=pu,e.ease=O,e.easeCubicInOut=R,e.ecefToLatLng=function(e){var t=h(e,3),i=t[0],r=t[1],n=t[2],a=Math.hypot(i,r,n),o=Math.atan2(i,n),s=.5*Math.PI-Math.acos(-r/a);return new mu(D(o),D(s))},e.emitValidationErrors=$n,e.endsWith=K,e.enforceCacheSizeLimit=function(e){me(),ce&&ce.then((function(t){t.keys().then((function(i){for(var r=0;ra&&(r+=(e[n]-a)*(e[n]-a)),t[n]0){var p=180/r;qs(d,d,[p/u+1,0,0,0,p/c+1,0,-.5*p/h,.5*p/f,1])}return d[2]=l,d[5]=e.x,d[8]=e.y,d},e.getImage=Ae,e.getJSON=function(e,t){return we(G(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){var t=Tu-5;e=F(e,-t,t)/t*90;var i=Math.pow(Math.abs(Math.sin(P(e))),3);return Math.round(i*(Ul.length-1))},e.getMapSessionAPI=Xe,e.getPerformanceMeasurement=rt,e.getProjection=dp,e.getRTLTextPluginStatus=$a,e.getReferrer=be,e.getTilePoint=function(e,t){var i=t.x,r=t.y;return new A(((i-(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0))*e.scale-e.x)*Vs,(r*e.scale-e.y)*Vs)},e.getTileVec3=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return al(((t.x-i)*e.scale-e.x)*Vs,(t.y*e.scale-e.y)*Vs,ku(t.z,t.y))},e.getVideo=function(e,t){var i=_.document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(var r=0;r0;return 0===r&&!n&&!o&&a},e.identity=Ws,e.identity$1=Sl,e.invert=Xs,e.isFullscreen=function(){return!!_.document.fullscreenElement||!!_.document.webkitFullscreenElement},e.isLngLatBehindGlobe=cu,e.isMapAuthenticated=function(e){return He.has(e)},e.isMapboxURL=Ce,e.isSafariWithAntialiasingBug=function(e){var t=e.navigator?e.navigator.userAgent:null;return!!se(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.latFromMercatorY=wu,e.latLngToECEF=tu,e.len=bl,e.length=nl,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=bu,e.loadVectorTile=Vv,e.makeRequest=we,e.mapValue=function(e,t,i,r,n){return F((e-t)/(i-t)*(n-r)+r,r,n)},e.mercatorScale=Eu,e.mercatorXfromLng=_u,e.mercatorYfromLat=gu,e.mercatorZfromAltitude=xu,e.mul=tl,e.mul$1=xl,e.multiply=Hs,e.multiply$1=qs,e.multiply$2=ll,e.nextPowerOfTwo=X,e.normalize=dl,e.normalize$1=Il,e.normalize$2=kl,e.number=Ni,e.ortho=function(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=(o+a)*u,e[15]=1,e},e.pbf=gf,e.perspective=function(e,t,i,r,n){var a,o=1/Math.tan(t/2);return e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+r)*(a=1/(r-n)),e[14]=2*n*r*a):(e[10]=-1,e[14]=-2*r),e},e.pick=function(e,t){for(var i={},r=0;r0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!cu(e,new mu(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!cu(e,new mu(e.center.lat,-90))]},e.polygonContainsPoint=Hu,e.polygonIntersectsBox=Yu,e.polygonIntersectsPolygon=Uu,e.polygonizeBounds=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=new A(i,i),a=e.sub(n),o=t.add(n),s=[a,new A(o.x,a.y),o,new A(a.x,o.y)];return r&&s.push(a.clone()),s},e.posAttributes=Pl,e.postMapLoadEvent=Ge,e.postPerformanceEvent=qe,e.postTurnstileEvent=Ne,e.potpack=Zf,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=D,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:Xa,pluginURL:Ha}),Ja.on("pluginStateChange",e),e},e.removeAuthState=function(e){He.delete(e)},e.renderColorRamp=vc,e.resample=Au,e.rotateX=Js,e.rotateX$1=Ml,e.rotateY=$s,e.rotateY$1=Al,e.rotateZ=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],c=t[5],h=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*r,e[1]=o*n+c*r,e[2]=s*n+h*r,e[3]=l*n+f*r,e[4]=u*n-a*r,e[5]=c*n-o*r,e[6]=h*n-s*r,e[7]=f*n-l*r,e},e.rotateZ$1=function(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*s,e[1]=n*l-r*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e},e.scale=Ks,e.scale$1=wl,e.scale$2=hl,e.scaleAndAdd=fl,e.set=function(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e},e.setCacheLimits=function(e,t){de=e,pe=t},e.setColumn=function(e,t,i){e[4*t+0]=i[0],e[4*t+1]=i[1],e[4*t+2]=i[2],e[4*t+3]=i[3]},e.setRTLTextPlugin=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Xa===Ga||Xa===Za||Xa===qa)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ha=nt.resolveURL(e),Xa=Ga,Wa=t,Ka(),i||Qa()},e.smoothstep=U,e.spec=ct,e.squaredLength=function(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r},e.storeAuthState=function(e,t){t?He.add(e):He.delete(e)},e.sub=gl,e.subtract=sl,e.symbolSize=pf,e.tileAABB=function(e,t,i,r,n,a,o,s,l){if("globe"===l.name)return Jl(e,t,new Fh(i,r,n));var u=Wd({z:i,x:r,y:n},l);return new Bl([(a+u.x/u.scale)*t,t*(u.y/u.scale),o],[(a+u.x2/u.scale)*t,t*(u.y2/u.scale),s])},e.tileCornersToBounds=$l,e.tileTransform=Wd,e.transformMat3=function(e,t,i){var r=t[0],n=t[1],a=t[2];return e[0]=r*i[0]+n*i[3]+a*i[6],e[1]=r*i[1]+n*i[4]+a*i[7],e[2]=r*i[2]+n*i[5]+a*i[8],e},e.transformMat4=ml,e.transformMat4$1=Tl,e.transformQuat=yl,e.transitionTileAABBinECEF=Yl,e.translate=Ys,e.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},e.triggerPluginCompletionEvent=Ya,e.uniqueId=q,e.updateGlobeVertexNormal=function(e,t,i,r,n){var a=5*t+2;e.float32[a+0]=i,e.float32[a+1]=r,e.float32[a+2]=n},e.validateCustomStyleLayer=function(e){var t=[],i=e.id;return void 0===i&&t.push({message:"layers.".concat(i,': missing required property "id"')}),void 0===e.render&&t.push({message:"layers.".concat(i,': missing required method "render"')}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:"layers.".concat(i,': property "renderingMode" must be either "2d" or "3d"')}),t},e.validateFilter=function(e){return Jn(Pn(e))},e.validateFog=function(e){return Jn(Zn(e))},e.validateLayer=function(e){return Jn(On(e))},e.validateLight=function(e){return Jn(jn(e))},e.validateSource=function(e){return Jn(Vn(e))},e.validateStyle=Hn,e.validateTerrain=function(e){return Jn(Gn(e))},e.values=j,e.vectorTile=oh,e.version=g,e.warnOnce=te,e.window=_,e.wrap=V})),_(["./shared"],(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){var i,r="[",n=f(e);try{for(n.s();!(i=n.n()).done;){var a=i.value;r+="".concat(t(a),",")}}catch(c){n.e(c)}finally{n.f()}return"".concat(r,"]")}var o,s="{",l=f(Object.keys(e).sort());try{for(l.s();!(o=l.n()).done;){var u=o.value;s+="".concat(u,":").concat(t(e[u]),",")}}catch(c){l.e(c)}finally{l.f()}return"".concat(s,"}")}function i(i){var r,n="",a=f(e.refProperties);try{for(a.s();!(r=a.n()).done;){var o=r.value;n+="/".concat(t(i[o]))}}catch(s){a.e(s)}finally{a.f()}return n}var r=function(){function t(e){d(this,t),this.keyCache={},e&&this.replace(e)}return p(t,[{key:"replace",value:function(e){this._layerConfigs={},this._layers={},this.update(e,[])}},{key:"update",value:function(t,r){var n,a=this,o=f(t);try{for(o.s();!(n=o.n()).done;){var s=n.value;this._layerConfigs[s.id]=s,(this._layers[s.id]=e.createStyleLayer(s)).compileFilter(),this.keyCache[s.id]&&delete this.keyCache[s.id]}}catch(b){o.e(b)}finally{o.f()}var l,u=f(r);try{for(u.s();!(l=u.n()).done;){var c=l.value;delete this.keyCache[c],delete this._layerConfigs[c],delete this._layers[c]}}catch(b){u.e(b)}finally{u.f()}this.familiesBySource={};var h,d=function(e,t){for(var r={},n=0;n=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!t&&e.reverse()}var c=e.VectorTileFeature.prototype.toGeoJSON,y=function(){function t(i){d(this,t),this._feature=i,this.extent=e.EXTENT,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}return p(t,[{key:"loadGeometry",value:function(){if(1===this._feature.type){var t,i=[],r=f(this._feature.geometry);try{for(r.s();!(t=r.n()).done;){var n=t.value;i.push([new e.pointGeometry(n[0],n[1])])}}catch(p){r.e(p)}finally{r.f()}return i}var a,o=[],s=f(this._feature.geometry);try{for(s.s();!(a=s.n()).done;){var l,u=a.value,c=[],h=f(u);try{for(h.s();!(l=h.n()).done;){var d=l.value;c.push(new e.pointGeometry(d[0],d[1]))}}catch(p){h.e(p)}finally{h.f()}o.push(c)}}catch(p){s.e(p)}finally{s.f()}return o}},{key:"toGeoJSON",value:function(e,t,i){return c.call(this,e,t,i)}}]),t}(),_=function(){function t(i){d(this,t),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=i.length,this._features=i}return p(t,[{key:"feature",value:function(e){return new y(this._features[e])}}]),t}(),g={},x={get exports(){return g},set exports(e){g=e}},b=e.pointGeometry,w=e.vectorTile.VectorTileFeature,k=T;function T(e,t){this.options=t||{},this.features=e,this.length=e.length}function E(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}T.prototype.feature=function(e){return new E(this.features[e],this.options.extent)},E.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t>31}function L(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,a=0,o=i.length,s=0;s>1;O(e,t,o,r,n,a%2),B(e,t,i,r,o-1,a+1),B(e,t,i,o+1,n,a+1)}}function O(e,t,i,r,n,a){for(;n>r;){if(n-r>600){var o=n-r+1,s=i-r+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(s-o/2<0?-1:1);O(e,t,i,Math.max(r,Math.floor(i-s*u/o+c)),Math.min(n,Math.floor(i+(o-s)*u/o+c)),a)}var h=t[2*i+a],f=r,d=n;for(F(e,t,r,i),t[2*n+a]>h&&F(e,t,r,n);fh;)d--}t[2*r+a]===h?F(e,t,r,d):F(e,t,++d,n),d<=i&&(r=d+1),i<=d&&(n=d-1)}}function F(e,t,i,r){U(e,i,r),U(t,2*i,2*r),U(t,2*i+1,2*r+1)}function U(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function V(e,t,i,r){var n=e-i,a=t-r;return n*n+a*a}x.exports=A,g.fromVectorTileJs=A,g.fromGeojsonVt=function(e,t){t=t||{};var i={};for(var r in e)i[r]=new M(e[r].features,t),i[r].name=r,i[r].version=t.version,i[r].extent=t.extent;return A({layers:i})},g.GeoJSONWrapper=M;var N,j=function(e){return e[0]},G=function(e){return e[1]},Z=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:G,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Float64Array;d(this,e),this.nodeSize=n,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,s=this.ids=new o(t.length),l=this.coords=new a(2*t.length),u=0;u=i&&s<=n&&l>=r&&l<=a&&c.push(e[p]);else{var v=Math.floor((d+f)/2);s=t[2*v],l=t[2*v+1],s>=i&&s<=n&&l>=r&&l<=a&&c.push(e[v]);var m=(h+1)%2;(0===h?i<=s:r<=l)&&(u.push(d),u.push(v-1),u.push(m)),(0===h?n>=s:a>=l)&&(u.push(v+1),u.push(f),u.push(m))}}return c}(this.ids,this.coords,e,t,i,r,this.nodeSize)}},{key:"within",value:function(e,t,i){return function(e,t,i,r,n,a){for(var o=[0,e.length-1,0],s=[],l=n*n;o.length;){var u=o.pop(),c=o.pop(),h=o.pop();if(c-h<=a)for(var f=h;f<=c;f++)V(t[2*f],t[2*f+1],i,r)<=l&&s.push(e[f]);else{var d=Math.floor((h+c)/2),p=t[2*d],v=t[2*d+1];V(p,v,i,r)<=l&&s.push(e[d]);var m=(u+1)%2;(0===u?i-n<=p:r-n<=v)&&(o.push(h),o.push(d-1),o.push(m)),(0===u?i+n>=p:r+n>=v)&&(o.push(d+1),o.push(c),o.push(m))}}return s}(this.ids,this.coords,e,t,i,this.nodeSize)}}]),e}(),q={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(e){return e}},W=Math.fround||(N=new Float32Array(1),function(e){return N[0]=+e,N[0]}),X=function(){function e(t){d(this,e),this.options=te(Object.create(q),t),this.trees=new Array(this.options.maxZoom+1)}return p(e,[{key:"load",value:function(e){var t=this.options,i=t.log,r=t.minZoom,n=t.maxZoom,a=t.nodeSize;i&&console.time("total time");var o="prepare ".concat(e.length," points");i&&console.time(o),this.points=e;for(var s=[],l=0;l=r;u--){var c=+Date.now();s=this._cluster(s,u),this.trees[u]=new Z(s,ie,re,a,Float32Array),i&&console.log("z%d: %d clusters in %dms",u,s.length,+Date.now()-c)}return i&&console.timeEnd("total time"),this}},{key:"getClusters",value:function(e,t){var i=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){var o=this.getClusters([i,r,180,a],t),s=this.getClusters([-180,r,n,a],t);return o.concat(s)}var l,u=this.trees[this._limitZoom(t)],c=u.range($(i),Q(a),$(n),Q(r)),h=[],d=f(c);try{for(d.s();!(l=d.n()).done;){var p=l.value,v=u.points[p];h.push(v.numPoints?K(v):this.points[v.index])}}catch(m){d.e(m)}finally{d.f()}return h}},{key:"getChildren",value:function(e){var t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);var a=n.points[t];if(!a)throw new Error(r);var o,s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),l=n.within(a.x,a.y,s),u=[],c=f(l);try{for(c.s();!(o=c.n()).done;){var h=o.value,d=n.points[h];d.parentId===e&&u.push(d.numPoints?K(d):this.points[d.index])}}catch(p){c.e(p)}finally{c.f()}if(0===u.length)throw new Error(r);return u}},{key:"getLeaves",value:function(e,t,i){var r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}},{key:"getTile",value:function(e,t,i){var r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),a=this.options,o=a.extent,s=a.radius/o,l=(i-s)/n,u=(i+1+s)/n,c={features:[]};return this._addTileFeatures(r.range((t-s)/n,l,(t+1+s)/n,u),r.points,t,i,n,c),0===t&&this._addTileFeatures(r.range(1-s/n,l,1,u),r.points,n,i,n,c),t===n-1&&this._addTileFeatures(r.range(0,l,s/n,u),r.points,-1,i,n,c),c.features.length?c:null}},{key:"getClusterExpansionZoom",value:function(e){for(var t=this._getOriginZoom(e)-1;t<=this.options.maxZoom;){var i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}},{key:"_appendLeaves",value:function(e,t,i,r,n){var a,o=this.getChildren(t),s=f(o);try{for(s.s();!(a=s.n()).done;){var l=a.value,u=l.properties;if(u&&u.cluster?n+u.point_count<=r?n+=u.point_count:n=this._appendLeaves(e,u.cluster_id,i,r,n):nt&&(m+=g.numPoints||1)}}catch(D){y.e(D)}finally{y.f()}if(m>v&&m>=s){var x,b=c.x*v,w=c.y*v,k=o&&v>1?this._map(c,!0):null,T=(u<<5)+(t+1)+this.points.length,E=f(p);try{for(E.s();!(x=E.n()).done;){var S=x.value,M=d.points[S];if(!(M.zoom<=t)){M.zoom=t;var A=M.numPoints||1;b+=M.x*A,w+=M.y*A,M.parentId=T,o&&(k||(k=this._map(c,!0)),o(k,this._map(M)))}}}catch(D){E.e(D)}finally{E.f()}c.parentId=T,i.push(H(b/m,w/m,T,m,k))}else if(i.push(c),m>1){var I,C=f(p);try{for(C.s();!(I=C.n()).done;){var z=I.value,P=d.points[z];P.zoom<=t||(P.zoom=t,i.push(P))}}catch(D){C.e(D)}finally{C.f()}}}}return i}},{key:"_getOriginId",value:function(e){return e-this.points.length>>5}},{key:"_getOriginZoom",value:function(e){return(e-this.points.length)%32}},{key:"_map",value:function(e,t){if(e.numPoints)return t?te({},e.properties):e.properties;var i=this.points[e.index].properties,r=this.options.map(i);return t&&r===i?te({},r):r}}]),e}();function H(e,t,i,r,n){return{x:W(e),y:W(t),zoom:1/0,id:i,parentId:-1,numPoints:r,properties:n}}function Y(e,t){var i=h(e.geometry.coordinates,2),r=i[0],n=i[1];return{x:W($(r)),y:W(Q(n)),zoom:1/0,index:t,parentId:-1}}function K(e){return{type:"Feature",id:e.id,properties:J(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),ee(e.y)]}};var t}function J(e){var t=e.numPoints,i=t>=1e4?"".concat(Math.round(t/1e3),"k"):t>=1e3?Math.round(t/100)/10+"k":t;return te(te({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:i})}function $(e){return e/360+.5}function Q(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function ee(e){var t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function te(e,t){for(var i in t)e[i]=t[i];return e}function ie(e){return e.x}function re(e){return e.y}function ne(e,t,i,r){for(var n,a=r,o=i-t>>1,s=i-t,l=e[t],u=e[t+1],c=e[i],h=e[i+1],f=t+3;fa)n=f,a=d;else if(d===a){var p=Math.abs(f-o);pr&&(n-t>3&&ne(e,t,n,r),e[n+2]=a,i-n>3&&ne(e,n,i,r))}function ae(e,t,i,r,n,a){var o=n-i,s=a-r;if(0!==o||0!==s){var l=((e-i)*o+(t-r)*s)/(o*o+s*s);l>1?(i=n,r=a):l>0&&(i+=o*l,r+=s*l)}return(o=e-i)*o+(s=t-r)*s}function oe(e,t,i,r){var n={id:void 0===e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)se(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r0&&(o+=r?(n*u-l*a)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-a,2))),n=l,a=u}var c=t.length-3;t[2]=1,ne(t,0,c,i),t[c+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function he(e,t,i,r){for(var n=0;n1?1:i}function pe(e,t,i,r,n,a,o,s){if(r/=t,a>=(i/=t)&&o=r)return null;for(var l=[],u=0;u=i&&p=r)){var v=[];if("Point"===f||"MultiPoint"===f)ve(h,v,i,r,n);else if("LineString"===f)me(h,v,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===f)_e(h,v,i,r,n,!1);else if("Polygon"===f)_e(h,v,i,r,n,!0);else if("MultiPolygon"===f)for(var m=0;m=i&&o<=r&&(t.push(e[a]),t.push(e[a+1]),t.push(e[a+2]))}}function me(e,t,i,r,n,a,o){for(var s,l,u=ye(e),c=0===n?xe:be,h=e.start,f=0;fi&&(l=c(u,d,p,m,y,i),o&&(u.start=h+s*l)):_>r?g=i&&(l=c(u,d,p,m,y,i),x=!0),g>r&&_<=r&&(l=c(u,d,p,m,y,r),x=!0),!a&&x&&(o&&(u.end=h+s*l),t.push(u),u=ye(e)),o&&(h+=s)}var b=e.length-3;d=e[b],p=e[b+1],v=e[b+2],(_=0===n?d:p)>=i&&_<=r&&ge(u,d,p,v),b=u.length-3,a&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&ge(u,u[0],u[1],u[2]),u.length&&t.push(u)}function ye(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function _e(e,t,i,r,n,a){for(var o=0;oo.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function Me(e,t,i,r){var n=t.geometry,a=t.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s0&&t.size<(n?o:r))i.numPoints+=t.length/3;else{for(var s=[],l=0;lo)&&(i.numSimplified++,s.push(t[l]),s.push(t[l+1])),i.numPoints++;n&&function(e,t){for(var i=0,r=0,n=e.length,a=n-2;r0===t)for(r=0,n=e.length;r24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r1&&console.time("creation"),f=this.tiles[h]=Se(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+t;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=e,n){if(t===l.maxZoom||t===n)continue;var p=1<1&&console.time("clipping");var v,m,y,_,g,x,b=.5*l.buffer/l.extent,w=.5-b,k=.5+b,T=1+b;v=m=y=_=null,g=pe(e,c,i-b,i+k,0,f.minX,f.maxX,l),x=pe(e,c,i+w,i+T,0,f.minX,f.maxX,l),e=null,g&&(v=pe(g,c,r-b,r+k,1,f.minY,f.maxY,l),m=pe(g,c,r+w,r+T,1,f.minY,f.maxY,l),g=null),x&&(y=pe(x,c,r-b,r+k,1,f.minY,f.maxY,l),_=pe(x,c,r+w,r+T,1,f.minY,f.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(v||[],t+1,2*i,2*r),s.push(m||[],t+1,2*i,2*r+1),s.push(y||[],t+1,2*i+1,2*r),s.push(_||[],t+1,2*i+1,2*r+1)}}},Ie.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,a=r.debug;if(e<0||e>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,u=e,c=t,h=i;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Ce(u,c,h)];return l&&l.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,c,h),a>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,e,t,i),a>1&&console.timeEnd("drilling down"),this.tiles[s]?Te(this.tiles[s],n):null):null};var Pe=function(t){v(r,t);var i=m(r);function r(e,t,n,a,o){var s;return d(this,r),s=i.call(this,e,t,n,a,ze),o&&(s.loadGeoJSON=o),s}return p(r,[{key:"loadData",value:function(t,i){var r=this,n=t&&t.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(t,(function(s,l){if(s||!l)return i(s);if("object"!=typeof l)return i(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));a(l,!0);try{if(t.filter){var u=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===u.result)throw new Error(u.value.map((function(e){return"".concat(e.key,": ").concat(e.message)})).join(", "));var c=l.features.filter((function(e){return u.value.evaluate({zoom:0},e)}));l={type:"FeatureCollection",features:c}}r._geoJSONIndex=t.cluster?new X(function(t){var i=t.superclusterOptions,r=t.clusterProperties;if(!r||!i)return i;for(var n={},a={},o={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r),u=0,c=l;u=0?0:t.button}function C(t,i,r){var n=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.pointGeometry((r.clientX-i.left)*n,(r.clientY-i.top)*n)}function z(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*a-n*r;return o?(e[0]=a*(o=1/o),e[1]=-r*o,e[2]=-n*o,e[3]=i*o,e):null}function P(e){var t=e.userImage;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}var D=function(t){v(r,t);var i=m(r);function r(){var t;return d(this,r),(t=i.call(this)).images={},t.updatedImages={},t.callbackDispatchedThisFrame={},t.loaded=!1,t.requestors=[],t.patterns={},t.atlasImage=new e.RGBAImage({width:1,height:1}),t.dirty=!0,t}return p(r,[{key:"isLoaded",value:function(){return this.loaded}},{key:"setLoaded",value:function(e){if(this.loaded!==e&&(this.loaded=e,e)){var t,i=f(this.requestors);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=r.ids,a=r.callback;this._notify(n,a)}}catch(o){i.e(o)}finally{i.f()}this.requestors=[]}}},{key:"hasImage",value:function(e){return!!this.getImage(e)}},{key:"getImage",value:function(e){return this.images[e]}},{key:"addImage",value:function(e,t){this._validate(e,t)&&(this.images[e]=t)}},{key:"_validate",value:function(t,i){var r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchX" value')))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchY" value')))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "content" value')))),r=!1),r}},{key:"_validateStretch",value:function(e,t){if(!e)return!0;var i,r=0,n=f(e);try{for(n.s();!(i=n.n()).done;){var a=i.value;if(a[0]1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateLight,t,i))for(var r in t){var n=t[r];e.endsWith(r,R)?this._transitionable.setTransition(r.slice(0,-R.length),n):this._transitionable.setValue(r,n)}}},{key:"updateTransitions",value:function(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}},{key:"hasTransition",value:function(){return this._transitioning.hasTransition()}},{key:"recalculate",value:function(e){this.properties=this._transitioning.possiblyEvaluate(e)}},{key:"_validate",value:function(t,i,r){return(!r||!1!==r.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}]),r}(e.Evented),O=new e.Properties({source:new e.DataConstantProperty(e.spec.terrain.source),exaggeration:new e.DataConstantProperty(e.spec.terrain.exaggeration)}),F="-transition",U=function(t){v(r,t);var i=m(r);function r(t,n){var a;return d(this,r),(a=i.call(this))._transitionable=new e.Transitionable(O),a.set(t),a._transitioning=a._transitionable.untransitioned(),a.drapeRenderMode=n,a}return p(r,[{key:"get",value:function(){return this._transitionable.serialize()}},{key:"set",value:function(t){for(var i in t){var r=t[i];e.endsWith(i,F)?this._transitionable.setTransition(i.slice(0,-F.length),r):this._transitionable.setValue(i,r)}}},{key:"updateTransitions",value:function(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}},{key:"hasTransition",value:function(){return this._transitioning.hasTransition()}},{key:"recalculate",value:function(e){this.properties=this._transitioning.possiblyEvaluate(e)}}]),r}(e.Evented);function V(t,i,r,n){var a=e.smoothstep(45,65,r),o=N(t,n),s=h(o,2),l=s[0],u=s[1],c=e.length(i),f=1-Math.min(1,Math.exp((c-l)/(u-l)*-6));return f*=f*f,(f=Math.min(1,1.00747*f))*a*t.alpha}function N(e,t){var i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}var j=new e.Properties({range:new e.DataConstantProperty(e.spec.fog.range),color:new e.DataConstantProperty(e.spec.fog.color),"high-color":new e.DataConstantProperty(e.spec.fog["high-color"]),"space-color":new e.DataConstantProperty(e.spec.fog["space-color"]),"horizon-blend":new e.DataConstantProperty(e.spec.fog["horizon-blend"]),"star-intensity":new e.DataConstantProperty(e.spec.fog["star-intensity"])}),G="-transition",Z=function(t){v(r,t);var i=m(r);function r(t,n){var a;return d(this,r),(a=i.call(this))._transitionable=new e.Transitionable(j),a.set(t),a._transitioning=a._transitionable.untransitioned(),a._transform=n,a}return p(r,[{key:"state",get:function(){var t=this._transform,i="globe"===t.projection.name,r=e.globeToMercatorTransition(t.zoom),n=this.properties.get("range"),a=[.5,3];return{range:i?[e.number(a[0],n[0],r),e.number(a[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}},{key:"get",value:function(){return this._transitionable.serialize()}},{key:"set",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateFog,t,i)){for(var r=0,n=Object.keys(e.spec.fog);rr.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(n[3]=this.cameraPoint)),e.bufferConvexPolygon(n,t)}},{key:"bufferedCameraGeometryGlobe",value:function(t){var i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.pointGeometry(1,1)):this.screenBounds[1],n=e.polygonizeBounds(i,r,t),a=this.cameraPoint.clone();switch(3*((a.y>i.y)+(a.y>r.y))+((a.x>i.x)+(a.x>r.x))){case 0:n[0]=a,n[4]=a.clone();break;case 1:n.splice(1,0,a);break;case 2:n[1]=a;break;case 3:n.splice(4,0,a);break;case 5:n.splice(2,0,a);break;case 6:n[3]=a;break;case 7:n.splice(3,0,a);break;case 8:n[2]=a}return n}},{key:"containsTile",value:function(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=t.queryPadding/i._pixelsPerMercatorPixel+1,o=r?this._bufferedCameraMercator(a,i):this._bufferedScreenMercator(a,i),s=t.tileID.wrap+(o.unwrapped?n:0),l=o.polygon.map((function(i){return e.getTilePoint(t.tileTransform,i,s)}));if(e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT)){s=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);var u,c=this.screenGeometryMercator.polygon.map((function(i){return e.getTileVec3(t.tileTransform,i,s)})),h=c.map((function(t){return new e.pointGeometry(t[0],t[1])})),f=i.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),d=e.getTileVec3(t.tileTransform,f,s),p=c.map((function(t){var i=e.sub(t,t,d);return e.normalize(i,i),new e.Ray(d,i)})),v=W(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:h,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(u=e.getBounds(l),u.min.x=e.clamp(u.min.x,0,e.EXTENT),u.min.y=e.clamp(u.min.y,0,e.EXTENT),u.max.x=e.clamp(u.max.x,0,e.EXTENT),u.max.y=e.clamp(u.max.y,0,e.EXTENT),u),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:v}}}},{key:"_bufferedScreenMercator",value:function(e,t){var i,r=K(e);return this._screenRaycastCache[r]?this._screenRaycastCache[r]:(i="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((function(e){return t.pointCoordinate3D(e)})),unwrapped:!0},this._screenRaycastCache[r]=i,i)}},{key:"_bufferedCameraMercator",value:function(e,t){var i,r=K(e);return this._cameraRaycastCache[r]?this._cameraRaycastCache[r]:(i="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((function(e){return t.pointCoordinate3D(e)})),unwrapped:!0},this._cameraRaycastCache[r]=i,i)}},{key:"_projectAndResample",value:function(t,i){var r=function(t,i){var r=e.multiply([],i.pixelMatrix,i.globeMatrix),n=[0,-e.GLOBE_RADIUS,0,1],a=[0,e.GLOBE_RADIUS,0,1],o=[0,0,0,1];e.transformMat4$1(n,n,r),e.transformMat4$1(a,a,r),e.transformMat4$1(o,o,r);var s=new e.pointGeometry(n[0]/n[3],n[1]/n[3]),l=new e.pointGeometry(a[0]/a[3],a[1]/a[3]),u=e.polygonContainsPoint(t,s)&&n[3]1?H(t.slice(0,d),i):[],m=dn&&(n=t[o].x,a=o);for(var s=0;s.5&&(u.x=r&&t.x=n&&t.y1&&void 0!==arguments[1]&&arguments[1];if(d(this,i),this.gl=e,this.isWebGL2=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),t){var r=e;this.extVertexArrayObject={createVertexArrayOES:r.createVertexArray.bind(e),deleteVertexArrayOES:r.deleteVertexArray.bind(e),bindVertexArrayOES:r.bindVertexArray.bind(e)}}this.clearColor=new ne(this),this.clearDepth=new ae(this),this.clearStencil=new oe(this),this.colorMask=new se(this),this.depthMask=new le(this),this.stencilMask=new ue(this),this.stencilFunc=new ce(this),this.stencilOp=new he(this),this.stencilTest=new fe(this),this.depthRange=new de(this),this.depthTest=new pe(this),this.depthFunc=new ve(this),this.blend=new me(this),this.blendFunc=new ye(this),this.blendColor=new _e(this),this.blendEquation=new ge(this),this.cullFace=new xe(this),this.cullFaceSide=new be(this),this.frontFace=new we(this),this.program=new ke(this),this.activeTexture=new Te(this),this.viewport=new Ee(this),this.bindFramebuffer=new Se(this),this.bindRenderbuffer=new Me(this),this.bindTexture=new Ae(this),this.bindVertexBuffer=new Ie(this),this.bindElementBuffer=new Ce(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ze(this),this.pixelStoreUnpack=new Pe(this),this.pixelStoreUnpackPremultiplyAlpha=new De(this),this.pixelStoreUnpackFlipY=new Le(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),t||(this.extTextureHalfFloat=e.getExtension("OES_texture_half_float")),(t||this.extTextureHalfFloat&&e.getExtension("OES_texture_half_float_linear"))&&(this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=t||e.getExtension("OES_standard_derivatives"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}return p(i,[{key:"setDefault",value: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()}},{key:"setDirty",value: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}},{key:"createIndexBuffer",value:function(e,t){return new ee(this,e,t)}},{key:"createVertexBuffer",value:function(e,t,i){return new ie(this,e,t,i)}},{key:"createRenderbuffer",value:function(e,t,i){var r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}},{key:"createFramebuffer",value:function(e,t,i){return new Ue(this,e,t,i)}},{key:"clear",value:function(e){var t=e.color,i=e.depth,r=e.stencil,n=this.gl,a=0;t&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(a|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),n.clear(a)}},{key:"setCullFace",value:function(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}},{key:"setDepthMode",value:function(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}},{key:"setStencilMode",value:function(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}},{key:"setColorMode",value:function(i){t(i.blendFunction,e.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}},{key:"unbindVAO",value:function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}]),i}(),Ne=function(t){v(r,t);var i=m(r);function r(t,a,o,s){var u;if(d(this,r),(u=i.call(this)).id=t,u.dispatcher=o,u.type="vector",u.minzoom=0,u.maxzoom=22,u.scheme="xyz",u.tileSize=512,u.reparseOverscaled=!0,u.isTileClipped=!0,u._loaded=!1,e.extend(n(u),e.pick(a,["url","scheme","tileSize","promoteId"])),u._options=e.extend({type:"vector"},a),u._collectResourceTiming=a.collectResourceTiming,512!==u.tileSize)throw new Error("vector tile sources must have a tileSize of 512");return u.setEventedParent(s),u._tileWorkers={},u._deduped=new e.DedupedRequest,l(u)}return p(r,[{key:"load",value:function(t){var i=this;this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"}));var r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map._worldview;this._tileJSONRequest=J(this._options,this.map._requestManager,r,n,(function(a,o){i._tileJSONRequest=null,i._loaded=!0,a?(r&&console.warn("Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ".concat(r)),n&&2!==n.length&&console.warn("Requested worldview strings must be a valid ISO alpha-2 code. Found: ".concat(n)),i.fire(new e.ErrorEvent(a))):o&&(e.extend(i,o),o.bounds&&(i.tileBounds=new Q(o.bounds,i.minzoom,i.maxzoom)),e.postTurnstileEvent(o.tiles,i.map._requestManager._customAccessToken),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(a)}))}},{key:"loaded",value:function(){return this._loaded}},{key:"hasTile",value:function(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"reload",value:function(){var e=this;this.cancelTileJSONRequest(),this.load((function(){return e.map.style._clearSource(e.id)}))}},{key:"setTiles",value:function(e){return this._options.tiles=e,this.reload(),this}},{key:"setUrl",value:function(e){return this.url=e,this._options.url=e,this.reload(),this}},{key:"onRemove",value:function(){this.cancelTileJSONRequest()}},{key:"serialize",value:function(){return e.extend({},this._options)}},{key:"loadTile",value:function(t,i){var r=this,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),a={request:this.map._requestManager.transformRequest(n,e.ResourceType.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile};if(a.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",a,s.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",a,s.bind(this),void 0,!0);else{var o=e.loadVectorTile.call({deduped:this._deduped},a,(function(e,i){e||!i?s.call(r,e):(a.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",a,s.bind(r),void 0,!0))}),!0);t.request={cancel:o}}function s(r,n){return delete t.request,t.aborted?i(null):r&&404!==r.status?i(r):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}},{key:"abortTile",value:function(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id})}},{key:"unloadTile",value:function(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}},{key:"hasTransition",value:function(){return!1}},{key:"afterUpdate",value:function(){this._tileWorkers={}}},{key:"cancelTileJSONRequest",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}]),r}(e.Evented),je=function(t){v(r,t);var i=m(r);function r(t,a,o,s){var l;return d(this,r),(l=i.call(this)).id=t,l.dispatcher=o,l.setEventedParent(s),l.type="raster",l.minzoom=0,l.maxzoom=22,l.roundZoom=!0,l.scheme="xyz",l.tileSize=512,l._loaded=!1,l._options=e.extend({type:"raster"},a),e.extend(n(l),e.pick(a,["url","scheme","tileSize"])),l}return p(r,[{key:"load",value:function(t){var i=this;this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=J(this._options,this.map._requestManager,null,null,(function(r,n){i._tileJSONRequest=null,i._loaded=!0,r?i.fire(new e.ErrorEvent(r)):n&&(e.extend(i,n),n.bounds&&(i.tileBounds=new Q(n.bounds,i.minzoom,i.maxzoom)),e.postTurnstileEvent(n.tiles),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(r)}))}},{key:"loaded",value:function(){return this._loaded}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"reload",value:function(){var e=this;this.cancelTileJSONRequest(),this.load((function(){return e.map.style._clearSource(e.id)}))}},{key:"setTiles",value:function(e){return this._options.tiles=e,this.reload(),this}},{key:"setUrl",value:function(e){return this.url=e,this._options.url=e,this.reload(),this}},{key:"onRemove",value:function(){this.cancelTileJSONRequest()}},{key:"serialize",value:function(){return e.extend({},this._options)}},{key:"hasTile",value:function(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"loadTile",value:function(t,i){var r=this,n=e.exported.devicePixelRatio>=2,a=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);t.request=e.getImage(this.map._requestManager.transformRequest(a,e.ResourceType.Tile),(function(n,a,o,s){return delete t.request,t.aborted?(t.state="unloaded",i(null)):n?(t.state="errored",i(n)):a?(r.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(a,r.map.painter),t.state="loaded",e.cacheEntryPossiblyAdded(r.dispatcher),void i(null)):i(null)}))}},{key:"abortTile",value:function(e,t){e.request&&(e.request.cancel(),delete e.request),t()}},{key:"unloadTile",value:function(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}},{key:"hasTransition",value:function(){return!1}},{key:"cancelTileJSONRequest",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}],[{key:"loadTileData",value:function(e,t,i){e.setTexture(t,i)}},{key:"unloadTileData",value:function(e,t){e.texture&&t.saveTileTexture(e.texture)}}]),r}(e.Evented);function Ge(t,i,r,n,a,o,s,l){var u=[t,r,a,i,n,o,1,1,1],c=[s,l,1],f=e.adjoint([],u),d=e.transformMat3(c,c,e.transpose(f,f)),p=h(d,3),v=p[0],m=p[1],y=p[2];return e.multiply$1(u,[v,0,0,0,m,0,0,0,y],u)}var Ze=function(t){v(r,t);var i=m(r);function r(e,t,n,a){var o;return d(this,r),(o=i.call(this)).id=e,o.dispatcher=n,o.coordinates=t.coordinates,o.type="image",o.minzoom=0,o.maxzoom=22,o.tileSize=512,o.tiles={},o._loaded=!1,o.setEventedParent(a),o.options=t,o._dirty=!1,o}return p(r,[{key:"load",value:function(t,i){var r=this;this._loaded=i||!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),(function(i,n){if(r._imageRequest=null,r._loaded=!0,i)r.fire(new e.ErrorEvent(i));else if(n){var a=e.window.HTMLImageElement;r.image=n instanceof a?e.exported.getImageData(n):n,r._dirty=!0,r.width=r.image.width,r.height=r.image.height,t&&(r.coordinates=t),r._finishLoading()}}))}},{key:"loaded",value:function(){return this._loaded}},{key:"updateImage",value:function(e){return this.image&&e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}},{key:"_finishLoading",value:function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"onRemove",value:function(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}},{key:"setCoordinates",value:function(t){this.coordinates=t,this._boundsArray=void 0;var i=t.map(e.MercatorCoordinate.fromLngLat);return this.tileID=function(t){var i,r=1/0,n=1/0,a=-1/0,o=-1/0,s=f(t);try{for(s.s();!(i=s.n()).done;){var l=i.value;r=Math.min(r,l.x),n=Math.min(n,l.y),a=Math.max(a,l.x),o=Math.max(o,l.y)}}catch(d){s.e(d)}finally{s.f()}var u=Math.max(a-r,o-n),c=Math.max(0,Math.floor(-Math.log(u)/Math.LN2)),h=Math.pow(2,c);return new e.CanonicalTileID(c,Math.floor((r+a)/2*h),Math.floor((n+o)/2*h))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}},{key:"_clear",value:function(){this._boundsArray=void 0}},{key:"_prepareData",value:function(t){for(var i in this.tiles){var r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(!this._boundsArray){var n=e.tileTransform(this.tileID,this.map.transform.projection),a=this.coordinates.map((function(t){var i=n.projection.project(t[0],t[1]);return e.getTilePoint(n,i)._round()})),o=h(a,4),s=o[0],l=o[1],u=o[2],c=o[3];this.perspectiveTransform=function(t,i,r,n,a,o,s,l,u,c){var h=Ge(0,0,t,0,0,i,t,i),f=Ge(r,n,a,o,s,l,u,c);return e.multiply$1(f,e.adjoint(h,h),f),[f[6]/f[8]*t/e.EXTENT,f[7]/f[8]*i/e.EXTENT]}(this.width,this.height,s.x,s.y,l.x,l.y,c.x,c.y,u.x,u.y);var f=this._boundsArray=new e.StructArrayLayout4i8;f.emplaceBack(s.x,s.y,0,0),f.emplaceBack(l.x,l.y,e.EXTENT,0),f.emplaceBack(c.x,c.y,0,e.EXTENT),f.emplaceBack(u.x,u.y,e.EXTENT,e.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(f,e.boundsAttributes.members),this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)}}},{key:"prepare",value:function(){if(0!==Object.keys(this.tiles).length&&this.image){var t=this.map.painter.context,i=t.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new e.Texture(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(t)}}},{key:"loadTile",value:function(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}},{key:"serialize",value:function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return!1}}]),r}(e.Evented),qe={vector:Ne,raster:je,"raster-dem":function(t){v(r,t);var i=m(r);function r(t,n,a,o){var s;return d(this,r),(s=i.call(this,t,n,a,o)).type="raster-dem",s.maxzoom=22,s._options=e.extend({type:"raster-dem"},n),s.encoding=n.encoding||"mapbox",s}return p(r,[{key:"loadTile",value:function(t,i){var r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,r){e&&(t.state="errored",i(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),function(r,a,o,s){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(r)t.state="errored",i(r);else if(a){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s});var l=e.window.ImageBitmap&&a instanceof e.window.ImageBitmap&&(null==$&&($=e.window.OffscreenCanvas&&new e.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof e.window.createImageBitmap),$),u=1-(a.width-e.prevPowerOfTwo(a.width))/2;u<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));var c=l?a:e.exported.getImageData(a,u),h={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:c,encoding:this.encoding,padding:u};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",h,n.bind(this),void 0,!0))}}.bind(this))}},{key:"_getNeighboringTiles",value:function(t){var i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,a=0===i.x?t.wrap-1:t.wrap,o=(i.x+1+r)%r,s=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,a,i.z,n,i.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,a,i.z,n,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,i.z,o,i.y-1).key]={backfilled:!1}),i.y+1i.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(i.start(0)," and ").concat(i.end(0),"-second mark.")))):this.video.currentTime=t}}},{key:"getVideo",value:function(){return this.video}},{key:"onAdd",value:function(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}},{key:"prepare",value:function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.Texture(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}}},{key:"serialize",value:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return this.video&&!this.video.paused}}]),r}(Ze),image:Ze,canvas:function(t){v(r,t);var i=m(r);function r(t,n,a,o){var s;return d(this,r),s=i.call(this,t,n,a,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(e){return!Array.isArray(e)||2!==e.length||e.some((function(e){return"number"!=typeof e}))}))||s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof e.window.HTMLCanvasElement||s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'missing required property "canvas"'))),s.options=n,s.animate=void 0===n.animate||n.animate,s}return p(r,[{key:"load",value:function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof e.window.HTMLCanvasElement?this.options.canvas:e.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.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())}},{key:"getCanvas",value:function(){return this.canvas}},{key:"onAdd",value:function(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}},{key:"onRemove",value:function(){this.pause()}},{key:"prepare",value:function(){var t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var i=this.map.painter.context;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.Texture(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i)}}},{key:"serialize",value:function(){return{type:"canvas",coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return this._playing}},{key:"_hasInvalidDimensions",value:function(){for(var e=0,t=[this.canvas.width,this.canvas.height];e7&&void 0!==arguments[7]&&arguments[7],l=e.tilesIn(r,o,s);l.sort(Ke);var u,c=[],h=f(l);try{for(h.s();!(u=h.n()).done;){var d=u.value;c.push({wrappedTileID:d.tile.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,i,e._state,d,n,a,Xe(e.transform,d.tile.tileID),s)})}}catch(m){h.e(m)}finally{h.f()}var p=function(e){var t,i={},r={},n=f(e);try{for(n.s();!(t=n.n()).done;){var a=t.value,o=a.queryResults,s=a.wrappedTileID,l=r[s]=r[s]||{};for(var u in o){var c,h=o[u],d=l[u]=l[u]||{},p=i[u]=i[u]||[],v=f(h);try{for(v.s();!(c=v.n()).done;){var y=c.value;d[y.featureIndex]||(d[y.featureIndex]=!0,p.push(y))}}catch(m){v.e(m)}finally{v.f()}}}}catch(m){n.e(m)}finally{n.f()}return i}(c);for(var v in p)p[v].forEach((function(t){var i=t.feature,r=i.layer;r&&"background"!==r.type&&"sky"!==r.type&&(i.source=r.source,r["source-layer"]&&(i.sourceLayer=r["source-layer"]),i.state=void 0!==i.id?e.getFeatureState(r["source-layer"],i.id):{})}));return p}function Ye(e,t){for(var i=e.getRenderableIds().map((function(t){return e.getTileByID(t)})),r=[],n={},a=0;a0?(n-o)/s:0;return this.points[a].mult(1-l).add(this.points[i].mult(l))}}]),t}(),dt=function(){function e(t,i,r){d(this,e);var n=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(i/r);for(var o=0;othis.width||r<0||t>this.height)return!n&&[];var o=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(var s=0;s0:o}},{key:"_queryCircle",value:function(e,t,i,r,n){var a=e-i,o=e+i,s=t-i,l=t+i;if(o<0||a>this.width||l<0||s>this.height)return!r&&[];var u=[];return this._forEachCell(a,s,o,l,this._queryCellCircle,u,{hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),r?u.length>0:u}},{key:"query",value:function(e,t,i,r,n){return this._query(e,t,i,r,!1,n)}},{key:"hitTest",value:function(e,t,i,r,n){return this._query(e,t,i,r,!0,n)}},{key:"hitTestCircle",value:function(e,t,i,r){return this._queryCircle(e,t,i,!0,r)}},{key:"_queryCell",value:function(e,t,i,r,n,a,o,s){var l=o.seenUids,u=this.boxCells[n];if(null!==u){var c,h=this.bboxes,d=f(u);try{for(d.s();!(c=d.n()).done;){var p=c.value;if(!l.box[p]){l.box[p]=!0;var v=4*p;if(e<=h[v+2]&&t<=h[v+3]&&i>=h[v+0]&&r>=h[v+1]&&(!s||s(this.boxKeys[p]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:h[v],y1:h[v+1],x2:h[v+2],y2:h[v+3]})}}}}catch(E){d.e(E)}finally{d.f()}}var m=this.circleCells[n];if(null!==m){var y,_=this.circles,g=f(m);try{for(g.s();!(y=g.n()).done;){var x=y.value;if(!l.circle[x]){l.circle[x]=!0;var b=3*x;if(this._circleAndRectCollide(_[b],_[b+1],_[b+2],e,t,i,r)&&(!s||s(this.circleKeys[x]))){if(o.hitTest)return a.push(!0),!0;var w=_[b],k=_[b+1],T=_[b+2];a.push({key:this.circleKeys[x],x1:w-T,y1:k-T,x2:w+T,y2:k+T})}}}}catch(E){g.e(E)}finally{g.f()}}}},{key:"_queryCellCircle",value:function(e,t,i,r,n,a,o,s){var l=o.circle,u=o.seenUids,c=this.boxCells[n];if(null!==c){var h,d=this.bboxes,p=f(c);try{for(p.s();!(h=p.n()).done;){var v=h.value;if(!u.box[v]){u.box[v]=!0;var m=4*v;if(this._circleAndRectCollide(l.x,l.y,l.radius,d[m+0],d[m+1],d[m+2],d[m+3])&&(!s||s(this.boxKeys[v])))return a.push(!0),!0}}}catch(k){p.e(k)}finally{p.f()}}var y=this.circleCells[n];if(null!==y){var _,g=this.circles,x=f(y);try{for(x.s();!(_=x.n()).done;){var b=_.value;if(!u.circle[b]){u.circle[b]=!0;var w=3*b;if(this._circlesCollide(g[w],g[w+1],g[w+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[b])))return a.push(!0),!0}}}catch(k){x.e(k)}finally{x.f()}}}},{key:"_forEachCell",value:function(e,t,i,r,n,a,o,s){for(var l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),c=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r),f=l;f<=c;f++)for(var d=u;d<=h;d++)if(n.call(this,e,t,i,r,this.xCellCount*d+f,a,o,s))return}},{key:"_convertToXCellCoord",value:function(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}},{key:"_convertToYCellCoord",value:function(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}},{key:"_circlesCollide",value:function(e,t,i,r,n,a){var o=r-e,s=n-t,l=i+a;return l*l>o*o+s*s}},{key:"_circleAndRectCollide",value:function(e,t,i,r,n,a,o){var s=(a-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;var u=(o-n)/2,c=Math.abs(t-(n+u));if(c>u+i)return!1;if(l<=s||c<=u)return!0;var h=l-s,f=c-u;return h*h+f*f<=i*i}}]),e}(),pt=Math.tan(85*Math.PI/180);function vt(t,i,r,n,a,o,s){var l=e.create();if(r)if("globe"===o.name){var u=e.calculateGlobeLabelMatrix(a,i);e.multiply(l,l,u)}else{var c=z([],s);l[0]=c[0],l[1]=c[1],l[4]=c[2],l[5]=c[3],n||e.rotateZ(l,l,a.angle)}else e.multiply(l,a.labelPlaneMatrix,t);return l}function mt(e,t,i,r,n,a,o){var s=vt(e,t,i,r,n,a,o);return"globe"===a.name&&i||(s[2]=s[6]=s[10]=s[14]=0),s}function yt(t,i,r,n,a,o,s){if(r){if("globe"===o.name){var l=vt(t,i,r,n,a,o,s);return e.invert(l,l),e.multiply(l,t,l),l}var u=e.clone(t),c=e.identity([]);return c[0]=s[0],c[1]=s[1],c[4]=s[2],c[5]=s[3],e.multiply(u,u,c),n||e.rotateZ(u,u,-a.angle),u}return a.glCoordMatrix}function _t(t,i,r,n){var a=[t,i,r,1];r?e.transformMat4$1(a,a,n):It(a,a,n);var o=a[3];return a[0]/=o,a[1]/=o,a[2]/=o,a}function gt(e,t){return Math.min(.5+e/t*.5,1.5)}function xt(e,t){var i=e[0]/e[3],r=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&r>=-t[1]&&r<=t[1]}function bt(t,i,r,n,a,o,s,l,u,c){var f=r.transform,d=n?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,r.transform.zoom),v="globe"===f.projection.name,m=[256/r.width*2+1,256/r.height*2+1],y=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;y.clear();var _=null;v&&(_=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);for(var g,x=t.lineVertexArray,b=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,w=r.transform.width/r.transform.height,k=!1,T=0;TMath.abs(r)?{useVertical:!0}:t===e.WritingMode.vertical?n>0?{needsFlipping:!0}:null:0!==i&&function(e,t){return 0===e||Math.abs(t/e)>pt}(r,n)?1===i?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function Tt(t,i,r,n,a,o,s,l,u,c,f,d,p,v,m,y,_,g,x){var b=i/24,w=t.lineOffsetX*b,k=t.lineOffsetY*b,T=t.lineStartIndex,E=t.glyphStartIndex,S=t.numGlyphs,M=t.segment,A=t.writingMode,I=t.flipState,C=T+t.lineLength,z=function(t){if(f){var i=h(t.up,3),r=i[0],n=i[1],a=i[2],o=c.length;e.updateGlobeVertexNormal(f,o+0,r,n,a),e.updateGlobeVertexNormal(f,o+1,r,n,a),e.updateGlobeVertexNormal(f,o+2,r,n,a),e.updateGlobeVertexNormal(f,o+3,r,n,a)}var s=h(t.point,3),l=s[0],u=s[1],d=s[2];e.addDynamicAttributes(c,l,u,d,t.angle)};if(S>1){var P=wt(b,l,w,k,r,d,p,t,u,o,v,y,!1,_,g,x);if(!P)return{notEnoughRoom:!0};if(n&&!r){var D,L,R,B,O=h(P.first.point,3),F=O[0],U=O[1],V=O[2],N=h(P.last.point,3),j=N[0],G=N[1],Z=N[2];D=_t(F,U,V,s),F=(L=h(D,2))[0],U=L[1],R=_t(j,G,Z,s);var q=kt(A,I,((j=(B=h(R,2))[0])-F)*m,(G=B[1])-U);if(t.flipState=q&&q.needsFlipping?1:2,q)return q}z(P.first);for(var W=E+1;W0?J:St(p,K,H,1,a,void 0,_,g.canonical),Q=kt(A,I,($[0]-H[0])*m,$[1]-H[1]);if(t.flipState=Q&&Q.needsFlipping?1:2,Q)return Q}var ee=Mt(b*l.getoffsetX(E),w,k,r,d,p,M,T,C,u,o,v,y,!1,!1,_,g,x);if(!ee)return{notEnoughRoom:!0};z(ee)}return{}}function Et(e,t,i,r,n){var a=r.projectTilePoint(e.x,e.y,t),o=a.x,s=a.y,l=a.z;if(!n)return _t(o,s,l,i);var u=n(e),c=h(u,3);return _t(o+c[0],s+c[1],l+c[2],i)}function St(t,i,r,n,a,o,s,l){var u=Et(t.sub(i)._unit()._add(t),l,a,s,o);return e.sub(u,r,u),e.normalize(u,u),e.scaleAndAdd(u,r,u,n)}function Mt(t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_){var g=n?t-i:t+i,x=g>0?1:-1,b=0;n&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);for(var w=l+s+(x>0?0:1)|0,k=a,T=a,E=0,S=0,M=Math.abs(g),A=[],I=[],C=o,z=C,P=function(){return St(z,C,T,M-E+1,h,d,m,y.canonical)};E+S<=M;){if((w+=x)=u)return null;if(T=k,z=C,A.push(T),p&&I.push(z),C=new e.pointGeometry(c.getx(w),c.gety(w)),!(k=f[w])){var D=Et(C,y.canonical,h,m,d);k=D[3]>0?f[w]=D:P()}E+=S,S=e.distance(T,k)}v&&d&&(f[w]&&(k=P(),S=e.distance(T,k)),f[w]=k);var L=(M-E)/S,R=C.sub(z)._mult(L)._add(z),B=e.sub([],k,T),O=e.scaleAndAdd([],T,B,L),F=[0,0,1],U=B[0],V=B[1];if(_&&(0!==(F=m.upVector(y.canonical,R.x,R.y))[0]||0!==F[1]||1!==F[2])){var N=[F[2],0,-F[0]],j=e.cross([],F,N);e.normalize(N,N),e.normalize(j,j),U=e.dot(B,N),V=e.dot(B,j)}if(r){var G=e.cross([],F,B);e.normalize(G,G),e.scaleAndAdd(O,O,G,r*x)}var Z=b+Math.atan2(V,U);return A.push(O),p&&I.push(R),{point:O,angle:Z,path:A,tilePath:I,up:F}}function At(e,t){var i=t.length,r=i+4*e;t.resize(r),t.float32.fill(-1/0,4*i,4*r)}function It(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}var Ct=100,zt=function(){function t(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new dt(e.width+200,e.height+200,25),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new dt(e.width+200,e.height+200,25);d(this,t),this.transform=e,this.grid=r,this.ignoredGrid=n,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Ct,this.screenBottomBoundary=e.height+Ct,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=i}return p(t,[{key:"placeCollisionBox",value:function(e,t,i,r,n,a,o,s){var l=i.projectedAnchorX,u=i.projectedAnchorY,c=i.projectedAnchorZ,f=i.elevation,d=i.tileID,p=e.getProjection();if(f&&d){var v=p.upVector(d.canonical,i.tileAnchorX,i.tileAnchorY),m=h(v,3),y=m[0],_=m[1],g=m[2],x=p.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=y*f*x,u+=_*f*x,c+=g*f*x}var b=this.projectAndGetPerspectiveRatio(o,l,u,c,i.tileID,"globe"===p.name||!!f||this.transform.pitch>0,p),w=a*b.perspectiveRatio,k=(i.x1*t+r.x-i.padding)*w+b.point.x,T=(i.y1*t+r.y-i.padding)*w+b.point.y,E=(i.x2*t+r.x+i.padding)*w+b.point.x,S=(i.y2*t+r.y+i.padding)*w+b.point.y,M=b.perspectiveRatio<=.55||b.occluded;return!this.isInsideGrid(k,T,E,S)||!n&&this.grid.hitTest(k,T,E,S,s)||M?{box:[],offscreen:!1,occluded:b.occluded}:{box:[k,T,E,S],offscreen:this.isOffscreen(k,T,E,S),occluded:!1}}},{key:"placeCollisionCircles",value:function(t,i,r,n,a,o,s,l,u,c,d,p,v,m,y){var _=[],g=this.transform.elevation,x=t.getProjection(),b=g?g.getAtTileOffsetFunc(y,this.transform.center.lat,this.transform.worldSize,x):null,w=new e.pointGeometry(r.tileAnchorX,r.tileAnchorY),k=x.projectTilePoint(w.x,w.y,y.canonical),T=k.x,E=k.y,S=k.z;if(b){var M=b(w),A=h(M,3);T+=A[0],E+=A[1],S+=A[2]}var I="globe"===x.name,C=this.projectAndGetPerspectiveRatio(s,T,E,S,y,I||!!g||this.transform.pitch>0,x),z=C.perspectiveRatio,P=(d?o/z:o*z)/e.ONE_EM,D=_t(T,E,S,l),L=C.signedDistanceFromCamera>0?wt(P,a,r.lineOffsetX*P,r.lineOffsetY*P,!1,D,w,r,n,l,{},g&&!d?b:null,d&&!!g,x,y,d):null,R=!1,B=!1,O=!0;if(L&&!C.occluded){for(var F=.5*v*z+m,U=new e.pointGeometry(-100,-100),V=new e.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),N=new ft,j=L.first,G=L.last,Z=j.path.length,q=[],W=Z-1;W>=1;W--)q.push(j.path[W]);for(var X=1;X0){var K,J=1/0,$=-1/0,Q=1/0,ee=-1/0,te=f(q);try{for(te.s();!(K=te.n()).done;){var ie=K.value;J=Math.min(J,ie[0]),Q=Math.min(Q,ie[1]),$=Math.max($,ie[0]),ee=Math.max(ee,ie[1])}}catch(me){te.e(me)}finally{te.f()}$>=U.x&&J<=V.x&&ee>=U.y&&Q<=V.y&&(Y=[q.map((function(t){return new e.pointGeometry(t[0],t[1])}))],(JV.x||QV.y)&&(Y=e.clipLine(Y,U.x,U.y,V.x,V.y)))}var re,ne=f(Y);try{for(ne.s();!(re=ne.n()).done;){var ae=re.value;N.reset(ae,.25*F);var oe=0;oe=N.length<=.5*F?1:Math.ceil(N.paddedLength/H)+1;for(var se=0;se0){e.transformMat4$1(l,l,t);var c="globe"===s.name;if(this.fogState&&a&&!c){var h=function(t,i,r,n,a,o){var s=o.calculateFogTileMatrix(a),l=[i,r,n];return e.transformMat4(l,l,s),V(t,l,o.pitch,o._fov)}(this.fogState,i,r,n,a.toUnwrapped(),this.transform);u=h>.9}}else It(l,l,t);var f=l[3];return{point:new e.pointGeometry((l[0]/f+1)/2*this.transform.width+Ct,(-l[1]/f+1)/2*this.transform.height+Ct),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(s)/f*.5,1.5),signedDistanceFromCamera:f,occluded:o&&l[2]>f||u}}},{key:"isOffscreen",value:function(e,t,i,r){return i=this.screenRightBoundary||rthis.screenBottomBoundary}},{key:"isInsideGrid",value:function(e,t,i,r){return i>=0&&e=0&&t5&&void 0!==arguments[5]&&arguments[5];d(this,e),this.text=new Rt(t?t.text:null,i,r,a),this.icon=new Rt(t?t.icon:null,i,n,a),this.clipped=o}return p(e,[{key:"isHidden",value:function(){return this.text.isHidden()&&this.icon.isHidden()}}]),e}(),Ot=p((function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];d(this,e),this.text=t,this.icon=i,this.skipFade=r,this.clipped=n})),Ft=p((function t(){d(this,t),this.invProjMatrix=e.create(),this.viewportMatrix=e.create(),this.circles=[]})),Ut=p((function e(t,i,r,n,a){d(this,e),this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=a})),Vt=function(){function e(t){d(this,e),this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}return p(e,[{key:"get",value:function(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){var t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:function(e){return e.collisionGroupID===t}}}return this.collisionGroups[e]}}]),e}();function Nt(t,i,r,n,a){var o=e.getAnchorAlignment(t),s=-(o.horizontalAlign-.5)*i,l=-(o.verticalAlign-.5)*r,u=e.evaluateVariableOffset(t,n);return new e.pointGeometry(s+u[0]*a,l+u[1]*a)}function jt(t,i,r,n,a){var o=new e.pointGeometry(t,i);return r&&o._rotate(n?a:-a),o}var Gt=function(){function t(e,i,r,n,a){d(this,t),this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new zt(this.transform,a),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Vt(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}return p(t,[{key:"getBucketParts",value:function(t,i,r,n){var a=r.getBucket(i),o=r.latestFeatureIndex;if(a&&o&&i.id===a.layerIds[0]){var s=a.layers[0].layout,l=r.collisionBoxArray,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/e.EXTENT,h=r.tileID.toUnwrapped();this.transform.setProjection(a.projection);var d,p,v,m=(d=r.tileID,p=a.getProjection(),v=this.transform,p.name===this.projection?v.calculateProjMatrix(d.toUnwrapped()):Pt(v,p,d)),y="map"===s.get("text-pitch-alignment"),_="map"===s.get("text-rotation-alignment");i.compileFilter();var g=i.dynamicFilter(),x=i.dynamicFilterNeedsFeature(),b=this.transform.calculatePixelsToTileUnitsMatrix(r),w=mt(m,r.tileID.canonical,y,_,this.transform,a.getProjection(),b),k=null;if(y){var T=yt(m,r.tileID.canonical,y,_,this.transform,a.getProjection(),b);k=e.multiply([],this.transform.labelPlaneMatrix,T)}var E=null;g&&r.latestFeatureIndex&&(E={unwrappedTileID:h,dynamicFilter:g,dynamicFilterNeedsFeature:x,featureIndex:r.latestFeatureIndex}),this.retainedQueryData[a.bucketInstanceId]=new Ut(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);var S={bucket:a,layout:s,posMatrix:m,textLabelPlaneMatrix:w,labelToScreenMatrix:k,clippingData:E,scale:u,textPixelRatio:c,holdingForFade:r.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.evaluateSizeForZoom(a.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n){var M,A=f(a.sortKeyRanges);try{for(A.s();!(M=A.n()).done;){var I=M.value,C=I.sortKey,z=I.symbolInstanceStart,P=I.symbolInstanceEnd;t.push({sortKey:C,symbolInstanceStart:z,symbolInstanceEnd:P,parameters:S})}}catch(D){A.e(D)}finally{A.f()}}else t.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:S})}}},{key:"attemptAnchorPlacement",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y){var _,g=h.textOffset0,x=h.textOffset1,b=h.crossTileID,w=[g,x],k=Nt(e,i,r,w,n),T=this.collisionIndex.placeCollisionBox(d,n,t,jt(k.x,k.y,a,o,this.transform.angle),c,s,l,u.predicate);if(v){var E=d.getSymbolInstanceIconSize(y,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(d,E,v,jt(k.x,k.y,a,o,this.transform.angle),c,s,l,u.predicate).box.length)return}if(T.box.length>0)return this.prevPlacement&&this.prevPlacement.variableOffsets[b]&&this.prevPlacement.placements[b]&&this.prevPlacement.placements[b].text&&(_=this.prevPlacement.variableOffsets[b].anchor),this.variableOffsets[b]={textOffset:w,width:i,height:r,anchor:e,textScale:n,prevAnchor:_},this.markUsedJustification(d,e,h,p),d.allowVerticalPlacement&&(this.markUsedOrientation(d,p,h),this.placedOrientations[b]=p),{shift:k,placedGlyphBoxes:T}}},{key:"placeLayerBucketPart",value:function(t,i,r,n){var a=this,o=t.parameters,s=o.bucket,l=o.layout,u=o.posMatrix,c=o.textLabelPlaneMatrix,h=o.labelToScreenMatrix,d=o.clippingData,p=o.textPixelRatio,v=o.holdingForFade,m=o.collisionBoxArray,y=o.partiallyEvaluatedTextSize,_=o.partiallyEvaluatedIconSize,g=o.collisionGroup,x=l.get("text-optional"),b=l.get("icon-optional"),w=l.get("text-allow-overlap"),k=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),M="viewport-y"===l.get("symbol-z-order");this.transform.setProjection(s.projection);var A=w&&(k||!s.hasIconData()||b),I=k&&(w||!s.hasTextData()||x);!s.collisionArrays&&m&&s.deserializeCollisionBoxes(m),r&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,m);var C=function(t,n,o){var m=t.crossTileID,M=t.numVerticalGlyphVertices;if(d){var C={zoom:a.transform.zoom,pitch:a.transform.pitch},z=null;if(d.dynamicFilterNeedsFeature){var P=a.retainedQueryData[s.bucketInstanceId];z=d.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:P.bucketIndex,sourceLayerIndex:P.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(C,z,a.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.pointGeometry(t.tileAnchorX,t.tileAnchorY),a.transform.calculateDistanceTileData(d.unwrappedTileID)))return a.placements[m]=new Ot(!1,!1,!1,!0),void(i[m]=!0)}if(!i[m])if(v)a.placements[m]=new Ot(!1,!1,!1);else{var D=!1,L=!1,R=!0,B=!1,O=!1,F=null,U={box:null,offscreen:null,occluded:null},V={box:null,offscreen:null,occluded:null},N=null,j=null,G=null,Z=0,q=0,W=0;o.textFeatureIndex?Z=o.textFeatureIndex:t.useRuntimeCollisionCircles&&(Z=t.featureIndex),o.verticalTextFeatureIndex&&(q=o.verticalTextFeatureIndex);var X=function(e){e.tileID=a.retainedQueryData[s.bucketInstanceId].tileID;var t=a.transform.elevation;(t||e.elevation)&&(e.elevation=t?t.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0)},H=o.textBox;if(H){X(H);var Y=function(i){var r=e.WritingMode.horizontal;if(s.allowVerticalPlacement&&!i&&a.prevPlacement){var n=a.prevPlacement.placedOrientations[m];n&&(a.placedOrientations[m]=n,r=n,a.markUsedOrientation(s,r,t))}return r},K=function(t,i){if(s.allowVerticalPlacement&&M>0&&o.verticalTextBox){var r,n=f(s.writingModes);try{for(n.s();!(r=n.n()).done&&(r.value===e.WritingMode.vertical?(U=i(),V=U):U=t(),!(U&&U.box&&U.box.length)););}catch(a){n.e(a)}finally{n.f()}}else U=t()};if(l.get("text-variable-anchor")){var J=l.get("text-variable-anchor");if(a.prevPlacement&&a.prevPlacement.variableOffsets[m]){var $=a.prevPlacement.variableOffsets[m];J.indexOf($.anchor)>0&&(J=J.filter((function(e){return e!==$.anchor})),J.unshift($.anchor))}var Q=function(e,i,r){var o=s.getSymbolInstanceTextSize(y,t,a.transform.zoom,n),l=(e.x2-e.x1)*o+2*e.padding,c=(e.y2-e.y1)*o+2*e.padding,h=S&&!k?i:null;h&&X(h);for(var f={box:[],offscreen:!1,occluded:!1},d=w?2*J.length:J.length,v=0;v=J.length,t,n,s,r,h,y,_);if(m&&(f=m.placedGlyphBoxes)&&f.box&&f.box.length){D=!0,F=m.shift;break}}return f};K((function(){return Q(H,o.iconBox,e.WritingMode.horizontal)}),(function(){var t=o.verticalTextBox;return t&&X(t),s.allowVerticalPlacement&&!(U&&U.box&&U.box.length)&&M>0&&t?Q(t,o.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),U&&(D=U.box,R=U.offscreen,B=U.occluded);var ee=Y(U&&U.box);if(!D&&a.prevPlacement){var te=a.prevPlacement.variableOffsets[m];te&&(a.variableOffsets[m]=te,a.markUsedJustification(s,te.anchor,t,ee))}}else{var ie=function(i,r){var o=s.getSymbolInstanceTextSize(y,t,a.transform.zoom,n),l=a.collisionIndex.placeCollisionBox(s,o,i,new e.pointGeometry(0,0),w,p,u,g.predicate);return l&&l.box&&l.box.length&&(a.markUsedOrientation(s,r,t),a.placedOrientations[m]=r),l};K((function(){return ie(H,e.WritingMode.horizontal)}),(function(){var t=o.verticalTextBox;return s.allowVerticalPlacement&&M>0&&t?(X(t),ie(t,e.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),Y(U&&U.box&&U.box.length)}}if(D=(N=U)&&N.box&&N.box.length>0,R=N&&N.offscreen,B=N&&N.occluded,t.useRuntimeCollisionCircles){var re=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),ne=e.evaluateSizeForFeature(s.textSizeData,y,re),ae=l.get("text-padding");j=a.collisionIndex.placeCollisionCircles(s,w,re,s.lineVertexArray,s.glyphOffsetArray,ne,u,c,h,r,E,g.predicate,t.collisionCircleDiameter*ne/e.ONE_EM,ae,a.retainedQueryData[s.bucketInstanceId].tileID),D=w||j.circles.length>0&&!j.collisionDetected,R=R&&j.offscreen,B=j.occluded}if(o.iconFeatureIndex&&(W=o.iconFeatureIndex),o.iconBox){var oe=function(i){X(i);var r=S&&F?jt(F.x,F.y,T,E,a.transform.angle):new e.pointGeometry(0,0),n=s.getSymbolInstanceIconSize(_,a.transform.zoom,t.placedIconSymbolIndex);return a.collisionIndex.placeCollisionBox(s,n,i,r,k,p,u,g.predicate)};L=V&&V.box&&V.box.length&&o.verticalIconBox?(G=oe(o.verticalIconBox)).box.length>0:(G=oe(o.iconBox)).box.length>0,R=R&&G.offscreen,O=G.occluded}var se=x||0===t.numHorizontalGlyphVertices&&0===M,le=b||0===t.numIconVertices;if(se||le?le?se||(L=L&&D):D=L&&D:L=D=L&&D,D&&N&&N.box&&a.collisionIndex.insertCollisionBox(N.box,l.get("text-ignore-placement"),s.bucketInstanceId,V&&V.box&&q?q:Z,g.ID),L&&G&&a.collisionIndex.insertCollisionBox(G.box,l.get("icon-ignore-placement"),s.bucketInstanceId,W,g.ID),j&&(D&&a.collisionIndex.insertCollisionCircles(j.circles,l.get("text-ignore-placement"),s.bucketInstanceId,Z,g.ID),r)){var ue=s.bucketInstanceId,ce=a.collisionCircleArrays[ue];void 0===ce&&(ce=a.collisionCircleArrays[ue]=new Ft);for(var he=0;he=0;--P){var D=z[P];C(s.symbolInstances.get(D),D,s.collisionArrays[D])}else for(var L=t.symbolInstanceStart;L=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:u),o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:u),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:u),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:u)}},{key:"markUsedOrientation",value:function(t,i,r){var n=i===e.WritingMode.horizontal||i===e.WritingMode.horizontalOnly?i:0,a=i===e.WritingMode.vertical?i:0,o=r.leftJustifiedTextSymbolIndex,s=r.centerJustifiedTextSymbolIndex,l=r.rightJustifiedTextSymbolIndex,u=r.verticalPlacedTextSymbolIndex,c=t.text.placedSymbolArray;o>=0&&(c.get(o).placedOrientation=n),s>=0&&(c.get(s).placedOrientation=n),l>=0&&(c.get(l).placedOrientation=n),u>=0&&(c.get(u).placedOrientation=a)}},{key:"commit",value:function(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;var t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;var r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(var s in this.placements){var l=this.placements[s],u=n[s];u?(this.opacities[s]=new Bt(u,r,l.text,l.icon,null,l.clipped),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new Bt(null,r,l.text,l.icon,l.skipFade,l.clipped),i=i||l.text||l.icon)}for(var c in n){var h=n[c];if(!this.opacities[c]){var f=new Bt(h,r,!1,!1);f.isHidden()||(this.opacities[c]=f,i=i||h.text.placed||h.icon.placed)}}for(var d in a)this.variableOffsets[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.variableOffsets[d]=a[d]);for(var p in o)this.placedOrientations[p]||!this.opacities[p]||this.opacities[p].isHidden()||(this.placedOrientations[p]=o[p]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}},{key:"updateLayerOpacities",value:function(e,t){var i,r={},n=f(t);try{for(n.s();!(i=n.n()).done;){var a=i.value,o=a.getBucket(e);o&&a.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,r,a.collisionBoxArray)}}catch(s){n.e(s)}finally{n.f()}}},{key:"updateBucketOpacities",value:function(t,i,r){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();var n=t.layers[0].layout,a=!!t.layers[0].dynamicFilter(),o=new Bt(null,0,!1,!1,!0),s=n.get("text-allow-overlap"),l=n.get("icon-allow-overlap"),u=n.get("text-variable-anchor"),c="map"===n.get("text-rotation-alignment"),h="map"===n.get("text-pitch-alignment"),f="none"!==n.get("icon-text-fit"),d=new Bt(null,0,s&&(l||!t.hasIconData()||n.get("icon-optional")),l&&(s||!t.hasTextData()||n.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);for(var p=function(e,t,i){for(var r=0;r0||g>0,T=b>0,E=this.placedOrientations[x],S=E===e.WritingMode.vertical,M=E===e.WritingMode.horizontal||E===e.WritingMode.horizontalOnly;if(!k&&!T||w.isHidden()||v++,k){var A=$t(w.text);p(t.text,_,S?Qt:A),p(t.text,g,M?Qt:A);var I=w.text.isHidden(),C=y.leftJustifiedTextSymbolIndex,z=y.centerJustifiedTextSymbolIndex,P=y.rightJustifiedTextSymbolIndex,D=y.verticalPlacedTextSymbolIndex,L=t.text.placedSymbolArray,R=I||S?1:0;C>=0&&(L.get(C).hidden=R),z>=0&&(L.get(z).hidden=R),P>=0&&(L.get(P).hidden=R),D>=0&&(L.get(D).hidden=I||M?1:0);var B=this.variableOffsets[x];B&&this.markUsedJustification(t,B.anchor,y,E);var O=this.placedOrientations[x];O&&(this.markUsedJustification(t,"left",y,O),this.markUsedOrientation(t,O,y))}if(T){var F=$t(w.icon),U=y.placedIconSymbolIndex,V=y.verticalPlacedIconSymbolIndex,N=t.icon.placedSymbolArray,j=w.icon.isHidden()?1:0;U>=0&&(p(t.icon,b,S?Qt:F),N.get(U).hidden=j),V>=0&&(p(t.icon,y.numVerticalIconVertices,M?Qt:F),N.get(V).hidden=j)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){var G=t.collisionArrays[m];if(G){var Z=new e.pointGeometry(0,0),q=!0;if(G.textBox||G.verticalTextBox){if(u){var W=this.variableOffsets[x];W?(Z=Nt(W.anchor,W.width,W.height,W.textOffset,W.textScale),c&&Z._rotate(h?this.transform.angle:-this.transform.angle)):q=!1}a&&(q=!w.clipped),G.textBox&&Zt(t.textCollisionBox.collisionVertexArray,w.text.placed,!q||S,Z.x,Z.y),G.verticalTextBox&&Zt(t.textCollisionBox.collisionVertexArray,w.text.placed,!q||M,Z.x,Z.y)}var X=q&&Boolean(!M&&G.verticalIconBox);G.iconBox&&Zt(t.iconCollisionBox.collisionVertexArray,w.icon.placed,X,f?Z.x:0,f?Z.y:0),G.verticalIconBox&&Zt(t.iconCollisionBox.collisionVertexArray,w.icon.placed,!X,f?Z.x:0,f?Z.y:0)}}}if(t.fullyClipped=0===v,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){var H=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=H.invProjMatrix,t.placementViewportMatrix=H.viewportMatrix,t.collisionCircleArray=H.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}},{key:"symbolFadeChange",value:function(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}},{key:"zoomAdjustment",value:function(e){return Math.max(0,(this.transform.zoom-e)/1.5)}},{key:"hasTransitions",value:function(e){return this.stale||e-this.lastPlacementChangeTimee}},{key:"setStale",value:function(){this.stale=!0}}]),t}();function Zt(e,t,i,r,n){e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0)}var qt=Math.pow(2,25),Wt=Math.pow(2,24),Xt=Math.pow(2,17),Ht=Math.pow(2,16),Yt=Math.pow(2,9),Kt=Math.pow(2,8),Jt=Math.pow(2,1);function $t(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;var t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*qt+t*Wt+i*Xt+t*Ht+i*Yt+t*Kt+i*Jt+t}var Qt=0,ei=function(){function e(t){d(this,e),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=[]}return p(e,[{key:"continuePlacement",value:function(e,t,i,r,n){for(var a=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=i[t[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 ei(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}},{key:"commit",value:function(e){return this.placement.commit(e),this.placement}}]),t}(),ii=512/e.EXTENT/2,ri=function(){function t(e,i,r){d(this,t),this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;ne.overscaledZ)for(var s in o){var l=o[s];l.tileID.isChildOf(e)&&l.findMatches(t.symbolInstances,e,n)}else{var u=o[e.scaledTo(Number(a)).key];u&&u.findMatches(t.symbolInstances,e,n)}}for(var c=0;c1&&void 0!==arguments[1]?arguments[1]:{};d(this,a),(i=r.call(this)).map=t,i.dispatcher=new q(tt(),n(i)),i.imageManager=new D,i.imageManager.setEventedParent(n(i)),i.glyphManager=new e.GlyphManager(t._requestManager,o.localFontFamily?e.LocalGlyphMode.all:o.localIdeographFontFamily?e.LocalGlyphMode.ideographs:e.LocalGlyphMode.none,o.localFontFamily||o.localIdeographFontFamily),i.crossTileSymbolIndex=new oi,i._layers={},i._num3DLayers=0,i._numSymbolLayers=0,i._numCircleLayers=0,i._serializedLayers={},i._sourceCaches={},i._otherSourceCaches={},i._symbolSourceCaches={},i._loaded=!1,i._availableImages=[],i._order=[],i._drapedFirstOrder=[],i._markersNeedUpdate=!1,i._resetUpdates(),i.dispatcher.broadcast("setReferrer",e.getReferrer());var s=n(i);return i._rtlTextPluginCallback=a.registerForPluginStateChange((function(t){s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(function(t,i){if(e.triggerPluginCompletionEvent(t),i&&i.every((function(e){return e})))for(var r in s._sourceCaches){var n=s._sourceCaches[r],a=n.getSource().type;"vector"!==a&&"geojson"!==a||n.reload()}}))})),i.on("data",(function(e){if("source"===e.dataType&&"metadata"===e.sourceDataType){var t=i.getSource(e.sourceId);if(t&&t.vectorLayerIds)for(var r in i._layers){var n=i._layers[r];n.source===t.id&&i._validateLayer(n)}}})),i}return p(a,[{key:"loadURL",value:function(t){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new e.Event("dataloading",{dataType:"style"}));var n="boolean"==typeof r.validate?r.validate:!e.isMapboxURL(t);t=this.map._requestManager.normalizeStyleURL(t,r.accessToken);var a=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(a,(function(t,r){i._request=null,t?i.fire(new e.ErrorEvent(t)):r&&i._load(r,n)}))}},{key:"loadJSON",value:function(t){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame((function(){i._request=null,i._load(t,!1!==r.validate)}))}},{key:"loadEmpty",value:function(){this.fire(new e.Event("dataloading",{dataType:"style"})),this._load(ci,!1)}},{key:"_updateLayerCount",value:function(e,t){var i=t?1:-1;e.is3D()&&(this._num3DLayers+=i),"circle"===e.type&&(this._numCircleLayers+=i),"symbol"===e.type&&(this._numSymbolLayers+=i)}},{key:"_load",value:function(t,i){if(!i||!si(this,e.validateStyle(t))){for(var r in this._loaded=!0,this.stylesheet=e.clone$1(t),this._updateMapProjection(),t.sources)this.addSource(r,t.sources[r],{validate:!1});this._changed=!1,t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(t.glyphs);var n=rt(this.stylesheet.layers);this._order=n.map((function(e){return e.id})),this._layers={},this._serializedLayers={};var a,o=f(n);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=e.createStyleLayer(s);l.setEventedParent(this,{layer:{id:l.id}}),this._layers[l.id]=l,this._serializedLayers[l.id]=l.serialize(),this._updateLayerCount(l,!0)}}catch(u){o.e(u)}finally{o.f()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new B(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new e.Event("data",{dataType:"style"})),this.fire(new e.Event("style.load"))}}},{key:"terrainSetForDrapingOnly",value:function(){return!!this.terrain&&0===this.terrain.drapeRenderMode}},{key:"setProjection",value:function(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this._updateMapProjection()}},{key:"applyProjectionUpdate",value:function(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}},{key:"_updateMapProjection",value:function(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}},{key:"_loadSprite",value:function(t){var i=this;this._spriteRequest=function(t,i,r){var n,a,o,s=e.exported.devicePixelRatio>1?"@2x":"",l=e.getJSON(i.transformRequest(i.normalizeSpriteURL(t,s,".json"),e.ResourceType.SpriteJSON),(function(e,t){l=null,o||(o=e,n=t,c())})),u=e.getImage(i.transformRequest(i.normalizeSpriteURL(t,s,".png"),e.ResourceType.SpriteImage),(function(e,t){u=null,o||(o=e,a=t,c())}));function c(){if(o)r(o);else if(n&&a){var t=e.exported.getImageData(a),i={};for(var s in n){var l=n[s],u=l.width,c=l.height,h=l.x,f=l.y,d=l.sdf,p=l.pixelRatio,v=l.stretchX,m=l.stretchY,y=l.content,_=new e.RGBAImage({width:u,height:c});e.RGBAImage.copy(t,_,{x:h,y:f},{x:0,y:0},{width:u,height:c}),i[s]={data:_,pixelRatio:p,sdf:d,stretchX:v,stretchY:m,content:y}}r(null,i)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(t,this.map._requestManager,(function(t,r){if(i._spriteRequest=null,t)i.fire(new e.ErrorEvent(t));else if(r)for(var n in r)i.imageManager.addImage(n,r[n]);i.imageManager.setLoaded(!0),i._availableImages=i.imageManager.listImages(),i.dispatcher.broadcast("setImages",i._availableImages),i.dispatcher.broadcast("spriteLoaded",!0),i.fire(new e.Event("data",{dataType:"style"}))}))}},{key:"_validateLayer",value:function(t){var i=this.getSource(t.source);if(i){var r=t.sourceLayer;r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new e.ErrorEvent(new Error('Source layer "'.concat(r,'" does not exist on source "').concat(i.id,'" as specified by style layer "').concat(t.id,'"'))))}}},{key:"loaded",value:function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}},{key:"_serializeLayers",value:function(e){var t,i=[],r=f(e);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=this._layers[n];"custom"!==a.type&&i.push(a.serialize())}}catch(o){r.e(o)}finally{r.f()}return i}},{key:"hasTransitions",value:function(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(var e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(var t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}},{key:"order",get:function(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}},{key:"isLayerDraped",value:function(e){return!!this.terrain&&("function"==typeof e.isLayerDraped?e.isLayerDraped():hi[e.type])}},{key:"_checkLoaded",value:function(){if(!this._loaded)throw new Error("Style is not done loading")}},{key:"update",value:function(t){if(this._loaded){var i=this._changed;if(this._changed){var r=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);for(var a in(r.length||n.length)&&this._updateWorkerLayers(r,n),this._updatedSources){var o=this._updatedSources[a];"reload"===o?this._reloadSource(a):"clear"===o&&this._clearSource(a)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(t);this.light.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._resetUpdates()}var l={};for(var u in this._sourceCaches){var c=this._sourceCaches[u];l[u]=c.used,c.used=!1}var h,d=f(this._order);try{for(d.s();!(h=d.n()).done;){var p=h.value,v=this._layers[p];if(v.recalculate(t,this._availableImages),!v.isHidden(t.zoom)){var m=this._getLayerSourceCache(v);m&&(m.used=!0)}var y=this.map.painter;if(y){var _=v.getProgramIds();if(!_)continue;var g,x=v.getProgramConfiguration(t.zoom),b=f(_);try{for(b.s();!(g=b.n()).done;){var w=g.value;y.useProgram(w,x)}}catch(E){b.e(E)}finally{b.f()}}}}catch(E){d.e(E)}finally{d.f()}for(var k in l){var T=this._sourceCaches[k];l[k]!==T.used&&T.getSource().fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:T.getSource().id}))}this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new e.Event("data",{dataType:"style"}))}}},{key:"_updateTilesForChangedImages",value:function(){var e=Object.keys(this._changedImages);if(e.length){for(var t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}},{key:"_updateWorkerLayers",value:function(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}},{key:"_resetUpdates",value:function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}},{key:"setState",value:function(i){var r=this;if(this._checkLoaded(),si(this,e.validateStyle(i)))return!1;(i=e.clone$1(i)).layers=rt(i.layers);var n=function(e,i){if(!e)return[{command:nt.setStyle,args:[i]}];var r=[];try{if(!t(e.version,i.version))return[{command:nt.setStyle,args:[i]}];t(e.center,i.center)||r.push({command:nt.setCenter,args:[i.center]}),t(e.zoom,i.zoom)||r.push({command:nt.setZoom,args:[i.zoom]}),t(e.bearing,i.bearing)||r.push({command:nt.setBearing,args:[i.bearing]}),t(e.pitch,i.pitch)||r.push({command:nt.setPitch,args:[i.pitch]}),t(e.sprite,i.sprite)||r.push({command:nt.setSprite,args:[i.sprite]}),t(e.glyphs,i.glyphs)||r.push({command:nt.setGlyphs,args:[i.glyphs]}),t(e.transition,i.transition)||r.push({command:nt.setTransition,args:[i.transition]}),t(e.light,i.light)||r.push({command:nt.setLight,args:[i.light]}),t(e.fog,i.fog)||r.push({command:nt.setFog,args:[i.fog]}),t(e.projection,i.projection)||r.push({command:nt.setProjection,args:[i.projection]});var n={},a=[];!function(e,i,r,n){var a;for(a in i=i||{},e=e||{})e.hasOwnProperty(a)&&(i.hasOwnProperty(a)||ot(a,r,n));for(a in i)if(i.hasOwnProperty(a)){var o=i[a];e.hasOwnProperty(a)?t(e[a],o)||("geojson"===e[a].type&&"geojson"===o.type&<(e,i,a)?r.push({command:nt.setGeoJSONSourceData,args:[a,o.data]}):st(a,i,r,n)):at(a,i,r)}}(e.sources,i.sources,a,n);var o=[];e.layers&&e.layers.forEach((function(e){e.source&&n[e.source]?r.push({command:nt.removeLayer,args:[e.id]}):o.push(e)}));var s=e.terrain;s&&n[s.source]&&(r.push({command:nt.setTerrain,args:[void 0]}),s=void 0),r=r.concat(a),t(s,i.terrain)||r.push({command:nt.setTerrain,args:[i.terrain]}),function(e,i,r){i=i||[];var n,a,o,s,l,u,c,h=(e=e||[]).map(ct),f=i.map(ct),d=e.reduce(ht,{}),p=i.reduce(ht,{}),v=h.slice(),m=Object.create(null);for(n=0,a=0;n0)throw new Error("Unimplemented: ".concat(a.map((function(e){return e.command})).join(", "),"."));return n.forEach((function(e){"setTransition"!==e.command&&"setProjection"!==e.command&&r[e.command].apply(r,e.args)})),this.stylesheet=i,this._updateMapProjection(),!0}},{key:"addImage",value:function(t,i){return this.getImage(t)?this.fire(new e.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,i),this._afterImageUpdated(t),this)}},{key:"updateImage",value:function(e,t){this.imageManager.updateImage(e,t)}},{key:"getImage",value:function(e){return this.imageManager.getImage(e)}},{key:"removeImage",value:function(t){return this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t),this):this.fire(new e.ErrorEvent(new Error("No image with this name exists.")))}},{key:"_afterImageUpdated",value:function(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}},{key:"listImages",value:function(){return this._checkLoaded(),this._availableImages.slice()}},{key:"addSource",value:function(t,i){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this._checkLoaded(),void 0!==this.getSource(t))throw new Error("There is already a source with this ID");if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(i).join(", "),"."));if(!(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.validateSource,"sources.".concat(t),i,null,n))){this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);var a=We(t,i,this.dispatcher,this);a.setEventedParent(this,(function(){return{isSourceLoaded:r._isSourceCacheLoaded(t),source:a.serialize(),sourceId:t}}));var o=function(i){var n=(i?"symbol:":"other:")+t,o=r._sourceCaches[n]=new e.SourceCache(n,a,i);(i?r._symbolSourceCaches:r._otherSourceCaches)[t]=o,o.style=r,o.onAdd(r.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),a.onAdd&&a.onAdd(this.map),this._changed=!0}}},{key:"removeSource",value:function(t){this._checkLoaded();var i=this.getSource(t);if(!i)throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===t)return this.fire(new e.ErrorEvent(new Error('Source "'.concat(t,'" cannot be removed while layer "').concat(r,'" is using it.'))));if(this.terrain&&this.terrain.get().source===t)return this.fire(new e.ErrorEvent(new Error('Source "'.concat(t,'" cannot be removed while terrain is using it.'))));var n,a=this._getSourceCaches(t),o=f(a);try{for(o.s();!(n=o.n()).done;){var s=n.value;delete this._sourceCaches[s.id],delete this._updatedSources[s.id],s.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:s.getSource().id})),s.setEventedParent(null),s.clearTiles()}}catch(l){o.e(l)}finally{o.f()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changed=!0,this}},{key:"setGeoJSONSourceData",value:function(e,t){this._checkLoaded(),this.getSource(e).setData(t),this._changed=!0}},{key:"getSource",value:function(e){var t=this._getSourceCache(e);return t&&t.getSource()}},{key:"_getSources",value:function(){var e=[];for(var t in this._otherSourceCaches){var i=this._getSourceCache(t);i&&e.push(i.getSource())}return e}},{key:"addLayer",value:function(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();var n=t.id;if(this.getLayer(n))this.fire(new e.ErrorEvent(new Error('Layer with id "'.concat(n,'" already exists on this map'))));else{var a;if("custom"===t.type){if(si(this,e.validateCustomStyleLayer(t)))return;a=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(n,t.source),t=e.clone$1(t),t=e.extend(t,{source:n})),this._validate(e.validateLayer,"layers.".concat(n),t,{arrayIndex:-1},r))return;a=e.createStyleLayer(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0)}var o=i?this._order.indexOf(i):this._order.length;if(i&&-1===o)this.fire(new e.ErrorEvent(new Error('Layer with id "'.concat(i,'" does not exist on this map.'))));else{this._order.splice(o,0,n),this._layerOrderChanged=!0,this._layers[n]=a;var s=this._getLayerSourceCache(a);if(this._removedLayers[n]&&a.source&&s&&"custom"!==a.type){var l=this._removedLayers[n];delete this._removedLayers[n],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",s.pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map),this._updateDrapeFirstLayers()}}}},{key:"moveLayer",value:function(t,i){if(this._checkLoaded(),this._changed=!0,this._layers[t]){if(t!==i){var r=this._order.indexOf(t);this._order.splice(r,1);var n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new e.ErrorEvent(new Error('Layer with id "'.concat(i,'" does not exist on this map.')))):(this._order.splice(n,0,t),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}}else this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot be moved."))))}},{key:"removeLayer",value:function(t){this._checkLoaded();var i=this._layers[t];if(i){i.setEventedParent(null),this._updateLayerCount(i,!1);var r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map),this._updateDrapeFirstLayers()}else this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot be removed."))))}},{key:"getLayer",value:function(e){return this._layers[e]}},{key:"hasLayer",value:function(e){return e in this._layers}},{key:"hasLayerType",value:function(e){for(var t in this._layers)if(this._layers[t].type===e)return!0;return!1}},{key:"setLayerZoomRange",value:function(t,i,r){this._checkLoaded();var n=this.getLayer(t);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot have zoom extent."))))}},{key:"setFilter",value:function(i,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();var a=this.getLayer(i);if(a){if(!t(a.filter,r))return null==r?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(e.validateFilter,"layers.".concat(a.id,".filter"),r,{layerType:a.type},n)||(a.filter=e.clone$1(r),this._updateLayer(a)))}else this.fire(new e.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be filtered."))))}},{key:"getFilter",value:function(t){var i=this.getLayer(t);return i&&e.clone$1(i.filter)}},{key:"setLayoutProperty",value:function(i,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();var o=this.getLayer(i);o?t(o.getLayoutProperty(r),n)||(o.setLayoutProperty(r,n,a),this._updateLayer(o)):this.fire(new e.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be styled."))))}},{key:"getLayoutProperty",value:function(t,i){var r=this.getLayer(t);if(r)return r.getLayoutProperty(i);this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' does not exist in the map's style."))))}},{key:"setPaintProperty",value:function(i,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();var o=this.getLayer(i);o?t(o.getPaintProperty(r),n)||(o.setPaintProperty(r,n,a)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[i]=!0):this.fire(new e.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be styled."))))}},{key:"getPaintProperty",value:function(e,t){var i=this.getLayer(e);return i&&i.getPaintProperty(t)}},{key:"setFeatureState",value:function(t,i){this._checkLoaded();var r=t.source,n=t.sourceLayer,a=this.getSource(r);if(a){var o=a.type;if("geojson"===o&&n)this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));else if("vector"!==o||n){void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided.")));var s,l=this._getSourceCaches(r),u=f(l);try{for(u.s();!(s=u.n()).done;)s.value.setFeatureState(n,t.id,i)}catch(c){u.e(c)}finally{u.f()}}else this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))))}},{key:"removeFeatureState",value:function(t,i){this._checkLoaded();var r=t.source,n=this.getSource(r);if(n){var a=n.type,o="vector"===a?t.sourceLayer:void 0;if("vector"!==a||o)if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));else{var s,l=this._getSourceCaches(r),u=f(l);try{for(u.s();!(s=u.n()).done;)s.value.removeFeatureState(o,t.id,i)}catch(c){u.e(c)}finally{u.f()}}else this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))))}},{key:"getFeatureState",value:function(t){this._checkLoaded();var i=t.source,r=t.sourceLayer,n=this.getSource(i);if(n){if("vector"!==n.type||r)return void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(i)[0].getFeatureState(r,t.id);this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error("The source '".concat(i,"' does not exist in the map's style."))))}},{key:"getTransition",value:function(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}},{key:"serialize",value:function(){var t={};for(var i in this._sourceCaches){var r=this._sourceCaches[i].getSource();t[r.id]||(t[r.id]=r.serialize())}return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:t,layers:this._serializeLayers(this._order)},(function(e){return void 0!==e}))}},{key:"_updateLayer",value:function(e){this._updatedLayers[e.id]=!0;var t=this._getLayerSourceCache(e);e.source&&!this._updatedSources[e.source]&&t&&"raster"!==t.getSource().type&&(this._updatedSources[e.source]="reload",t.pause()),this._changed=!0,e.invalidateCompiledFilter()}},{key:"_flattenAndSortRenderedFeatures",value:function(e){for(var t=this,i=function(e){return"fill-extrusion"===t._layers[e].type},r={},n=[],a=this._order.length-1;a>=0;a--){var o=this._order[a];if(i(o)){r[o]=a;var s,l=f(e);try{for(l.s();!(s=l.n()).done;){var u=s.value[o];if(u){var c,h=f(u);try{for(h.s();!(c=h.n()).done;){var d=c.value;n.push(d)}}catch(E){h.e(E)}finally{h.f()}}}}catch(E){l.e(E)}finally{l.f()}}}n.sort((function(e,t){return t.intersectionZ-e.intersectionZ}));for(var p=[],v=this._order.length-1;v>=0;v--){var m=this._order[v];if(i(m))for(var y=n.length-1;y>=0;y--){var _=n[y].feature;if(r[_.layer.id]1&&void 0!==arguments[1]?arguments[1]:{};this._checkLoaded();var r=this.light.getLight(),n=!1;for(var a in e)if(!t(e[a],r[a])){n=!0;break}if(n){var o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(e,i),this.light.updateTransitions(o)}}},{key:"getTerrain",value:function(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}},{key:"setTerrainForDraping",value:function(){this.setTerrain({source:"",exaggeration:0},0)}},{key:"setTerrain",value:function(i){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this._checkLoaded(),!i)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);var n=i;if(1===r){if("object"==typeof n.source){var a="terrain-dem-src";this.addSource(a,n.source),n=e.clone$1(n),n=e.extend(n,{source:a})}if(this._validate(e.validateTerrain,"terrain",n))return}if(!this.terrain||this.terrain&&r!==this.terrain.drapeRenderMode){if(!n)return;this._createTerrain(n,r)}else{for(var o=this.terrain,s=o.get(),l=0,u=Object.keys(e.spec.terrain);l4&&void 0!==arguments[4]?arguments[4]:{};return(!a||!1!==a.validate)&&si(this,t.call(e.validateStyle,e.extend({key:i,style:this.serialize(),value:r,styleSpec:e.spec},n)))}},{key:"_remove",value:function(){for(var t in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[t].setEventedParent(null);for(var i in this._sourceCaches)this._sourceCaches[i].clearTiles(),this._sourceCaches[i].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}},{key:"_clearSource",value:function(e){var t,i=this._getSourceCaches(e),r=f(i);try{for(r.s();!(t=r.n()).done;)t.value.clearTiles()}catch(n){r.e(n)}finally{r.f()}}},{key:"_reloadSource",value:function(e){var t,i=this._getSourceCaches(e),r=f(i);try{for(r.s();!(t=r.n()).done;){var n=t.value;n.resume(),n.reload()}}catch(a){r.e(a)}finally{r.f()}}},{key:"_reloadSources",value:function(){var e,t=f(this._getSources());try{for(t.s();!(e=t.n()).done;){var i=e.value;i.reload&&i.reload()}}catch(r){t.e(r)}finally{t.f()}}},{key:"_updateSources",value:function(e){for(var t in this._sourceCaches)this._sourceCaches[t].update(e)}},{key:"_generateCollisionBoxes",value:function(){for(var e in this._sourceCaches){var t=this._sourceCaches[e];t.resume(),t.reload()}}},{key:"_updatePlacement",value:function(t,i,r,n){var a,o=this,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=!1,u=!1,c={},h=f(this._order);try{var d=function(){var e=a.value,i=o._layers[e];if("symbol"!==i.type)return"continue";if(!c[i.source]){var r=o._getLayerSourceCache(i);if(!r)return"continue";c[i.source]=r.getRenderableIds(!0).map((function(e){return r.getTileByID(e)})).sort((function(e,t){return t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)}))}var n=o.crossTileSymbolIndex.addLayer(i,c[i.source],t.center.lng,t.projection);l=l||n};for(h.s();!(a=h.n()).done;)d()}catch(_){h.e(_)}finally{h.f()}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),s=s||this._layerOrderChanged||0===r,this._layerOrderChanged&&this.fire(new e.Event("neworder")),(s||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new ti(t,this._order,s,i,r,n,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),u=!0),l&&this.pauseablePlacement.placement.setStale()),u||l){var p,v=f(this._order);try{for(v.s();!(p=v.n()).done;){var m=p.value,y=this._layers[m];"symbol"===y.type&&this.placement.updateLayerOpacities(y,c[y.source])}}catch(_){v.e(_)}finally{v.f()}}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.exported.now())}},{key:"_releaseSymbolFadeTiles",value:function(){for(var e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}},{key:"getImages",value:function(e,t,i){this.imageManager.getImages(t.icons,i),this._updateTilesForChangedImages();var r=function(e){e&&e.setDependencies(t.tileID.key,t.type,t.icons)};r(this._otherSourceCaches[t.source]),r(this._symbolSourceCaches[t.source])}},{key:"getGlyphs",value:function(e,t,i){this.glyphManager.getGlyphs(t.stacks,i)}},{key:"getResource",value:function(t,i,r){return e.makeRequest(i,r)}},{key:"_getSourceCache",value:function(e){return this._otherSourceCaches[e]}},{key:"_getLayerSourceCache",value:function(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}},{key:"_getSourceCaches",value:function(e){var t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}},{key:"_isSourceCacheLoaded",value:function(t){var i=this._getSourceCaches(t);return 0===i.length?(this.fire(new e.ErrorEvent(new Error("There is no source with ID '".concat(t,"'")))),!1):i.every((function(e){return e.loaded()}))}},{key:"has3DLayers",value:function(){return this._num3DLayers>0}},{key:"hasSymbolLayers",value:function(){return this._numSymbolLayers>0}},{key:"hasCircleLayers",value:function(){return this._numCircleLayers>0}},{key:"_clearWorkerCaches",value:function(){this.dispatcher.broadcast("clearCaches")}},{key:"destroy",value:function(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}]),a}(e.Evented);fi.getSourceType=function(e){return qe[e]},fi.setSourceType=function(e,t){qe[e]=t},fi.registerForPluginStateChange=e.registerForPluginStateChange;var di="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",pi="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",vi="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\nconst float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",mi="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",yi="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",_i={},gi={},xi=[];Ei(di,xi),Ei(vi,xi),Ei(mi,xi),Ei(yi,xi),_i=Si("",vi),gi=Si(yi,mi);var bi=Si("\n#if __VERSION__ >=300\n#define varying in\n#define gl_FragColor glFragColor\n#define texture2D texture\n#define textureCube texture\nout vec4 glFragColor;\n#endif\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\n#if __VERSION__ >=300\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),wi=di,ki="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",Ti={background:Si("uniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nvarying vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform vec4 u_color;varying vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(u_color);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:Si("uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:Si("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:Si("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Si("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:Si("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Si("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Si("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Si("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:Si("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:Si("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:Si("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:Si("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:Si("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(color,NdotL);\n#else\nv_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef LIGHTING_3D_MODE\nv_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));\n#else\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:Si("uniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,v_NdotL)*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_NdotL=NdotL;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:Si("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Si("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\ngl_FragColor=apply_lighting(gl_FragColor);\n#endif\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:Si("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}\n#else\nout_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:Si("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:Si("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:Si("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:Si("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:Si("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:Si("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=wireframeOffset;\n#endif\nv_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:Si("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;varying float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:Si("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",pi),skyboxGradient:Si("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",pi),skyboxCapture:Si("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Si("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\ncolor=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:Si("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")};function Ei(e,t){var i,r=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"),n=f(r);try{for(n.s();!(i=n.n()).done;){var a=i.value;if("#"===(a=a.trim())[0]&&a.includes("if")&&!a.includes("endif")){var o,s=(a=a.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "),l=f(s);try{for(l.s();!(o=l.n()).done;){var u=o.value;t.includes(u)||t.push(u)}}catch(c){l.e(c)}finally{l.f()}}}}catch(c){n.e(c)}finally{n.f()}}function Si(e,t){var i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),n={},a=[].concat(xi);return Ei(e,a),Ei(t,a),{fragmentSource:e=e.replace(i,(function(e,t,i,r,a){return n[a]=!0,"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nvarying ").concat(i," ").concat(r," ").concat(a,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(a,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(a,"\n ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n")})),vertexSource:t=t.replace(i,(function(e,t,i,r,a){var o="float"===r?"vec2":"vec4",s=a.match(/color/)?"color":o;return n[a]?"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nuniform lowp float u_").concat(a,"_t;\nattribute ").concat(i," ").concat(o," a_").concat(a,";\nvarying ").concat(i," ").concat(r," ").concat(a,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(a,";\n#endif\n"):"vec4"===s?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(a," = a_").concat(a,";\n#else\n ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(a," = unpack_mix_").concat(s,"(a_").concat(a,", u_").concat(a,"_t);\n#else\n ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n"):"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nuniform lowp float u_").concat(a,"_t;\nattribute ").concat(i," ").concat(o," a_").concat(a,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(a,";\n#endif\n"):"vec4"===s?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(i," ").concat(r," ").concat(a," = a_").concat(a,";\n#else\n ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(i," ").concat(r," ").concat(a," = unpack_mix_").concat(s,"(a_").concat(a,", u_").concat(a,"_t);\n#else\n ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n")})),staticAttributes:r,usedDefines:a}}var Mi=function(){function e(){d(this,e),this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}return p(e,[{key:"bind",value:function(e,t,i,r,n,a,o){this.context=e;for(var s=this.boundPaintVertexBuffers.length!==r.length,l=0;!s&&l=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}},{key:"_nextOp",value:function(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}},{key:"_validOp",value:function(e){return e.from.hasData()&&e.to.hasData()}}]),e}()),Oi={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Fi(e){return 6*Math.pow(1.5,22-e)}function Ui(e,t){var i=1<0){var o=e.exported.now(),s=(o-t.timeAdded)/a,l=i?(o-i.timeAdded)/a:-1,u=r.getSource(),c=n.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-c)>Math.abs(t.tileID.overscaledZ-c),f=h&&t.refreshedUponExpiration?1:e.clamp(h?s:1-l,0,1);return t.refreshedUponExpiration&&s>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var ji=function(e){v(i,e);var t=m(i);function i(e){var r;d(this,i);var a={type:"raster-dem",maxzoom:e.transform.maxZoom},o=new q(tt(),null),s=We("mock-dem",a,o,e.style);return r=t.call(this,"mock-dem",s,!1),s.setEventedParent(n(r)),r._sourceLoaded=!0,r}return p(i,[{key:"_loadTile",value:function(e,t){e.state="loaded",t(null)}}]),i}(e.SourceCache),Gi=function(t){v(r,t);var i=m(r);function r(e){var t;d(this,r);var a=We("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new q(tt(),null),e.style);return t=i.call(this,"proxy",a,!1),a.setEventedParent(n(t)),t.map=t.getSource().map=e,t.used=t._sourceLoaded=!0,t.renderCache=[],t.renderCachePool=[],t.proxyCachedFBO={},t}return p(r,[{key:"update",value:function(t,i,r){var n=this;if(!t.freezeTileCoverage){this.transform=t;var a=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((function(i,r){if(i[r.key]="",!n._tiles[r.key]){var a=new e.Tile(r,n._source.tileSize*r.overscaleFactor(),t.tileZoom);a.state="loaded",n._tiles[r.key]=a}return i}),{});for(var o in this._tiles)o in a||(this.freeFBO(o),this._tiles[o].unloadVectorData(),delete this._tiles[o])}}},{key:"freeFBO",value:function(e){var t=this.proxyCachedFBO[e];if(void 0!==t){var i,r=Object.values(t);(i=this.renderCachePool).push.apply(i,r),delete this.proxyCachedFBO[e]}}},{key:"deallocRenderCache",value:function(){this.renderCache.forEach((function(e){return e.fb.destroy()})),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}]),r}(e.SourceCache),Zi=function(e){v(i,e);var t=m(i);function i(e,r,n){var a;return d(this,i),(a=t.call(this,e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)).proxyTileKey=r,a.projMatrix=n,a}return p(i)}(e.OverscaledTileID),qi=function(t){v(r,t);var i=m(r);function r(t,n){var a;d(this,r),(a=i.call(this)).painter=t,a.terrainTileForTile={},a.prevTerrainTileForTile={};var o=function(t){var i=new e.StructArrayLayout2i4,r=new e.StructArrayLayout3ui6,n=131;i.reserve(17161),r.reserve(33800);for(var a=e.EXTENT/128,o=e.EXTENT+a/2,s=o+a,l=-a;lo||l<0||l>o?24575:0,h=e.clamp(Math.round(u),0,e.EXTENT),f=e.clamp(Math.round(l),0,e.EXTENT);i.emplaceBack(h+c,f)}for(var d=function(e,t){var i=t*n+e;r.emplaceBack(i+1,i,i+n),r.emplaceBack(i+n,i+n+1,i+1)},p=1;p<129;p++)for(var v=1;v<129;v++)d(v,p);return[0,129].forEach((function(e){for(var t=0;t<130;t++)d(t,e),d(e,t)})),[i,r,32768]}(),s=h(o,3),l=s[0],u=s[1],c=s[2],f=t.context;a.gridBuffer=f.createVertexBuffer(l,e.posAttributes.members),a.gridIndexBuffer=f.createIndexBuffer(u),a.gridSegments=e.SegmentVector.simpleSegment(0,0,l.length,u.length),a.gridNoSkirtSegments=e.SegmentVector.simpleSegment(0,0,l.length,c),a.proxyCoords=[],a.proxiedCoords={},a._visibleDemTiles=[],a._drapedRenderBatches=[],a._sourceTilesOverlap={},a.proxySourceCache=new Gi(n.map),a.orthoMatrix=e.create(),e.ortho(a.orthoMatrix,"globe"===a.painter.transform.projection.name?.015:0,e.EXTENT,0,e.EXTENT,0,1);var p=f.gl;return a._overlapStencilMode=new e.StencilMode({func:p.GEQUAL,mask:255},0,255,p.KEEP,p.KEEP,p.REPLACE),a._previousZoom=t.transform.zoom,a.pool=[],a._findCoveringTileCache={},a._tilesDirty={},a.style=n,a._useVertexMorphing=!0,a._exaggeration=1,a._mockSourceCache=new ji(n.map),a}return p(r,[{key:"style",set:function(e){var t=this;e.on("data",this._onStyleDataEvent.bind(this)),e.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=e,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",(function(){t._clearLineLayersFromRenderCache()}))}},{key:"update",value:function(t,i,r){var n=this;if(t&&t.terrain){this._style!==t&&(this.style=t),this.enabled=!0;var a=t.terrain.properties;this.sourceCache=0===t.terrain.drapeRenderMode?this._mockSourceCache:t._getSourceCache(a.get("source")),this._exaggeration=a.get("exaggeration");var o=function(){n.sourceCache.used&&e.warnOnce("Raster DEM source '".concat(n.sourceCache.id,"' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source."));var t=n.getScaledDemTileSize();n.sourceCache.update(i,t,!0),n.resetTileLookupCache(n.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),i.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0}else this._disable()}},{key:"resetTileLookupCache",value:function(e){this._findCoveringTileCache[e]={}}},{key:"getScaledDemTileSize",value:function(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}},{key:"_checkRenderCacheEfficiency",value:function(){var t=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==t.efficiency&&e.warnOnce("Terrain render cache efficiency is not optimal (".concat(t.efficiency,"%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '").concat(t.firstUndrapedLayer,"' or create a map using optimizeForTerrain: true option."))}},{key:"_onStyleDataEvent",value:function(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this._invalidateRenderCache=!0)}},{key:"_disable",value:function(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(var e in this._style._sourceCaches)this._style._sourceCaches[e].usedForTerrain=!1}},{key:"destroy",value:function(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach((function(e){return e.fb.destroy()})),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}},{key:"_source",value:function(){return this.enabled?this.sourceCache:null}},{key:"isUsingMockSource",value:function(){return this.sourceCache===this._mockSourceCache}},{key:"exaggeration",value:function(){return this._exaggeration}},{key:"visibleDemTiles",get:function(){return this._visibleDemTiles}},{key:"drapeBufferSize",get:function(){var e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}},{key:"useVertexMorphing",set:function(e){this._useVertexMorphing=e}},{key:"updateTileBinding",value:function(t){var i=this;if(this.enabled){this.prevTerrainTileForTile=this.terrainTileForTile;var r=this.proxySourceCache,n=this.painter.transform;this._initializing&&(this._initializing=0===n._centerAltitude&&-1===this.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(n.center),-1),this._emptyDEMTextureDirty=!this._initializing);var a=this.proxyCoords=r.getIds().map((function(e){var t=r.getTileByID(e).tileID;return t.projMatrix=n.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){var r=i.transform.pointCoordinate(i.transform.getCameraPoint()),n=new e.pointGeometry(r.x,r.y);t.sort((function(t,i){if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;var r=new e.pointGeometry(t.canonical.x+(1<0&&e++,t+r}),0);return e?t/e:0}},{key:"_updateEmptyDEMTexture",value:function(){var t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);var r=this._getLoadedAreaMinimum(),n=new e.RGBAImage({width:1,height:1},new Uint8Array(e.DEMData.pack(r,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;var a=this._emptyDEMTexture;return a?a.update(n,{premultiply:!1}):a=this._emptyDEMTexture=new e.Texture(t,n,i.RGBA,{premultiply:!1}),a}},{key:"setupElevationDraw",value:function(t,i,r){var n,a=this.painter.context,o=a.gl,s=(n=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:e.DEMData.getUnpackVector(n),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});s.u_dem_size=this.sourceCache.getSource().tileSize,s.u_exaggeration=this.exaggeration();var l=null,u=null,c=1;if(r&&r.morphing&&this._useVertexMorphing){var h=r.morphing.srcDemTile,f=r.morphing.dstDemTile;c=r.morphing.phase,h&&f&&(this._prepareDemTileUniforms(t,h,s,"_prev")&&(u=h),this._prepareDemTileUniforms(t,f,s)&&(l=f))}if(u&&l?(a.activeTexture.set(o.TEXTURE2),l.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.activeTexture.set(o.TEXTURE4),u.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),s.u_dem_lerp=c):(l=this.terrainTileForTile[t.tileID.key],a.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(t,l,s)?l.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE)),a.activeTexture.set(o.TEXTURE3),r&&r.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),this._depthFBO&&(s.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),s.u_depth_size_inv=[1,1]),r&&r.useMeterToDem&&l){var d=(1<t.renderCachePool.length){var i=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(var r=0;r=0;l--){var u=o[l];if(t.getTileByID(u.key),void 0!==t.proxyCachedFBO[u.key]){var h=e[u.key],d=this.proxyToSource[u.key],p=0,v=function(e){var t=d[e],i=h[e];if(!i||i.length!==t.length||t.some((function(t,r){return t!==i[r]||s[e]&&s[e].hasOwnProperty(t.key)})))return p=-1,"break";++p};for(var m in d)if("break"===v(m))break;for(var y in t.proxyCachedFBO[u.key])t.renderCache[t.proxyCachedFBO[u.key][y]].dirty=p<0||p!==Object.values(h).length}}var _=c(this._drapedRenderBatches);_.sort((function(e,t){return t.end-t.start-(e.end-e.start)}));var g,x=f(_);try{for(x.s();!(g=x.n()).done;){var b,w=g.value,k=f(o);try{for(k.s();!(b=k.n()).done;){var T=b.value;if(!t.proxyCachedFBO[T.key]){var E=t.renderCachePool.pop();void 0===E&&t.renderCache.length<50&&(E=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==E&&(t.proxyCachedFBO[T.key]={},t.proxyCachedFBO[T.key][w.start]=E,t.renderCache[E].dirty=!0)}}}catch(S){k.e(S)}finally{k.f()}}}catch(S){x.e(S)}finally{x.f()}this._tilesDirty={}}}},{key:"_setupStencil",value:function(e,t,i,r){if(r&&this._sourceTilesOverlap[r.id]){var n=this.painter.context,a=n.gl;if(t.length<=1)this._overlapStencilType=!1;else{var o;if(i.isTileClipped())o=t.length,this._overlapStencilMode.test={func:a.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:a.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}}else this._overlapStencilType&&(this._overlapStencilType=!1)}},{key:"clipOrMaskOverlapStencilType",value:function(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}},{key:"stencilModeForRTTOverlap",value:function(t){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):e.StencilMode.disabled}},{key:"_renderTileClippingMasks",value:function(t,i){var r=this.painter,n=this.painter.context,a=n.gl;r._tileClippingMaskIDs={},n.setColorMode(e.ColorMode.disabled),n.setDepthMode(e.DepthMode.disabled);var o,s=r.useProgram("clippingMask"),l=f(t);try{for(l.s();!(o=l.n()).done;){var u=o.value,c=r._tileClippingMaskIDs[u.key]=--i;s.draw(n,a.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:a.ALWAYS,mask:0},c,255,a.KEEP,a.KEEP,a.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,Vi(u.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}catch(h){l.e(h)}finally{l.f()}}},{key:"pointCoordinate",value:function(t){var i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;var r=[t.x,t.y,1,1];e.transformMat4$1(r,r,i.pixelMatrixInverse),e.scale$1(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;var n=i._camera.position,a=e.mercatorZfromAltitude(1,i.center.lat),o=[n[0],n[1],n[2]/a,0],s=e.subtract([],r.slice(0,3),o);e.normalize(s,s);var l=this.raycast(o,s,this._exaggeration);return null!==l&&l?(e.scaleAndAdd(o,o,s,l),o[3]=o[2],o[2]*=a,o):null}},{key:"drawDepth",value:function(){var t=this.painter,i=t.context,r=this.proxySourceCache,n=Math.ceil(t.width),a=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===n&&this._depthFBO.height===a||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){var o=i.gl,s=i.createFramebuffer(n,a,!0);i.activeTexture.set(o.TEXTURE0);var l=new e.Texture(i,{width:n,height:a,data:null},o.RGBA);l.bind(o.NEAREST,o.CLAMP_TO_EDGE),s.colorAttachment.set(l.texture);var u=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,n,a);s.depthAttachment.set(u),this._depthFBO=s,this._depthTexture=l}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,n,a]),function(t,i,r,n){if("globe"!==t.transform.projection.name){var a=t.context,o=a.gl;a.clear({depth:1});var s,l=t.useProgram("terrainDepth"),u=new e.DepthMode(o.LESS,e.DepthMode.ReadWrite,t.depthRangeFor3D),c=f(n);try{for(c.s();!(s=c.n()).done;){var h=s.value,d=r.getTile(h),p=Di(h.projMatrix,0);i.setupElevationDraw(d,l),l.draw(a,o.TRIANGLES,u,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.backCCW,p,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}catch(v){c.e(v)}finally{c.f()}}}(t,this,r,this.proxyCoords)}},{key:"_setupProxiedCoordsForOrtho",value:function(e,t,i){if(e.getSource()instanceof Ze)return this._setupProxiedCoordsForImageSource(e,t,i);this._findCoveringTileCache[e.id]=this._findCoveringTileCache[e.id]||{};for(var r=this.proxiedCoords[e.id]=[],n=this.proxyCoords,a=0;ao+l.max.x||n+as+l.max.y},c=0;c0?(s=(o=e.EXTENT>>u)*((i.tileID.canonical.x<=c){var h=t.canonical.z-c;i.getSource().reparseOverscaled?(s=Math.max(t.canonical.z+2,i.transform.tileZoom),o=new e.OverscaledTileID(s,t.wrap,c,t.canonical.x>>h,t.canonical.y>>h)):0!==h&&(s=c,o=new e.OverscaledTileID(s,t.wrap,c,t.canonical.x>>h,t.canonical.y>>h))}o.key!==t.key&&(u.push(o.key),r=i.getTile(o))}var f=function(e){u.forEach((function(t){n[t]=e})),u.length=0};for(s-=1;s>=l&&(!r||!r.hasData());s--){r&&f(r.tileID.key);var d=o.calculateScaledKey(s);if((r=i.getTileByID(d))&&r.hasData())break;var p=n[d];if(null===p)break;void 0===p?u.push(d):r=i.getTileByID(p)}return f(r?r.tileID.key:null),r&&r.hasData()?r:null}},{key:"findDEMTileFor",value:function(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}},{key:"prepareDrawTile",value:function(){this.renderedToTile=!0}},{key:"_clearRenderCacheForTile",value:function(e,t){var i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}},{key:"getWirefameBuffer",value:function(){if(!this.wireframeSegments){var t=function(t){for(var i=0,r=new e.StructArrayLayout2ui4,n=131,a=1;a<129;a++){for(var o=1;o<129;o++)i=a*n+o,r.emplaceBack(i,i+1),r.emplaceBack(i,i+n),r.emplaceBack(i+1,i+n),128===a&&r.emplaceBack(i+n,i+n+1);r.emplaceBack(i+1,i+1+n)}return r}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(t),this.wireframeSegments=e.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,t.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}]),r}(e.Elevation),Wi=function(){function t(i,r,n,a,o,s){d(this,t);var l=i.gl;this.program=l.createProgram();var u=function(e){for(var t=[],i=0;i>16,a>>16],u_pixel_coord_lower:[65535&n,65535&a]}}var Hi=e.create(),Yi=function(t,i,r,n,a,o,s,l,u,c,h){var f=i.style.light,d=f.properties.get("position"),p=[d.x,d.y,d.z],v=e.create$1();"viewport"===f.properties.get("anchor")&&(e.fromRotation(v,-i.transform.angle),e.transformMat3(p,p,v));var m=f.properties.get("color"),y=i.transform,_={u_matrix:t,u_lightpos:p,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[m.r,m.g,m.b],u_vertical_gradient:+r,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Hi,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:a,u_edge_radius:o};return"globe"===y.projection.name&&(_.u_tile_id=[s.canonical.x,s.canonical.y,1<2&&void 0!==arguments[2]?arguments[2]:1}},or=e.create(),sr=function(t,i,r,n,a,o,s){var l=t.transform,u="globe"===l.projection.name,c=u?e.globePixelsToTileUnits(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:W(r,1,o),h={u_matrix:i.projMatrix,u_extrude_scale:c,u_intensity:s,u_inv_rot_matrix:or,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(u){h.u_inv_rot_matrix=n,h.u_merc_center=a,h.u_tile_id=[i.canonical.x,i.canonical.y,1<0?1-1/(1.001-s):-s),u_contrast_factor:(o=n.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:pr(n.paint.get("raster-hue-rotate")),u_perspective_transform:a};var o,s};function pr(e){e*=Math.PI/180;var t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}var vr,mr=e.create(),yr=function(t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m){var y=a.transform,_={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:y.cameraToCenterDistance,u_rotate_symbol:+r,u_aspect_ratio:y.width/y.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+n,u_texsize:c,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:mr,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:mr,u_up_vector:[0,-1,0]};return"globe"===m.name&&(_.u_tile_id=[h.canonical.x,h.canonical.y,1<>16,c>>16],u_pixel_coord_lower:[65535&u,65535&c]}}(n,r,a),{u_matrix:t,u_opacity:i})},wr={fillExtrusion:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t)}},fillExtrusionPattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_height_factor:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t)}},fill:function(t){return{u_matrix:new e.UniformMatrix4f(t)}},fillPattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}},fillOutline:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t)}},fillOutlinePattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}},circle:function(t){return{u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}},collisionBox:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.Uniform2f(t)}},collisionCircle:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_inv_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_viewport_size:new e.Uniform2f(t)}},debug:function(t){return{u_color:new e.UniformColor(t),u_matrix:new e.UniformMatrix4f(t),u_overlay:new e.Uniform1i(t),u_overlay_scale:new e.Uniform1f(t)}},clippingMask:function(t){return{u_matrix:new e.UniformMatrix4f(t)}},heatmap:function(t){return{u_extrude_scale:new e.Uniform1f(t),u_intensity:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}},heatmapTexture:function(t){return{u_image:new e.Uniform1i(t),u_color_ramp:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t)}},hillshade:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_latrange:new e.Uniform2f(t),u_light:new e.Uniform2f(t),u_shadow:new e.UniformColor(t),u_highlight:new e.UniformColor(t),u_accent:new e.UniformColor(t)}},hillshadePrepare:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_dimension:new e.Uniform2f(t),u_zoom:new e.Uniform1f(t),u_unpack:new e.Uniform4f(t)}},line:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_units_to_pixels:new e.Uniform2f(t),u_dash_image:new e.Uniform1i(t),u_gradient_image:new e.Uniform1i(t),u_image_height:new e.Uniform1f(t),u_texsize:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t),u_trim_offset:new e.Uniform2f(t)}},linePattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_texsize:new e.Uniform2f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_units_to_pixels:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t)}},raster:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_tl_parent:new e.Uniform2f(t),u_scale_parent:new e.Uniform1f(t),u_fade_t:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_image0:new e.Uniform1i(t),u_image1:new e.Uniform1i(t),u_brightness_low:new e.Uniform1f(t),u_brightness_high:new e.Uniform1f(t),u_saturation_factor:new e.Uniform1f(t),u_contrast_factor:new e.Uniform1f(t),u_spin_weights:new e.Uniform3f(t),u_perspective_transform:new e.Uniform2f(t)}},symbolIcon:function(t){return{u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_texture:new e.Uniform1i(t)}},symbolSDF:function(t){return{u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_is_halo:new e.Uniform1i(t)}},symbolTextAndIcon:function(t){return{u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texsize_icon:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_texture_icon:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_is_halo:new e.Uniform1i(t)}},background:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_color:new e.UniformColor(t)}},backgroundPattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_pattern_tl:new e.Uniform2f(t),u_pattern_br:new e.Uniform2f(t),u_texsize:new e.Uniform2f(t),u_pattern_size:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}},terrainRaster:Pi,terrainDepth:Pi,skybox:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_sun_direction:new e.Uniform3f(t),u_cubemap:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}},skyboxGradient:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_color_ramp:new e.Uniform1i(t),u_center_direction:new e.Uniform3f(t),u_radius:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}},skyboxCapture:function(t){return{u_matrix_3f:new e.UniformMatrix3f(t),u_sun_direction:new e.Uniform3f(t),u_sun_intensity:new e.Uniform1f(t),u_color_tint_r:new e.Uniform4f(t),u_color_tint_m:new e.Uniform4f(t),u_luminance:new e.Uniform1f(t)}},globeRaster:function(t){return{u_proj_matrix:new e.UniformMatrix4f(t),u_globe_matrix:new e.UniformMatrix4f(t),u_normalize_matrix:new e.UniformMatrix4f(t),u_merc_matrix:new e.UniformMatrix4f(t),u_zoom_transition:new e.Uniform1f(t),u_merc_center:new e.Uniform2f(t),u_image0:new e.Uniform1i(t),u_grid_matrix:new e.UniformMatrix3f(t),u_skirt_height:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_viewport:new e.Uniform2f(t)}},globeAtmosphere:function(t){return{u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_horizon:new e.Uniform1f(t),u_transition:new e.Uniform1f(t),u_fadeout_range:new e.Uniform1f(t),u_color:new e.Uniform4f(t),u_high_color:new e.Uniform4f(t),u_space_color:new e.Uniform4f(t),u_star_intensity:new e.Uniform1f(t),u_star_density:new e.Uniform1f(t),u_star_size:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t),u_horizon_angle:new e.Uniform1f(t),u_rotation_matrix:new e.UniformMatrix4f(t)}}};function kr(t,i,r,n,a,o,s){for(var l=t.context,u=l.gl,c=t.transform,h=t.useProgram("collisionBox"),f=[],d=0,p=0,v=0;v0){var k=e.create(),T=x;e.mul(k,_.placementInvProjMatrix,c.glCoordMatrix),e.mul(k,k,_.placementViewportMatrix),f.push({circleArray:w,circleOffset:p,transform:T,invTransform:k,projection:_.getProjection()}),p=d+=w.length/4}b&&(t.terrain&&t.terrain.setupElevationDraw(y,h),h.draw(l,u.LINES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,nr(x,c,y,_.getProjection()),r.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,c.zoom,null,[b.collisionVertexBuffer,b.collisionVertexBufferExt]))}}if(s&&f.length){var E=t.useProgram("collisionCircle"),S=new e.StructArrayLayout2f1f2i16;S.resize(4*d),S._trim();for(var M=0,A=0,I=f;A=0&&(m[w.associatedIconIndex]={x:U,y:V,z:N,angle:W})}else At(E,p)}if(f){v.clear();for(var H=t.icon.placedSymbolArray,Y=0;Y0&&b.push("FAUX_AO");var w,k=f(n);try{for(k.s();!(w=k.n()).done;){var T=w.value,E=i.getTile(T),S=E.getBucket(r);if(S&&S.projection.name===c.projection.name){var M=S.programConfigurations.get(r.id),A=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",M,b);if(t.terrain){var I=t.terrain;if(t.style.terrainSetForDrapingOnly())I.setupElevationDraw(E,A,{useMeterToDem:!0});else{if(!S.enableTerrain)continue;if(I.setupElevationDraw(E,A,{useMeterToDem:!0}),Pr(l,i,T,S,r,I),!S.centroidVertexBuffer){var C=A.attributes.a_centroid_pos;void 0!==C&&u.vertexAttrib2f(C,0,0)}}}d&&(t.context.activeTexture.set(u.TEXTURE0),E.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),M.updatePaintBuffers());var z=h.constantOr(null);if(z&&E.imageAtlas){var P=E.imageAtlas.patternPositions[z.toString()];P&&M.setConstantPatternPositions(P)}var D=t.translatePosMatrix(T.projMatrix,E,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),L=c.projection.createInversionMatrix(c,T.canonical),R=r.paint.get("fill-extrusion-vertical-gradient"),B=d?Ki(D,t,R,p,v,m,T,E,y,g,x,L):Yi(D,t,R,p,v,m,T,y,g,x,L);t.prepareDrawProgram(l,A,T.toUnwrapped());var O=[];t.terrain&&O.push(S.centroidVertexBuffer),_&&O.push(S.layoutVertexExtBuffer),A.draw(l,l.gl.TRIANGLES,a,o,s,e.CullFaceMode.backCCW,B,r.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,r.paint,t.transform.zoom,M,O)}}}catch(F){k.e(F)}finally{k.f()}}function Pr(t,i,r,n,a,o){for(var s,l,u,c=[function(t){var i=t.canonical.x-1,r=t.wrap;return i<0&&(i=(1<t.max.x?i.min.x-e.EXTENT:t.max.x,d},v=function(t,i){return d[0]=Math.min(t.min.x,i.min.x),d[1]=Math.max(t.max.x,i.max.x),d[2]=e.EXTENT-i.min.y>t.max.y?i.min.y-e.EXTENT:t.max.y,d},m=[function(e,t){return p(e,t)},function(e,t){return p(t,e)},function(e,t){return v(e,t)},function(e,t){return v(t,e)}],y=new e.pointGeometry(0,0),_=function(t,i,n,a,c){var h=[[a?n:t,a?t:n,0],[a?n:i,a?i:n,0]],f=c<0?e.EXTENT+c:c,d=[a?f:(t+i)/2,a?(t+i)/2:f,0];return 0===n&&c<0||0!==n&&c>0?o.getForTilePoints(u,[d],!0,l):h.push(d),o.getForTilePoints(r,h,!0,s),Math.max(h[0][2],h[1][2],d[2])/o.exaggeration()},g=0;g<4;g++){var x=(g<2?1:5)-g,b=n.borders[g];if(0!==b.length){var w=u=c[g](r),k=h(w);if(k&&k instanceof e.FillExtrusionBucket&&k.enableTerrain&&(n.borderDoneWithNeighborZ[g]!==k.canonical.z||k.borderDoneWithNeighborZ[x]!==n.canonical.z)&&(l=o.findDEMTileFor(w))&&l.dem){if(!s){var T=o.findDEMTileFor(r);if(!T||!T.dem)return;s=T}var E=k.borders[x],S=0,M=k.borderDoneWithNeighborZ[x]!==n.canonical.z;if(n.canonical.z===k.canonical.z){for(var A=0;AC[0]+3);)M&&k.encodeCentroid(void 0,z,!1),S++;if(z&&SC[1]-3)&&(D++,++S!==E.length);)z=k.featuresOnBorder[E[S]];if(z=k.featuresOnBorder[E[P]],I.intersectsCount()>1||z.intersectsCount()>1||1!==D){1!==D&&(S=P),n.encodeCentroid(void 0,I,!1),M&&k.encodeCentroid(void 0,z,!1);continue}var L=m[g](I,z),R=g%2?e.EXTENT-1:0;y.x=_(L[0],Math.min(e.EXTENT-1,L[1]),R,g<2,L[2]),y.y=0,n.encodeCentroid(y,I,!1),M&&k.encodeCentroid(y,z,!1)}else n.encodeCentroid(void 0,I,!1)}n.borderDoneWithNeighborZ[g]=k.canonical.z,n.needsCentroidUpdate=!0,M&&(k.borderDoneWithNeighborZ[x]=n.canonical.z,k.needsCentroidUpdate=!0)}else{var B,O=f(b);try{for(O.s();!(B=O.n()).done;){var F=B.value;n.encodeCentroid(void 0,n.featuresOnBorder[F],!1)}}catch(j){O.e(j)}finally{O.f()}if(M){var U,V=f(E);try{for(V.s();!(U=V.n()).done;){var N=U.value;k.encodeCentroid(void 0,k.featuresOnBorder[N],!1)}}catch(j){V.e(j)}finally{V.f()}k.borderDoneWithNeighborZ[x]=n.canonical.z,k.needsCentroidUpdate=!0}n.borderDoneWithNeighborZ[g]=k.canonical.z,n.needsCentroidUpdate=!0}}}}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(t)}var Dr=new e.Color(1,0,0,1),Lr=new e.Color(0,1,0,1),Rr=new e.Color(0,0,1,1),Br=new e.Color(1,0,1,1),Or=new e.Color(0,1,1,1);function Fr(t,i,r){var n=t.context,a=t.transform,o=n.gl,s="globe"===a.projection.name,l=s?["PROJECTION_GLOBE_VIEW"]:null,u=r.projMatrix;if(s&&e.globeToMercatorTransition(a.zoom)>0){var c=e.transitionTileAABBinECEF(r.canonical,a),h=e.globeDenormalizeECEF(c);u=e.multiply(new Float32Array(16),a.globeMatrix,h),e.multiply(u,a.projMatrix,u)}var f=t.useProgram("debug",null,l),d=i.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(d,f);var p=e.DepthMode.disabled,v=e.StencilMode.disabled,m=t.colorModeForRenderPass(),y="$debug";n.activeTexture.set(o.TEXTURE0),t.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s?d._makeGlobeTileDebugBuffers(t.context,a):d._makeDebugTileBoundsBuffers(t.context,a.projection);var _=d._tileDebugBuffer||t.debugBuffer,g=d._tileDebugIndexBuffer||t.debugIndexBuffer,x=d._tileDebugSegments||t.debugSegments;f.draw(n,o.LINE_STRIP,p,v,m,e.CullFaceMode.disabled,ar(u,e.Color.red),y,_,g,x,null,null,null,[d._globeTileDebugBorderBuffer]);var b=d.latestRawTileData,w=Math.floor((b&&b.byteLength||0)/1024),k=i.getTile(r).tileSize,T=512/Math.min(k,512)*(r.overscaledZ/a.zoom)*.5,E=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(E+=" => ".concat(r.overscaledZ)),function(e,t){e.initDebugOverlayCanvas();var i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,E+=" ".concat(w,"kb"));var S=d._tileDebugTextBuffer||t.debugBuffer,M=d._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,A=d._tileDebugTextSegments||t.debugSegments;f.draw(n,o.TRIANGLES,p,v,e.ColorMode.alphaBlended,e.CullFaceMode.disabled,ar(u,e.Color.transparent,T),y,S,M,A,null,null,null,[d._globeTileDebugTextBuffer])}function Ur(e,t,i,r){Nr(e,0,t+i/2,e.transform.width,i,r)}function Vr(e,t,i,r){Nr(e,t-i/2,0,i,e.transform.height,r)}function Nr(t,i,r,n,a,o){var s=t.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.exported.devicePixelRatio,r*e.exported.devicePixelRatio,n*e.exported.devicePixelRatio,a*e.exported.devicePixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}var jr=e.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]).members;function Gr(e,t,i,r){e.emplaceBack(t,i,r)}var Zr=p((function t(i){d(this,t),this.vertexArray=new e.StructArrayLayout3f12,this.indices=new e.StructArrayLayout3ui6,Gr(this.vertexArray,-1,-1,1),Gr(this.vertexArray,1,-1,1),Gr(this.vertexArray,-1,1,1),Gr(this.vertexArray,1,1,1),Gr(this.vertexArray,-1,-1,-1),Gr(this.vertexArray,1,-1,-1),Gr(this.vertexArray,-1,1,-1),Gr(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=i.createVertexBuffer(this.vertexArray,jr),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=e.SegmentVector.simpleSegment(0,0,36,12)}));function qr(t,i,r,n,a,o){var s=t.gl,l=i.paint.get("sky-atmosphere-color"),u=i.paint.get("sky-atmosphere-halo-color"),c=i.paint.get("sky-atmosphere-sun-intensity"),h=function(e,t,i,r,n){return{u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}}(e.fromMat4(e.create$1(),n),a,c,l,u);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+o,i.skyboxTexture,0),r.draw(t,s.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.frontCW,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}var Wr=e.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),Xr=function(){function t(i){d(this,t);var r=new e.StructArrayLayout5f20;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);var n=new e.StructArrayLayout3ui6;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(r,Wr.members),this.indexBuffer=i.createIndexBuffer(n),this.segments=e.SegmentVector.simpleSegment(0,0,4,2)}return p(t,[{key:"destroy",value:function(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}]),t}(),Hr={symbol:function(t,i,r,n,a){if("translucent"===t.renderPass){var o=e.StencilMode.disabled,s=t.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(t,i,r,n,a,o,s){var l,u=i.transform,c="map"===a,h="map"===o,d=f(t);try{for(d.s();!(l=d.n()).done;){var p=l.value,v=n.getTile(p),m=v.getBucket(r);if(m&&m.text&&m.text.segments.get().length){var y=e.evaluateSizeForZoom(m.textSizeData,u.zoom),_=Lt(p,m.getProjection(),u),g=u.calculatePixelsToTileUnitsMatrix(v),x=vt(_,v.tileID.canonical,h,c,u,m.getProjection(),g),b="none"!==r.layout.get("icon-text-fit")&&m.hasIconData();if(y){var w=Math.pow(2,u.zoom-v.tileID.overscaledZ);Sr(m,c,h,s,e.symbolSize,u,x,p,w,y,b)}}}}catch(k){d.e(k)}finally{d.f()}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),a),0!==r.paint.get("icon-opacity").constantOr(1)&&Ar(t,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),o,s),0!==r.paint.get("text-opacity").constantOr(1)&&Ar(t,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),o,s),i.map.showCollisionBoxes&&(kr(t,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),kr(t,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}},circle:function(t,i,r,n){if("translucent"===t.renderPass){var a=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1);if(0!==a.constantOr(1)||0!==o.constantOr(1)&&0!==s.constantOr(1)){for(var u=t.context,c=u.gl,h=t.transform,d=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),p=e.StencilMode.disabled,v=t.colorModeForRenderPass(),m="globe"===h.projection.name,y=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],_=[],g=0;g20&&u.texParameterf(u.TEXTURE_2D,l.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,l.extTextureFilterAnisotropicMax);var R=dr(M,D||[0,0],P||1,z,r,c instanceof Ze?c.perspectiveTransform:[0,0]);if(t.prepareDrawProgram(l,d,E),c instanceof Ze)c.boundsBuffer&&c.boundsSegments&&d.draw(l,u.TRIANGLES,T,e.StencilMode.disabled,p,e.CullFaceMode.disabled,R,r.id,c.boundsBuffer,t.quadTriangleIndexBuffer,c.boundsSegments);else{var B=t.getTileBoundsBuffers(S),O=B.tileBoundsBuffer,F=B.tileBoundsIndexBuffer,U=B.tileBoundsSegments;d.draw(l,u.TRIANGLES,T,A,p,e.CullFaceMode.disabled,R,r.id,O,F,U)}}}}catch(V){w.e(V)}finally{w.f()}t.resetStencilClippingMasks()}},background:function(t,i,r,n){var a=r.paint.get("background-color"),o=r.paint.get("background-opacity");if(0!==o){var s=t.context,l=s.gl,u=t.transform,c=u.tileSize,h=r.paint.get("background-pattern");if(!t.isPatternMissing(h)){var d=!h&&1===a.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===d){var p,v=e.StencilMode.disabled,m=t.depthModeForSublayer(0,"opaque"===d?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly),y=t.colorModeForRenderPass(),_=t.useProgram(h?"backgroundPattern":"background"),g=n;g||(p=t.getBackgroundTiles(),g=Object.values(p).map((function(e){return e.tileID}))),h&&(s.activeTexture.set(l.TEXTURE0),t.imageManager.bind(t.context));var x,b=f(g);try{for(b.s();!(x=b.n()).done;){var w=x.value,k=w.toUnwrapped(),T=n?w.projMatrix:t.transform.calculateProjMatrix(k);t.prepareDrawTile();var E=i?i.getTile(w):p?p[w.key]:new e.Tile(w,c,u.zoom,t),S=h?br(T,o,t,h,{tileID:w,tileSize:c}):xr(T,o,a);t.prepareDrawProgram(s,_,k);var M=t.getTileBoundsBuffers(E),A=M.tileBoundsBuffer,I=M.tileBoundsIndexBuffer,C=M.tileBoundsSegments;_.draw(s,l.TRIANGLES,m,v,y,e.CullFaceMode.disabled,S,r.id,A,I,C)}}catch(z){b.e(z)}finally{b.f()}}}}},sky:function(t,i,r){var n=t.transform,a="mercator"===n.projection.name||"globe"===n.projection.name?1:e.smoothstep(7,8,n.zoom),o=r.paint.get("sky-opacity")*a;if(0!==o){var s=t.context,l=r.paint.get("sky-type"),u=new e.DepthMode(s.gl.LEQUAL,e.DepthMode.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===t.renderPass?r.needsSkyboxCapture(t)&&(function(t,i,r,n){var a=t.context,o=a.gl,s=i.skyboxFbo;if(!s){s=i.skyboxFbo=a.createFramebuffer(32,32,!1),i.skyboxGeometry=new Zr(a),i.skyboxTexture=a.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,i.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(var l=0;l<6;++l)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}a.bindFramebuffer.set(s.framebuffer),a.viewport.set([0,0,32,32]);var u=i.getCenter(t,!0),c=t.useProgram("skyboxCapture"),h=new Float64Array(16);e.identity(h),e.rotateY(h,h,.5*-Math.PI),qr(a,i,c,h,u,0),e.identity(h),e.rotateY(h,h,.5*Math.PI),qr(a,i,c,h,u,1),e.identity(h),e.rotateX(h,h,.5*-Math.PI),qr(a,i,c,h,u,2),e.identity(h),e.rotateX(h,h,.5*Math.PI),qr(a,i,c,h,u,3),e.identity(h),qr(a,i,c,h,u,4),e.identity(h),e.rotateY(h,h,Math.PI),qr(a,i,c,h,u,5),a.viewport.set([0,0,t.width,t.height])}(t,r),r.markSkyboxValid(t)):"sky"===t.renderPass&&function(t,i,r,n,a){var o=t.context,s=o.gl,l=t.transform,u=t.useProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture);var c=function(e,t,i,r,n){return{u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:n}}(l.skyboxMatrix,i.getCenter(t,!1),0,n,a);t.prepareDrawProgram(o,u),u.draw(o,s.TRIANGLES,r,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,c,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,u,o,c):"gradient"===l&&"sky"===t.renderPass&&function(t,i,r,n,a){var o=t.context,s=o.gl,l=t.transform,u=t.useProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new Zr(o)),o.activeTexture.set(s.TEXTURE0);var c=i.colorRampTexture;c||(c=i.colorRampTexture=new e.Texture(o,i.colorRamp,s.RGBA)),c.bind(s.LINEAR,s.CLAMP_TO_EDGE);var h=function(t,i,r,n,a){return{u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.degToRad(r),u_opacity:n,u_temporal_offset:a}}(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),n,a);t.prepareDrawProgram(o,u),u.draw(o,s.TRIANGLES,r,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,h,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,u,o,c)}},debug:function(e,t,i){for(var r=0;r2&&void 0!==arguments[2]&&arguments[2];d(this,t),this.context=new Ve(i,n),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=e.SourceCache.maxUnderzooming+e.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new oi,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}return p(t,[{key:"updateTerrain",value:function(e,t){var i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(i||this._terrain&&this._terrain.enabled){this._terrain||(this._terrain=new qi(this,e));var r=this._terrain;this.transform.elevation=i?r:null,r.update(e,this.transform,t)}}},{key:"_updateFog",value:function(e){var t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)this.transform.fogCullDistSq=null;else{var i=t.getFovAdjustedRange(this.transform._fov),r=h(i,2),n=r[0],a=r[1];if(n>a)this.transform.fogCullDistSq=null;else{var o=n+.78*(a-n);this.transform.fogCullDistSq=o*o}}}},{key:"terrain",get:function(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}},{key:"resize",value:function(t,i){if(this.width=t*e.exported.devicePixelRatio,this.height=i*e.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style){var r,n=f(this.style.order);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.style._layers[a].resize()}}catch(o){n.e(o)}finally{n.f()}}}},{key:"setup",value:function(){var t=this.context,i=new e.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(e.EXTENT,0),i.emplaceBack(0,e.EXTENT),i.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(i,e.posAttributes.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);var r=new e.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(e.EXTENT,0),r.emplaceBack(0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(r,e.posAttributes.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);var n=new e.StructArrayLayout2i4;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,e.posAttributes.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);var a=new e.StructArrayLayout4i8;a.emplaceBack(0,0,0,0),a.emplaceBack(e.EXTENT,0,e.EXTENT,0),a.emplaceBack(0,e.EXTENT,0,e.EXTENT),a.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.mercatorBoundsBuffer=t.createVertexBuffer(a,e.boundsAttributes.members),this.mercatorBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);var o=new e.StructArrayLayout3ui6;o.emplaceBack(0,1,2),o.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(o);for(var s=new e.StructArrayLayout1ui2,l=0,u=[0,1,3,2,0];l256&&this.clearStencil(),l.setColorMode(e.ColorMode.disabled),l.setDepthMode(e.DepthMode.disabled);var c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};var h,d=f(r);try{for(d.s();!(h=d.n()).done;){var p=h.value,v=i.getTile(p),m=this._tileClippingMaskIDs[p.key]=this.nextStencilID++,y=this.getTileBoundsBuffers(v),_=y.tileBoundsBuffer,g=y.tileBoundsIndexBuffer,x=y.tileBoundsSegments;c.draw(l,u.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:u.ALWAYS,mask:0},m,255,u.KEEP,u.KEEP,u.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,Vi(p.projMatrix),"$clipping",_,g,x)}}catch(b){d.e(b)}finally{d.f()}}}},{key:"stencilModeFor3D",value:function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var t=this.nextStencilID++,i=this.context.gl;return new e.StencilMode({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}},{key:"stencilModeForClipping",value:function(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);var i=this.context.gl;return new e.StencilMode({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}},{key:"stencilConfigForOverlap",value:function(t){var i=this.context.gl,n=t.sort((function(e,t){return t.overscaledZ-e.overscaledZ})),a=n[n.length-1].overscaledZ,o=n[0].overscaledZ-a+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();for(var s={},l=0;l=0;this.currentLayer--){var w=this.style._layers[n[this.currentLayer]],k=t._getLayerSourceCache(w);if(!w.isSky()){var T=k?u[k.id]:void 0;this._renderTileClippingMasks(w,k,T),this.renderLayer(this,k,w,T)}}if(this.style.fog&&this.transform.projection.supportsFog&&function(t,i){var r=t.context,n=r.gl,a=t.transform,o=new e.DepthMode(n.LEQUAL,e.DepthMode.ReadOnly,[0,1]),s=t.useProgram("globeAtmosphere",null,"globe"===a.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=e.globeToMercatorTransition(a.zoom),u=i.properties.get("color").toArray01(),c=i.properties.get("high-color").toArray01(),h=i.properties.get("space-color").toArray01PremultipliedAlpha(),f=e.identity$1([]);e.rotateY$1(f,f,-e.degToRad(a._center.lng)),e.rotateX$1(f,f,e.degToRad(a._center.lat)),e.rotateZ$1(f,f,a.angle),e.rotateX$1(f,f,-a._pitch);var d=e.fromQuat(new Float32Array(16),f),p=e.mapValue(i.properties.get("star-intensity"),0,1,0,.25),v=5e-4,m=e.mapValue(i.properties.get("horizon-blend"),0,1,v,.25),y=e.globeUseCustomAntiAliasing(t,r,a)&&m===v?a.worldSize/(2*Math.PI*1.025)-1:a.globeRadius,_=t.frameCounter/1e3%1,g=e.length(a.globeCenterInViewSpace),x=Math.sqrt(Math.pow(g,2)-Math.pow(y,2)),b=Math.acos(x/g),w=function(t,i,r,n,a,o,s,l,u,c,h,f,d,p){return{u_frustum_tl:t,u_frustum_tr:i,u_frustum_br:r,u_frustum_bl:n,u_horizon:a,u_transition:o,u_fadeout_range:s,u_color:l,u_high_color:u,u_space_color:c,u_star_intensity:h,u_star_size:5*e.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:f,u_horizon_angle:d,u_rotation_matrix:p}}(a.frustumCorners.TL,a.frustumCorners.TR,a.frustumCorners.BR,a.frustumCorners.BL,a.frustumCorners.horizon,l,m,u,c,h,p,_,b,d);t.prepareDrawProgram(r,s);var k=t.atmosphereBuffer;k&&s.draw(r,n.TRIANGLES,o,e.StencilMode.disabled,e.ColorMode.alphaBlended,e.CullFaceMode.backCW,w,"skybox",k.vertexBuffer,k.indexBuffer,k.segments)}(this,this.style.fog),this.renderPass="sky",(e.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer0?t.pop():null}},{key:"isPatternMissing",value:function(e){return null===e||void 0!==e&&!this.imageManager.getPattern(e.toString())}},{key:"terrainRenderModeElevated",value:function(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}},{key:"currentGlobalDefines",value:function(){var e=this.terrain&&this.terrain.renderingToTexture,t=this.terrain&&0===this.terrain.exaggeration(),i=this.style&&this.style.fog,r=[];return this.terrainRenderModeElevated()&&r.push("TERRAIN"),"globe"===this.transform.projection.name&&r.push("GLOBE"),t&&r.push("ZERO_EXAGGERATION"),i&&!e&&0!==i.getOpacity(this.transform.pitch)&&r.push("FOG"),e&&r.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&r.push("OVERDRAW_INSPECTOR"),r}},{key:"useProgram",value:function(e,t,i){this.cache=this.cache||{};var r=i||[],n=this.currentGlobalDefines().concat(r),a=Wi.cacheKey(Ti[e],e,n,t);return this.cache[a]||(this.cache[a]=new Wi(this.context,e,Ti[e],t,wr[e],n)),this.cache[a]}},{key:"setCustomLayerDefaults",value:function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}},{key:"setBaseState",value:function(){var e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}},{key:"initDebugOverlayCanvas",value:function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=e.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}},{key:"destroy",value:function(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}},{key:"prepareDrawTile",value:function(){this.terrain&&this.terrain.prepareDrawTile()}},{key:"prepareDrawProgram",value:function(t,i,r){if(!this.terrain||!this.terrain.renderingToTexture){var n=this.style.fog;if(n){var a=n.getOpacity(this.transform.pitch),o=function(t,i,r,n,a,o,s,l,u,c,h){var f=t.transform,d=i.properties.get("color").toArray01();d[3]=n;var p=t.frameCounter/1e3%1;return{u_fog_matrix:r?f.calculateFogTileMatrix(r):t.identityMat,u_fog_range:i.getFovAdjustedRange(f._fov),u_fog_color:d,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_temporal_offset:p,u_frustum_tl:a,u_frustum_tr:o,u_frustum_br:s,u_frustum_bl:l,u_globe_pos:u,u_globe_radius:c,u_viewport:h,u_globe_transition:e.globeToMercatorTransition(f.zoom),u_is_globe:+("globe"===f.projection.name)}}(this,n,r,a,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.exported.devicePixelRatio,this.transform.height*e.exported.devicePixelRatio]);i.setFogUniformValues(t,o)}}}},{key:"setTileLoadedFlag",value:function(e){this.tileLoaded=e}},{key:"saveCanvasCopy",value:function(){var e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}},{key:"canvasCopy",value:function(){var e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}},{key:"getCanvasCopiesAndTimestamps",value:function(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}},{key:"averageElevationNeedsEasing",value:function(){if(!this.transform._elevation)return!1;var e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}},{key:"getBackgroundTiles",value:function(){var t,i=this._backgroundTiles,r=this._backgroundTiles={},n=this.transform.coveringTiles({tileSize:512}),a=f(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;r[o.key]=i[o.key]||new e.Tile(o,512,this.transform.tileZoom,this)}}catch(s){a.e(s)}finally{a.f()}return r}},{key:"clearBackgroundTiles",value:function(){this._backgroundTiles={}}}]),t}(),Kr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(d(this,t),isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=r,this.right=n}return p(t,[{key:"interpolate",value:function(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.number(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.number(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.number(t.right,i.right,r)),this}},{key:"getCenter",value:function(t,i){var r=e.clamp((this.left+t-this.right)/2,0,t),n=e.clamp((this.top+i-this.bottom)/2,0,i);return new e.pointGeometry(r,n)}},{key:"equals",value:function(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}},{key:"clone",value:function(){return new t(this.top,this.bottom,this.left,this.right)}},{key:"toJSON",value:function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}]),t}();function Jr(t,i){var r=e.getColumn(t,3);e.fromQuat(t,i),e.setColumn(t,3,r)}function $r(t,i){var r=e.identity$1([]);return e.rotateZ$1(r,r,-i),e.rotateX$1(r,r,-t),r}function Qr(t,i){var r=[t[0],t[1],0],n=[i[0],i[1],0];if(e.length(r)>=1e-15){var a=e.normalize([],r);e.scale$2(n,a,e.dot(n,a)),i[0]=n[0],i[1]=n[1]}var o=e.cross([],i,t);if(e.len(o)<1e-15)return null;var s=Math.atan2(-o[1],o[0]);return $r(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}var en=function(){function t(e,i){d(this,t),this.position=e,this.orientation=i}return p(t,[{key:"position",get:function(){return this._position},set:function(t){if(t){var i=t instanceof e.MercatorCoordinate?t:new e.MercatorCoordinate(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.wrap(i.x,0,1)),this._position=i}else this._position=null}},{key:"lookAtPoint",value:function(t,i){if(this.orientation=null,this.position){var r=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)):0,a=e.MercatorCoordinate.fromLngLat(t,n),o=[a.x-r.x,a.y-r.y,a.z-r.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Qr(o,i)}}},{key:"setPitchBearing",value:function(t,i){this.orientation=$r(e.degToRad(t),e.degToRad(-i))}}]),t}(),tn=function(){function t(i,r){d(this,t),this._transform=e.identity([]),this.orientation=r,this.position=i}return p(t,[{key:"mercatorPosition",get:function(){var t=this.position;return new e.MercatorCoordinate(t[0],t[1],t[2])}},{key:"position",get:function(){var t=e.getColumn(this._transform,3);return[t[0],t[1],t[2]]},set:function(t){var i;t&&e.setColumn(this._transform,3,[(i=t)[0],i[1],i[2],1])}},{key:"orientation",get:function(){return this._orientation},set:function(t){this._orientation=t||e.identity$1([]),t&&Jr(this._transform,this._orientation)}},{key:"getPitchBearing",value:function(){var e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}},{key:"setPitchBearing",value:function(e,t){this._orientation=$r(e,t),Jr(this._transform,this._orientation)}},{key:"forward",value:function(){var t=e.getColumn(this._transform,2);return[-t[0],-t[1],-t[2]]}},{key:"up",value:function(){var t=e.getColumn(this._transform,1);return[-t[0],-t[1],-t[2]]}},{key:"right",value:function(){var t=e.getColumn(this._transform,0);return[t[0],t[1],t[2]]}},{key:"getCameraToWorld",value:function(t,i){var r=new Float64Array(16);return e.invert(r,this.getWorldToCamera(t,i)),r}},{key:"getWorldToCameraPosition",value:function(t,i,r){var n=this.position;e.scale$2(n,n,-t);var a=new Float64Array(16);return e.fromScaling(a,[r,r,r]),e.translate(a,a,n),a[10]*=i,a}},{key:"getWorldToCamera",value:function(t,i){var r=new Float64Array(16),n=new Float64Array(4),a=this.position;return e.conjugate(n,this._orientation),e.scale$2(a,a,-t),e.fromQuat(r,n),e.translate(r,r,a),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}},{key:"getCameraToClipPerspective",value:function(t,i,r,n){var a=new Float64Array(16);return e.perspective(a,t,i,r,n),a}},{key:"getDistanceToElevation",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0===t?0:e.mercatorZfromAltitude(t,i?e.latFromMercatorY(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}},{key:"clone",value:function(){return new t(c(this.position),c(this.orientation))}}]),t}();function rn(t,i){var r=an(t.projection,t.zoom,t.width,t.height),n=function(t,i,r,n,a){var o=new e.LngLat(r.lng-180*on,r.lat),s=new e.LngLat(r.lng+180*on,r.lat),l=t.project(o.lng,o.lat),u=t.project(s.lng,s.lat),c=-Math.atan2(u.y-l.y,u.x-l.x),h=e.MercatorCoordinate.fromLngLat(r);h.y=e.clamp(h.y,-.999975,.999975);var f=h.toLngLat(),d=t.project(f.lng,f.lat),p=e.MercatorCoordinate.fromLngLat(f);p.x+=on;var v=p.toLngLat(),m=t.project(v.lng,v.lat),y=ln(m.x-d.x,m.y-d.y,c),_=e.MercatorCoordinate.fromLngLat(f);_.y+=on;var g=_.toLngLat(),x=t.project(g.lng,g.lat),b=ln(x.x-d.x,x.y-d.y,c),w=Math.abs(y.x)/Math.abs(b.y),k=e.identity([]);e.rotateZ(k,k,-c*(1-(a?0:n)));var T=e.identity([]);return e.scale(T,T,[1,1-(1-w)*n,1]),T[4]=-b.x/b.y*n,e.rotateZ(T,T,c),e.multiply(T,k,T),T}(t.projection,0,t.center,r,i),a=nn(t);return e.scale(n,n,[a,a,1]),n}function nn(t){var i=t.projection,r=an(t.projection,t.zoom,t.width,t.height),n=sn(i,t.center),a=sn(i,e.LngLat.convert(i.center));return Math.pow(2,n*r+(1-r)*a)}function an(t,i,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=t.range;if(!o)return 0;var s=Math.min(a,Math.max(r,n)),l=Math.log(s/1024)/Math.LN2;return e.smoothstep(o[0]+l,o[1]+l,i)}var on=1/4e4;function sn(t,i){var r=e.clamp(i.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),n=new e.LngLat(i.lng-180*on,r),a=new e.LngLat(i.lng+180*on,r),o=t.project(n.lng,r),s=t.project(a.lng,r),l=e.MercatorCoordinate.fromLngLat(n),u=e.MercatorCoordinate.fromLngLat(a),c=s.x-o.x,h=s.y-o.y,f=u.x-l.x,d=u.y-l.y,p=Math.sqrt((f*f+d*d)/(c*c+h*h));return Math.log(p)/Math.LN2}function ln(e,t,i){var r=Math.cos(i),n=Math.sin(i);return{x:e*r-t*n,y:e*n+t*r}}var un=function(){function i(t,r,n,a,o,s,l){d(this,i),this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==a?60:a,this.setProjection(s),this.setMaxBounds(l),this.width=0,this.height=0,this._center=new e.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Kr,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new tn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}return p(i,[{key:"clone",value:function(){var e=new i(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}},{key:"elevation",get:function(){return this._elevation},set:function(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}},{key:"updateElevation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices()}},{key:"getProjection",value:function(){return e.pick(this.projection,["name","center","parallels"])}},{key:"setProjection",value:function(i){this.projectionOptions=i||{name:"mercator"};var r=this.projection?this.getProjection():void 0;this.projection=e.getProjection(this.projectionOptions);var n=!t(r,this.getProjection());return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}},{key:"setMercatorFromTransition",value:function(){var t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.getProjection({name:"mercator"});var i=t!==this.projection.name;return i&&this._calcMatrices(),i}},{key:"minZoom",get:function(){return this._minZoom},set:function(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}},{key:"maxZoom",get:function(){return this._maxZoom},set:function(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}},{key:"minPitch",get:function(){return this._minPitch},set:function(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}},{key:"maxPitch",get:function(){return this._maxPitch},set:function(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}},{key:"renderWorldCopies",get:function(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies},set:function(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}},{key:"worldSize",get:function(){return this.tileSize*this.scale}},{key:"cameraWorldSizeForFog",get:function(){var e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}},{key:"cameraWorldSize",get:function(){var e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}},{key:"pixelsPerMeter",get:function(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}},{key:"cameraPixelsPerMeter",get:function(){return e.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}},{key:"centerOffset",get:function(){return this.centerPoint._sub(this.size._div(2))}},{key:"size",get:function(){return new e.pointGeometry(this.width,this.height)}},{key:"bearing",get:function(){return e.wrap(this.rotation,-180,180)},set:function(e){this.rotation=e}},{key:"rotation",get:function(){return-this.angle/Math.PI*180},set:function(t){var i,r=-t*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=(i=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(i[1]=0,i[2]=0),i[0]=1,i[3]=1,i),function(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);e[0]=r*l+a*s,e[1]=n*l+o*s,e[2]=r*-s+a*l,e[3]=n*-s+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}},{key:"pitch",get:function(){return this._pitch/Math.PI*180},set:function(t){var i=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}},{key:"aspect",get:function(){return this.width/this.height}},{key:"fov",get:function(){return this._fov/Math.PI*180},set:function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.degToRad(t),this._calcMatrices())}},{key:"fovX",get:function(){return this._fov}},{key:"fovY",get:function(){var e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}},{key:"averageElevation",get:function(){return this._averageElevation},set:function(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}},{key:"zoom",get:function(){return this._zoom},set:function(e){var t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}},{key:"_setZoom",value:function(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}},{key:"_updateCameraOnTerrain",value:function(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);var e=this._elevation;this._centerAltitude=e.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=e.exaggeration(),this._updateSeaLevelZoom()}},{key:"_updateSeaLevelZoom",value:function(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}},{key:"sampleAverageElevation",value:function(){if(!this._elevation)return 0;for(var t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop(),n=0,a=0,o=0;ot.maxzoom&&(r=t.maxzoom);var s=this.locationCoordinate(this.center),l=this.center.lat,u=1<=.9)return!0}else if(a&&(s=I(t.aabb.distanceZ(y)*v)),i.projection.isReprojectedInTileSpace&&n<=5){var x=Math.pow(2,t.zoom),b=k(new e.MercatorCoordinate((t.x+.5)/x,(t.y+.5)/x));u=b>.85?1:b}var w=r*r+o*o+s,T=I((1<0;){var L=E.pop(),R=L.x,B=L.y,O=L.fullyVisible;if(!O){var F=L.aabb.intersects(d);if(0===F)continue;O=2===F}if(L.zoom!==M&&P(L))for(var U=0;U<4;U++){var V=(R<<1)+U%2,N=(B<<1)+(U>>1),j={aabb:o?L.aabb.quadrant(U):e.tileAABB(this,u,L.zoom+1,V,N,L.wrap,L.minZ,L.maxZ,this.projection),zoom:L.zoom+1,x:V,y:N,wrap:L.wrap,fullyVisible:O,tileID:void 0,shouldSplit:void 0,minZ:L.minZ,maxZ:L.maxZ};a&&!h&&(j.tileID=new e.OverscaledTileID(L.zoom+1===M?A:L.zoom+1,L.wrap,L.zoom+1,V,N),z(j)),E.push(j)}else{var G=L.zoom===M?A:L.zoom;if(t.minzoom&&t.minzoom>G)continue;var Z=c[0]-(.5+R+(L.wrap<X&&0!==H){var c,h=i.calculateProjMatrix(r.tileID.toUnwrapped());t.isTerrainDEM||(c=u.getMinMaxForTile(r.tileID)),c||(c={min:b,max:x});var f=e.furthestTileCorner(i.rotation),d=[f[0]*e.EXTENT,f[1]*e.EXTENT,c.max];e.transformMat4(d,d,h),l=(1-d[1])*i.height*.51&&void 0!==arguments[1]?arguments[1]:this._centerAltitude;return this.projection.pointCoordinate(this,e.x,e.y,t)}},{key:"pointCoordinate3D",value:function(t){if(!this.elevation)return this.pointCoordinate(t);var i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new e.MercatorCoordinate(i[0],i[1],i[2]);var r=0,n=this.horizonLineFromTop();if(t.y>n)return this.pointCoordinate(t);for(var a=.02*n,o=t.clone(),s=0;s<10&&n-r>a;s++){o.y=e.number(r,n,.66);var l=this.projection.pointCoordinate3D(this,o.x,o.y);l?(n=o.y,i=l):r=o.y}return i?new e.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(t)}},{key:"isPointAboveHorizon",value:function(e){return this.projection.isPointAboveHorizon(this,e)}},{key:"_coordinatePoint",value:function(t,i){var r=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return e.transformMat4$1(n,n,this.pixelMatrix),n[3]>0?new e.pointGeometry(n[0]/n[3],n[1]/n[3]):new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}},{key:"_getBoundsNonRectangular",value:function(){var t=this,i=this._edgeInsets,r=i.top,n=i.left,a=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,s=this.pointLocation3D(new e.pointGeometry(n,r)),l=this.pointLocation3D(new e.pointGeometry(o,r)),u=this.pointLocation3D(new e.pointGeometry(o,a)),c=this.pointLocation3D(new e.pointGeometry(n,a)),f=Math.min(s.lng,l.lng,u.lng,c.lng),d=Math.max(s.lng,l.lng,u.lng,c.lng),p=Math.min(s.lat,l.lat,u.lat,c.lat),v=Math.max(s.lat,l.lat,u.lat,c.lat),m=Math.pow(2,-this.zoom)/16*270,y="globe"===this.projection.name?1:4,_=function i(r,n,a,o,s){var l=(r+a)/2,u=(n+o)/2,c=new e.pointGeometry(l,u),h=t.pointLocation3D(c),_=h.lng,g=h.lat,x=Math.max(0,f-_,p-g,_-d,g-v);f=Math.min(f,_),d=Math.max(d,_),p=Math.min(p,g),v=Math.max(v,g),(sm)&&(i(r,n,l,u,s+1),i(l,u,a,o,s+1))};if(_(n,r,o,r,1),_(o,r,o,a,1),_(o,a,n,a,1),_(n,a,n,r,1),"globe"===this.projection.name){var g=e.polesInViewport(this),x=h(g,2),b=x[0],w=x[1];b?(v=90,d=180,f=-180):w&&(p=-90,d=180,f=-180)}return new e.LngLatBounds(new e.LngLat(f,p),new e.LngLat(d,v))}},{key:"_getBoundsRectangular",value:function(t,i){var r=this._edgeInsets,n=r.top,a=r.left,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,l=new e.pointGeometry(a,n),u=new e.pointGeometry(s,n),c=new e.pointGeometry(s,o),h=new e.pointGeometry(a,o),f=this.pointCoordinate(l,t),d=this.pointCoordinate(u,t),p=this.pointCoordinate(c,i),v=this.pointCoordinate(h,i),m=function(e,t){return(t.y-e.y)/(t.x-e.x)};return f.y>1&&d.y>=0?f=new e.MercatorCoordinate((1-v.y)/m(v,f)+v.x,1):f.y<0&&d.y<=1&&(f=new e.MercatorCoordinate(-v.y/m(v,f)+v.x,0)),d.y>1&&f.y>=0?d=new e.MercatorCoordinate((1-p.y)/m(p,d)+p.x,1):d.y<0&&f.y<=1&&(d=new e.MercatorCoordinate(-p.y/m(p,d)+p.x,0)),(new e.LngLatBounds).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(v)).extend(this.coordinateLocation(p))}},{key:"_getBoundsRectangularTerrain",value:function(){var e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);var t=e.visibleDemTiles.reduce((function(e,t){if(t.dem){var i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}},{key:"getBounds",value:function(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}},{key:"horizonLineFromTop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}},{key:"getMaxBounds",value:function(){return this.maxBounds}},{key:"setMaxBounds",value:function(t){this.maxBounds=t,this.minLat=-e.MAX_MERCATOR_LATITUDE,this.maxLat=e.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng1&&void 0!==arguments[1]&&arguments[1],r=t.key,n=i?this._alignedProjMatrixCache:this._projMatrixCache;if(n[r])return n[r];var a=this.calculatePosMatrix(t,this.worldSize);return e.multiply(a,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:i?this.alignedProjMatrix:this.projMatrix,a),n[r]=new Float32Array(a),n[r]}},{key:"calculatePixelsToTileUnitsMatrix",value:function(t){var i=t.tileID.key,r=this._pixelsToTileUnitsCache;if(r[i])return r[i];var n=function(t,i){var r,n,a,o,s,l,u,c,h=t.tileTransform.scale*e.EXTENT/(t.tileSize*Math.pow(2,i.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return r=new Float32Array(4),o=(n=i.inverseAdjustmentMatrix)[1],s=n[2],l=n[3],c=(a=[h,h])[1],r[0]=n[0]*(u=a[0]),r[1]=o*u,r[2]=s*c,r[3]=l*c,r}(t,this);return r[i]=n,r[i]}},{key:"customLayerMatrix",value:function(){return this.mercatorMatrix.slice()}},{key:"globeToMercatorMatrix",value:function(){if("globe"===this.projection.name){var t=1/this.worldSize,i=e.fromScaling([],[t,t,t]);return e.multiply(i,i,this.globeMatrix),i}}},{key:"recenterOnTerrain",value:function(){if(this._elevation&&"globe"!==this.projection.name){var t=this._elevation;this._updateCameraState();var i=e.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=this._camera.forward(),a=e.mercatorZfromAltitude(1,this._center.lat);r[2]/=a,n[2]/=a,e.normalize(n,n);var o=t.raycast(r,n,t.exaggeration());if(o){var s=e.scaleAndAdd([],r,n,o),l=new e.MercatorCoordinate(s[0],s[1],e.mercatorZfromAltitude(s[2],e.latFromMercatorY(s[1]))),u=(l.z+e.length([l.x-r[0],l.y-r[1],l.z-r[2]*a]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(u),this._centerAltitude=l.toAltitude(),this._center=this.coordinateLocation(l),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}}},{key:"_constrainCamera",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._elevation){var i=this._elevation,r=e.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(r),o=i.getAtPointOrZero(a(e.MercatorCoordinate,c(n))),s=this.pixelsPerMeter/this.worldSize*o,l=this._minimumHeightOverTerrain(),u=n[2]-s;if(u<=l)if(u<0||t){var h=this.locationCoordinate(this._center,this._centerAltitude),f=[n[0],n[1],h.z-n[2]],d=e.length(f);f[2]-=(l-u)/this._pixelsPerMercatorPixel;var p=e.length(f);if(0===p)return;e.scale$2(f,f,d/p*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],h.z*this._pixelsPerMercatorPixel-f[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}}},{key:"_constrain",value:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){var i=this.center;return i.lat=e.clamp(i.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(i.lng=e.clamp(i.lng,this.minLng,this.maxLng)),this.center=i,void(this._constraining=!1)}var r=this._unmodified,n=this.point,a=n.x,o=n.y,s=0,l=a,u=o,c=this.width/2,h=this.height/2,f=this.worldMinY*this.scale,d=this.worldMaxY*this.scale;if(o-hd&&(u=d-h),d-fv&&(l=v-c),v-p.5?b-1:b,w>.5?w-1:w,0]),this.alignedProjMatrix=k,s=e.create(),e.scale(s,s,[this.width/2,-this.height/2,1]),e.translate(s,s,[1,-1,0]),this.labelPlaneMatrix=s,s=e.create(),e.scale(s,s,[1,-1,1]),e.translate(s,s,[-1,-1,0]),e.scale(s,s,[2/this.width,2/this.height,1]),this.glCoordMatrix=s,this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(s=e.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=s,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.calculateGlobeMatrix(this);var T=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.transformMat4(T,T,a),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=s;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}}},{key:"_calcFogMatrices",value:function(){this._fogTileMatrixCache={};var t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,a=[t,t,i];e.scale$2(a,a,n),e.scale$2(r,r,-1),e.multiply$2(r,r,a);var o=e.create();e.translate(o,o,r),e.scale(o,o,a),this.mercatorFogMatrix=o,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,n)}},{key:"_computeCameraPosition",value:function(e){var t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,e/this.worldSize*this._centerAltitude-i[2]*n]}},{key:"_updateCameraState",value:function(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}},{key:"_translateCameraConstrained",value:function(t){var i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=t[2],a=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(a=Math.min((i-r)/n,1)),this._camera.position=e.scaleAndAdd([],this._camera.position,t,a),this._updateStateFromCamera()}},{key:"_updateStateFromCamera",value:function(){var t=this._camera.position,i=this._camera.forward(),r=this._camera.getPitchBearing(),n=r.pitch,a=r.bearing,o=e.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.degToRad(this._maxPitch)),l=Math.max((t[2]-o)/Math.cos(n),s),u=this._zoomFromMercatorZ(l);e.scaleAndAdd(t,t,i,l),this._pitch=e.clamp(n,e.degToRad(this.minPitch),e.degToRad(this.maxPitch)),this.angle=e.wrap(a,-Math.PI,Math.PI),this._setZoom(e.clamp(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.MercatorCoordinate(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}},{key:"_worldSizeFromZoom",value:function(e){return Math.pow(2,e)*this.tileSize}},{key:"_mercatorZfromZoom",value:function(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}},{key:"_minimumHeightOverTerrain",value:function(){var e=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(e)}},{key:"_zoomFromMercatorZ",value:function(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}},{key:"zoomFromMercatorZAdjusted",value:function(t){for(var i=0,r=e.GLOBE_ZOOM_THRESHOLD_MAX,n=0,a=1/0;r-i>1e-6&&r>i;){var o=i+.5*(r-i),s=this.tileSize*Math.pow(2,o),l=this.getCameraToCenterDistance(this.projection,o,s),u=this.scaleZoom(l/(t*this.tileSize)),c=Math.abs(o-u);cu||p.y>1)return!0}return!1}},{key:"isHorizonVisible",value:function(){return this.pitch+e.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.pointGeometry(0,0),new e.pointGeometry(this.width,this.height))}},{key:"zoomDeltaToMovement",value:function(t,i){var r=e.length(e.sub([],this._camera.position,t)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}},{key:"getCameraPoint",value:function(){if("globe"===this.projection.name){var t=function(t,i){var r=h(t,3),n=[r[0],r[1],r[2],1];e.transformMat4$1(n,n,i);var a=n[3]=Math.max(n[3],1e-6);return n[0]/=a,n[1]/=a,n[2]/=a,n}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.pointGeometry(t[0],t[1])}var i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.pointGeometry(0,i))}},{key:"getCameraToCenterDistance",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.zoom,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.worldSize,r=an(e,t,this.width,this.height,1024),n=e.pixelSpaceConversion(this.center.lat,i,r);return.5/Math.tan(.5*this._fov)*this.height*n}},{key:"getWorldToCameraMatrix",value:function(){var t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.multiply(t,t,this.globeMatrix),t}}]),i}();function cn(e,t){var i=!1,r=null,n=function n(){r=null,i&&(e(),r=setTimeout(n,t),i=!1)};return function(){return i=!0,r||n(),r}}var hn=function(){function t(i){d(this,t),this._hashName=i&&encodeURIComponent(i),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=cn(this._updateHashUnthrottled.bind(this),300)}return p(t,[{key:"addTo",value:function(t){return this._map=t,e.window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}},{key:"remove",value:function(){return this._map?(this._map.off("moveend",this._updateHash),e.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}},{key:"getHashString",value:function(){var t=this._map;if(!t)return"";var i=fn(t);if(this._hashName){var r=this._hashName,n=!1,a=e.window.location.hash.slice(1).split("&").map((function(e){var t=e.split("=")[0];return t===r?(n=!0,"".concat(t,"=").concat(i)):e})).filter((function(e){return e}));return n||a.push("".concat(r,"=").concat(i)),"#".concat(a.join("&"))}return"#".concat(i)}},{key:"_getCurrentHash",value:function(){var t,i=this,r=e.window.location.hash.replace("#","");return this._hashName?(r.split("&").map((function(e){return e.split("=")})).forEach((function(e){e[0]===i._hashName&&(t=e)})),(t&&t[1]||"").split("/")):r.split("/")}},{key:"_onHashChange",value:function(){var e=this._map;if(!e)return!1;var t=this._getCurrentHash();if(t.length>=3&&!t.some((function(e){return isNaN(e)}))){var i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}},{key:"_updateHashUnthrottled",value:function(){var t=e.window.location.href.replace(/(#.+)?$/,this.getHashString());e.window.history.replaceState(e.window.history.state,null,t)}}]),t}();function fn(e,t){var i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,n),o=Math.round(i.lng*a)/a,s=Math.round(i.lat*a)/a,l=e.getBearing(),u=e.getPitch(),c=t?"/".concat(o,"/").concat(s,"/").concat(r):"".concat(r,"/").concat(s,"/").concat(o);return(l||u)&&(c+="/"+Math.round(10*l)/10),u&&(c+="/".concat(Math.round(u))),c}var dn={linearity:.3,easing:e.bezier(0,0,.3,1)},pn=e.extend({deceleration:2500,maxSpeed:1400},dn),vn=e.extend({deceleration:20,maxSpeed:1400},dn),mn=e.extend({deceleration:1e3,maxSpeed:360},dn),yn=e.extend({deceleration:1e3,maxSpeed:90},dn),_n=function(){function t(e){d(this,t),this._map=e,this.clear()}return p(t,[{key:"clear",value:function(){this._inertiaBuffer=[]}},{key:"record",value:function(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}},{key:"_drainInertiaBuffer",value:function(){for(var t=this._inertiaBuffer,i=e.exported.now();t.length>0&&i-t[0].time>160;)t.shift()}},{key:"_onMoveEnd",value:function(t){if(!e.exported.prefersReducedMotion&&(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2))){var i,r={zoom:0,bearing:0,pitch:0,pan:new e.pointGeometry(0,0),pinchAround:void 0,around:void 0},n=f(this._inertiaBuffer);try{for(n.s();!(i=n.n()).done;){var a=i.value.settings;r.zoom+=a.zoomDelta||0,r.bearing+=a.bearingDelta||0,r.pitch+=a.pitchDelta||0,a.panDelta&&r.pan._add(a.panDelta),a.around&&(r.around=a.around),a.pinchAround&&(r.pinchAround=a.pinchAround)}}catch(p){n.e(p)}finally{n.f()}var o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(r.pan.mag()){var l=xn(r.pan.mag(),o,e.extend({},pn,t||{}));s.offset=r.pan.mult(l.amount/r.pan.mag()),s.center=this._map.transform.center,gn(s,l)}if(r.zoom){var u=xn(r.zoom,o,vn);s.zoom=this._map.transform.zoom+u.amount,gn(s,u)}if(r.bearing){var c=xn(r.bearing,o,mn);s.bearing=this._map.transform.bearing+e.clamp(c.amount,-179,179),gn(s,c)}if(r.pitch){var h=xn(r.pitch,o,yn);s.pitch=this._map.transform.pitch+h.amount,gn(s,h)}if(s.zoom||s.bearing){var d=void 0===r.pinchAround?r.around:r.pinchAround;s.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),s.noMoveStart=!0,s}}}]),t}();function gn(e,t){(!e.duration||e.duration3&&void 0!==arguments[3]?arguments[3]:{};d(this,r);var l=M(n.getCanvasContainer(),a),u=n.unproject(l);return(o=i.call(this,t,e.extend({point:l,lngLat:u,originalEvent:a},s)))._defaultPrevented=!1,o.target=n,o}return p(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(e.Event),wn=function(t){v(r,t);var i=m(r);function r(t,n,a){var o;d(this,r);var s="touchend"===t?a.changedTouches:a.touches,l=A(n.getCanvasContainer(),s),u=l.map((function(e){return n.unproject(e)})),c=l.reduce((function(e,t,i,r){return e.add(t.div(r.length))}),new e.pointGeometry(0,0));return(o=i.call(this,t,{points:l,point:c,lngLats:u,lngLat:n.unproject(c),originalEvent:a}))._defaultPrevented=!1,o}return p(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(e.Event),kn=function(e){v(i,e);var t=m(i);function i(e,r,n){var a;return d(this,i),(a=t.call(this,e,{originalEvent:n}))._defaultPrevented=!1,a}return p(i,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),i}(e.Event),Tn=function(){function t(e,i){d(this,t),this._map=e,this._clickTolerance=i.clickTolerance}return p(t,[{key:"reset",value:function(){this._mousedownPos=void 0}},{key:"wheel",value:function(e){return this._firePreventable(new kn(e.type,this._map,e))}},{key:"mousedown",value:function(e,t){return this._mousedownPos=t,this._firePreventable(new bn(e.type,this._map,e))}},{key:"mouseup",value:function(e){this._map.fire(new bn(e.type,this._map,e))}},{key:"preclick",value:function(t){var i=e.extend({},t);i.type="preclick",this._map.fire(new bn(i.type,this._map,i))}},{key:"click",value:function(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new bn(e.type,this._map,e)))}},{key:"dblclick",value:function(e){return this._firePreventable(new bn(e.type,this._map,e))}},{key:"mouseover",value:function(e){this._map.fire(new bn(e.type,this._map,e))}},{key:"mouseout",value:function(e){this._map.fire(new bn(e.type,this._map,e))}},{key:"touchstart",value:function(e){return this._firePreventable(new wn(e.type,this._map,e))}},{key:"touchmove",value:function(e){this._map.fire(new wn(e.type,this._map,e))}},{key:"touchend",value:function(e){this._map.fire(new wn(e.type,this._map,e))}},{key:"touchcancel",value:function(e){this._map.fire(new wn(e.type,this._map,e))}},{key:"_firePreventable",value:function(e){if(this._map.fire(e),e.defaultPrevented)return{}}},{key:"isEnabled",value:function(){return!0}},{key:"isActive",value:function(){return!1}},{key:"enable",value:function(){}},{key:"disable",value:function(){}}]),t}(),En=function(){function e(t){d(this,e),this._map=t}return p(e,[{key:"reset",value:function(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}},{key:"mousemove",value:function(e){this._map.fire(new bn(e.type,this._map,e))}},{key:"mousedown",value:function(){this._delayContextMenu=!0}},{key:"mouseup",value:function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new bn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}},{key:"contextmenu",value:function(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new bn(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}},{key:"isEnabled",value:function(){return!0}},{key:"isActive",value:function(){return!1}},{key:"enable",value:function(){}},{key:"disable",value:function(){}}]),e}(),Sn=function(){function t(e,i){d(this,t),this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}return p(t,[{key:"isEnabled",value:function(){return!!this._enabled}},{key:"isActive",value:function(){return!!this._active}},{key:"enable",value:function(){this.isEnabled()||(this._enabled=!0)}},{key:"disable",value:function(){this.isEnabled()&&(this._enabled=!1)}},{key:"mousedown",value:function(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(k(),this._startPos=this._lastPos=t,this._active=!0)}},{key:"mousemoveWindow",value:function(e,t){var i=this;if(this._active){var r=t,n=this._startPos,a=this._lastPos;if(!(!n||!a||a.equals(r)||!this._box&&r.dist(n)this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){var i,r=new e.pointGeometry(0,0),n=f(t);try{for(n.s();!(i=n.n()).done;){var a=i.value;r._add(a)}}catch(o){n.e(o)}finally{n.f()}return r.div(t.length)}(i),this.touches=Mn(r,i)))}},{key:"touchmove",value:function(e,t,i){if(!this.aborted&&this.centroid){var r=Mn(i,t);for(var n in this.touches){var a=this.touches[n],o=r[n];(!o||o.dist(a)>30)&&(this.aborted=!0)}}}},{key:"touchend",value:function(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){var r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}}]),t}(),In=function(){function e(t){d(this,e),this.singleTap=new An(t),this.numTaps=t.numTaps,this.reset()}return p(e,[{key:"reset",value:function(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}},{key:"touchstart",value:function(e,t,i){this.singleTap.touchstart(e,t,i)}},{key:"touchmove",value:function(e,t,i){this.singleTap.touchmove(e,t,i)}},{key:"touchend",value:function(e,t,i){var r=this.singleTap.touchend(e,t,i);if(r){var n=e.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(r)<30;if(n&&a||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}]),e}(),Cn=function(){function e(){d(this,e),this._zoomIn=new In({numTouches:1,numTaps:2}),this._zoomOut=new In({numTouches:2,numTaps:1}),this.reset()}return p(e,[{key:"reset",value:function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}},{key:"touchstart",value:function(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}},{key:"touchmove",value:function(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}},{key:"touchend",value:function(e,t,i){var r=this,n=this._zoomIn.touchend(e,t,i),a=this._zoomOut.touchend(e,t,i);return n?(this._active=!0,e.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(t){return t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(n)},{originalEvent:e})}}):a?(this._active=!0,e.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(t){return t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(a)},{originalEvent:e})}}):void 0}},{key:"touchcancel",value:function(){this.reset()}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}(),zn={0:1,2:2},Pn=function(){function e(t){d(this,e),this.reset(),this._clickTolerance=t.clickTolerance||1}return p(e,[{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}},{key:"_correctButton",value:function(e,t){return!1}},{key:"_move",value:function(e,t){return{}}},{key:"mousedown",value:function(e,t){if(!this._lastPoint){var i=I(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}}},{key:"mousemoveWindow",value:function(e,t){var i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){var i=zn[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)0&&(this._active=!0);var n=Mn(r,i),a=new e.pointGeometry(0,0),o=new e.pointGeometry(0,0),s=0;for(var l in n){var u=n[l],c=this._touches[l];c&&(a._add(u),o._add(u.sub(c)),s++,n[l]=u)}if(this._touches=n,!(sMath.abs(e.x)}var Zn=function(t){v(r,t);var i=m(r);function r(e){var t;return d(this,r),(t=i.call(this))._map=e,t}return p(r,[{key:"reset",value:function(){o(s(r.prototype),"reset",this).call(this),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}},{key:"_start",value:function(e){this._lastPoints=e,Gn(e[0].sub(e[1]))&&(this._valid=!1)}},{key:"_move",value:function(t,i,r){var n=this._lastPoints;if(n){var a=t[0].sub(n[0]),o=t[1].sub(n[1]);return this._map._cooperativeGestures&&!e.isFullscreen()&&r.touches.length<3||(this._valid=this.gestureBeginsVertically(a,o,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+o.y)/2*-.5})}}},{key:"gestureBeginsVertically",value:function(e,t,i){if(void 0!==this._valid)return this._valid;var r=e.mag()>=2,n=t.mag()>=2;if(r||n){if(!r||!n)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;var a=e.y>0==t.y>0;return Gn(e)&&Gn(t)&&a}}}]),r}(On),qn={panStep:100,bearingStep:15,pitchStep:10},Wn=function(){function e(){d(this,e);var t=qn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}return p(e,[{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1}},{key:"keydown",value:function(e){var t=this;if(!(e.altKey||e.ctrlKey||e.metaKey)){var i=0,r=0,n=0,a=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,n=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Xn,zoom:i?Math.round(l)+i*(e.shiftKey?2:1):l,bearing:s.getBearing()+r*t._bearingStep,pitch:s.getPitch()+n*t._pitchStep,offset:[-a*t._panStep,-o*t._panStep],center:s.getCenter()},{originalEvent:e})}}}}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}},{key:"disableRotation",value:function(){this._rotationDisabled=!0}},{key:"enableRotation",value:function(){this._rotationDisabled=!1}}]),e}();function Xn(e){return e*(2-e)}var Hn=4.000244140625,Yn=function(){function t(i,r){d(this,t),this._map=i,this._el=i.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}return p(t,[{key:"setZoomRate",value:function(e){this._defaultZoomRate=e}},{key:"setWheelZoomRate",value:function(e){this._wheelZoomRate=e}},{key:"isEnabled",value:function(){return!!this._enabled}},{key:"isActive",value:function(){return this._active||void 0!==this._finishTimeout}},{key:"isZooming",value:function(){return!!this._zooming}},{key:"enable",value:function(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}},{key:"disable",value:function(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}},{key:"wheel",value:function(t){if(this.isEnabled()){if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}var i=t.deltaMode===e.window.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,r=e.exported.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Hn==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}}},{key:"_onTimeout",value:function(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}},{key:"_start",value:function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var t=M(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}}},{key:"renderFrame",value:function(){var t=this;if(this._frameId&&(this._frameId=null,this.isActive())){var i=this._map.transform;"wheel"===this._type&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);var r=function(){return i._terrainEnabled()&&t._aroundCoord?i.computeZoomRelativeTo(t._aroundCoord):i.zoom};if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>Hn?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==a&&(a=1/a);var o=r(),s=Math.pow(2,o),l="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(l*a))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._delta=0}var u,c="number"==typeof this._targetZoom?this._targetZoom:r(),h=this._startZoom,f=this._easing,d=!1;if("wheel"===this._type&&h&&f){var p=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),v=f(p);u=e.number(h,c,v),p<1?this._frameId||(this._frameId=!0):d=!0}else u=c,d=!0;return this._active=!0,d&&(this._active=!1,this._finishTimeout=setTimeout((function(){t._zooming=!1,t._handler._triggerRenderFrame(),delete t._targetZoom,delete t._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!d,zoomDelta:u-r(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}}},{key:"_smoothOutEasing",value:function(t){var i=e.ease;if(this._prevEase){var r=this._prevEase,n=(e.exported.now()-r.start)/r.duration,a=r.easing(n+.01)-r.easing(n),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=e.bezier(o,s,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:i},i}},{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1}},{key:"_addScrollZoomBlocker",value:function(){this._map&&!this._alertContainer&&(this._alertContainer=_("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(e.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize="".concat(Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth))),"px"))}},{key:"_showBlockerAlert",value:function(){var e=this;this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout((function(){e._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),e._alertContainer.setAttribute("role","null")}),200)}}]),t}(),Kn=function(){function e(t,i){d(this,e),this._clickZoom=t,this._tapZoom=i}return p(e,[{key:"enable",value:function(){this._clickZoom.enable(),this._tapZoom.enable()}},{key:"disable",value:function(){this._clickZoom.disable(),this._tapZoom.disable()}},{key:"isEnabled",value:function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}},{key:"isActive",value:function(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}]),e}(),Jn=function(){function e(){d(this,e),this.reset()}return p(e,[{key:"reset",value:function(){this._active=!1}},{key:"blur",value:function(){this.reset()}},{key:"dblclick",value:function(e,t){return e.preventDefault(),{cameraAnimation:function(i){i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}(),$n=function(){function e(){d(this,e),this._tap=new In({numTouches:1,numTaps:1}),this.reset()}return p(e,[{key:"reset",value:function(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}},{key:"touchstart",value:function(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}},{key:"touchmove",value:function(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;var r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}},{key:"touchend",value:function(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}},{key:"touchcancel",value:function(){this.reset()}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}(),Qn=function(){function e(t,i,r){d(this,e),this._el=t,this._mousePan=i,this._touchPan=r}return p(e,[{key:"enable",value:function(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}},{key:"disable",value:function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}},{key:"isEnabled",value:function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}},{key:"isActive",value:function(){return this._mousePan.isActive()||this._touchPan.isActive()}}]),e}(),ea=function(){function e(t,i,r){d(this,e),this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}return p(e,[{key:"enable",value:function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}},{key:"disable",value:function(){this._mouseRotate.disable(),this._mousePitch.disable()}},{key:"isEnabled",value:function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}},{key:"isActive",value:function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}]),e}(),ta=function(){function e(t,i,r,n){d(this,e),this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}return p(e,[{key:"enable",value:function(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}},{key:"disable",value:function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}},{key:"isEnabled",value:function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}},{key:"isActive",value:function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}},{key:"disableRotation",value:function(){this._rotationDisabled=!0,this._touchRotate.disable()}},{key:"enableRotation",value:function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}]),e}(),ia=function(e){return e.zoom||e.drag||e.pitch||e.rotate},ra=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i)}(e.Event),na=function(){function t(){d(this,t),this.constants=[1,1,.01],this.radius=0}return p(t,[{key:"setup",value:function(t,i){var r=e.sub([],i,t);this.radius=e.length(r[2]<0?e.div([],r,this.constants):[r[0],r[1],0])}},{key:"projectRay",value:function(t){e.div(t,t,this.constants),e.normalize(t,t),e.mul$1(t,t,this.constants);var i=e.scale$2([],t,this.radius);if(i[2]>0){var r=e.scale$2([],[0,0,1],e.dot(i,[0,0,1])),n=e.scale$2([],e.normalize([],[i[0],i[1],0]),this.radius),a=e.add([],i,e.scale$2([],e.sub([],e.add([],n,r),i),2));i[0]=a[0],i[1]=a[1]}return i}}]),t}();function aa(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}var oa=function(){function t(i,r){d(this,t),this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _n(i),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new na,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.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],[e.window.document,"mousemove",{capture:!0}],[e.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],[e.window,"blur",void 0]];var a,o=f(this._listeners);try{for(o.s();!(a=o.n()).done;){var s=h(a.value,3),l=s[0],u=s[1],c=s[2];l.addEventListener(u,l===e.window.document?this.handleWindowEvent:this.handleEvent,c)}}catch(p){o.e(p)}finally{o.f()}}return p(t,[{key:"destroy",value:function(){var t,i=f(this._listeners);try{for(i.s();!(t=i.n()).done;){var r=h(t.value,3),n=r[0],a=r[1],o=r[2];n.removeEventListener(a,n===e.window.document?this.handleWindowEvent:this.handleEvent,o)}}catch(s){i.e(s)}finally{i.f()}}},{key:"_addDefaultHandlers",value:function(e){var t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new Tn(t,e));var r=t.boxZoom=new Sn(t,e);this._add("boxZoom",r);var n=new Cn,a=new Jn;t.doubleClickZoom=new Kn(a,n),this._add("tapZoom",n),this._add("clickZoom",a);var o=new $n;this._add("tapDragZoom",o);var s=t.touchPitch=new Zn(t);this._add("touchPitch",s);var l=new Ln(e),u=new Rn(e);t.dragRotate=new ea(e,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);var c=new Dn(e),h=new Bn(t,e);t.dragPan=new Qn(i,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);var f=new jn,d=new Vn;t.touchZoomRotate=new ta(i,d,f,o),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]),this._add("blockableMapEvent",new En(t));var p=t.scrollZoom=new Yn(t,this);this._add("scrollZoom",p,["mousePan"]);var v=t.keyboard=new Wn;this._add("keyboard",v);for(var m=0,y=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];m0&&(c=0),o._isCameraConstrained=!1),void 0!==v&&(d=v),(c||i.drag&&!n._eventsInProgress.drag)&&d&&(this._dragOrigin=s(o.pointCoordinate3D(d)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",a._stop(!0),d=d||a.transform.centerPoint,h&&(o.bearing+=h),f&&(o.pitch+=f),o._updateCameraState();var m=[0,0,0];if(u)if("mercator"===o.projection.name){var y=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(d).dir),_=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(d.sub(u)).dir);m[0]=_[0]-y[0],m[1]=_[1]-y[1]}else{var g=o.pointCoordinate(d);if("globe"===o.projection.name){u=u.rotate(-o.angle);var x=o._pixelsPerMercatorPixel/o.worldSize;m[0]=-u.x*e.mercatorScale(e.latFromMercatorY(g.y))*x,m[1]=-u.y*e.mercatorScale(o.center.lat)*x}else{var b=o.pointCoordinate(d.sub(u));g&&b&&(m[0]=b.x-g.x,m[1]=b.y-g.y)}}var w=o.zoom,k=[0,0,0];if(c){var T=s(p||o.pointCoordinate3D(d)),E={dir:e.normalize([],e.sub([],T,o._camera.position))};if(E.dir[2]<0){var S=o.zoomDeltaToMovement(T,c);e.scale$2(k,E.dir,S)}}var M=e.add(m,m,k);o._translateCameraConstrained(M),c&&Math.abs(o.zoom-w)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}else this._fireEvents(i,r,!0)}},{key:"_fireEvents",value:function(t,i,r){var n=this,a=ia(this._eventsInProgress),o=ia(t),s={};for(var l in t){var u=t[l].originalEvent;this._eventsInProgress[l]||(s["".concat(l,"start")]=u),this._eventsInProgress[l]=t[l]}for(var c in!a&&o&&this._fireEvent("movestart",o.originalEvent),s)this._fireEvent(c,s[c]);for(var h in o&&this._fireEvent("move",o.originalEvent),t){var f=t[h].originalEvent;this._fireEvent(h,f)}var d,p={};for(var v in this._eventsInProgress){var m=this._eventsInProgress[v],y=m.handlerName,_=m.originalEvent;this._handlersById[y].isActive()||(delete this._eventsInProgress[v],d=i[y]||_,p["".concat(v,"end")]=d)}for(var g in p)this._fireEvent(g,p[g]);var x=ia(this._eventsInProgress);if(r&&(a||o)&&!x){this._updatingCamera=!0;var b=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),w=function(e){return 0!==e&&-n._bearingSnape.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}},{key:"_cameraForBoundsOnGlobe",value:function(t,i,r,n,a,o){var s=t.clone(),l=this._extendCameraOptions(o);s.bearing=n,s.pitch=a;var u=e.LngLat.convert(i),c=e.LngLat.convert(r),h=.5*(u.lat+c.lat),f=.5*(u.lng+c.lng),d=e.latLngToECEF(h,f),p=e.normalize([],d),v=e.normalize([],e.cross([],p,[0,1,0])),m=e.cross([],v,p),y=[v[0],v[1],v[2],0,m[0],m[1],m[2],0,p[0],p[1],p[2],0,0,0,0,1],_=[d,e.latLngToECEF(u.lat,u.lng),e.latLngToECEF(c.lat,u.lng),e.latLngToECEF(c.lat,c.lng),e.latLngToECEF(u.lat,c.lng),e.latLngToECEF(h,u.lng),e.latLngToECEF(h,c.lng),e.latLngToECEF(u.lat,f),e.latLngToECEF(c.lat,f)],g=e.Aabb.fromPoints(_.map((function(t){return[e.dot(v,t),e.dot(m,t),e.dot(p,t)]}))),x=e.transformMat4([],g.center,y);0===e.squaredLength(x)&&e.set(x,0,0,1),e.normalize(x,x),e.scale$2(x,x,e.GLOBE_RADIUS),s.center=e.ecefToLatLng(x);var b=s.getWorldToCameraMatrix(),w=e.invert(new Float64Array(16),b);g=e.Aabb.applyTransform(g,e.multiply([],b,y)),e.transformMat4(x,x,b);var k=.5*(g.max[2]-g.min[2]),T=this._minimumAABBFrustumDistance(s,g),E=e.scale$2([],[0,0,1],k),S=e.add(E,x,E),M=T+(0===s.pitch?0:e.distance(x,S)),A=s.globeCenterInViewSpace,I=e.sub([],x,[A[0],A[1],A[2]]);e.normalize(I,I),e.scale$2(I,I,M);var C=e.add([],x,I);e.transformMat4(C,C,w);var z=e.earthRadius/e.GLOBE_RADIUS,P=e.length(C),D=e.mercatorZfromAltitude(Math.max(P*z-e.earthRadius,Number.EPSILON),0),L=Math.min(s.zoomFromMercatorZAdjusted(D),l.maxZoom);return L>.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"mercator"}),s.zoom=L,this._cameraForBounds(s,i,r,n,a,o)):{center:s.center,zoom:L,bearing:n,pitch:a}}},{key:"queryTerrainElevation",value:function(t,i){var r=this.transform.elevation;return r?(i=e.extend({},{exaggerated:!0},i),r.getAtPoint(e.MercatorCoordinate.fromLngLat(t),null,i.exaggerated)):null}},{key:"_cameraForBounds",value:function(t,i,r,n,a,o){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,r,n,a,o);var s=t.clone(),l=this._extendCameraOptions(o),u=s.padding;s.bearing=n,s.pitch=a;var c=e.LngLat.convert(i),h=e.LngLat.convert(r),f=new e.LngLat(c.lng,h.lat),d=new e.LngLat(h.lng,c.lat),p=s.project(c),v=s.project(h),m=this.queryTerrainElevation(c),y=this.queryTerrainElevation(h),_=this.queryTerrainElevation(f),g=this.queryTerrainElevation(d),x=[[p.x,p.y,Math.min(m||0,y||0,_||0,g||0)],[v.x,v.y,Math.max(m||0,y||0,_||0,g||0)]],b=e.Aabb.fromPoints(x),w=s.getWorldToCameraMatrix(),k=e.invert(new Float64Array(16),w);b=e.Aabb.applyTransform(b,w);var T=e.sub([],b.max,b.min),E=u.left||0,S=u.right||0,M=u.bottom||0,A=u.top||0,I=l.padding,C=I.left,z=I.right,P=I.top,D=I.bottom,L=.5*(E+S),R=.5*(A+M),B=Math.min(s.scaleZoom(s.scale*Math.min((s.width-(E+S+C+z))/T[0],(s.height-(M+A+D+P))/T[1])),l.maxZoom),O=s.scale/s.zoomScale(B);b=new e.Aabb([b.min[0]-(C+L)*O,b.min[1]-(D+R)*O,b.min[2]],[b.max[0]+(z+L)*O,b.max[1]+(P+R)*O,b.max[2]]);var F=.5*T[2],U=this._minimumAABBFrustumDistance(s,b),V=[0,0,1,0];e.transformMat4$1(V,V,w),e.normalize$2(V,V);var N=e.scale$2([],V,U+F),j=e.add([],b.center,N),G=("number"==typeof l.offset.x&&"number"==typeof l.offset.y?new e.pointGeometry(l.offset.x,l.offset.y):e.pointGeometry.convert(l.offset)).rotate(-e.degToRad(n));b.center[0]-=G.x*O,b.center[1]+=G.y*O,e.transformMat4(b.center,b.center,k),e.transformMat4(j,j,k);var Z=[b.center[0],b.center[1],j[2]*s.pixelsPerMeter];e.scale$2(Z,Z,1/s.worldSize);var q=e.lngFromMercatorX(Z[0]),W=e.latFromMercatorY(Z[1]),X=Math.min(s._zoomFromMercatorZ(Z[2]),l.maxZoom),H=new e.LngLat(q,W);return s.mercatorFromTransition&&X<.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"globe"}),s.zoom=X,this._cameraForBounds(s,i,r,n,a,o)):{center:H,zoom:X,bearing:n,pitch:a}}},{key:"fitBounds",value:function(e,t,i){var r=this.cameraForBounds(e,t);return this._fitInternal(r,t,i)}},{key:"fitScreenCoordinates",value:function(t,i,r,n,a){var o=e.pointGeometry.convert(t),s=e.pointGeometry.convert(i),l=new e.pointGeometry(Math.min(o.x,s.x),Math.min(o.y,s.y)),u=new e.pointGeometry(Math.max(o.x,s.x),Math.max(o.y,s.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(o,s))return this;var c=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(u),f=this.transform.pointLocation3D(new e.pointGeometry(l.x,u.y)),d=this.transform.pointLocation3D(new e.pointGeometry(u.x,l.y)),p=[Math.min(c.lng,h.lng,f.lng,d.lng),Math.min(c.lat,h.lat,f.lat,d.lat)],v=[Math.max(c.lng,h.lng,f.lng,d.lng),Math.max(c.lat,h.lat,f.lat,d.lat)],m=n&&n.pitch?n.pitch:this.getPitch(),y=this._cameraForBounds(this.transform,p,v,r,m,n);return this._fitInternal(y,n,a)}},{key:"_fitInternal",value:function(t,i,r){return t?(delete(i=e.extend(t,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}},{key:"jumpTo",value:function(t,i){this.stop();var r=t.preloadOnly?this.transform.clone():this.transform,n=!1,a=!1,o=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.LngLat.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(a=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.pitch=+t.pitch),null==t.padding||r.isPaddingEqual(t.padding)||(r.padding=t.padding),t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),n&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),a&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),o&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)))}},{key:"getFreeCameraOptions",value:function(){return this.transform.projection.supportsFreeCamera||e.warnOnce(sa),this.transform.getFreeCameraOptions()}},{key:"setFreeCameraOptions",value:function(t,i){var r=this.transform;if(!r.projection.supportsFreeCamera)return e.warnOnce(sa),this;this.stop();var n=r.zoom,a=r.pitch,o=r.bearing;r.setFreeCameraOptions(t);var s=n!==r.zoom,l=a!==r.pitch,u=o!==r.bearing;return this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),s&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),u&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),l&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)),this}},{key:"easeTo",value:function(t,i){var r=this;this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||!t.essential&&e.exported.prefersReducedMotion)&&(t.duration=0);var n,a,o,s=this.transform,l=this.getZoom(),u=this.getBearing(),c=this.getPitch(),h=this.getPadding(),f="zoom"in t?+t.zoom:l,d="bearing"in t?this._normalizeBearing(t.bearing,u):u,p="pitch"in t?+t.pitch:c,v="padding"in t?t.padding:s.padding,m=e.pointGeometry.convert(t.offset);if("globe"===s.projection.name){var y=e.MercatorCoordinate.fromLngLat(s.center),_=m.rotate(-s.angle);y.x+=_.x/s.worldSize,y.y+=_.y/s.worldSize;var g=y.toLngLat(),x=e.LngLat.convert(t.center||g);this._normalizeCenter(x),n=s.centerPoint.add(_),a=new e.pointGeometry(y.x,y.y).mult(s.worldSize),o=new e.pointGeometry(e.mercatorXfromLng(x.lng),e.mercatorYfromLat(x.lat)).mult(s.worldSize).sub(a)}else{n=s.centerPoint.add(m);var b=s.pointLocation(n),w=e.LngLat.convert(t.center||b);this._normalizeCenter(w),a=s.project(b),o=s.project(w).sub(a)}var k,T,E=s.zoomScale(f-l);t.around&&(k=e.LngLat.convert(t.around),T=s.locationPoint(k));var S=this._zooming||f!==l,M=this._rotating||u!==d,A=this._pitching||p!==c,I=!s.isPaddingEqual(v),C=function(s){return function(y){if(S&&(s.zoom=e.number(l,f,y)),M&&(s.bearing=e.number(u,d,y)),A&&(s.pitch=e.number(c,p,y)),I&&(s.interpolatePadding(h,v,y),n=s.centerPoint.add(m)),k)s.setLocationAtPoint(k,T);else{var _=s.zoomScale(s.zoom-l),g=f>l?Math.min(2,E):Math.max(.5,E),x=Math.pow(g,1-y),b=s.unproject(a.add(o.mult(y*x)).mult(_));s.setLocationAtPoint(s.renderWorldCopies?b.wrap():b,n)}return t.preloadOnly||r._fireMoveEvents(i),s}};if(t.preloadOnly){var z=this._emulate(C,t.duration,s);return this._preloadTiles(z),this}var P={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=S,this._rotating=M,this._pitching=A,this._padding=I,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,P),this._ease(C(s),(function(e){s.recenterOnTerrain(),r._afterEase(i,e)}),t),this}},{key:"_prepareEase",value:function(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._moving=!0,this.transform.cameraElevationReference="sea",i||r.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.Event("pitchstart",t))}},{key:"_fireMoveEvents",value:function(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}},{key:"_afterEase",value:function(t,i){if(!this._easeId||!i||this._easeId!==i){this._easeId=void 0,this.transform.cameraElevationReference="ground";var r=this._zooming,n=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.Event("zoomend",t)),n&&this.fire(new e.Event("rotateend",t)),a&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}}},{key:"flyTo",value:function(t,i){var r=this;if(!t.essential&&e.exported.prefersReducedMotion){var n=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);var a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),u=this.getPadding(),c="zoom"in t?e.clamp(+t.zoom,a.minZoom,a.maxZoom):o,h="bearing"in t?this._normalizeBearing(t.bearing,s):s,f="pitch"in t?+t.pitch:l,d="padding"in t?t.padding:a.padding,p=a.zoomScale(c-o),v=e.pointGeometry.convert(t.offset),m=a.centerPoint.add(v),y=a.pointLocation(m),_=e.LngLat.convert(t.center||y);this._normalizeCenter(_);var g=a.project(y),x=a.project(_).sub(g),b=t.curve,w=Math.max(a.width,a.height),k=w/p,T=x.mag();if("minZoom"in t){var E=e.clamp(Math.min(t.minZoom,o,c),a.minZoom,a.maxZoom),S=w/a.zoomScale(E-o);b=Math.sqrt(S/T*2)}var M=b*b;function A(e){var t=(k*k-w*w+(e?-1:1)*M*M*T*T)/(2*(e?k:w)*M*T);return Math.log(Math.sqrt(t*t+1)-t)}function I(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}var z=A(0),P=function(e){return C(z)/C(z+b*e)},D=function(e){return w*((C(z)*(I(t=z+b*e)/C(t))-I(z))/M)/T;var t},L=(A(1)-z)/b;if(Math.abs(T)<1e-6||!isFinite(L)){if(Math.abs(w-k)<1e-6)return this.easeTo(t,i);var R=kt.maxDuration&&(t.duration=0);var B=s!==h,O=f!==l,F=!a.isPaddingEqual(d),U=function(n){return function(a){var p=a*L,y=1/P(p);n.zoom=1===a?c:o+n.scaleZoom(y),B&&(n.bearing=e.number(s,h,a)),O&&(n.pitch=e.number(l,f,a)),F&&(n.interpolatePadding(u,d,a),m=n.centerPoint.add(v));var b=1===a?_:n.unproject(g.add(x.mult(D(p))).mult(y));return n.setLocationAtPoint(n.renderWorldCopies?b.wrap():b,m),n._updateCameraOnTerrain(),t.preloadOnly||r._fireMoveEvents(i),n}};if(t.preloadOnly){var V=this._emulate(U,t.duration,a);return this._preloadTiles(V),this}return this._zooming=!0,this._rotating=B,this._pitching=O,this._padding=F,this._prepareEase(i,!1),this._ease(U(a),(function(){return r._afterEase(i)}),t),this}},{key:"isEasing",value:function(){return!!this._easeFrameId}},{key:"stop",value:function(){return this._stop()}},{key:"_stop",value:function(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){var i=this._onEaseEnd;this._onEaseEnd=void 0,i.call(this,t)}if(!e){var r=this.handlers;r&&r.stop(!1)}return this}},{key:"_ease",value:function(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=e.exported.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}},{key:"_renderFrameCallback",value:function(){var t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}},{key:"_normalizeBearing",value:function(t,i){t=e.wrap(t,-180,180);var r=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}}},{key:"_emulate",value:function(e,t,i){for(var r=Math.ceil(15*t/1e3),n=[],a=e(i.clone()),o=0;o<=r;o++){var s=a(o/r);n.push(s.clone())}return n}}]),r}(e.Evented),ua=function(){function t(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(this,t),this.options=i,e.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}return p(t,[{key:"getDefaultPosition",value:function(){return"bottom-right"}},{key:"onAdd",value:function(e){var t=this.options&&this.options.compact;return this._map=e,this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=_("button","mapboxgl-ctrl-attrib-button",this._container),_("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=_("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}},{key:"_setElementTitle",value:function(e,t){var i=this._map._getUIString("AttributionControl.".concat(t));e.setAttribute("aria-label",i),e.removeAttribute("title"),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},{key:"_toggleAttribution",value:function(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}},{key:"_updateEditLink",value:function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.config.ACCESS_TOKEN}];if(t){var r=i.reduce((function(e,t,r){return t.value&&(e+="".concat(t.key,"=").concat(t.value).concat(r=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[].concat(c(this.options.customAttribution),c(e)):e.unshift(this.options.customAttribution));var o=e.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,e.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}}},{key:"_updateCompact",value:function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}]),t}(),ca=function(){function t(){d(this,t),e.bindAll(["_updateLogo","_updateCompact"],this)}return p(t,[{key:"onAdd",value:function(e){this._map=e,this._container=_("div","mapboxgl-ctrl");var t=_("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}},{key:"getDefaultPosition",value:function(){return"bottom-left"}},{key:"_updateLogo",value:function(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}},{key:"_logoRequired",value:function(){if(!this._map.style)return!0;var e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(var t in e){var i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}},{key:"_updateCompact",value:function(){var e=this._container.children;if(e.length){var t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}]),t}(),ha=function(){function e(){d(this,e),this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}return p(e,[{key:"add",value:function(e){var t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}},{key:"remove",value:function(e){var t,i=this._currentlyRunning,r=i?this._queue.concat(i):this._queue,n=f(r);try{for(n.s();!(t=n.n()).done;){var a=t.value;if(a.id===e)return void(a.cancelled=!0)}}catch(o){n.e(o)}finally{n.f()}}},{key:"run",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this._currentlyRunning=this._queue;this._queue=[];var i,r=f(t);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(!n.cancelled&&(n.callback(e),this._cleared))break}}catch(a){r.e(a)}finally{r.f()}this._cleared=!1,this._currentlyRunning=!1}},{key:"clear",value:function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}]),e}();function fa(t,i,r){if(t=new e.LngLat(t.lng,t.lat),i){var n=new e.LngLat(t.lng-360,t.lat),a=new e.LngLat(t.lng+360,t.lat),o=360*Math.ceil(Math.abs(t.lng-r.center.lng)/360),s=r.locationPoint(t).distSqr(i),l=i.x<0||i.y<0||i.x>r.width||i.y>r.height;r.locationPoint(n).distSqr(i)180;){var u=r.locationPoint(t);if(u.x>=0&&u.y>=0&&u.x<=r.width&&u.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}var da={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%)"},pa=function(t){v(r,t);var i=m(r);function r(t,a){var o;if(d(this,r),o=i.call(this),(t instanceof e.window.HTMLElement||a)&&(t=e.extend({element:t},a)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],n(o)),o._anchor=t&&t.anchor||"center",o._color=t&&t.color||"#3FB1CE",o._scale=t&&t.scale||1,o._draggable=t&&t.draggable||!1,o._clickTolerance=t&&t.clickTolerance||0,o._isDragging=!1,o._state="inactive",o._rotation=t&&t.rotation||0,o._rotationAlignment=t&&t.rotationAlignment||"auto",o._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",o._updateMoving=function(){return o._update(!0)},o._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)o._element=t.element,o._offset=e.pointGeometry.convert(t&&t.offset||[0,0]);else{o._defaultMarker=!0,o._element=_("div");var s=41,u=27,c=g("svg",{display:"block",height:s*o._scale+"px",width:u*o._scale+"px",viewBox:"0 0 ".concat(u," ").concat(s)},o._element),h=g("radialGradient",{id:"shadowGradient"},g("defs",{},c));g("stop",{offset:"10%","stop-opacity":.4},h),g("stop",{offset:"100%","stop-opacity":.05},h),g("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},c),g("path",{fill:o._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},c),g("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},c),g("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},c),o._offset=e.pointGeometry.convert(t&&t.offset||[0,-14])}o._element.hasAttribute("aria-label")||o._element.setAttribute("aria-label","Map marker"),o._element.classList.add("mapboxgl-marker"),o._element.addEventListener("dragstart",(function(e){e.preventDefault()})),o._element.addEventListener("mousedown",(function(e){e.preventDefault()}));var f=o._element.classList;for(var p in da)f.remove("mapboxgl-marker-anchor-".concat(p));return f.add("mapboxgl-marker-anchor-".concat(o._anchor)),o._popup=null,l(o)}return p(r,[{key:"addTo",value:function(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}},{key:"remove",value:function(){var e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}},{key:"getLngLat",value:function(){return this._lngLat}},{key:"setLngLat",value:function(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}},{key:"getElement",value:function(){return this._element}},{key:"setPopup",value:function(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){var t=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}},{key:"_onKeyPress",value:function(e){var t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}},{key:"_onMapClick",value:function(e){var t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}},{key:"getPopup",value:function(){return this._popup}},{key:"togglePopup",value:function(){var e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}},{key:"_behindTerrain",value:function(){var e=this._map,t=this._pos;if(!e||!t)return!1;var i=e.unproject(t),r=e.getFreeCameraOptions();if(!r.position)return!1;var n=r.position.toLngLat();return n.distanceTo(i)<.9*n.distanceTo(this._lngLat)}},{key:"_evaluateOpacity",value:function(){var t=this._map;if(t){var i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)this._clearFadeTimer();else{var r,n=t.unproject(i);t._showingGlobe()&&e.isLngLatBehindGlobe(t.transform,this._lngLat)?r=0:(r=1-t._queryFogOpacity(n),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity="".concat(r),this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}}}},{key:"_clearFadeTimer",value:function(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}},{key:"_updateDOM",value:function(){var e=this._pos;if(e&&this._map){var t=this._offset.mult(this._scale);this._element.style.transform="\n translate(".concat(e.x,"px,").concat(e.y,"px)\n ").concat(da[this._anchor],"\n ").concat(this._calculateXYTransform()," ").concat(this._calculateZTransform(),"\n translate(").concat(t.x,"px,").concat(t.y,"px)\n ")}}},{key:"_calculateXYTransform",value:function(){var t=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!t||"map"!==r)return"";if(!i._showingGlobe()){var n=i.getPitch();return n?"rotateX(".concat(n,"deg)"):""}var a=e.radToDeg(e.globeTiltAtLngLat(i.transform,this._lngLat)),o=t.sub(e.globeCenterToScreenPoint(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";var l=a/s;return"rotateX(".concat(-o.y*l,"deg) rotateY(").concat(o.x*l,"deg)")}},{key:"_calculateZTransform",value:function(){var t=this._pos,i=this._map;if(!i||!t)return"";var r=0,n=this.getRotationAlignment();if("map"===n)if(i._showingGlobe()){var a=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),o=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(a);r=e.radToDeg(Math.atan2(o.y,o.x))-90}else r=-i.getBearing();else if("horizon"===n){var s=e.smoothstep(4,6,i.getZoom()),l=e.globeCenterToScreenPoint(i.transform);l.y+=s*i.transform.height;var u=t.sub(l),c=e.radToDeg(Math.atan2(u.y,u.x));r=(c>90?c-270:c+90)*(1-s)}return(r+=this._rotation)?"rotateZ(".concat(r,"deg)"):""}},{key:"_update",value:function(t){var i=this;e.window.cancelAnimationFrame(this._updateFrameId);var r=this._map;r&&(r.transform.renderWorldCopies&&(this._lngLat=fa(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat),!0===t?this._updateFrameId=e.window.requestAnimationFrame((function(){i._element&&i._pos&&i._anchor&&(i._pos=i._pos.round(),i._updateDOM())})):this._pos=this._pos.round(),r._requestDomTask((function(){i._map&&(i._element&&i._pos&&i._anchor&&i._updateDOM(),(r._showingGlobe()||r.getTerrain()||r.getFog())&&!i._fadeTimer&&(i._fadeTimer=setTimeout(i._evaluateOpacity.bind(i),60)))})))}},{key:"getOffset",value:function(){return this._offset}},{key:"setOffset",value:function(t){return this._offset=e.pointGeometry.convert(t),this._update(),this}},{key:"_onMove",value:function(t){var i=this._map;if(i){var r=this._pointerdownPos,n=this._positionDelta;if(r&&n){if(!this._isDragging){var a=this._clickTolerance||i._clickTolerance;if(t.point.dist(r)0&&void 0!==arguments[0]?arguments[0]:new e.pointGeometry(0,0),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bottom";if("number"==typeof t){var r=Math.round(Math.sqrt(.5*Math.pow(t,2)));switch(i){case"top":return new e.pointGeometry(0,t);case"top-left":return new e.pointGeometry(r,r);case"top-right":return new e.pointGeometry(-r,r);case"bottom":return new e.pointGeometry(0,-t);case"bottom-left":return new e.pointGeometry(r,-r);case"bottom-right":return new e.pointGeometry(-r,-r);case"left":return new e.pointGeometry(t,0);case"right":return new e.pointGeometry(-t,0)}return new e.pointGeometry(0,0)}return t instanceof e.pointGeometry||Array.isArray(t)?e.pointGeometry.convert(t):e.pointGeometry.convert(t[i]||[0,0])}var _a=function(){function t(e){d(this,t),this.jumpTo(e)}return p(t,[{key:"getValue",value:function(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;var i=e.easeCubicInOut((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}},{key:"isEasing",value:function(e){return e>=this._startTime&&e<=this._endTime}},{key:"jumpTo",value:function(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}},{key:"easeTo",value:function(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}]),t}(),ga={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},xa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},ba={showCompass:!0,showZoom:!0,visualizePitch:!1},wa=function(){function t(i,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];d(this,t),this._clickTolerance=10,this.element=r,this.mouseRotate=new Ln({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,n&&(this.mousePitch=new Rn({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),e.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}return p(t,[{key:"down",value:function(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),k()}},{key:"move",value:function(e,t){var i=this.map,r=this.mouseRotate.mousemoveWindow(e,t),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){var a=this.mousePitch.mousemoveWindow(e,t),o=a&&a.pitchDelta;o&&i.setPitch(i.getPitch()+o)}}},{key:"off",value:function(){var e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}},{key:"offTemp",value:function(){T(),e.window.removeEventListener("mousemove",this.mousemove),e.window.removeEventListener("mouseup",this.mouseup)}},{key:"mousedown",value:function(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:function(){return t.preventDefault()}}),M(this.element,t)),e.window.addEventListener("mousemove",this.mousemove),e.window.addEventListener("mouseup",this.mouseup)}},{key:"mousemove",value:function(e){this.move(e,M(this.element,e))}},{key:"mouseup",value:function(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}},{key:"touchstart",value:function(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=A(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return e.preventDefault()}},this._startPos))}},{key:"touchmove",value:function(e){1!==e.targetTouches.length?this.reset():(this._lastPos=A(this.element,e.targetTouches)[0],this.move({preventDefault:function(){return e.preventDefault()}},this._lastPos))}},{key:"touchend",value:function(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){var t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}var Ma={version:e.version,supported:i,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:function(t){v(c,t);var a=m(c);function c(t){var i;if(d(this,c),e.LivePerformanceUtils.mark(e.PerformanceMarkers.create),null!=(t=e.extend({},xa,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.isSafariWithAntialiasingBug(e.window)&&(t.antialias=!1,e.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),(i=a.call(this,new un(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t))._interactive=t.interactive,i._minTileCacheSize=t.minTileCacheSize,i._maxTileCacheSize=t.maxTileCacheSize,i._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,i._preserveDrawingBuffer=t.preserveDrawingBuffer,i._antialias=t.antialias,i._useWebGL2=t.useWebGL2,i._trackResize=t.trackResize,i._bearingSnap=t.bearingSnap,i._refreshExpiredTiles=t.refreshExpiredTiles,i._fadeDuration=t.fadeDuration,i._isInitialLoad=!0,i._crossSourceCollisions=t.crossSourceCollisions,i._collectResourceTiming=t.collectResourceTiming,i._optimizeForTerrain=t.optimizeForTerrain,i._language=i._parseLanguage(t.language),i._worldview=t.worldview,i._renderTaskQueue=new ha,i._domRenderTaskQueue=new ha,i._controls=[],i._markers=[],i._popups=[],i._mapId=e.uniqueId(),i._locale=e.extend({},ga,t.locale),i._clickTolerance=t.clickTolerance,i._cooperativeGestures=t.cooperativeGestures,i._performanceMetricsCollection=t.performanceMetricsCollection,i._containerWidth=0,i._containerHeight=0,i._averageElevationLastSampledAt=-1/0,i._averageElevationExaggeration=0,i._averageElevation=new _a(0),i._interactionRange=[1/0,-1/0],i._visibilityHidden=0,i._useExplicitProjection=!1,i._requestManager=new e.RequestManager(t.transformRequest,t.accessToken,t.testMode),i._silenceAuthErrors=!!t.testMode,"string"==typeof t.container){if(i._container=e.window.document.getElementById(t.container),!i._container)throw new Error("Container '".concat(t.container,"' not found."))}else{if(!(t.container instanceof e.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");i._container=t.container}if(i._container.childNodes.length>0&&e.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&i.setMaxBounds(t.maxBounds),e.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],n(i)),i._setupContainer(),i._setupPainter(),void 0===i.painter)throw new Error("Failed to initialize WebGL.");return i.on("move",(function(){return i._update(!1)})),i.on("moveend",(function(){return i._update(!1)})),i.on("zoom",(function(){return i._update(!0)})),void 0!==e.window&&(e.window.addEventListener("online",i._onWindowOnline,!1),e.window.addEventListener("resize",i._onWindowResize,!1),e.window.addEventListener("orientationchange",i._onWindowResize,!1),e.window.addEventListener("webkitfullscreenchange",i._onWindowResize,!1),e.window.addEventListener("visibilitychange",i._onVisibilityChange,!1)),i.handlers=new oa(n(i),t),i._localFontFamily=t.localFontFamily,i._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&i.setStyle(t.style,{localFontFamily:i._localFontFamily,localIdeographFontFamily:i._localIdeographFontFamily}),t.projection&&i.setProjection(t.projection),i._hash=t.hash&&new hn("string"==typeof t.hash&&t.hash||void 0).addTo(n(i)),i._hash&&i._hash._onHashChange()||(i.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(i.resize(),i.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),i.resize(),t.attributionControl&&i.addControl(new ua({customAttribution:t.customAttribution})),i._logoControl=new ca,i.addControl(i._logoControl,t.logoPosition),i.on("style.load",(function(){i.transform.unmodified&&i.jumpTo(i.style.stylesheet)})),i.on("data",(function(t){i._update("style"===t.dataType),i.fire(new e.Event("".concat(t.dataType,"data"),t))})),i.on("dataloading",(function(t){i.fire(new e.Event("".concat(t.dataType,"dataloading"),t))})),l(i)}return p(c,[{key:"_getMapId",value:function(){return this._mapId}},{key:"addControl",value:function(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var r=t.onAdd(this);this._controls.push(t);var n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}},{key:"removeControl",value:function(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}},{key:"hasControl",value:function(e){return this._controls.indexOf(e)>-1}},{key:"getContainer",value:function(){return this._container}},{key:"getCanvasContainer",value:function(){return this._canvasContainer}},{key:"getCanvas",value:function(){return this._canvas}},{key:"resize",value:function(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));var i=!this._moving;return i&&this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t)),this.fire(new e.Event("resize",t)),i&&this.fire(new e.Event("moveend",t)),this}},{key:"getBounds",value:function(){return this.transform.getBounds()}},{key:"getMaxBounds",value:function(){return this.transform.getMaxBounds()||null}},{key:"setMaxBounds",value:function(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}},{key:"setMinZoom",value:function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}},{key:"getMaxZoom",value:function(){return this.transform.maxZoom}},{key:"setMinPitch",value: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()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}},{key:"getMaxPitch",value:function(){return this.transform.maxPitch}},{key:"getRenderWorldCopies",value:function(){return this.transform.renderWorldCopies}},{key:"setRenderWorldCopies",value:function(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}},{key:"getLanguage",value:function(){return this._language}},{key:"_parseLanguage",value:function(t){return"auto"===t?e.window.navigator.language:Array.isArray(t)?0===t.length?void 0:t.map((function(t){return"auto"===t?e.window.navigator.language:t})):t}},{key:"setLanguage",value:function(e){var t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style._reloadSources();var i,r=f(this._controls);try{for(r.s();!(i=r.n()).done;){var n=i.value;n._setLanguage&&n._setLanguage(this._language)}}catch(a){r.e(a)}finally{r.f()}return this}},{key:"getWorldview",value:function(){return this._worldview}},{key:"setWorldview",value:function(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style._reloadSources(),this):this}},{key:"getProjection",value:function(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}},{key:"_showingGlobe",value:function(){return"globe"===this.transform.projection.name}},{key:"setProjection",value:function(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.stylesheet?this.style.stylesheet.projection:null)}},{key:"_updateProjectionTransition",value:function(){if("globe"===this.getProjection().name){var t,i=this.transform,r=i.projection.name;"globe"===r&&i.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX?(i.setMercatorFromTransition(),t=!0):"mercator"===r&&i.zoom=e.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i){for(var r in this.painter.clearBackgroundTiles(),this.style._sourceCaches)this.style._sourceCaches[r].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}},{key:"project",value:function(t){return this.transform.locationPoint3D(e.LngLat.convert(t))}},{key:"unproject",value:function(t){return this.transform.pointLocation3D(e.pointGeometry.convert(t))}},{key:"isMoving",value:function(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}},{key:"isZooming",value:function(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}},{key:"isRotating",value:function(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}},{key:"_isDragging",value:function(){return this.handlers&&this.handlers._isDragging()||!1}},{key:"_createDelegatedListener",value:function(e,t,i){var n=this;if("mouseenter"===e||"mouseover"===e){var a=!1,o=function(r){var o=t.filter((function(e){return n.getLayer(e)})),s=o.length?n.queryRenderedFeatures(r.point,{layers:o}):[];s.length?a||(a=!0,i.call(n,new bn(e,n,r.originalEvent,{features:s}))):a=!1},s=function(){a=!1};return{layers:new Set(t),listener:i,delegates:{mousemove:o,mouseout:s}}}if("mouseleave"===e||"mouseout"===e){var l=!1,u=function(r){var a=t.filter((function(e){return n.getLayer(e)}));(a.length?n.queryRenderedFeatures(r.point,{layers:a}):[]).length?l=!0:l&&(l=!1,i.call(n,new bn(e,n,r.originalEvent)))},c=function(t){l&&(l=!1,i.call(n,new bn(e,n,t.originalEvent)))};return{layers:new Set(t),listener:i,delegates:{mousemove:u,mouseout:c}}}var h=function(e){var r=t.filter((function(e){return n.getLayer(e)})),a=r.length?n.queryRenderedFeatures(e.point,{layers:r}):[];a.length&&(e.features=a,i.call(n,e),delete e.features)};return{layers:new Set(t),listener:i,delegates:r({},e,h)}}},{key:"on",value:function(e,t,i){if(void 0===i)return o(s(c.prototype),"on",this).call(this,e,t);Array.isArray(t)||(t=[t]);var r=this._createDelegatedListener(e,t,i);for(var n in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r),r.delegates)this.on(n,r.delegates[n]);return this}},{key:"once",value:function(e,t,i){if(void 0===i)return o(s(c.prototype),"once",this).call(this,e,t);Array.isArray(t)||(t=[t]);var r=this._createDelegatedListener(e,t,i);for(var n in r.delegates)this.once(n,r.delegates[n]);return this}},{key:"off",value:function(e,t,i){var r=this;if(void 0===i)return o(s(c.prototype),"off",this).call(this,e,t);t=new Set(Array.isArray(t)?t:[t]);var n=function(e,t){if(e.size!==t.size)return!1;var i,r=f(e);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(!t.has(n))return!1}}catch(a){r.e(a)}finally{r.f()}return!0},a=this._delegatedListeners?this._delegatedListeners[e]:void 0;return a&&function(e){for(var a=0;a2&&void 0!==arguments[2]?arguments[2]:{},n=r.pixelRatio,a=void 0===n?1:n,o=r.sdf,s=void 0!==o&&o,l=r.stretchX,u=r.stretchY,c=r.content;if(this._lazyInitEmptyStyle(),i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap){var h=e.exported.getImageData(i),f=h.width,d=h.height,p=h.data;this.style.addImage(t,{data:new e.RGBAImage({width:f,height:d},p),pixelRatio:a,stretchX:l,stretchY:u,content:c,sdf:s,version:0})}else if(void 0===i.width||void 0===i.height)this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{var v=i.width,m=i.height,y=i;this.style.addImage(t,{data:new e.RGBAImage({width:v,height:m},new Uint8Array(y.data)),pixelRatio:a,stretchX:l,stretchY:u,content:c,sdf:s,version:0,userImage:y}),y.onAdd&&y.onAdd(this,t)}}},{key:"updateImage",value:function(t,i){var r=this.style.getImage(t);if(r){var n=i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap?e.exported.getImageData(i):i,a=n.width,o=n.height;void 0!==a&&void 0!==o?a===r.data.width&&o===r.data.height?(r.data.replace(n.data,!(i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap)),this.style.updateImage(t,r)):this.fire(new e.ErrorEvent(new Error("The width and height of the updated image (".concat(a,", ").concat(o,")\n must be that same as the previous version of the image\n (").concat(r.data.width,", ").concat(r.data.height,")")))):this.fire(new e.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`")))}else this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")))}},{key:"hasImage",value:function(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}},{key:"removeImage",value:function(e){this.style.removeImage(e)}},{key:"loadImage",value:function(t,i){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),(function(t,r){i(t,r instanceof e.window.HTMLImageElement?e.exported.getImageData(r):r)}))}},{key:"listImages",value:function(){return this.style.listImages()}},{key:"addLayer",value:function(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}},{key:"moveLayer",value:function(e,t){return this.style.moveLayer(e,t),this._update(!0)}},{key:"removeLayer",value:function(e){return this.style.removeLayer(e),this._update(!0)}},{key:"getLayer",value:function(e){return this.style.getLayer(e)}},{key:"setLayerZoomRange",value:function(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}},{key:"setFilter",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.style.setFilter(e,t,i),this._update(!0)}},{key:"getFilter",value:function(e){return this.style.getFilter(e)}},{key:"setPaintProperty",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.style.setPaintProperty(e,t,i,r),this._update(!0)}},{key:"getPaintProperty",value:function(e,t){return this.style.getPaintProperty(e,t)}},{key:"setLayoutProperty",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}},{key:"getLayoutProperty",value:function(e,t){return this.style.getLayoutProperty(e,t)}},{key:"setLight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}},{key:"getLight",value:function(){return this.style.getLight()}},{key:"setTerrain",value:function(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}},{key:"getTerrain",value:function(){return this.style?this.style.getTerrain():null}},{key:"setFog",value:function(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}},{key:"getFog",value:function(){return this.style?this.style.getFog():null}},{key:"_queryFogOpacity",value:function(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.LngLat.convert(t),this.transform):0}},{key:"setFeatureState",value:function(e,t){return this.style.setFeatureState(e,t),this._update()}},{key:"removeFeatureState",value:function(e,t){return this.style.removeFeatureState(e,t),this._update()}},{key:"getFeatureState",value:function(e){return this.style.getFeatureState(e)}},{key:"_updateContainerDimensions",value:function(){if(this._container){for(var t,i,r,n=this._container.getBoundingClientRect().width||400,a=this._container.getBoundingClientRect().height||300,o=this._container;o&&(!i||!r);){var s=e.window.getComputedStyle(o).transform;s&&"none"!==s&&((t=s.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==t[0]&&"1"!==t[0]&&(i=t[0]),t[3]&&"0"!==t[3]&&"1"!==t[3]&&(r=t[3])),o=o.parentElement}this._containerWidth=i?Math.abs(n/i):n,this._containerHeight=r?Math.abs(a/r):a}}},{key:"_detectMissingCSS",value:function(){"rgb(250, 128, 114)"!==e.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.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/.")}},{key:"_setupContainer",value:function(){var e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=_("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();var t=this._canvasContainer=_("div","mapboxgl-canvas-container",e);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=_("canvas","mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);var i=this._controlContainer=_("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((function(e){r[e]=_("div","mapboxgl-ctrl-".concat(e),i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}},{key:"_resizeCanvas",value:function(t,i){var r=e.exported.devicePixelRatio||1;this._canvas.width=r*Math.ceil(t),this._canvas.height=r*Math.ceil(i),this._canvas.style.width="".concat(t,"px"),this._canvas.style.height="".concat(i,"px")}},{key:"_addMarker",value:function(e){this._markers.push(e)}},{key:"_removeMarker",value:function(e){var t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}},{key:"_addPopup",value:function(e){this._popups.push(e)}},{key:"_removePopup",value:function(e){var t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}},{key:"_setupPainter",value:function(){var t=this,r=e.extend({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._useWebGL2&&this._canvas.getContext("webgl2",r),a=n||this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);a?(this._useWebGL2&&!n&&e.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),e.storeAuthState(a,!0),this.painter=new Yr(a,this.transform,!!n),this.on("data",(function(e){"source"===e.dataType&&t.painter.setTileLoadedFlag(!0)})),e.exported$1.testSupport(a)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}},{key:"_contextLost",value:function(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}},{key:"_contextRestored",value:function(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}},{key:"_onMapScroll",value:function(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}},{key:"loaded",value:function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}},{key:"_update",value:function(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}},{key:"_requestRenderFrame",value:function(e){return this._update(),this._renderTaskQueue.add(e)}},{key:"_cancelRenderFrame",value:function(e){this._renderTaskQueue.remove(e)}},{key:"_requestDomTask",value:function(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}},{key:"_render",value:function(t){var i,r=this,n=this.painter.context.extTimerQuery,a=e.exported.now();if(this.listens("gpu-timing-frame")&&(i=n.createQueryEXT(),n.beginQueryEXT(n.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],e.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],e.window.performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),!this._removed){this._updateProjectionTransition();var o=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;var s=this.transform.zoom,l=this.transform.pitch,u=e.exported.now(),c=new e.EvaluationParameters(s,{now:u,fadeDuration:o,pitch:l,transition:this.style.getTransition()});this.style.update(c)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);var h=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),h=this._updateAverageElevation(a),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):h=this._updateAverageElevation(a),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){var f=e.exported.now()-a;n.endQueryEXT(n.TIME_ELAPSED_EXT,i),setTimeout((function(){var t=n.getQueryObjectEXT(i,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(i),r.fire(new e.Event("gpu-timing-frame",{cpuTime:f,gpuTime:t})),e.window.performance.mark("frame-gpu",{startTime:a,detail:{gpuTime:t}})}),50)}if(this.listens("gpu-timing-layer")){var d=this.painter.collectGpuTimers();setTimeout((function(){var t=r.painter.queryGpuTimers(d);r.fire(new e.Event("gpu-timing-layer",{layerTimes:t}))}),50)}if(this.listens("gpu-timing-deferred-render")){var p=this.painter.collectDeferredRenderGpuQueries();setTimeout((function(){var t=r.painter.queryGpuTimeDeferredRender(p);r.fire(new e.Event("gpu-timing-deferred-render",{gpuTime:t}))}),50)}var v=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(v||this._repaint)this.triggerRepaint();else{var m=!this.isMoving()&&this.loaded();if(m&&(h=this._updateAverageElevation(a,!0)),h)this.triggerRepaint();else if(this._triggerFrame(!1),m&&(this.fire(new e.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){var y=this._calculateSpeedIndex();this.fire(new e.Event("speedindexcompleted",{speedIndex:y})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||v||(this._fullyLoaded=!0,e.LivePerformanceUtils.mark(e.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&e.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}}},{key:"_forceMarkerAndPopupUpdate",value:function(e){var t,i=f(this._markers);try{for(i.s();!(t=i.n()).done;){var r=t.value;e&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update()}}catch(s){i.e(s)}finally{i.f()}var n,a=f(this._popups);try{for(a.s();!(n=a.n()).done;){var o=n.value;!e||this.getRenderWorldCopies()||o._trackPointer||(o._lngLat=o._lngLat.wrap()),o._update()}}catch(s){a.e(s)}finally{a.f()}}},{key:"_updateAverageElevation",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=function(e){return t.transform.averageElevation=e,t._update(!1),!0};if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);if((i||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){var n=this.transform.averageElevation,a=this.transform.sampleAverageElevation(),o=!1;this.transform.elevation&&(o=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(a)?a=0:this._averageElevationLastSampledAt=e;var s=Math.abs(n-a);if(s>1){if(this._isInitialLoad||o)return this._averageElevation.jumpTo(a),r(a);this._averageElevation.easeTo(a,e,300)}else if(s>1e-4)return this._averageElevation.jumpTo(a),r(a)}return!!this._averageElevation.isEasing(e)&&r(this._averageElevation.getValue(e))}},{key:"_authenticate",value:function(){var t=this;e.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(function(i){if(i&&(i.message===e.AUTH_ERR_MSG||401===i.status)){var r=t.painter.context.gl;e.storeAuthState(r,!1),t._logoControl instanceof ca&&t._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),t._silenceAuthErrors||t.fire(new e.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),e.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(function(){}))}},{key:"_updateTerrain",value:function(){var e=this._isDragging();this.painter.updateTerrain(this.style,e)}},{key:"_calculateSpeedIndex",value:function(){var e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());var i=this.painter.context.gl,r=i.createFramebuffer();function n(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);var t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}},{key:"_canvasPixelComparison",value:function(e,t,i){for(var r=i[1]-i[0],n=e.length/4,a=0;a0&&void 0!==arguments[0]?arguments[0]:!!i.options.geolocation;i._supportsGeolocation=e,t(e)};void 0!==this._supportsGeolocation?t(this._supportsGeolocation):void 0!==e.window.navigator.permissions?e.window.navigator.permissions.query({name:"geolocation"}).then((function(e){return r("denied"!==e.state)})).catch((function(){return r()})):r()}},{key:"_isOutOfMapMaxBounds",value:function(e){var t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitudet.getEast()||i.latitudet.getNorth())}},{key:"_setErrorState",value:function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}},{key:"_onSuccess",value:function(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}},{key:"_updateCamera",value:function(t){var i=new e.LngLat(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),a=e.extend({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),a,{geolocateSource:!0})}},{key:"_updateMarker",value:function(t){if(t){var i=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}},{key:"_updateCircleRadius",value:function(){var t=this._map.transform,i=e.mercatorZfromAltitude(1,t._center.lat)*t.worldSize,r=Math.ceil(2*this._accuracy*i);this._circleElement.style.width="".concat(r,"px"),this._circleElement.style.height="".concat(r,"px")}},{key:"_onZoom",value:function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}},{key:"_updateMarkerRotation",value:function(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}},{key:"_onError",value:function(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}},{key:"_finish",value:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}},{key:"_setupUI",value:function(t){var i=this;if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(function(e){return e.preventDefault()})),this._geolocateButton=_("button","mapboxgl-ctrl-geolocate",this._container),_("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{var n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=_("div","mapboxgl-user-location"),this._dotElement.appendChild(_("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(_("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new pa({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=_("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new pa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(t){t.geolocateSource||"ACTIVE_LOCK"!==i._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(i._watchState="BACKGROUND",i._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),i._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),i.fire(new e.Event("trackuserlocationend")))}))}}},{key:"_onDeviceOrientation",value:function(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}},{key:"trigger",value:function(){if(!this._setup)return e.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var t;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(t={maximumAge:6e5,timeout:0},this._noTimeout=!0):(t=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,t),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}},{key:"_addDeviceOrientationListener",value:function(){var t=this,i=function(){e.window.addEventListener("ondeviceorientationabsolute"in e.window?"deviceorientationabsolute":"deviceorientation",t._onDeviceOrientation)};void 0!==e.window.DeviceMotionEvent&&"function"==typeof e.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e&&i()})).catch(console.error):i()}},{key:"_clearWatch",value:function(){this.options.geolocation.clearWatch(this._geolocationWatchID),e.window.removeEventListener("deviceorientation",this._onDeviceOrientation),e.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}}]),r}(e.Evented),AttributionControl:ua,ScaleControl:function(){function t(i){d(this,t),this.options=e.extend({},Ta,i),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(e){return!1}}()||(this._setScale=Ea.bind(this)),e.bindAll(["_update","_setScale","setUnit"],this)}return p(t,[{key:"getDefaultPosition",value:function(){return"bottom-left"}},{key:"_update",value:function(){var e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),a=t.unproject([r+e,i]),o=n.distanceTo(a);if("imperial"===this.options.unit){var s=3.2808*o;s>5280?this._setScale(e,s/5280,"mile"):this._setScale(e,s,"foot")}else"nautical"===this.options.unit?this._setScale(e,o/1852,"nautical-mile"):o>=1e3?this._setScale(e,o/1e3,"kilometer"):this._setScale(e,o,"meter")}},{key:"_setScale",value:function(e,t,i){var r=this,n=Sa(t),a=n/t;this._map._requestDomTask((function(){r._container.style.width=e*a+"px",r._container.innerHTML="nautical-mile"!==i?new Intl.NumberFormat(r._language,{style:"unit",unitDisplay:"narrow",unit:i}).format(n):"".concat(n," nm")}))}},{key:"onAdd",value:function(e){return this._map=e,this._language=e.getLanguage(),this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}},{key:"_setLanguage",value:function(e){this._language=e,this._update()}},{key:"setUnit",value:function(e){this.options.unit=e,this._update()}}]),t}(),FullscreenControl:function(){function t(i){d(this,t),this._fullscreen=!1,i&&i.container&&(i.container instanceof e.window.HTMLElement?this._container=i.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in e.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in e.window.document&&(this._fullscreenchange="webkitfullscreenchange")}return p(t,[{key:"onAdd",value:function(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}},{key:"onRemove",value:function(){this._controlContainer.remove(),this._map=null,e.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}},{key:"_checkFullscreenSupport",value:function(){return!(!e.window.document.fullscreenEnabled&&!e.window.document.webkitFullscreenEnabled)}},{key:"_setupUI",value:function(){var t=this._fullscreenButton=_("button","mapboxgl-ctrl-fullscreen",this._controlContainer);_("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),e.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}},{key:"_updateTitle",value:function(){var e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}},{key:"_getTitle",value:function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}},{key:"_isFullscreen",value:function(){return this._fullscreen}},{key:"_changeIcon",value:function(){(e.window.document.fullscreenElement||e.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}},{key:"_onClickFullscreen",value:function(){this._isFullscreen()?e.window.document.exitFullscreen?e.window.document.exitFullscreen():e.window.document.webkitCancelFullScreen&&e.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}}]),t}(),Popup:function(t){v(r,t);var i=m(r);function r(t){var a;return d(this,r),(a=i.call(this)).options=e.extend(Object.create(va),t),e.bindAll(["_update","_onClose","remove","_onMouseEvent"],n(a)),a._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[]),a}return p(r,[{key:"addTo",value:function(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.Event("open")),this}},{key:"isOpen",value:function(){return!!this._map}},{key:"remove",value:function(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);var t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.Event("close")),this}},{key:"getLngLat",value:function(){return this._lngLat}},{key:"setLngLat",value:function(t){this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update();var i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}},{key:"trackPointer",value:function(){this._trackPointer=!0,this._pos=null,this._update();var e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}},{key:"getElement",value:function(){return this._container}},{key:"setText",value:function(t){return this.setDOMContent(e.window.document.createTextNode(t))}},{key:"setHTML",value:function(t){var i,r=e.window.document.createDocumentFragment(),n=e.window.document.createElement("body");for(n.innerHTML=t;i=n.firstChild;)r.appendChild(i);return this.setDOMContent(r)}},{key:"getMaxWidth",value:function(){return this._container&&this._container.style.maxWidth}},{key:"setMaxWidth",value:function(e){return this.options.maxWidth=e,this._update(),this}},{key:"setDOMContent",value:function(e){var t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=_("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){var i=this._closeButton=_("button","mapboxgl-popup-close-button",t);i.type="button",i.setAttribute("aria-label","Close popup"),i.setAttribute("aria-hidden","true"),i.innerHTML="×",i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}},{key:"addClassName",value:function(e){return this._classList.add(e),this._updateClassList(),this}},{key:"removeClassName",value:function(e){return this._classList.delete(e),this._updateClassList(),this}},{key:"setOffset",value:function(e){return this.options.offset=e,this._update(),this}},{key:"toggleClassName",value:function(e){var t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}},{key:"_onMouseEvent",value:function(e){this._update(e.point)}},{key:"_getAnchor",value:function(e){if(this.options.anchor)return this.options.anchor;var t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";var n=i.offsetWidth,a=i.offsetHeight,o=r.xt.transform.width-n/2;if(r.y+et.transform.height-a){if(o)return"bottom-left";if(s)return"bottom-right"}return o?"left":s?"right":"bottom"}},{key:"_updateClassList",value:function(){var e=this._container;if(e){var t=c(this._classList);t.push("mapboxgl-popup"),this._anchor&&t.push("mapboxgl-popup-anchor-".concat(this._anchor)),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}}},{key:"_update",value:function(t){var i=this,r=this._map,n=this._content;if(r&&(this._lngLat||this._trackPointer)&&n){var a=this._container;if(a||(a=this._container=_("div","mapboxgl-popup",r.getContainer()),this._tip=_("div","mapboxgl-popup-tip",a),a.appendChild(n)),this.options.maxWidth&&a.style.maxWidth!==this.options.maxWidth&&(a.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=fa(this._lngLat,this._pos,r.transform)),!this._trackPointer||t){var o=this._pos=this._trackPointer&&t?t:r.project(this._lngLat),s=ya(this.options.offset),l=this._anchor=this._getAnchor(s.y),u=ya(this.options.offset,l),c=o.add(u).round();r._requestDomTask((function(){i._container&&l&&(i._container.style.transform="".concat(da[l]," translate(").concat(c.x,"px,").concat(c.y,"px)"))}))}if(!this._marker&&r._showingGlobe()){var h=e.isLngLatBehindGlobe(r.transform,this._lngLat)?0:1;this._setOpacity(h)}this._updateClassList()}}},{key:"_focusFirstElement",value:function(){if(this.options.focusAfterOpen&&this._container){var e=this._container.querySelector(ma);e&&e.focus()}}},{key:"_onClose",value:function(){this.remove()}},{key:"_setOpacity",value:function(e){this._container&&(this._container.style.opacity="".concat(e)),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}}]),r}(e.Evented),Marker:pa,Style:fi,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.pointGeometry,MercatorCoordinate:e.MercatorCoordinate,FreeCameraOptions:en,Evented:e.Evented,config:e.config,prewarm:function(){tt().acquire(Qe)},clearPrewarmedResources:function(){var e=$e;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(Qe),$e=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return e.config.ACCESS_TOKEN},set accessToken(t){e.config.ACCESS_TOKEN=t},get baseApiUrl(){return e.config.API_URL},set baseApiUrl(t){e.config.API_URL=t},get workerCount(){return et.workerCount},set workerCount(e){et.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage:function(t){e.clearTileCache(t)},workerUrl:"",workerClass:null,setNow:e.exported.setNow,restoreNow:e.exported.restoreNow};return Ma})),i}()},3405:function(e,t,i){var r=i(3897);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.__esModule=!0,e.exports.default=e.exports},6115:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},6690:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},3515:function(e,t,i){var r=i(6015),n=i(9617);function a(t,i,o){return n()?(e.exports=a=Reflect.construct.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=a=function(e,t,i){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return i&&r(a,i.prototype),a},e.exports.__esModule=!0,e.exports.default=e.exports),a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},9728:function(e,t,i){var r=i(4062);function n(e,t){for(var i=0;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==i.return||i.return()}finally{if(l)throw o}}}},e.exports.__esModule=!0,e.exports.default=e.exports},6389:function(e,t,i){var r=i(3808),n=i(9617),a=i(4993);e.exports=function(e){var t=n();return function(){var i,n=r(e);if(t){var o=r(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return a(this,i)}},e.exports.__esModule=!0,e.exports.default=e.exports},8416:function(e,t,i){var r=i(4062);e.exports=function(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports},1588:function(e,t,i){var r=i(1753);function n(){return"undefined"!==typeof Reflect&&Reflect.get?(e.exports=n=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=n=function(e,t,i){var n=r(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(arguments.length<3?e:i):a.value}},e.exports.__esModule=!0,e.exports.default=e.exports),n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},3808:function(e){function t(i){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},1655:function(e,t,i){var r=i(6015);e.exports=function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},6035:function(e){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports},9617:function(e){e.exports=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},9498:function(e){e.exports=function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},2281:function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},4993:function(e,t,i){var r=i(8698).default,n=i(6115);e.exports=function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},6015:function(e){function t(i,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(i,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},1753:function(e,t,i){var r=i(3808);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},1589:function(e,t,i){var r=i(5372),n=i(9498),a=i(6116),o=i(2218);e.exports=function(e){return r(e)||n(e)||a(e)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},861:function(e,t,i){var r=i(3405),n=i(9498),a=i(6116),o=i(2281);e.exports=function(e){return r(e)||n(e)||a(e)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},5036:function(e,t,i){var r=i(8698).default;e.exports=function(e,t){if("object"!==r(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},4062:function(e,t,i){var r=i(8698).default,n=i(5036);e.exports=function(e){var t=n(e,"string");return"symbol"===r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},3496:function(e,t,i){var r=i(3808),n=i(6015),a=i(6035),o=i(3515);function s(t){var i="function"===typeof Map?new Map:void 0;return e.exports=s=function(e){if(null===e||!a(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return o(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n(t,e)},e.exports.__esModule=!0,e.exports.default=e.exports,s(t)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}]); //# sourceMappingURL=483.cfd1db64.chunk.js.map