1(this["webpackJsonpstudent-playbook"]=this["webpackJsonpstudent-playbook"]||[]).push([[9],{231:function(e,t){function i(t){return e.exports=i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(t)}e.exports=i},232:function(e,t,i){var r=i(242);e.exports=function(e,t){if(e){if("string"===typeof e)return r(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}},241:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},242:function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}},243:function(e,t){function i(t,r){return e.exports=i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(t,r)}e.exports=i},255:function(e,t){e.exports=function(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},256:function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},257:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},258:function(e,t){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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},259:function(e,t,i){var r=i(275),n=i(241);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!==typeof t?n(e):t}},264:function(e,t,i){var r=i(265);function n(t,i,a){return"undefined"!==typeof Reflect&&Reflect.get?e.exports=n=Reflect.get: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(i):a.value}},n(t,i,a||t)}e.exports=n},265:function(e,t,i){var r=i(231);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},266:function(e,t,i){var r=i(267),n=i(255),a=i(232),o=i(268);e.exports=function(e){return r(e)||n(e)||a(e)||o()}},267:function(e,t,i){var r=i(242);e.exports=function(e){if(Array.isArray(e))return r(e)}},268:function(e,t){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.")}},269:function(e,t,i){var r=i(256),n=i(270),a=i(232),o=i(257);e.exports=function(e,t){return r(e)||n(e,t)||a(e,t)||o()}},270:function(e,t){e.exports=function(e,t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e)){var i=[],r=!0,n=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(i.push(o.value),!t||i.length!==t);r=!0);}catch(l){n=!0,a=l}finally{try{r||null==s.return||s.return()}finally{if(n)throw a}}return i}}},271:function(e,t,i){var r=i(232);e.exports=function(e,t){var i;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=r(e))||t&&e&&"number"===typeof e.length){i&&(e=i);var n=0,a=function(){};return{s:a,n:function(){return n>=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=e[Symbol.iterator]()},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}}}}},273:function(e,t,i){var r=i(243);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}}),t&&r(e,t)}},274:function(e,t,i){var r=i(231),n=i(258),a=i(259);e.exports=function(e){var t=n();return function(){var i,n=r(e);
1if(t){var o=r(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return a(this,i)}}},275:function(e,t){function i(t){return"function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?e.exports=i=function(e){return typeof e}:e.exports=i=function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(t)}e.exports=i},276:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},277:function(e,t){function i(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e}},296:function(e,t,i){var r=i(243),n=i(258);function a(t,i,o){return n()?e.exports=a=Reflect.construct: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},a.apply(null,arguments)}
vendor: 4,319 bytes, line 1
1e.exports=a},365:function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var r=i(99);function n(e,t){var i;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=Object(r.a)(e))||t&&e&&"number"===typeof e.length){i&&(e=i);var n=0,a=function(){};return{s:a,n:function(){return n>=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=e[Symbol.iterator]()},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}}}}},367:function(e,t,i){var r=i(368),n=i(241),a=i(296),o=i(264),s=i(231),l=i(259),u=i(369),c=i(266),h=i(269),f=i(271),p=i(370),d=i(273),m=i(274),v=i(276),y=i(277);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="undefined"!=typeof self?self:{},i=r;function r(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=r,this.p2x=i,this.p2y=r}r.prototype.sampleCurveX=function(e){return((this.ax*e+this.bx)*e+this.cx)*e},r.prototype.sampleCurveY=function(e){return((this.ay*e+this.by)*e+this.cy)*e},r.prototype.sampleCurveDerivativeX=function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},r.prototype.solveCurveX=function(e,t){var i,r,n,a,o;for(void 0===t&&(t=1e-6),n=e,o=0;o<8;o++){if(a=this.sampleCurveX(n)-e,Math.abs(a)<t)return n;var s=this.sampleCurveDerivativeX(n);if(Math.abs(s)<1e-6)break;n-=a/s}if((n=e)<(i=0))return i;if(n>(r=1))return r;for(;i<r;){if(a=this.sampleCurveX(n),Math.abs(a-e)<t)return n;e>a?i=n:r=n,n=.5*(r-i)+i}return n},r.prototype.solve=function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))};var _=g;function g(e,t){this.x=e,this.y=t}g.prototype={clone:function(){return new g(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}
1,_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}},g.convert=function(e){return e instanceof g?e:Array.isArray(e)?new g(e[0],e[1]):e};var x=Math.PI/180,b=180/Math.PI;function w(e){return e*x}function k(e){return e*b}var T=[[0,0],[1,0],[1,1],[0,1]];function E(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 S(e,t,r,n){var a=new i(e,t,r,n);return function(e){return a.solve(e)}}var A=S(.25,.1,.25,1);function M(e,t,i){return Math.min(i,Math.max(t,e))}function I(e,t,i){return(i=M((i-e)/(t-e),0,1))*i*(3-2*i)}function C(e,t,i){var r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function z(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 P(e){var t=[];for(var i in e)t.push(e[i]);return t}function D(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n=0,a=i;n<a.length;n++){var o=a[n];for(var s in o)e[s]=o[s]}return e}var L=1;function B(){return L++}function R(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function F(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function O(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 U(e,t){e.forEach((function(e){t[e]&&(t[e]=t[e].bind(t))}))}function V(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 N(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 G(e){return Array.isArray(e)?e.map(G):"object"==typeof e&&e?j(e,G):e}var Z={};function q(e){Z[e]||("undefined"!=typeof console&&console.warn(e),Z[e]=!0)}function W(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function X(e){for(var t,i,r=0,n=0,a=e.length,o=a-1;n<a;o=n++)t=e[n],r+=((i=e[o]).x-t.x)*(t.y+i.y);return r}function H(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function Y(e){var t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\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 K=null;function J(e){if(null==K){var t=e.navigator?e.navigator.userAgent:null;K=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return K}function $(e){try{var i=t[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Q(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}var ee=t.performance;function te(e){var t=e?e.url.toString():void 0;return ee.getEntriesByName(t)}var ie,re,ne,ae,oe,se,le,ue="2.10.0",ce={now:function(){return void 0!==ne?ne:t.performance.now()},setNow:function(e){ne=e},restoreNow:function(){ne=void 0},frame:function(e){var i=t.requestAnimationFrame(e);return{cancel:function(){return t.cancelAnimationFrame(i)}}},getImageData:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=e.width,n=e.height;ae||(ae=t.document.createElement("canvas"));var a=ae.getContext("2d");if(!a)throw new Error("failed to create canvas 2d context");return(r>ae.width||n>ae.height)&&(ae.width=r,ae.height=n),a.clearRect(-i,-i,r+2*i,n+2*i),a.drawImage(e,0,0,r,n),a.getImageData(-i,-i,r+2*i,n+2*i)},resolveURL:function(e){return ie||(ie=t.document.createElement("a")),ie.href=e,ie.href},get devicePixelRatio(){return t.devicePixelRatio},get prefersReducedMotion(){return!!t.matchMedia&&(null==re&&(re=t.matchMedia("(prefers-reduced-motion: reduce)")),re.matches)}},he={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==oe){var e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{oe=null!=Object({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(Object({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){oe=e}}return oe},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},fe={supported:!1,testSupport:function(e){!pe&&le&&(de?me(e):se=e)}},pe=!1,de=!1;function me(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,le),e.isContextLost())return;fe.supported=!0}
1catch(e){}e.deleteTexture(t),pe=!0}t.document&&((le=t.document.createElement("img")).onload=function(){se&&me(se),se=null,de=!0},le.onerror=function(){pe=!0,se=null},le.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var ve="01",ye="NO_ACCESS_TOKEN";function _e(e){return 0===e.indexOf("mapbox:")}function ge(e){return he.API_URL_REGEX.test(e)}var xe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function be(e){var t=e.match(xe);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function we(e){var t=e.params.length?"?".concat(e.params.join("&")):"";return"".concat(e.protocol,"://").concat(e.authority).concat(e.path).concat(t)}function ke(e){if(!e)return null;var i=e.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(decodeURIComponent(t.atob(i[1]).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(e){return null}}var Te,Ee=function(){function e(t){v(this,e),this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}return y(e,[{key:"getStorageKey",value:function(e){var i=ke(he.ACCESS_TOKEN),r="";return r=i&&i.u?t.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(Number("0x"+t))}))):he.ACCESS_TOKEN||"",e?"mapbox.eventData.".concat(e,":").concat(r):"mapbox.eventData:".concat(r)}}
1,{key:"fetchEventData",value:function(){var e=$("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(e)try{var n=t.localStorage.getItem(i);n&&(this.eventData=JSON.parse(n));var a=t.localStorage.getItem(r);a&&(this.anonId=a)}catch(e){q("Unable to read from LocalStorage")}}},{key:"saveEventData",value:function(){var e=$("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(e)try{t.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&t.localStorage.setItem(i,JSON.stringify(this.eventData))}catch(e){q("Unable to write to LocalStorage")}}},{key:"processRequests",value:function(e){}},{key:"postEvent",value:function(e,t,i,r){var n=this;if(he.EVENTS_URL){var a=be(he.EVENTS_URL);a.params.push("access_token=".concat(r||he.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(e).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:ue,skuId:ve,userId:this.anonId},s=t?D(o,t):o,l={url:we(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=Xe(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}(),Se=new(function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,"appUserTurnstile"))._customAccessToken=e,r}return y(i,[{key:"postTurnstileEvent",value:function(e,t){he.EVENTS_URL&&he.ACCESS_TOKEN&&Array.isArray(e)&&e.some((function(e){return _e(e)||ge(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=ke(he.ACCESS_TOKEN),r=i?i.u:he.ACCESS_TOKEN,n=r!==this.eventData.tokenU;O(this.anonId)||(this.anonId=R(),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,{"enabled.telemetry":!1},(function(e){e||(t.eventData.lastSuccess=a,t.eventData.tokenU=r)}),e):this.processRequests()}}}]),i}(Ee)),Ae=Se.postTurnstileEvent.bind(Se),Me=new(function(e){d(i,e);var t=m(i);function i(){var e;return v(this,i),(e=t.call(this,"map.load")).success={},e.skuToken="",e}return y(i,[{key:"postMapLoadEvent",value:function(e,t,i,r){this.skuToken=t,this.errorCb=r,he.EVENTS_URL&&(i||he.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ye)))}},{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(),O(this.anonId)||(this.anonId=R()),this.postEvent(n,{skuToken:this.skuToken},(function(e){e?t.errorCb(e):r&&(t.success[r]=!0)}),e))}}}]),i}(Ee)),Ie=Me.postMapLoadEvent.bind(Me),Ce=new(function(e){d(i,e);var t=m(i);function i(){var e;return v(this,i),(e=t.call(this,"map.auth")).success={},e.skuToken="",e}return y(i,[{key:"getSession",value:function(e,t,i,r){var n=this;if(he.API_URL&&he.SESSION_PATH){var a=be(he.API_URL+he.SESSION_PATH);a.params.push("sku=".concat(t||"")),a.params.push("access_token=".concat(r||he.ACCESS_TOKEN||""));var o={url:we(a),headers:{"Content-Type":"text/plain"}};this.pendingRequest=He(o,(function(e){n.pendingRequest=null,i(e),n.saveEventData(),n.processRequests(r)}))}}},{key:"getSessionAPI",value:function(e,t,i,r){this.skuToken=t,this.errorCb=r,he.SESSION_PATH&&he.API_URL&&(i||he.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ye)))}},{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.getSession(n,this.skuToken,(function(e){e?t.errorCb(e):r&&(t.success[r]=!0)}),e)}}}]),i}(Ee)),ze=Ce.getSessionAPI.bind(Ce),Pe=new Set,De=500,Le=50,Be={};function Re(e){var t,i,r=Ue(e);r&&r.forEach((function(e){var r=e.split("=");"language"===r[0]?t=r[1]:"worldview"===r[0]&&(i=r[1])}));var n="mapbox-tiles";return t&&(n+="-".concat(t)),i&&(n+="-".concat(i)),n}function Fe(){try{return t.caches}catch(e){}}function Oe(e){var t=Fe();t&&!Be[e]&&(Be[e]=t.open(e))}function Ue(e){var t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}function Ve(e){var t=e.indexOf("?");if(t<0)return e;var i=Ue(e).filter((function(e){var t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return i.length?"".concat(e.slice(0,t),"?").concat(i.join("&")):e.slice(0,t)}var je=1/0,Ne={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(Ne);var Ge=function(e){d(i,e);var t=m(i);function i(e,r,n){var a;return v(this,i),401===r&&ge(n)&&(e+=": you may have provided an invali
1d Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),(a=t.call(this,e)).status=r,a.url=n,a}return y(i,[{key:"toString",value:function(){return"".concat(this.name,": ").concat(this.message," (").concat(this.status,"): ").concat(this.url)}}]),i}(p(Error)),Ze=H()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===t.location.protocol?t.parent:t).location.href},qe=function(e,i){if(!(/^file:/.test(r=e.url)||/^file:/.test(Ze())&&!/^\w+:/.test(r))){if(t.fetch&&t.Request&&t.AbortController&&t.Request.prototype.hasOwnProperty("signal"))return function(e,i){var r,n=new t.AbortController,a=new t.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:Ze(),signal:n.signal}),o=!1,s=!1,l=(r=a.url).indexOf("sku=")>0&&ge(r);"json"===e.type&&a.headers.set("Accept","application/json");var u=function(r,n,o){if(!s){if(r&&"SecurityError"!==r.message&&q(r),n&&o)return c(n);var u=Date.now();t.fetch(a).then((function(t){if(t.ok){var r=l?t.clone():null;return c(t,r,u)}return i(new Ge(t.statusText,t.status,e.url))})).catch((function(e){20!==e.code&&i(new Error(e.message))}))}},c=function(r,n,l){("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then((function(e){s||(n&&l&&function(e,i,r){var n=Re(e.url);if(Oe(n),Be[n]){var a={status:i.status,statusText:i.statusText,headers:new t.Headers};i.headers.forEach((function(e,t){return a.headers.set(t,e)}));var o=Y(i.headers.get("Cache-Control")||"");if(!o["no-store"]){o["max-age"]&&a.headers.set("Expires",new Date(r+1e3*o["max-age"]).toUTCString());var s=a.headers.get("Expires");s&&(new Date(s).getTime()-r<42e4||function(e,t){if(void 0===Te)try{new Response(new ReadableStream),Te=!0}catch(e){Te=!1}Te?t(e.body):e.blob().then(t)}(i,(function(i){var r=new t.Response(i,a);Oe(n),Be[n]&&Be[n].then((function(t){return t.put(Ve(e.url),r)})).catch((function(e){return q(e.message)}))})))}}}(a,n,l),o=!0,i(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(e){s||i(new Error(e.message))}))};return l?function(e,t){var i=Re(e.url);if(Oe(i),!Be[i])return t(null);var r=Ve(e.url);Be[i].then((function(e){e.match(r).then((function(i){var n=function(e){if(!e)return!1;var t=new Date(e.headers.get("Expires")||0),i=Y(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(i);e.delete(r),n&&e.put(r,i.clone()),t(null,i,n)})).catch(t)})).catch(t)}(a,u):u(null,null),{cancel:function(){s=!0,o||n.abort()}}}(e,i);if(H()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}var r;return function(e,i){var r=new t.XMLHttpRequest;for(var n in r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer"),e.headers)r.setRequestHeader(n,e.headers[n]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=function(){i(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var t=r.response;if("json"===e.type)try{t=JSON.parse(r.response)}catch(e){return i(e)}i(null,t,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else i(new Ge(r.statusText,r.status,e.url))},r.send(e.body),{cancel:function(){return r.abort()}}}(e,i)},We=function(e,t){return qe(D(e,{type:"arrayBuffer"}),t)},Xe=function(e,t){return qe(D(e,{method:"POST"}),t)},He=function(e,t){return qe(D(e,{method:"GET"}),t)};function Ye(e){var i=t.document.createElement("a");return i.href=e,i.protocol===t.document.location.protocol&&i.host===t.document.location.host}var Ke,Je,$e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";Ke=[],Je=0;var Qe=function e(i,r){if(fe.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Je>=he.MAX_PARALLEL_IMAGE_REQUESTS){var n={requestParameters:i,callback:r,cancelled:!1,cancel:function(){this.cancelled=!0}};return Ke.push(n),n}Je++;var a=!1,o=function(){if(!a)for(a=!0,Je--;Ke.length&&Je<he.MAX_PARALLEL_IMAGE_REQUESTS;){var t=Ke.shift(),i=t.requestParameters,r=t.callback;t.cancelled||(t.cancel=e(i,r).cancel)}},s=We(i,(function(e,i,n,a){o(),e?r(e):i&&(t.createImageBitmap?function(e,i){var r=new t.Blob([new Uint8Array(e)],{type:"image/png"});t.createImageBitmap(r).then((function(e){i(null,e)}
1)).catch((function(e){i(new Error("Could not load image because of ".concat(e.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")))}))}(i,(function(e,t){return r(e,t,n,a)})):function(e,i){var r=new t.Image,n=t.URL;r.onload=function(){i(null,r),n.revokeObjectURL(r.src),r.onload=null,t.requestAnimationFrame((function(){r.src=$e}))},r.onerror=function(){return i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var a=new t.Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?n.createObjectURL(a):$e}(i,(function(e,t){return r(e,t,n,a)})))}));return{cancel:function(){s.cancel(),o()}}};function et(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function tt(e,t,i){if(i&&i[e]){var r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}var it=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};v(this,e),D(this,i),this.type=t},rt=function(e){d(i,e);var t=m(i);function i(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return v(this,i),t.call(this,"error",D({error:e},r))}return i}(it),nt=function(){function e(){v(this,e)}return y(e,[{key:"on",value:function(e,t){return this._listeners=this._listeners||{},et(e,t,this._listeners),this}},{key:"off",value:function(e,t){return tt(e,t,this._listeners),tt(e,t,this._oneTimeListeners),this}},{key:"once",value:function(e,t){var i=this;return t?(this._oneTimeListeners=this._oneTimeListeners||{},et(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 it(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;tt(i,u,this._oneTimeListeners),u.call(this,e)}}catch(h){l.e(h)}finally{l.f()}var c=this._eventedParent;c&&(D(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),c.fire(e))}else e instanceof rt&&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}(),at=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1
vendor: 17,950 bytes, line 1
1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-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":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-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"}
vendor: 1,871 bytes, line 1
1,"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}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-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":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"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"},"cross-faded":{"type":"property-type"},"cross-faded-data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function ot(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n=0,a=i;n<a.length;n++){var o=a[n];for(var s in o)e[s]=o[s]}return e}function st(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function lt(e){if(Array.isArray(e))return e.map(lt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){var t={};for(var i in e)t[i]=lt(e[i]);return t}return st(e)}var ut=function(e){d(i,e);var t=m(i);function i(e,r){var n;return v(this,i),(n=t.call(this,r)).message=r,n.key=e,n}return i}(p(Error)),ct=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];v(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()}}
1return y(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}(),ht={kind:"null"},ft={kind:"number"},pt={kind:"string"},dt={kind:"boolean"},mt={kind:"color"},vt={kind:"object"},yt={kind:"value"},_t={kind:"collator"},gt={kind:"formatted"},xt={kind:"resolvedImage"};function bt(e,t){return{kind:"array",itemType:e,N:t}}function wt(e){if("array"===e.kind){var t=wt(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 kt=[ht,ft,pt,dt,mt,gt,vt,bt(yt),xt];function Tt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Tt(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){var i,r=f(kt);try{for(r.s();!(i=r.n()).done;)if(!Tt(i.value,t))return null}catch(n){r.e(n)}finally{r.f()}}}return"Expected ".concat(wt(e)," but found ").concat(wt(t)," instead.")}function Et(e,t){return t.some((function(t){return t.kind===e.kind}))}function St(e,t){return t.some((function(t){return"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e}))}function At(e){var t={exports:{}};return e(t,t.exports),t.exports}var Mt=At((function(e,t){var i={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function r(e){return(e=Math.round(e))<0?0:e>255?255:e}function n(e){return r("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function a(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function o(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{t.parseCSSColor=function(e){var t,s=e.replace(/ /g,"").toLowerCase();if(s in i)return i[s].slice();if("#"===s[0])return 4===s.length?(t=parseInt(s.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===s.length&&(t=parseInt(s.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var l=s.indexOf("("),u=s.indexOf(")");if(-1!==l&&u+1===s.length){var c=s.substr(0,l),h=s.substr(l+1,u-(l+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=a(h.pop());case"rgb":return 3!==h.length?null:[n(h[0]),n(h[1]),n(h[2]),f];case"hsla":if(4!==h.length)return null;f=a(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,d=a(h[1]),m=a(h[2]),v=m<=.5?m*(d+1):m+d-m*d,y=2*m-v;return[r(255*o(y,v,p+1/3)),r(255*o(y,v,p)),r(255*o(y,v,p-1/3)),f];default:return null}}return null}}catch(e){}})),It=function(){function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;v(this,e),this.r=t,this.g=i,this.b=r,this.a=n}return y(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=Mt.parseCSSColor(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}();It.black=new It(0,0,0,1),It.white=new It(1,1,1,1),It.transparent=new It(0,0,0,0),It.red=new It(1,0,0,1),It.blue=new It(0,0,1,1);var Ct=It,zt=function(){function e(t,i,r){v(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"})}
1return y(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}(),Pt=function e(t,i,r,n,a){v(this,e),this.text=t.normalize?t.normalize():t,this.image=i,this.scale=r,this.fontStack=n,this.textColor=a},Dt=function(){function e(t){v(this,e),this.sections=t}return y(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 Pt(t,null,null,null,null)])}},{key:"factory",value:function(t){return t instanceof e?t:e.fromString(t)}}]),e}(),Lt=function(){function e(t){v(this,e),this.name=t.name,this.available=t.available}return y(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 Bt(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 Rt(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 Ct)return!0;if(e instanceof zt)return!0;if(e instanceof Dt)return!0;if(e instanceof Lt)return!0;if(Array.isArray(e)){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(!Rt(t.value))return!1}catch(n){i.e(n)}finally{i.f()}return!0}if("object"==typeof e){for(var r in e)if(!Rt(e[r]))return!1;return!0}return!1}function Ft(e){if(null===e)return ht;if("string"==typeof e)return pt;if("boolean"==typeof e)return dt;if("number"==typeof e)return ft;if(e instanceof Ct)return mt;if(e instanceof zt)return _t;if(e instanceof Dt)return gt;if(e instanceof Lt)return xt;if(Array.isArray(e)){var t,i,r=e.length,n=f(e);try{for(n.s();!(i=n.n()).done;){var a=Ft(i.value);if(t){if(t===a)continue;t=yt;break}t=a}}catch(o){n.e(o)}finally{n.f()}return bt(t||yt,r)}return vt}function Ot(e){var t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Ct||e instanceof Dt||e instanceof Lt?e.toString():JSON.stringify(e)}var Ut=function(){function e(t,i){v(this,e),this.type=t,this.value=i}return y(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 Ct?["rgba"].concat(this.value.toArray()):this.value instanceof Dt?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(!Rt(t[1]))return i.error("invalid value");var r=t[1],n=Ft(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}(),Vt=function(){function e(t){v(this,e),this.name="ExpressionEvaluationError",this.message=t}return y(e,[{key:"toJSON",value:function(){return this.message}}]),e}(),jt={string:pt,number:ft,boolean:dt,object:vt},Nt=function(){function e(t,i){v(this,e),this.type=t,this.args=i}return y(e,[{key:"evaluate",value:function(e){for(var t=0;t<this.args.length;t++){var i=this.args[t].evaluate(e);if(!Tt(this.type,Ft(i)))return i;if(t===this.args.length-1)throw new Vt("Expected value to be of type ".concat(wt(this.t
1ype),", but found ").concat(wt(Ft(i))," instead."))}return null}},{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=this.type,t=[e.kind];if("array"===e.kind){var i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);var r=e.N;("number"==typeof r||this.args.length>1)&&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 jt)||"object"===l)return i.error('The item type argument of "array" must be one of string, number, boolean',1);o=jt[l],n++}else o=yt;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=bt(o,s)}else r=jt[a];for(var u=[];n<t.length;n++){var c=i.parse(t[n],n,yt);if(!c)return null;u.push(c)}return new e(r,u)}}]),e}(),Gt=function(){function e(t){v(this,e),this.type=gt,this.sections=t}return y(e,[{key:"evaluate",value:function(e){return new Dt(this.sections.map((function(t){var i=t.content.evaluate(e);return Ft(i)===xt?new Pt("",i,null,null,null):new Pt(Ot(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}},{key:"eachChild",value:function(e){var t,i=f(this.sections);try{for(i.s();!(t=i.n()).done;){var r=t.value;e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}}catch(n){i.e(n)}finally{i.f()}}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var e,t=["format"],i=f(this.sections);try{for(i.s();!(e=i.n()).done;){var r=e.value;t.push(r.content.serialize());var n={};r.scale&&(n["font-scale"]=r.scale.serialize()),r.font&&(n["text-font"]=r.font.serialize()),r.textColor&&(n["text-color"]=r.textColor.serialize()),t.push(n)}}catch(a){i.e(a)}finally{i.f()}return t}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");for(var n=[],a=!1,o=1;o<=t.length-1;++o){var s=t[o];if(a&&"object"==typeof s&&!Array.isArray(s)){a=!1;var l=null;if(s["font-scale"]&&!(l=i.parse(s["font-scale"],1,ft)))return null;var u=null;if(s["text-font"]&&!(u=i.parse(s["text-font"],1,bt(pt))))return null;var c=null;if(s["text-color"]&&!(c=i.parse(s["text-color"],1,mt)))return null;var h=n[n.length-1];h.scale=l,h.font=u,h.textColor=c}else{var f=i.parse(t[o],1,yt);if(!f)return null;var p=f.type.kind;if("string"!==p&&"value"!==p&&"null"!==p&&"resolvedImage"!==p)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:f,scale:null,font:null,textColor:null})}}return new e(n)}}]),e}(),Zt=function(){function e(t){v(this,e),this.type=xt,this.input=t}return y(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e),i=Lt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-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,pt);return r?new e(r):i.error("No image name provided.")}}]),e}(),qt={"to-boolean":dt,"to-color":mt,"to-number":ft,"to-string":pt},Wt=function(){function e(t,i){v(this,e),this.type=t,this.args=i}return y(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 Ct)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."):Bt(t[0],t[1],t[2],t[3]))
1)return new Ct(t[0]/255,t[1]/255,t[2]/255,t[3])}}catch(c){n.e(c)}finally{n.f()}throw new Vt(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 Vt("Could not convert ".concat(JSON.stringify(s)," to number."))}return"formatted"===this.type.kind?Dt.fromString(Ot(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Lt.fromString(Ot(this.args[0].evaluate(e))):Ot(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 Gt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Zt(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=qt[r],a=[],o=1;o<t.length;o++){var s=i.parse(t[o],o,yt);if(!s)return null;a.push(s)}return new e(n,a)}}]),e}(),Xt=["Unknown","Point","LineString","Polygon"],Ht=function(){function e(){v(this,e),this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}return y(e,[{key:"id",value:function(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}},{key:"geometryType",value:function(){return this.feature?"number"==typeof this.feature.type?Xt[this.feature.type]:this.feature.type:null}},{key:"geometry",value:function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}},{key:"canonicalID",value:function(){return this.canonical}},{key:"properties",value:function(){return this.feature&&this.feature.properties||{}}},{key:"distanceFromCenter",value:function(){if(this.featureTileCoord&&this.featureDistanceData){var e=this.featureDistanceData.center,t=this.featureDistanceData.scale,i=this.featureTileCoord,r=i.x,n=i.y;return this.featureDistanceData.bearing[0]*(r*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}},{key:"parseColor",value:function(e){var t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Ct.parse(e)),t}}]),e}(),Yt=function(){function e(t,i,r,n){v(this,e),this.name=t,this.type=i,this._evaluate=r,this.args=n}return y(e,[{key:"evaluate",value:function(e){return this._evaluate(e,this.args)}},{key:"eachChild",value:function(e){this.args.forEach(e)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return[this.name].concat(this.args.map((function(e){return e.serialize()})))}}],[{key:"parse",value:function(t,i){var r,n=t[0],a=e.definitions[n];if(!a)return i.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0);var o,s=Array.isArray(a)?a[0]:a.type,l=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,u=l.filter((function(e){var i=h(e,1)[0];return!Array.isArray(i)||i.length===t.length-1})),p=null,d=f(u);try{for(d.s();!(o=d.n()).done;){var m=h(o.value,2),v=m[0],y=m[1];p=new _i(i.registry,i.path,null,i.scope);for(var _=[],g=!1,x=1;x<t.length;x++){var b=t[x],w=Array.isArray(v)?v[x-1]:v.type,k=p.parse(b,1+_.length,w);if(!k){g=!0;break}_.push(k)}if(!g)if(Array.isArray(v)&&v.length!==_.length)p.error("Expected ".concat(v.length," arguments, but found ").concat(_.length," instead."));else{for(var T=0;T<_.length;T++){var E=Array.isArray(v)?v[T]:v.type,S=_[T];p.concat(T+1).checkSubtype(E,S.type)}if(0===p.errors.length)return new e(n,s,y,_)}}}catch(z){d.e(z)}finally{d.f()}if(1===u.length)(r=i.errors).push.apply(r,c(p.errors));else{for(var A=(u.length?u:l).map((function(e){var t;return t=h(e,1)[0],Array.isArray(t)?"(".concat(t.map(wt).join(", "),")"):"(".concat(wt(t.type),"...)")})).join(" | "),M=[],I=1;I<t.length;I++){var C=i.parse(t[I],1+M.length);if(!C)return null;M.push(wt(C.type))}i.error("Expected arguments of type ".concat(A,", but found (").concat(M.join(", "),") instead."))}return null}},{key:"register",value:function(t,i){for(var r in e.definitions=i,i)t[r]=e}}]),e}(),Kt=function(){function e(t,i,r){v(this,e),this.type=_t,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}return y(e,[{key:"evaluate",value:function(e){return new zt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}},{key:"eachChild",value:function(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("Expected one argument.");var r=t[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");var n=i.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,dt);if(!n)return null;var a=i.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,dt);if(!a)return null;var o=null;return r.locale&&!(o=i.parse(r.locale,1,pt))?null:new e(n,a,o)}}]),e}(),Jt=8192;function $t(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Qt(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function ei(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*Jt),Math.round(r*n*Jt)]}function ti(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 ii(e,t){for(var i,r,n,a=!1,o=0,s=t.length;o<s;o++)for(var l=t[o],u=0,c=l.length;u<c-1;u++){if(ti(e,l[u],l[u+1]))return!1;(r=l[u])[1]>(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 ri(e,t){for(var i=0;i<t.length;i++)if(ii(e,t[i]))return!0;return!1}function ni(e,t,i,r){var n=r[0]-i[0],a=r[1]-i[1],o=(e[0]-i[0])*a-n*(e[1]-i[1]),s=(t[0]-i[0])*a-n*(t[1]-i[1]);return o>0&&s<0||o<0&&s>0}function ai(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,p=0;p<h.length-1;++p)if(0!=(l=[(s=h[p+1])[0]-(o=h[p])[0],s[1]-o[1]])[0]*(u=[(a=t)[0]-(n=e)[0],a[1]-n[1]])[1]-l[1]*u[0]&&ni(n,a,o,s)&&ni(o,s,n,a))return!0}catch(d){c.e(d)}finally{c.f()}return!1}function oi(e,t){for(var i=0;i<e.length;++i)if(!ii(e[i],t))return!1;for(var r=0;r<e.length-1;++r)if(ai(e[r],e[r+1],t))return!1;return!0}function si(e,t){for(var i=0;i<t.length;i++)if(oi(e,t[i]))return!0;return!1}function li(e,t,i){for(var r=[],n=0;n<e.length;n++){for(var a=[],o=0;o<e[n].length;o++){var s=ei(e[n][o],i);$t(t,s),a.push(s)}r.push(a)}return r}function ui(e,t,i){for(var r=[],n=0;n<e.length;n++){var a=li(e[n],t,i);r.push(a)}return r}function ci(e,t,i,r){if(e[0]<i[0]||e[0]>i[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}$t(t,e)}function hi(e,t,i,r){var n=Math.pow(2,r.z)*Jt,a=[r.x*Jt,r.y*Jt],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 p=u.value,d=[p.x+a[0],p.y+a[1]];ci(d,t,i,n),o.push(d)}}catch(m){h.e(m)}finally{h.f()}}}catch(m){l.e(m)}finally{l.f()}return o}function fi(e,t,i,r){var n=Math.pow(2,r.z)*Jt,a=[r.x*Jt,r.y*Jt],o=[];if(!e)return o;var s,l,u=f(e);try{for(u.s();!(s=u.n()).done;){var c,h=s.value,p=[],d=f(h);try{for(d.s();!(c=d.n()).done;){var m=c.value,v=[m.x+a[0],m.y+a[1]];$t(t,v),p.push(v)}}catch(w){d.e(w)}finally{d.f()}o.push(p)}}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;)ci(g.value,t,i,n)}catch(w){b.e(w)}finally{b.f()}}}catch(w){_.e(w)}finally{_.f()}}return o}var pi=function(){function e(t,i){v(this,e),this.type=dt,this.geojson=t,this.geometries=i}return y(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=li(t.coordinates,r,n),o=hi(e.geometry(),i,r,n);if(!Qt(i,r))return!1;var s,l=f(o);try{for(l.s();!(s=l.n()).done;)if(!ii(s.value,a))return!1}
1catch(d){l.e(d)}finally{l.f()}}if("MultiPolygon"===t.type){var u=ui(t.coordinates,r,n),c=hi(e.geometry(),i,r,n);if(!Qt(i,r))return!1;var h,p=f(c);try{for(p.s();!(h=p.n()).done;)if(!ri(h.value,u))return!1}catch(d){p.e(d)}finally{p.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=li(t.coordinates,r,n),o=fi(e.geometry(),i,r,n);if(!Qt(i,r))return!1;var s,l=f(o);try{for(l.s();!(s=l.n()).done;)if(!oi(s.value,a))return!1}catch(d){l.e(d)}finally{l.f()}}if("MultiPolygon"===t.type){var u=ui(t.coordinates,r,n),c=fi(e.geometry(),i,r,n);if(!Qt(i,r))return!1;var h,p=f(c);try{for(p.s();!(h=p.n()).done;)if(!si(h.value,u))return!1}catch(d){p.e(d)}finally{p.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(Rt(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;n<r.features.length;++n){var a=r.features[n].geometry.type;if("Polygon"===a||"MultiPolygon"===a)return new e(r,r.features[n].geometry)}else if("Feature"===r.type){var o=r.geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new e(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new e(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}}]),e}();function di(e){if(e instanceof Yt){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof pi)return!1;var t=!0;return e.eachChild((function(e){t&&!di(e)&&(t=!1)})),t}function mi(e){if(e instanceof Yt&&"feature-state"===e.name)return!1;var t=!0;return e.eachChild((function(e){t&&!mi(e)&&(t=!1)})),t}function vi(e,t){if(e instanceof Yt&&t.indexOf(e.name)>=0)return!1;var i=!0;return e.eachChild((function(e){i&&!vi(e,t)&&(i=!1)})),i}var yi=function(){function e(t,i){v(this,e),this.type=i.type,this.name=t,this.boundExpression=i}return y(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}(),_i=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 ct,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];v(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 y(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 Nt(t,[e]):"coerce"===i?new Wt(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 Ut)&&"resolvedImage"!==a.type.kind&&gi(a)){var l=new Ht;
1try{a=new Ut(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;r<t;r++)i[r-1]=arguments[r];var n="".concat(this.key).concat(i.map((function(e){return"[".concat(e,"]")})).join(""));this.errors.push(new ut(n,e))}},{key:"checkSubtype",value:function(e,t){var i=Tt(e,t);return i&&this.error(i),i}}]),e}();function gi(e){if(e instanceof yi)return gi(e.boundExpression);if(e instanceof Yt&&"error"===e.name)return!1;if(e instanceof Kt)return!1;if(e instanceof pi)return!1;var t=e instanceof Wt||e instanceof Nt,i=!0;return e.eachChild((function(e){i=t?i&&gi(e):i&&e instanceof Ut})),!!i&&di(e)&&vi(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function xi(e,t){for(var i,r,n=e.length-1,a=0,o=n,s=0;a<=o;)if(i=e[s=Math.floor((a+o)/2)],r=e[s+1],i<=t){if(s===n||t<r)return s;a=s+1}else{if(!(i>t))throw new Vt("Input is not a number.");o=s-1}return 0}var bi=function(){function e(t,i,r){v(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 y(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[xi(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;t<this.labels.length;t++)t>0&&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,ft);if(!r)return null;var n=[],a=null;i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);for(var o=1;o<t.length;o+=2){var s=1===o?-1/0:t[o],l=t[o+1],u=o,c=o+1;if("number"!=typeof s)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=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}();function wi(e,t,i){return e*(1-i)+t*i}function ki(e,t,i){return e.map((function(e,r){return wi(e,t[r],i)}))}var Ti=Object.freeze({__proto__:null,number:wi,color:function(e,t,i){return new Ct(wi(e.r,t.r,i),wi(e.g,t.g,i),wi(e.b,t.b,i),wi(e.a,t.a,i))},array:ki}),Ei=.95047,Si=1.08883,Ai=4/29,Mi=6/29,Ii=3*Mi*Mi,Ci=Math.PI/180,zi=180/Math.PI;function Pi(e){return e>.008856451679035631?Math.pow(e,1/3):e/Ii+Ai}function Di(e){return e>Mi?e*e*e:Ii*(e-Ai)}function Li(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Bi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ri(e){var t=Bi(e.r),i=Bi(e.g),r=Bi(e.b),n=Pi((.4124564*t+.3575761*i+.1804375*r)/Ei),a=Pi((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*a-16,a:500*(n-a),b:200*(a-Pi((.0193339*t+.119192*i+.9503041*r)/Si)),alpha:e.a}}function Fi(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*Di(t),i=Ei*Di(i),r=Si*Di(r),new Ct(Li(3.2404542*i-1.5371385*t-.4985314*r),Li(-.969266*i+1.8760108*t+.041556*r),Li(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function Oi(e,t,i){var r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}var Ui={forward:Ri,reverse:Fi,interpolate:function(e,t,i){return{l:wi(e.l,t.l,i),a:wi(e.a,t.a,i),b:wi(e.b,t.b,i),alpha:wi(e.alpha,t.alpha,i)}}},Vi={forward:function(e){var t=Ri(e),i=t.l,r=t.a,n=t.b,a=Math.atan2(n,r)*zi;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*Ci,i=e.c;return Fi({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:Oi(e.h,t.h,i),c:wi(e.c,t.c,i),l:wi(e.l,t.l,i),alpha:wi(e.alpha,t.alpha,i)}}},ji=Object.freeze({__proto__:null,lab:Ui,hcl:Vi});function Ni(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 Gi=function(){function e(t,i,r,n,a){v(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)}}
1catch(p){s.e(p)}finally{s.f()}}return y(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=xi(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?Ti[this.type.kind.toLowerCase()](l,u,s):"interpolate-hcl"===this.operator?Vi.reverse(Vi.interpolate(Vi.forward(l),Vi.forward(u),s)):Ui.reverse(Ui.interpolate(Ui.forward(l),Ui.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;i<this.labels.length;i++)t.push(this.labels[i],this.outputs[i].serialize());return t}}],[{key:"interpolationFactor",value:function(e,t,r,n){var a=0;if("exponential"===e.name)a=Ni(t,e.base,r,n);else if("linear"===e.name)a=Ni(t,1,r,n);else if("cubic-bezier"===e.name){var o=e.controlPoints;a=new i(o[0],o[1],o[2],o[3]).solve(Ni(t,1,r,n))}return a}},{key:"parse",value:function(t,i){var r=u(t),n=r[0],a=r[1],o=r[2],s=r.slice(3);if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};
1else if("exponential"===a[0]){var l=a[1];if("number"!=typeof l)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:l}}else{if("cubic-bezier"!==a[0])return i.error("Unknown interpolation type ".concat(String(a[0])),1,0);var c=a.slice(1);if(4!==c.length||c.some((function(e){return"number"!=typeof e||e<0||e>1})))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,ft)))return null;var h=[],f=null;"interpolate-hcl"===n||"interpolate-lab"===n?f=mt:i.expectedType&&"value"!==i.expectedType.kind&&(f=i.expectedType);for(var p=0;p<s.length;p+=2){var d=s[p],m=s[p+1],v=p+3,y=p+4;if("number"!=typeof d)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',v);if(h.length&&h[h.length-1][0]>=d)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',v);var _=i.parse(m,y,f);if(!_)return null;f=f||_.type,h.push([d,_])}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(wt(f)," is not interpolatable."))}}]),e}(),Zi=function(){function e(t,i){v(this,e),this.type=t,this.args=i}return y(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 Lt&&!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(c){s.e(c)}finally{s.f()}return new e(n&&o.some((function(e){return Tt(n,e.type)}))?yt:r,o)}}]),e}(),qi=function(){function e(t,i){v(this,e),this.type=i.type,this.bindings=[].concat(t),this.result=i}return y(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<t.length-1;n+=2){var a=t[n];if("string"!=typeof a)return i.error("Expected string, but found ".concat(typeof a," instead."),n);if(/[^a-zA-Z0-9_]/.test(a))return i.error("Variable names must contain only alphanumeric characters or '_'.",n);var o=i.parse(t[n+1],n+1);if(!o)return null;r.push([a,o])}var s=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return s?new e(r,s):null}}]),e}(),Wi=function(){function e(t,i,r){v(this,e),this.type=t,this.index=i,this.input=r}return y(e,[{key:"evaluate",value:function(e){var t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Vt("Array index out of bounds: ".concat(t," < 0."));if(t>=i.length)throw new Vt("Array index out of bounds: ".concat(t," > ").concat(i.length-1,"."));if(t!==Math.floor(t))throw new Vt("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,ft),n=i.parse(t[2],2,bt(i.expectedType||yt));return r&&n?new e(n.type.itemType,r,n):null}}]),e}(),Xi=function(){function e(t,i){v(this,e),this.type=dt,this.needle=t,this.haystack=i}return y(e,[{key:"evaluate",value:function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!St(t,["boolean","string","number","null"]))throw new Vt("Expected first argument to be of type boolean, string, number or null, but found ".concat(wt(Ft(t))," instead."));if(!St(i,["string","array"]))throw new Vt("Expected second argument to be of type array or string, but found ".concat(wt(Ft(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,yt),n=i.parse(t[2],2,yt);return r&&n?Et(r.type,[dt,pt,ft,ht,yt])?new e(r,n):i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(wt(r.type)," instead")):null}}]),e}(),Hi=function(){function e(t,i,r){v(this,e),this.type=ft,this.needle=t,this.haystack=i,this.fromIndex=r}return y(e,[{key:"evaluate",value:function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!St(t,["boolean","string","number","null"]))throw new Vt("Expected first argument to be of type boolean, string, number or null, but found ".concat(wt(Ft(t))," instead."));if(!St(i,["string","array"]))throw new Vt("Expected second argument to be of type array or string, but found ".concat(wt(Ft(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,yt),n=i.parse(t[2],2,yt);if(!r||!n)return null;if(!Et(r.type,[dt,pt,ft,ht,yt]))return i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(wt(r.type)," instead"));if(4===t.length){var a=i.parse(t[3],3,ft);return a?new e(r,n,a):null}return new e(r,n)}}]),e}(),Yi=function(){function e(t,i,r,n,a,o){v(this,e),this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=a,this.otherwise=o}return y(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e);return(Ft(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}},{key:"eachChild",value:function(e){e(this.input),this.outputs.forEac
1h(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,p=n;c<p.length;c++){var d=h(p[c],2),m=d[0],v=d[1];i.push(1===v.length?u(v[0]):v.map(u)),i.push(this.outputs[m].serialize())}return i.push(this.otherwise.serialize()),i}}],[{key:"parse",value:function(t,i){if(t.length<5)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=1)return i.error("Expected an even number of arguments.");var r,n;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(var a={},o=[],s=2;s<t.length-1;s+=2){var l=t[s],u=t[s+1];Array.isArray(l)||(l=[l]);var c=i.concat(s);if(0===l.length)return c.error("Expected at least one branch label.");var h,p=f(l);try{for(p.s();!(h=p.n()).done;){var d=h.value;if("number"!=typeof d&&"string"!=typeof d)return c.error("Branch labels must be numbers or strings.");if("number"==typeof d&&Math.abs(d)>Number.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if("number"==typeof d&&Math.floor(d)!==d)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,Ft(d)))return null}else r=Ft(d);if(void 0!==a[String(d)])return c.error("Branch labels must be unique.");a[String(d)]=o.length}}catch(_){p.e(_)}finally{p.f()}var m=i.parse(u,s,n);if(!m)return null;n=n||m.type,o.push(m)}var v=i.parse(t[1],1,yt);if(!v)return null;var y=i.parse(t[t.length-1],t.length-1,n);return y?"value"!==v.type.kind&&i.concat(1).checkSubtype(r,v.type)?null:new e(r,n,v,a,o,y):null}}]),e}(),Ki=function(){function e(t,i,r){v(this,e),this.type=t,this.branches=i,this.otherwise=r}return y(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<t.length-1;a+=2){var o=i.parse(t[a],a,dt);if(!o)return null;var s=i.parse(t[a+1],a+1,r);if(!s)return null;n.push([o,s]),r=r||s.type}var l=i.parse(t[t.length-1],t.length-1,r);return l?new e(r,n,l):null}}]),e}(),Ji=function(){function e(t,i,r,n){v(this,e),this.type=t,this.input=i,this.beginIndex=r,this.endIndex=n}return y(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!St(t,["string","array"]))throw new Vt("Expected first argument to be of type array or string, but found ".concat(wt(Ft(t))," instead."));if(this.endIndex){var r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)}},{key:"eachChild",value:function(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){if(null!=this.endIndex&&void 0!==this.endIndex){var e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.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,yt),n=i.parse(t[2],2,ft);if(!r||!n)return null;if(!Et(r.type,[bt(yt),pt,yt]))return i.error("Expected first argument to be of type array or string, but found ".concat(wt(r.type)," instead"));if(4===t.length){var a=i.parse(t[3],3,ft);return a?new e(r.type,r,n,a):null}return new e(r.type,r,n)}}]),e}();function $i(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 Qi(e,t,i,r){return 0===r.compare(t,i)}function er(e,t,i){var r="=="!==e&&"!="!==e;return function(){function n(e,t,i){v(this,n),this.type=dt,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}return y(n,[{key:"evaluate",value:function(n){var a=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){var s=Ft(a),l=Ft(o);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new Vt('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=Ft(a),c=Ft(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}}
1],[{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,yt);if(!a)return null;if(!$i(i,a.type))return t.concat(1).error('"'.concat(i,"\" comparisons are not supported for type '").concat(wt(a.type),"'."));var o=t.parse(e[2],2,yt);if(!o)return null;if(!$i(i,o.type))return t.concat(2).error('"'.concat(i,"\" comparisons are not supported for type '").concat(wt(o.type),"'."));if(a.type.kind!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error("Cannot compare types '".concat(wt(a.type),"' and '").concat(wt(o.type),"'."));r&&("value"===a.type.kind&&"value"!==o.type.kind?a=new Nt(o.type,[a]):"value"!==a.type.kind&&"value"===o.type.kind&&(o=new Nt(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,_t)))return null}return new n(a,o,s)}}]),n}()}var tr=er("==",(function(e,t,i){return t===i}),Qi),ir=er("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!Qi(0,t,i,r)})),rr=er("<",(function(e,t,i){return t<i}),(function(e,t,i,r){return r.compare(t,i)<0})),nr=er(">",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),ar=er("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),or=er(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0})),sr=function(){function e(t,i,r,n,a,o){v(this,e),this.type=pt,this.number=t,this.locale=i,this.currency=r,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=o}return y(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,ft);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,pt)))return null;var o=null;if(n.currency&&!(o=i.parse(n.currency,1,pt)))return null;var s=null;if(n.unit&&!(s=i.parse(n.unit,1,pt)))return null;var l=null;if(n["min-fraction-digits"]&&!(l=i.parse(n["min-fraction-digits"],1,ft)))return null;var u=null;return n["max-fraction-digits"]&&!(u=i.parse(n["max-fraction-digits"],1,ft))?null:new e(r,a,o,s,l,u)}}]),e}(),lr={"==":tr,"!=":ir,">":nr,"<":rr,">=":or,"<=":ar,array:Nt,at:Wi,boolean:Nt,case:Ki,coalesce:Zi,collator:Kt,format:Gt,image:Zt,in:Xi,"index-of":Hi,interpolate:Gi,"interpolate-hcl":Gi,"interpolate-lab":Gi,length:function(){function e(t){v(this,e),this.type=ft,this.input=t}return y(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 Vt("Expected value to be of type string or array, but found ".concat(wt(Ft(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(wt(r.type)," instead.")):new e(r):null}}]),e}
1(),let:qi,literal:Ut,match:Yi,number:Nt,"number-format":sr,object:Nt,slice:Ji,step:bi,string:Nt,"to-boolean":Wt,"to-color":Wt,"to-number":Wt,"to-string":Wt,var:yi,within:pi};function ur(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=Bt(r,n,a,s);if(l)throw new Vt(l);return new Ct(r/255*s,n/255*s,a/255*s,s)}function cr(e,t){return e in t}function hr(e,t){var i=t[e];return void 0===i?null:i}function fr(e){return{type:e}}Yt.register(lr,{error:[{kind:"error"},[pt],function(e,t){var i=h(t,1)[0];throw new Vt(i.evaluate(e))}],typeof:[pt,[yt],function(e,t){return wt(Ft(h(t,1)[0].evaluate(e)))}],"to-rgba":[bt(ft,4),[mt],function(e,t){return h(t,1)[0].evaluate(e).toArray()}],rgb:[mt,[ft,ft,ft],ur],rgba:[mt,[ft,ft,ft,ft],ur],has:{type:dt,overloads:[[[pt],function(e,t){return cr(h(t,1)[0].evaluate(e),e.properties())}],[[pt,vt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return cr(r.evaluate(e),n.evaluate(e))}]]},get:{type:yt,overloads:[[[pt],function(e,t){return hr(h(t,1)[0].evaluate(e),e.properties())}],[[pt,vt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return hr(r.evaluate(e),n.evaluate(e))}]]},"feature-state":[yt,[pt],function(e,t){return hr(h(t,1)[0].evaluate(e),e.featureState||{})}],properties:[vt,[],function(e){return e.properties()}],"geometry-type":[pt,[],function(e){return e.geometryType()}],id:[yt,[],function(e){return e.id()}],zoom:[ft,[],function(e){return e.globals.zoom}],pitch:[ft,[],function(e){return e.globals.pitch||0}],"distance-from-center":[ft,[],function(e){return e.distanceFromCenter()}],"heatmap-density":[ft,[],function(e){return e.globals.heatmapDensity||0}],"line-progress":[ft,[],function(e){return e.globals.lineProgress||0}],"sky-radial-progress":[ft,[],function(e){return e.globals.skyRadialProgress||0}],accumulated:[yt,[],function(e){return void 0===e.globals.accumulated?null:e.globals.accumulated}],"+":[ft,fr(ft),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}],"*":[ft,fr(ft),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:ft,overloads:[[[ft,ft],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)-n.evaluate(e)}],[[ft],function(e,t){return-h(t,1)[0].evaluate(e)}]]},"/":[ft,[ft,ft],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)/n.evaluate(e)}],"%":[ft,[ft,ft],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)%n.evaluate(e)}],ln2:[ft,[],function(){return Math.LN2}],pi:[ft,[],function(){return Math.PI}],e:[ft,[],function(){return Math.E}],"^":[ft,[ft,ft],function(e,t){var i=h(t,2),r=i[0],n=i[1];return Math.pow(r.evaluate(e),n.evaluate(e))}],sqrt:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.sqrt(i.evaluate(e))}],log10:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))/Math.LN10}],ln:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))}],log2:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))/Math.LN2}],sin:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.sin(i.evaluate(e))}],cos:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.cos(i.evaluate(e))}],tan:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.tan(i.evaluate(e))}],asin:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.asin(i.evaluate(e))}],acos:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.acos(i.evaluate(e))}],atan:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.atan(i.evaluate(e))}],min:[ft,fr(ft),function(e,t){return Math.min.apply(Math,c(t.map((function(t){return t.evaluate(e)}))))}],max:[ft,fr(ft),function(e,t){return Math.max.apply(Math,c(t.map((function(t){return t.evaluate(e)}))))}],abs:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.abs(i.evaluate(e))}],round:[ft,[ft],function(e,t){var i=h(t,1)[0].evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.floor(i.evaluate(e))}],ceil:[ft,[ft],function(e,t){var i=h(t,1)[0];return Math.ceil(i.evaluate(e))}],"filter-==":[dt,[pt,yt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return e.properties()[r.value]===n.value}],"filter-id-==":[dt,[yt],function(e,t){var i=h(t,1)[0];return e.id()===i.value}],"filter-type-==":[dt,[pt],function(e,t){var i=h(t,1)[0];return e.geometryType()===i.value}],"filter-<":[dt,[pt,yt],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-<":[dt,[yt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r<n}],"filter->":[dt,[pt,yt],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->":[dt,[yt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r>n}],"filter-<=":[dt,[pt,yt],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-<=":[dt,[yt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r<=n}],"filter->=":[dt,[pt,yt],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->=":[dt,[yt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r>=n}],"filter-has":[dt,[yt],function(e,t){return h(t,1)[0].value in e.properties()}],"filter-has-id":[dt,[],function(e){return null!==e.id()&&void 0!==e.id()}],"filter-type-in":[dt,[bt(pt)],function(e,t){return h(t,1)[0].value.indexOf(e.geometryType())>=0}],"filter-id-in":[dt,[bt(yt)],function(e,t){return h(t,1)[0].value.indexOf(e.id())>=0}],"filter-in-small":[dt,[pt,bt(yt)],function(e,t){var i=h(t,2),r=i[0];return i[1].value.indexOf(e.properties()[r.value])>=0}],"filter-in-large":[dt,[pt,bt(yt)],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:dt,overloads:[[[dt,dt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)&&n.evaluate(e)}],[fr(dt),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:dt,overloads:[[[dt,dt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)||n.evaluate(e)}],[fr(dt),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}]]},"!":[dt,[dt],function(e,t){return!h(t,1)[0].evaluate(e)}],"is-supported-script":[dt,[pt],function(e,t){var i=h(t,1)[0],r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[pt,[pt],function(e,t){return h(t,1)[0].evaluate(e).toUpperCase()}],downcase:[pt,[pt],function(e,t){return h(t,1)[0].evaluate(e).toLowerCase()}],concat:[pt,fr(yt),function(e,t){return t.map((function(t){return Ot(t.evaluate(e))})).join("")}],"resolved-locale":[pt,[_t],function(e,t){return h(t,1)[0].evaluate(e).resolvedLocale()}]});var pr=lr;function dr(e){return{result:"success",value:e}}function mr(e){return{result:"error",value:e}}function vr(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function yr(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function _r(e){return!!e.expression&&e.expression.interpolated}function gr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function xr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function br(e){return e}function wr(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||(_r(t)?"exponential":"interval");
1if(a&&((e=ot({},e)).stops&&(e.stops=e.stops.map((function(e){return[e[0],Ct.parse(e[1])]}))),e.default=Ct.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!ji[e.colorSpace])throw new Error("Unknown color space: ".concat(e.colorSpace));if("exponential"===l)i=Sr;else if("interval"===l)i=Er;else if("categorical"===l){i=Tr,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=Ar}if(o){for(var p={},d=[],m=0;m<e.stops.length;m++){var v=e.stops[m],y=v[0].zoom;void 0===p[y]&&(p[y]={zoom:y,type:e.type,property:e.property,default:e.default,stops:[]},d.push(y)),p[y].stops.push([v[0].value,v[1]])}for(var _=[],g=0,x=d;g<x.length;g++){var b=x[g];_.push([p[b].zoom,wr(p[b],t)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:Gi.interpolationFactor.bind(void 0,w),zoomStops:_.map((function(e){return e[0]})),evaluate:function(i,r){var n=i.zoom;return Sr({stops:_,base:e.base},t,n).evaluate(n,r)}}}if(s){var k="exponential"===l?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:k,interpolationFactor:Gi.interpolationFactor.bind(void 0,k),zoomStops:e.stops.map((function(e){return e[0]})),evaluate:function(a){var o=a.zoom;return i(e,t,o,r,n)}}}return{kind:"source",evaluate:function(a,o){var s=o&&o.properties?o.properties[e.property]:void 0;return void 0===s?kr(e.default,t.default):i(e,t,s,r,n)}}}function kr(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Tr(e,t,i,r,n){return kr(typeof i===n?r[i]:void 0,e.default,t.default)}function Er(e,t,i){if("number"!==gr(i))return kr(e.default,t.default);var r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];var n=xi(e.stops.map((function(e){return e[0]})),i);return e.stops[n][1]}function Sr(e,t,i){var r=void 0!==e.base?e.base:1;if("number"!==gr(i))return kr(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=xi(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=Ti[t.type]||br;if(e.colorSpace&&"rgb"!==e.colorSpace){var c=ji[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;i<e;i++)t[i]=arguments[i];var r=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return u(r,n,o)}}:u(s,l,o)}function Ar(e,t,i){return"color"===t.type?i=Ct.parse(i):"formatted"===t.type?i=Dt.fromString(i.toString()):"resolvedImage"===t.type?i=Lt.fromString(i.toString()):gr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),kr(i,e.default,t.default)}var Mr=function(){function e(t,i){v(this,e),this.expression=t,this._warningHistory={},this._evaluator=new Ht,this._defaultValue=i?function(e){return"color"===e.type&&(xr(e.default)||Array.isArray(e.default))?new Ct(0,0,0,0):"color"===e.type?Ct.parse(e.default)||null:void 0===e.default?null:e.default}(i):null,this._enumValues=i&&"enum"===i.type?i.values:null}return y(e,[{key:"evaluateWithoutErrorHandling",value:function(e,t,i,r,n,a,o,s){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=s||null,this.expression.evaluate(this._evaluator)}},{key:"evaluate",value:function(e,t,i,r,n,a,o,s){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=s||null;try{var l=this.expression.evaluate(this._evaluator);if(null==l||"number"==typeof l&&l!=l)return this._defaultValue;if(this._enumValues&&!(l in this._enumValues))throw new Vt("Expected value to be one of ".concat(Object.keys(this._enumValues).map((function(e){return JSON.stringify(e)})).join(", "),", but found ").concat(JSON.stringify(l)," instead."));return l}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}]),e}();function Ir(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in pr}function Cr(e,t){var i=new _i(pr,[],t?function(e){var t={color:mt,string:pt,number:ft,enum:pt,boolean:dt,formatted:gt,resolvedImage:xt};return"array"===e.type?bt(t[e.value]||yt,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?dr(new Mr(r,t)):mr(i.errors)}var zr=function(){function e(t,i){v(this,e),this.kind=t,this._styleExpression=i,this.isStateDependent="constant"!==t&&!mi(i.expression)}return y(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}(),Pr=function(){function e(t,i,r,n){v(this,e),this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==t&&!mi(i.expression),this.interpolationType=n}return y(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?Gi.interpolationFactor(this.interpolationType,e,t,i):0}}]),e}();function Dr(e,t){if("error"===(e=Cr(e,t)).result)return e;var i=e.value.expression,r=di(i);if(!r&&!vr(t))return mr([new ut("","data expressions not supported")]);var n=vi(i,["zoom","pitch","distance-from-center"]);if(!n&&!yr(t))return mr([new ut("","zoom expressions not supported")]);var a=Br(i);return a||n?a instanceof ut?mr([a]):a instanceof Gi&&!_r(t)?mr([new ut("",'"interpolate" expressions cannot be used with this property')]):dr(a?new Pr(r?"camera":"composite",e.value,a.labels,a
1instanceof Gi?a.interpolation:void 0):new zr(r?"constant":"source",e.value)):mr([new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}var Lr=function(){function e(t,i){v(this,e),this._parameters=t,this._specification=i,ot(this,wr(this._parameters,this._specification))}return y(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 Br(e){var t=null;if(e instanceof qi)t=Br(e.result);else if(e instanceof Zi){var i,r=f(e.args);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(t=Br(n))break}}catch(a){r.e(a)}finally{r.f()}}else(e instanceof bi||e instanceof Gi)&&e.input instanceof Yt&&"zoom"===e.input.name&&(t=e);return t instanceof ut||e.eachChild((function(e){var i=Br(e);i instanceof ut?t=i:!t&&i?t=new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new ut("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}var Rr=function e(t,i,r,n){v(this,e),this.message=(t?"".concat(t,": "):"")+r,n&&(this.identifier=n),null!=i&&i.__line__&&(this.line=i.__line__)};function Fr(e){var t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=[],l=gr(i);if("object"!==l)return[new Rr(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=yn:n["*"]?f=n["*"]:r["*"]&&(f=yn),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 Rr(t,i[u],'unknown property "'.concat(u,'"')))}for(var p in r)n[p]||r[p].required&&void 0===r[p].default&&void 0===i[p]&&s.push(new Rr(t,i,'missing required property "'.concat(p,'"')));return s}function Or(e){var t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,a=e.key,o=e.arrayElementValidator||yn;if("array"!==gr(t))return[new Rr(a,t,"array expected, ".concat(gr(t)," found"))];if(i.length&&t.length!==i.length)return[new Rr(a,t,"array length ".concat(i.length," expected, length ").concat(t.length," found"))];if(i["min-length"]&&t.length<i["min-length"])return[new Rr(a,t,"array length at least ".concat(i["min-length"]," expected, length ").concat(t.length," found"))];var s={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum,function:void 0};n.$version<7&&(s.function=i.function),"object"===gr(i.value)&&(s=i.value);for(var l=[],u=0;u<t.length;u++)l=l.concat(o({array:t,arrayIndex:u,value:t[u],valueSpec:s,style:r,styleSpec:n,key:"".concat(a,"[").concat(u,"]")}));return l}function Ur(e){var t=e.key,i=e.value,r=e.valueSpec,n=gr(i);if("number"===n&&i!=i&&(n="NaN"),"number"!==n)return[new Rr(t,i,"number expected, ".concat(n," found"))];if("minimum"in r){var a=r.minimum;if("array"===gr(r.minimum)&&(a=r.minimum[e.arrayIndex]),i<a)return[new Rr(t,i,"".concat(i," is less than the minimum value ").concat(a))]}if("maximum"in r){var o=r.maximum;if("array"===gr(r.maximum)&&(o=r.maximum[e.arrayIndex]),i>o)return[new Rr(t,i,"".concat(i," is greater than the maximum value ").concat(o))]}return[]}function Vr(e){var t,i,r,n=e.valueSpec,a=st(e.value.type),o={},s="categorical"!==a&&void 0===e.value.property,l=!s,u="array"===gr(e.value.stops)&&"array"===gr(e.value.stops[0])&&"object"===gr(e.value.stops[0][0]),c=Fr({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 Rr(e.key,e.value,'identity function may not have a "stops" property')];var t=[],i=e.value;return t=t.concat(Or({key:e.key,value:i,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===gr(i)&&0===i.length&&t.push(new Rr(e.key,i,"array must have at least one stop")),t},default:function(e){return yn({key:e.key,value:e.value,valueSpec:n,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&s&&c.push(new Rr(e.key,e.value,'missing required property "property"')),"identity"===a||e.value.stops||c.push(new Rr(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!_r(e.valueSpec)&&c.push(new Rr(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!vr(e.valueSpec)?c.push(new Rr(e.key,e.value,"property functions not supported")):s&&!yr(e.valueSpec)&&c.push(new Rr(e.key,e.value,"zoom functions not supported"))),"categorical"!==a&&!u||void 0!==e.value.property||c.push(new Rr(e.key,e.value,'"property" property is required')),c;function h(e){var t=[],a=e.value,s=e.key;
1if("array"!==gr(a))return[new Rr(s,a,"array expected, ".concat(gr(a)," found"))];if(2!==a.length)return[new Rr(s,a,"array length 2 expected, length ".concat(a.length," found"))];if(u){if("object"!==gr(a[0]))return[new Rr(s,a,"object expected, ".concat(gr(a[0])," found"))];if(void 0===a[0].zoom)return[new Rr(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new Rr(s,a,"object stop key must have value")];var l=st(a[0].zoom);if("number"!=typeof l)return[new Rr(s,a[0].zoom,"stop zoom values must be numbers")];if(r&&r>l)return[new Rr(s,a[0].zoom,"stop zoom values must appear in ascending order")];l!==r&&(r=l,i=void 0,o={}),t=t.concat(Fr({key:"".concat(s,"[0]"),value:a[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Ur,value:f}}))}else t=t.concat(f({key:"".concat(s,"[0]"),value:a[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},a));return Ir(lt(a[1]))?t.concat([new Rr("".concat(s,"[1]"),a[1],"expressions are not allowed in function stops.")]):t.concat(yn({key:"".concat(s,"[1]"),value:a[1],valueSpec:n,style:e.style,styleSpec:e.styleSpec}))}function f(e,r){var s=gr(e.value),l=st(e.value),u=null!==e.value?e.value:r;if(t){if(s!==t)return[new Rr(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 Rr(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 vr(n)&&void 0===a&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Rr(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<i?[new Rr(e.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===a&&l in o?[new Rr(e.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new Rr
1(e.key,u,"integer expected, found ".concat(String(l)))]}}function jr(e){var t=("property"===e.expressionContext?Dr:Cr)(lt(e.value),e.valueSpec);if("error"===t.result)return t.value.map((function(t){return new Rr("".concat(e.key).concat(t.key),e.value,t.message)}));var i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new Rr(e.key,e.value,'Invalid data expression for "'.concat(e.propertyKey,'". Output values must be contained as literals within the expression.'))];if("property"===e.expressionContext&&"layout"===e.propertyType&&!mi(i))return[new Rr(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return Nr(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!vi(i,["zoom","feature-state"]))return[new Rr(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!di(i))return[new Rr(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Nr(e,t){var i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression){var r,n=f(t.valueSpec.expression.parameters);try{for(n.s();!(r=n.n()).done;){var a=r.value;i.delete(a)}}catch(s){n.e(s)}finally{n.f()}}if(0===i.size)return[];var o=[];return e instanceof Yt&&i.has(e.name)?[new Rr(t.key,t.value,'["'.concat(e.name,'"] expression is not supported in a filter for a ').concat(t.object.type," layer with id: ").concat(t.object.id))]:(e.eachChild((function(e){o.push.apply(o,c(Nr(e,t)))})),o)}function Gr(e){var t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(st(i))&&n.push(new Rr(t,i,"expected one of [".concat(r.values.join(", "),"], ").concat(JSON.stringify(i)," found"))):-1===Object.keys(r.values).indexOf(st(i))&&n.push(new Rr(t,i,"expected one of [".concat(Object.keys(r.values).join(", "),"], ").concat(JSON.stringify(i)," found"))),n}function Zr(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":var t,i=f(e.slice(1));try{for(i.s();!(t=i.n()).done;){var r=t.value;if(!Zr(r)&&"boolean"!=typeof r)return!1}}catch(n){i.e(n)}finally{i.f()}return!0;default:return!0}}function qr(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};Zr(e)||(e=$r(e));var i=e,r=!0;try{r=function(e){if(!Hr(e))return e;var t=lt(e);return Xr(t),t=Wr(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=at["filter_".concat(t)],a=Cr(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=Cr(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=!di(u.value.expression)}return{filter:o=o,dynamicFilter:s||void 0,needGeometry:Jr(r),needFeature:!!l}}function Wr(e){if(!Array.isArray(e))return e;var t=function(e){if(Yr.has(e[0]))for(var t=1;t<e.length;t++)if(Hr(e[t]))return!0;return e}(e);return!0===t?t:t.map((function(e){return Wr(e)}))}function Xr(e){var t=!1,i=[];if("case"===e[0]){for(var r=1;r<e.length-1;r+=2)t=t||Hr(e[r]),i.push(e[r+1]);i.push(e[e.length-1])}else if("match"===e[0]){t=t||Hr(e[1]);for(var n=2;n<e.length-1;n+=2)i.push(e[n+1]);i.push(e[e.length-1])}else if("step"===e[0]){t=t||Hr(e[1]);for(var a=1;a<e.length-1;a+=2)i.push(e[a+1])}t&&(e.length=0,e.push.apply(e,["any"].concat(i)));for(var o=1;o<e.length;o++)Xr(e[o])}function Hr(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;for(var t,i=1;i<e.length;i++)if(Hr(e[i]))return!0;return!1}var Yr=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Kr(e,t){return e<t?-1:e>t?1:0}function Jr(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var t=1;t<e.length;t++)if(Jr(e[t]))return!0;return!1}function $r(e){if(!e)return!0;var t,i=e[0];return e.length<=1?"any"!==i:"=="===i?Qr(e[1],e[2],"=="):"!="===i?rn(Qr(e[1],e[2],"==")):"<"===i||">"===i||"<="===i||">="===i?Qr(e[1],e[2],i):"any"===i?(t=e.slice(1),["any"].concat(t.map($r))):"all"===i?["all"].concat(e.slice(1).map($r)):"none"===i?["all"].concat(e.slice(1).map($r).map(rn)):"in"===i?en(e[1],e.slice(2)):"!in"===i?rn(en(e[1],e.slice(2))):"has"===i?tn(e[1]):"!has"===i?rn(tn(e[1])):"within"!==i||e}function Qr(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 en(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(Kr)]]:["filter-in-small",e,["literal",t]]}}function tn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function rn(e){return["!",e]}function nn(e){return Zr(lt(e.value))?jr(ot({},e,{expressionContext:"filter",valueSpec:e.styleSpec["filter_".concat(e.layerType||"fill")]})):an(e)}function an(e){var t=e.value,i=e.key;if("array"!==gr(t))return[new Rr(i,t,"array expected, ".concat(gr(t)," found"))];var r,n=e.styleSpec,a=[];if(t.length<1)return[new Rr(i,t,"filter array must have at least 1 element")];switch(a=a.concat(Gr({key:"".concat(i,"[0]"),value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),st(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===st(t[1])&&a.push(new Rr(i,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":3!==t.length&&a.push(new Rr(i,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&"string"!==(r=gr(t[1]))&&a.push(new Rr("".concat(i,"[1]"),t[1],"string expected, ".concat(r," found")));for(var o=2;o<t.length;o++)r=gr(t[o]),"$type"===st(t[1])?a=a.concat(Gr({key:"".concat(i,"[").concat(o,"]"),value:t[o],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&a.push(new Rr("".concat(i,"[").concat(o,"]"),t[o],"string, number, or boolean expected, ".concat(r," found")));break;case"any":case"all":case"none":for(var s=1;s<t.length;s++)a=a.concat(an({key:"".concat(i,"[").concat(s,"]"),value:t[s],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":r=gr(t[1]),2!==t.length?a.push(new Rr(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"string"!==r&&a.push(new Rr("".concat(i,"[1]"),t[1],"string expected, ".concat(r," found")));break;case"within":r=gr(t[1]),2!==t.length?a.push(new Rr(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"object"!==r&&a.push(new Rr("".concat(i,"[1]"),t[1],"object expected, ".concat(r," found")))}return a}function on(e,t){var i=e.key,r=e.style,n=e.styleSpec,a=e.value,o=e.objectKey,s=n["".concat(t,"_").concat(e.layerType)];if(!s)return[];var l=o.match(/^(.*)-transition$/);if("paint"===t&&l&&s[l[1]]&&s[l[1]].transition)return yn({key:i,value:a,valueSpec:n.transition,style:r,styleSpec:n});var u,c=e.valueSpec||s[o];if(!c)return[new Rr(i,a,'unknown property "'.concat(o,'"'))];
1if("string"===gr(a)&&vr(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(a)))return[new Rr(i,a,'"'.concat(o,'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ').concat(JSON.stringify(u[1])," }`."))];var h=[];return"symbol"===e.layerType&&("text-field"===o&&r&&!r.glyphs&&h.push(new Rr(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&xr(lt(a))&&"identity"===st(a.type)&&h.push(new Rr(i,a,'"text-font" does not support identity functions'))),h.concat(yn({key:e.key,value:a,valueSpec:c,style:r,styleSpec:n,expressionContext:"property",propertyType:t,propertyKey:o}))}function sn(e){return on(e,"paint")}function ln(e){return on(e,"layout")}function un(e){var t=[],i=e.value,r=e.key,n=e.style,a=e.styleSpec;i.type||i.ref||t.push(new Rr(r,i,'either "type" or "ref" is required'));var o,s=st(i.type),l=st(i.ref);if(i.id)for(var u=st(i.id),c=0;c<e.arrayIndex;c++){var h=n.layers[c];st(h.id)===u&&t.push(new Rr(r,i.id,'duplicate layer id "'.concat(i.id,'", previously used at line ').concat(h.id.__line__)))}if("ref"in i)["type","source","source-layer","filter","layout"].forEach((function(e){e in i&&t.push(new Rr(r,i[e],'"'.concat(e,'" is prohibited for ref layers')))})),n.layers.forEach((function(e){st(e.id)===l&&(o=e)})),o?o.ref?t.push(new Rr(r,i.ref,"ref cannot reference another ref layer")):s=st(o.type):"string"==typeof l&&t.push(new Rr(r,i.ref,'ref layer "'.concat(l,'" not found')));else if("background"!==s&&"sky"!==s)if(i.source){var f=n.sources&&n.sources[i.source],p=f&&st(f.type);f?"vector"===p&&"raster"===s?t.push(new Rr(r,i.source,'layer "'.concat(i.id,'" requires a raster source'))):"raster"===p&&"raster"!==s?t.push(new Rr(r,i.source,'layer "'.concat(i.id,'" requires a vector source'))):"vector"!==p||i["source-layer"]?"raster-dem"===p&&"hillshade"!==s?t.push(new Rr(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]&&!i.paint["line-trim-offset"]||"geojson"===p&&f.lineMetrics||t.push(new Rr(r,i,'layer "'.concat(i.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new Rr(r,i,'layer "'.concat(i.id,'" must specify a "source-layer"'))):t.push(new Rr(r,i.source,'source "'.concat(i.source,'" not found')))}else t.push(new Rr(r,i,'missing required property "source"'));return t=t.concat(Fr({key:r,value:i,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return yn({key:"".concat(r,".type"),value:i.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"})},filter:function(e){return nn(ot({layerType:s},e))},layout:function(e){return Fr({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return ln(ot({layerType:s},e))}}})},paint:function(e){return Fr({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return sn(ot({layerType:s},e))}}})}}}))}function cn(e){var t=e.value,i=e.key,r=gr(t);return"string"!==r?[new Rr(i,t,"string expected, ".concat(r," found"))]:[]}var hn={promoteId:function(e){var t=e.key,i=e.value;if("string"===gr(i))return cn({key:t,value:i});var r=[];for(var n in i)r.push.apply(r,c(cn({key:"".concat(t,".").concat(n),value:i[n]})));return r}};function fn(e){var t=e.value,i=e.key,r=e.styleSpec,n=e.style;if(!t.type)return[new Rr(i,t,'"type" is required')];var a,o=st(t.type);switch(o){case"vector":case"raster":case"raster-dem":return a=Fr({key:i,value:t,valueSpec:r["source_".concat(o.replace("-","_"))],style:e.style,styleSpec:r,objectElementValidators:hn});case"geojson":if(a=Fr({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,objectElementValidators:hn}),t.cluster)for(var s in t.clusterProperties){var l,u,f=h(t.clusterProperties[s],2),p=f[0],d=f[1],m="string"==typeof p?[p,["accumulated"],["get",s]]:p;(l=a).push.apply(l,c(jr({key:"".concat(i,".").concat(s,".map"),value:d,expressionContext:"cluster-map"}))),(u=a).push.apply(u,c(jr({key:"".concat(i,".").concat(s,".reduce"),value:m,expressionContext:"cluster-reduce"})))}return a;case"video":return Fr({key:i,value:t,valueSpec:r.source_video,style:n,styleSpec:r});case"image":return Fr({key:i,value:t,valueSpec:r.source_image,style:n,styleSpec:r});case"canvas":return[new Rr(i,null,"Please use runtime APIs to add canvas sources, rather than
1including them in stylesheets.","source.canvas")];default:return Gr({key:"".concat(i,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,styleSpec:r})}}function pn(e){var t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],o=gr(t);if(void 0===t)return a;if("object"!==o)return a=a.concat([new Rr("light",t,"object expected, ".concat(o," found"))]);for(var s in t){var l=s.match(/^(.*)-transition$/);a=a.concat(l&&r[l[1]]&&r[l[1]].transition?yn({key:s,value:t[s],valueSpec:i.transition,style:n,styleSpec:i}):r[s]?yn({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i}):[new Rr(s,t[s],'unknown property "'.concat(s,'"'))])}return a}function dn(e){var t=e.value,i=e.key,r=e.style,n=e.styleSpec,a=n.terrain,o=[],s=gr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new Rr("terrain",t,"object expected, ".concat(s," found"))]);for(var l in t){var u=l.match(/^(.*)-transition$/);o=o.concat(u&&a[u[1]]&&a[u[1]].transition?yn({key:l,value:t[l],valueSpec:n.transition,style:r,styleSpec:n}):a[l]?yn({key:l,value:t[l],valueSpec:a[l],style:r,styleSpec:n}):[new Rr(l,t[l],'unknown property "'.concat(l,'"'))])}if(t.source){var c=r.sources&&r.sources[t.source],h=c&&st(c.type);c?"raster-dem"!==h&&o.push(new Rr(i,t.source,"terrain cannot be used with a source of type ".concat(String(h),', it only be used with a "raster-dem" source type'))):o.push(new Rr(i,t.source,'source "'.concat(t.source,'" not found')))}else o.push(new Rr(i,t,'terrain is missing required property "source"'));return o}function mn(e){var t=e.value,i=e.style,r=e.styleSpec,n=r.fog,a=[],o=gr(t);if(void 0===t)return a;
1if("object"!==o)return a=a.concat([new Rr("fog",t,"object expected, ".concat(o," found"))]);for(var s in t){var l=s.match(/^(.*)-transition$/);a=a.concat(l&&n[l[1]]&&n[l[1]].transition?yn({key:s,value:t[s],valueSpec:r.transition,style:i,styleSpec:r}):n[s]?yn({key:s,value:t[s],valueSpec:n[s],style:i,styleSpec:r}):[new Rr(s,t[s],'unknown property "'.concat(s,'"'))])}return a}var vn={"*":function(){return[]},array:Or,boolean:function(e){var t=e.value,i=e.key,r=gr(t);return"boolean"!==r?[new Rr(i,t,"boolean expected, ".concat(r," found"))]:[]},number:Ur,color:function(e){var t=e.key,i=e.value,r=gr(i);return"string"!==r?[new Rr(t,i,"color expected, ".concat(r," found"))]:null===Mt.parseCSSColor(i)?[new Rr(t,i,'color expected, "'.concat(i,'" found'))]:[]},enum:Gr,filter:nn,function:Vr,layer:un,object:Fr,source:fn,light:pn,terrain:dn,fog:mn,string:cn,formatted:function(e){return 0===cn(e).length?[]:jr(e)},resolvedImage:function(e){return 0===cn(e).length?[]:jr(e)},projection:function(e){var t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=[],o=gr(t);if("object"===o)for(var s in t)a=a.concat(yn({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i}));else"string"!==o&&(a=a.concat([new Rr("projection",t,"object or string expected, ".concat(o," found"))]));return a}};function yn(e){var t=e.value,i=e.valueSpec,r=e.styleSpec;return i.expression&&xr(st(t))?Vr(e):i.expression&&Ir(lt(t))?jr(e):i.type&&vn[i.type]?vn[i.type](e):Fr(ot({},e,{valueSpec:i.type?r[i.type]:i}))}function _n(e){var t=e.value,i=e.key,r=cn(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new Rr(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new Rr(i,t,'"glyphs" url must include a "{range}" token'))),r}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:at;return wn(yn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:_n,"*":function(){return[]}}}))}var xn=function(e){return wn(sn(e))},bn=function(e){return wn(ln(e))};function wn(e){return e.slice().sort((function(e,t){return e.line&&t.line?e.line-t.line:0}))}function kn(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 rt(new Error(a.message))),i=!0}}catch(o){n.e(o)}finally{n.f()}}return i}var Tn=En;function En(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<this.d*this.d;a++){var o=n[3+a],s=n[3+a+1];r.push(o===s?null:n.subarray(o,s))}var l=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*i;for(var u=0;u<this.d*this.d;u++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;var c=i/t*e;this.min=-c,this.max=e+c}En.prototype.insert=function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},En.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},En.prototype._insertCell=function(e,t,i,r,n,a){this.cells[n].push(a)},En.prototype.query=function(e,t,i,r,n){var a=this.min,o=this.max;if(e<=a&&t<=a&&o<=i&&o<=r&&!n)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(e,t,i,r,this._queryCell,s,{},n),s},En.prototype._queryCell=function(e,t,i,r,n,a,o,s){var l=this.cells[n];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var f=l[h];if(void 0===o[f]){var p=4*f;(s?s(c[p+0],c[p+1],c[p+2],c[p+3]):e<=c[p+2]&&t<=c[p+3]&&i>=c[p+0]&&r>=c[p+1])?(o[f]=!0,a.push(u[f])):o[f]=!1}}},En.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 p=u;p<=h;p++){var d=this.d*p+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(p),this._convertFromCellCoord(f+1),this._convertFromCellCoord(p+1)))&&n.call(this,e,t,i,r,d,a,o,s))return}},En.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},En.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},En.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;r<this.cells.length;r++)i+=this.cells[r].length;var n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;
1for(var a=t,o=0;o<e.length;o++){var s=e[o];n[3+o]=a,n.set(s,a),a+=s.length}return n[3+e.length]=a,n.set(this.keys,a),n[3+e.length+1]=a+=this.keys.length,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer};var Sn={};function An(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Sn[t]={klass:e,omit:i.omit||[]}}for(var Mn in An(Object,"Object"),Tn.serialize=function(e,t){var i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}},Tn.deserialize=function(e){return new Tn(e.buffer)},Object.defineProperty(Tn,"name",{value:"Grid"}),An(Tn,"Grid"),An(Ct,"Color"),An(Error,"Error"),An(Ge,"AJAXError"),An(Lt,"ResolvedImage"),An(Lr,"StylePropertyFunction"),An(Mr,"StyleExpression",{omit:["_evaluator"]}),An(Pr,"ZoomDependentExpression"),An(zr,"ZoomConstantExpression"),An(Yt,"CompoundExpression",{omit:["_evaluate"]}),pr)Sn[pr[Mn]._classRegistryKey]||An(pr[Mn],"Expression".concat(Mn));function In(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Cn(e){return t.ImageBitmap&&e instanceof t.ImageBitmap}function zn(e,i){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(In(e)||Cn(e))return i&&i.push(e),e;if(ArrayBuffer.isView(e)){var r=e;return i&&i.push(r.buffer),r}if(e instanceof t.ImageData)return i&&i.push(e.data.buffer),e;if(Array.isArray(e)){var n,a=[],o=f(e);try{for(o.s();!(n=o.n()).done;){var s=n.value;a.push(zn(s,i))}}catch(p){o.e(p)}finally{o.f()}return a}if("object"==typeof e){var l=e.constructor,u=l._classRegistryKey;if(!u)throw new Error("can't serialize object of unregistered class ".concat(u));var c=l.serialize?l.serialize(e,i):{};if(!l.serialize){for(var h in e)e.hasOwnProperty(h)&&(Sn[u].omit.indexOf(h)>=0||(c[h]=zn(e[h],i)));e instanceof Error&&(c.message=e.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==u&&(c.$name=u),c}throw new Error("can't serialize object of type "+typeof e)}function Pn(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||In(e)||Cn(e)||ArrayBuffer.isView(e)||e instanceof t.ImageData)return e;if(Array.isArray(e))return e.map(Pn);if("object"==typeof e){var i=e.$name||"Object",r=Sn[i].klass;if(!r)throw new Error("can't deserialize unregistered class ".concat(i));if(r.deserialize)return r.deserialize(e);for(var n=Object.create(r.prototype),a=0,o=Object.keys(e);a<o.length;a++){var s=o[a];"$name"!==s&&(n[s]=Pn(e[s]))}return n}throw new Error("can't deserialize object of type "+typeof e)}var Dn=function(){function e(){v(this,e),this.first=!0}return y(e,[{key:"update",value:function(e,t){var i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=i,!0))}}]),e}(),Ln=function(e){return e>=1536&&e<=1791},Bn=function(e){return e>=1872&&e<=1919},Rn=function(e){return e>=2208&&e<=2303},Fn=function(e){return e>=11904&&e<=12031},On=function(e){return e>=12032&&e<=12255},Un=function(e){return e>=12272&&e<=12287},Vn=function(e){return e>=12288&&e<=12351},jn=function(e){return e>=12352&&e<=12447},Nn=function(e){return e>=12448&&e<=12543},Gn=function(e){return e>=12544&&e<=12591},Zn=function(e){return e>=12704&&e<=12735},qn=function(e){return e>=12736&&e<=12783},Wn=function(e){return e>=12784&&e<=12799},Xn=function(e){return e>=12800&&e<=13055},Hn=function(e){return e>=13056&&e<=13311},Yn=function(e){return e>=13312&&e<=19903},Kn=function(e){return e>=19968&&e<=40959},Jn=function(e){return e>=40960&&e<=42127},$n=function(e){return e>=42128&&e<=42191},Qn=function(e){return e>=44032&&e<=55215},ea=function(e){return e>=63744&&e<=64255},ta=function(e){return e>=64336&&e<=65023},ia=function(e){return e>=65040&&e<=65055},ra=function(e){return e>=65072&&e<=65103},na=function(e){return e>=65104&&e<=65135},aa=function(e){return e>=65136&&e<=65279},oa=function(e){return e>=65280&&e<=65519};function sa(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(ca(t.value.charCodeAt(0)))return!0}catch(r){i.e(r)}finally{i.f()}return!1}function la(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(!ua(t.value.charCodeAt(0)))return!1}catch(r){i.e(r)}finally{i.f()}return!0}function ua(e){return!(Ln(e)||Bn(e)||Rn(e)||ta(e)||aa(e))}function ca(e){return!(746!==e&&747!==e&&(e<4352||!(Zn(e)||Gn(e)||ra(e)&&!(e>=65097&&e<=65103)||ea(e)||Hn(e)||Fn(e)||qn(e)||!(!Vn(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Yn(e)||Kn(e)||Xn(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>
1=4352&&e<=4607}(e)||Qn(e)||jn(e)||Un(e)||function(e){return e>=12688&&e<=12703}(e)||On(e)||Wn(e)||Nn(e)&&12540!==e||!(!oa(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)||!(!na(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)||ia(e)||function(e){return e>=19904&&e<=19967}(e)||Jn(e)||$n(e))))}function ha(e){return!(ca(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)||Vn(e)||Nn(e)||function(e){return e>=57344&&e<=63743}(e)||ra(e)||na(e)||oa(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function fa(e){return e>=1424&&e<=2303||ta(e)||aa(e)}function pa(e,t){return!(!t&&fa(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||function(e){return e>=6016&&e<=6143}(e))}function da(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}var ma="deferred",va="loading",ya="loaded",_a=null,ga="unavailable",xa=null,ba=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(ga="error"),_a&&_a(e)};function wa(){ka.fire(new it("pluginStateChange",{pluginStatus:ga,pluginURL:xa}))}var ka=new nt,Ta=function(){return ga},Ea=function(){if(ga!==ma||!xa)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ga=va,wa(),xa&&We({url:xa},(function(e){e?ba(e):(ga=ya,wa())}))},Sa={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return ga===ya||null!=Sa.applyArabicShaping},isLoading:function(){return ga===va},setState:function(e){ga=e.pluginStatus,xa=e.pluginURL},isParsed:function(){return null!=Sa.applyArabicShaping&&null!=Sa.processBidirectionalText&&null!=Sa.processStyledBidirectionalText},getPluginURL:function(){return xa}},Aa=function(){function e(t,i){v(this,e),this.zoom=t,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.zoomHistory=i.zoomHistory,this.transition=i.transition,this.pitch=i.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Dn,this.transition={},this.pitch=0)}return y(e,[{key:"isSupportedScript",value:function(e){return function(e,t){var i,r=f(e);try{for(r.s();!(i=r.n()).done;)if(!pa(i.value.charCodeAt(0),t))return!1}catch(n){r.e(n)}finally{r.f()}return!0}(e,Sa.isLoaded())}},{key:"crossFadingFactor",value:function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}},{key:"getCrossfadeParameters",value:function(){var e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}]),e}(),Ma=function(){function e(t,i){v(this,e),this.property=t,this.value=i,this.expression=function(e,t){if(xr(e))return new Lr(e,t);if(Ir(e)){var i=Dr(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=Ct.parse(e)),{kind:"constant",evaluate:function(){return r}}}(void 0===i?t.specification.default:i,t.specification)}return y(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}(),Ia=function(){function e(t){v(this,e),this.property=t,this.value=new Ma(t,void 0)}return y(e,[{key:"transitioned",value:function(e,t){return new za(this.property,this.value,t,D({},e.transition,this.transition),e.now)}},{key:"untransitioned",value:function(){return new za(this.property,this.value,
1null,{},0)}}]),e}(),Ca=function(){function e(t){v(this,e),this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}return y(e,[{key:"getValue",value:function(e){return G(this._values[e].value.value)}},{key:"setValue",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Ia(this._values[e].property)),this._values[e].value=new Ma(this._values[e].property,null===t?void 0:G(t))}},{key:"getTransition",value:function(e){return G(this._values[e].transition)}},{key:"setTransition",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Ia(this._values[e].property)),this._values[e].transition=G(t)||void 0}},{key:"serialize",value:function(){for(var e={},t=0,i=Object.keys(this._values);t<i.length;t++){var r=i[t],n=this.getValue(r);void 0!==n&&(e[r]=n);var a=this.getTransition(r);void 0!==a&&(e["".concat(r,"-transition")]=a)}return e}},{key:"transitioned",value:function(e,t){for(var i=new Pa(this._properties),r=0,n=Object.keys(this._values);r<n.length;r++){var a=n[r];i._values[a]=this._values[a].transitioned(e,t._values[a])}return i}},{key:"untransitioned",value:function(){for(var e=new Pa(this._properties),t=0,i=Object.keys(this._values);t<i.length;t++){var r=i[t];e._values[r]=this._values[r].untransitioned()}return e}}]),e}(),za=function(){function e(t,i,r,n,a){v(this,e);var o=n.delay||0,s=n.duration||0;a=a||0,this.property=t,this.value=i,this.begin=a+o,this.end=this.begin+s,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}return y(e,[{key:"possiblyEvaluate",value:function(e,t,i){var r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return a.possiblyEvaluate(e,t,i);var o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),n,E(o))}return n}}]),e}(),Pa=function(){function e(t){v(this,e),this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}return y(e,[{key:"possiblyEvaluate",value:function(e,t,i){for(var r=new Ba(this._properties),n=0,a=Object.keys(this._values);n<a.length;n++){var o=a[n];r._values[o]=this._values[o].possiblyEvaluate(e,t,i)}return r}},{key:"hasTransition",value:function(){for(var e=0,t=Object.keys(this._values);e<t.length;e++){var i=t[e];if(this._values[i].prior)return!0}return!1}}]),e}(),Da=function(){function e(t){v(this,e),this._properties=t,this._values=Object.create(t.defaultPropertyValues)}return y(e,[{key:"getValue",value:function(e){return G(this._values[e].value)}},{key:"setValue",value:function(e,t){this._values[e]=new Ma(this._values[e].property,null===t?void 0:G(t))}},{key:"serialize",value:function(){for(var e={},t=0,i=Object.keys(this._values);t<i.length;t++){var r=i[t],n=this.getValue(r);void 0!==n&&(e[r]=n)}return e}},{key:"possiblyEvaluate",value:function(e,t,i){for(var r=new Ba(this._properties),n=0,a=Object.keys(this._values);n<a.length;n++){var o=a[n];r._values[o]=this._values[o].possiblyEvaluate(e,t,i)}return r}}]),e}(),La=function(){function e(t,i,r){v(this,e),this.property=t,this.value=i,this.parameters=r}return y(e,[{key:"isConstant",value:function(){return"constant"===this.value.kind}},{key:"constantOr",value:function(e){return"constant"===this.value.kind?this.value.value:e}},{key:"evaluate",value:function(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}}]),e}(),Ba=function(){function e(t){v(this,e),this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}return y(e,[{key:"get",value:function(e){return this._values[e]}}]),e}(),Ra=function(){function e(t){v(this,e),this.specification=t}return y(e,[{key:"possiblyEvaluate",value:function(e,t){return e.expression.evaluate(t)}},{key:"interpolate",value:function(e,t,i){var r=Ti[this.specification.type];return r?r(e,t,i):e}}]),e}(),Fa=function(){function e(t,i){v(this,e),this.specification=t,this.overrides=i}return y(e,[{key:"possiblyEvaluate",value:function(e,t,i,r){return new La(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)}:e.expression,t)}},{key:"interpolate",value:function(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;
1if(void 0===e.value.value||void 0===t.value.value)return new La(this,{kind:"constant",value:void 0},e.parameters);var r=Ti[this.specification.type];return r?new La(this,{kind:"constant",value:r(e.value.value,t.value.value,i)},e.parameters):e}},{key:"evaluate",value:function(e,t,i,r,n,a){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,a)}}]),e}(),Oa=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"possiblyEvaluate",value:function(e,t,i,r){if(void 0===e.value)return new La(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){var n=e.expression.evaluate(t,null,{},i,r),a="resolvedImage"===e.property.specification.type&&"string"!=typeof n?n.name:n,o=this._calculate(a,a,a,t);return new La(this,{kind:"constant",value:o},t)}if("camera"===e.expression.kind){var s=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new La(this,{kind:"constant",value:s},t)}return new La(this,e.expression,t)}},{key:"evaluate",value:function(e,t,i,r,n,a){if("source"===e.kind){var o=e.evaluate(t,i,r,n,a);return this._calculate(o,o,o,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}},{key:"_calculate",value:function(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t,other:i}:{from:i,to:t,other:e}}},{key:"interpolate",value:function(e){return e}}]),i}(Fa),Ua=function(){function e(t){v(this,e),this.specification=t}return y(e,[{key:"possiblyEvaluate",value:function(e,t,i,r){if(void 0!==e.value){if("constant"===e.expression.kind){var n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new Aa(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Aa(Math.floor(t.zoom),t)),e.expression.evaluate(new Aa(Math.floor(t.zoom+1),t)),t)}}},{key:"_calculate",value:function(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}},{key:"interpolate",value:function(e){return e}}]),e}(),Va=function(){function e(t){v(this,e),this.specification=t}return y(e,[{key:"possiblyEvaluate",value:function(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}},{key:"interpolate",value:function(){return!1}}]),e}(),ja=function e(t){v(this,e),this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];var i=new Aa(0,{});for(var r in t){var n=t[r];n.specification.overridable&&this.overridableProperties.push(r);var a=this.defaultPropertyValues[r]=new Ma(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Ia(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=a.possiblyEvaluate(i)}};function Na(e,t){return 256*(e=M(Math.floor(e),0,255))+M(Math.floor(t),0,255)}An(Fa,"DataDrivenProperty"),An(Ra,"DataConstantProperty"),An(Oa,"CrossFadedDataDrivenProperty"),An(Ua,"CrossFadedProperty"),An(Va,"ColorRampProperty");var Ga={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Za=function e(t,i){v(this,e),this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},qa=function(){function e(){v(this,e),this.isTransferred=!1,this.capacity=-1,this.resize(0)}return y(e,[{key:"_trim",value:function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}},{key:"clear",value:function(){this.length=0}},{key:"resize",value:function(e){this.reserve(e),this.length=e}},{key:"reserve",value:function(e){if(e>this.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 Wa(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=Ga[e.type].BYTES_PER_ELEMENT,a=i=Xa(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:Xa(i,Math.max(r,t)),alignment:t}}function Xa(e,t){return Math.ceil(e/t)*t}var Ha=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);Ha.prototype.bytesPerElement=4,An(Ha,"StructArrayLayout2i4");var Ya=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);Ya.prototype.bytesPerElement=6,An(Ya,"StructArrayLayout3i6");var Ka=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);
1Ka.prototype.bytesPerElement=8,An(Ka,"StructArrayLayout4i8");var Ja=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);Ja.prototype.bytesPerElement=12,An(Ja,"StructArrayLayout2i4ub1f12");var $a=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);$a.prototype.bytesPerElement=16,An($a,"StructArrayLayout4f16");var Qa=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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,n,a,o,s,l,u){var c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,a,o,s,l,u)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c){var h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=a,this.uint16[h+5]=o,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,e}}]),i}(qa);Qa.prototype.bytesPerElement=20,An(Qa,"StructArrayLayout10ui20");var eo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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,n,a,o,s){var l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,r,n,a,o,s)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l){var u=8*e;return this.uint16[u+0]=t,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=o,this.uint16[u+6]=s,this.uint16[u+7]=l,e}}]),i}(qa);eo.prototype.bytesPerElement=16,An(eo,"StructArrayLayout8ui16");var to=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);to.prototype.bytesPerElement=12,An(to,"StructArrayLayout6i12");var io=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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 p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=u,this.int16[p+9]=c,this.int16[p+10]=h,this.int16[p+11]=f,e}}]),i}(qa);io.prototype.bytesPerElement=24,An(io,"StructArrayLayout4i4ui4i24");var ro=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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)}}
1,{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}(qa);ro.prototype.bytesPerElement=20,An(ro,"StructArrayLayout3i3f20");var no=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);no.prototype.bytesPerElement=4,An(no,"StructArrayLayout1ul4");var ao=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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 p=this.length;return this.resize(p+1),this.emplace(p,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,p){var d=20*e,m=10*e;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.int16[d+4]=a,this.float32[m+3]=o,this.float32[m+4]=s,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[d+14]=c,this.uint32[m+8]=h,this.uint16[d+18]=f,this.uint16[d+19]=p,e}}]),i}(qa);ao.prototype.bytesPerElement=40,An(ao,"StructArrayLayout5i4f1i1ul2ui40");var oo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);oo.prototype.bytesPerElement=16,An(oo,"StructArrayLayout3i2i2i16");var so=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);so.prototype.bytesPerElement=16,An(so,"StructArrayLayout2f1f2i16");var lo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);lo.prototype.bytesPerElement=12,An(lo,"StructArrayLayout2ub2f12");var uo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);uo.prototype.bytesPerElement=12,An(uo,"StructArrayLayout3f12");var co=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);co.prototype.bytesPerElement=6,An(co,"StructArrayLayout3ui6");var ho=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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,p,d,m,v,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,p,d,m,v,y,_,g,x)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,p,d,m,v,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]=p,this.float32[k+10]=d,this.float32[k+11]=m,this.uint8[T+48]=v,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}(qa);ho.prototype.bytesPerElement=60,An(ho,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");var fo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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,p,d,m,v,y,_,g,x,b,w,k,T,E,S,A,M,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,p,d,m,v,y,_,g,x,b,w,k,T,E,S,A,M,I)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,p,d,m,v,y,_,g,x,b,w,k,T,E,S,A,M,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]=p,this.uint16[z+16]=d,this.uint16[z+17]=m,this.uint16[z+18]=v,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]=A,this.float32[P+16]=M,this.float32[P+17]=I,this.float32[P+18]=C,e}}]),i}(qa);fo.prototype.bytesPerElement=76,An(fo,"StructArrayLayout3i2f6i15ui1ul3f76");var po=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);po.prototype.bytesPerElement=4,An(po,"StructArrayLayout1f4");var mo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);mo.prototype.bytesPerElement=20,An(mo,"StructArrayLayout5f20");var vo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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;
1return this.uint32[3*e+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,this.uint16[a+4]=n,e}}]),i}(qa);vo.prototype.bytesPerElement=12,An(vo,"StructArrayLayout1ul3ui12");var yo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);yo.prototype.bytesPerElement=4,An(yo,"StructArrayLayout2ui4");var _o=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);_o.prototype.bytesPerElement=2,An(_o,"StructArrayLayout1ui2");var go=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(qa);go.prototype.bytesPerElement=8,An(go,"StructArrayLayout2f8");var xo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"a_pos_30",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"a_pos_31",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"a_pos_32",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"a_pos_normal_30",get:function(){return this._structArray.int16[this._pos2+3]}},{key:"a_pos_normal_31",get:function(){return this._structArray.int16[this._pos2+4]}},{key:"a_pos_normal_32",get:function(){return this._structArray.int16[this._pos2+5]}}]),i}(Za);xo.prototype.size=12;var bo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"get",value:function(e){return new xo(this,e)}}]),i}(to);An(bo,"FillExtrusionExtArray");var wo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(Za);wo.prototype.size=40;var ko=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"get",value:function(e){return new wo(this,e)}}]),i}(ao);An(ko,"CollisionBoxArray");var To=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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]}
1},{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}(Za);To.prototype.size=60;var Eo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"get",value:function(e){return new To(this,e)}}]),i}(ho);An(Eo,"PlacedSymbolArray");var So=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(Za);So.prototype.size=76;var Ao=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"get",value:function(e){return new So(this,e)}}]),i}(fo);An(Ao,"SymbolInstanceArray");var Mo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getoffsetX",value:function(e){return this.float32[1*e+0]}}]),i}(po);An(Mo,"GlyphOffsetArray");var Io=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getx",value:function(e){return this.int16[3*e+0]}}
1,{key:"gety",value:function(e){return this.int16[3*e+1]}},{key:"gettileUnitDistanceFromAnchor",value:function(e){return this.int16[3*e+2]}}]),i}(Ya);An(Io,"SymbolLineVertexArray");var Co=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(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}(Za);Co.prototype.size=12;var zo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"get",value:function(e){return new Co(this,e)}}]),i}(vo);An(zo,"FeatureIndexArray");var Po=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"a_centroid_pos0",get:function(){return this._structArray.uint16[this._pos2+0]}},{key:"a_centroid_pos1",get:function(){return this._structArray.uint16[this._pos2+1]}}]),i}(Za);Po.prototype.size=4;var Do=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"get",value:function(e){return new Po(this,e)}}]),i}(yo);An(Do,"FillExtrusionCentroidArray");var Lo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"a_pos_30",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"a_pos_31",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"a_pos_32",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"a_pos_normal_30",get:function(){return this._structArray.int16[this._pos2+3]}},{key:"a_pos_normal_31",get:function(){return this._structArray.int16[this._pos2+4]}},{key:"a_pos_normal_32",get:function(){return this._structArray.int16[this._pos2+5]}}]),i}(Za);Lo.prototype.size=12;var Bo=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"get",value:function(e){return new Lo(this,e)}}]),i}(to);An(Bo,"CircleGlobeExtArray");var Ro=Wa([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),Fo=Wa([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]),Oo=At((function(e){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<r;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,n=27492+(65535&(a=5*(65535&(n=(n^=l=(6
15535&(l=(l=(65535&l)*o+(((l>>>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}})),Uo=At((function(e){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}})),Vo=Oo,jo=Uo;Vo.murmur3=Oo,Vo.murmur2=jo;var No=function(){function e(){v(this,e),this.ids=[],this.positions=[],this.indexed=!1}return y(e,[{key:"add",value:function(e,t,i,r){this.ids.push(Go(e)),this.positions.push(t,i,r)}},{key:"getPositions",value:function(e){for(var t=Go(e),i=0,r=this.ids.length-1;i<r;){var n=i+r>>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 Zo(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 Go(e){var t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:Vo(String(e))}function Zo(e,t,i,r){for(;i<r;){for(var n=e[i+r>>1],a=i-1,o=r+1;;){do{a++}while(e[a]<n);do{o--}while(e[o]>n);if(a>=o)break;qo(e,a,o),qo(t,3*a,3*o),qo(t,3*a+1,3*o+1),qo(t,3*a+2,3*o+2)}o-i<r-o?(Zo(e,t,i,o),i=o+1):(Zo(e,t,o+1,r),r=o)}}function qo(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}An(No,"FeaturePositionMap");var Wo=function(){function e(t){v(this,e),this.gl=t.gl,this.initialized=!1}return y(e,[{key:"fetchUniformLocation",value:function(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}}]),e}(),Xo=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=0,r}return y(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}]),i}(Wo),Ho=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=[0,0,0,0],r}return y(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]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4f(this.location,i[0],i[1],i[2],i[3])))}}]),i}(Wo),Yo=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=Ct.transparent,r}return y(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&(i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a)))}}]),i}(Wo),Ko=new Float32Array(16),Jo=new Float32Array(9),$o=new Float32Array(4);function Qo(e){return[Na(255*e.r,255*e.g),Na(255*e.b,255*e.a)]}var es=function(){function e(t,i,r){v(this,e),this.value=t,this.uniformNames=i.map((function(e){return"u_".concat(e)})),this.type=r}return y(e,[{key:"setUniform",value:function(e,t,i,r,n){t.set(e,n,r.constantOr(this.value))}},{key:"getBinding",value:function(e,t){return"color"===this.type?new Yo(e):new Xo(e)}}]),e}(),ts=function(){function e(t,i){v(this,e),this.uniformNames=i.map((function(e){return"u_".concat(e)})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}return y(e,[{key:"setConstantPatternPositions",value:function(e,t){this.pixelRatioFrom=t.pixelRatio||1,this.pixelRatioTo=e.pixelRatio||1,this.patternFrom=t.tl.concat(t.br),this.patternTo=e.tl.concat(e.br)}},{key:"setUniform",value:function(e,t,i,r,n){var a="u_pattern_to"===n||"u_dash_to"===n?this.patternTo:"u_pattern_from"===n||"u_dash_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;a&&t.set(e,n,a)}},{key:"getBinding",value:function(e,t){return"u_pattern_from"===t||"u_pattern_to"===t||"u_dash_from"===t||"u_dash_to"===t?new Ho(e):new Xo(e)}}]),e}(),is=function(){function e(t,i,r,n){v(this,e),this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map((function(e){return{name:"a_".concat(e),type:"Float32",components:"color"===r?2:1,offset:0}})),this.paintVertexArray=new n}return y(e,[{key:"populatePaintArray",value:function(e,t,i,r,n,a){var o=this.paintVertexArray.length,s=this.expression.evaluate(new Aa(0),t,{},n,r,a);this.paintVertexArray.resize(e),this._setPaintValue(o,e,s)}},{key:"updatePaintArray",value:function(e,t,i,r,n){var a=this.expression.evaluate({zoom:0},i,r,void 0,n);this._setPaintValue(e,t,a)}},{key:"_setPaintValue",value:function(e,t,i){if("color"===this.type)for(var r=Qo(i),n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1]);else{for(var a=e;a<t;a++)this.paintVertexArray.emplace(a,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}},{key:"upload",value:function(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}},{key:"destroy",value:function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}]),e}(),rs=function(){function e(t,i,r,n,a,o){v(this,e),this.expression=t,this.uniformNames=i.map((function(e){return"u_".concat(e,"_t")})),this.type=r,this.useIntegerZoom=n,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=i.map((function(e){return{name:"a_".concat(e),type:"Float32",components:"color"===r?4:2,offset:0}})),this.paintVertexArray=new o}return y(e,[{key:"populatePaintArray",value:function(e,t,i,r,n,a){var o=this.expression.evaluate(new Aa(this.zoom),t,{},n,r,a),s=this.expression.evaluate(new Aa(this.zoom+1),t,{},n,r,a),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,o,s)}},{key:"updatePaintArray",value:function(e,t,i,r,n){var a=this.expression.evaluate({zoom:this.zoom},i,r,void 0,n),o=this.expression.evaluate({zoom:this.zoom+1},i,r,void 0,n);this._setPaintValue(e,t,a,o)}},{key:"_setPaintValue",value:function(e,t,i,r){if("color"===this.type)for(var n=Qo(i),a=Qo(r),o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1],a[0],a[1]);else{for(var s=e;s<t;s++)this.paintVertexArray.emplace(s,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}},{key:"upload",value:function(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}},{key:"destroy",value:function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},{key:"setUniform",value:function(e,t,i,r,n){var a=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,o=M(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(e,n,o)}},{key:"getBinding",value:function(e,t){return new Xo(e)}}]),e}(),ns=function(){function e(t,i,r,n,a,o,s){v(this,e),this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=a,this.layerId=s,this.paintVertexAttributes=("array"===r?Fo:Ro).members;for(var l=0;l<i.length;++l);this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}return y(e,[{key:"populatePaintArray",value:function(e,t,i){var r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],i)}},{key:"updatePaintArray",value:function(e,t,i,r,n,a){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],a)}},{key:"_setPaintValues",value:function(e,t,i,r){if(r&&i){var n=i.min,a=i.mid,o=i.max,s=r[n],l=r[a],u=r[o];if(s&&l&&u)for(var c=e;c<t;c++)this._setPaintValue(this.zoomInPaintVertexArray,c,l,s),this._setPaintValue(this.zoomOutPaintVertexArray,c,l,u)}}},{key:"_setPaintValue",value:function(e,t,i,r){e.emplace(t,i.tl[0],i.tl[1],i.br[0],i.br[1],r.tl[0],r.tl[1],r.br[0],r.br[1],i.pixelRatio,r.pixelRatio)}},{key:"upload",value:function(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}},{key:"destroy",value:function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}]),e}(),as=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};v(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 La&&vr(o.property.specification)){var s=ls(a,t.type),l=o.value,u=o.property.specification.type,c=o.property.useIntegerZoom,h=o.property.specification["property-type"],f="cross-faded"===h||"cross-faded-data-driven"===h,p="line-dasharray"===String(a)&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==l.kind||p)if("source"===l.kind||p||f){var d=hs(a,u,"source");this.binders[a]=f?new ns(l,s,u,c,i,d,t.id):new is(l,s,u,d),n.push("/a_".concat(a))}else{var m=hs(a,u,"composite");this.binders[a]=new rs(l,s,u,c,i,m),n.push("/z_".concat(a))}else this.binders[a]=f?new ts(l.value,s):new es(l.value,s,u),n.push("/u_".concat(a))}}this.cacheKey=n.sort().join("")}return y(e,[{key:"getMaxValue",value:function(e){var t=this.binders[e];return t instanceof is||t instanceof rs?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 is||s instanceof rs||s instanceof ns)&&s.populatePaintArray(e,t,i,r,n,a)}}},{key:"setConstantPatternPositions",value:function(e,t){for(var i in this.binders){var r=this.binders[i];r instanceof ts&&r.setConstantPatternPositions(e,t)}}},{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,p=i.feature(h.index);for(var d in this.binders){var m=this.binders[d];if((m instanceof is||m instanceof rs||m instanceof ns)&&!0===m.expression.isStateDependent){var v=r.paint.get(d);m.expression=v.value,m.updatePaintArray(h.start,h.end,p,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 es||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 is||i instanceof rs||i instanceof ns)for(var r=0;r<i.paintVertexAttributes.length;r++)e.push(i.paintVertexAttributes[r].name)}return e}},{key:"getBinderUniforms",value:function(){var e=[];for(var t in this.binders){var i=this.binders[t];if(i instanceof es||i instanceof ts||i instanceof rs){var r,n=f(i.uniformNames);try{for(n.s();!(r=n.n()).done;){var a=r.value;e.push(a)}}catch(o){n.e(o)}finally{n.f()}}}return e}},{key:"getPaintVertexBuffers",value:function(){return this._buffers}},{key:"getUniforms",value:function(e){var t=[];for(var i in this.binders){var r=this.binders[i];if(r instanceof es||r instanceof ts||r instanceof rs){var n,a=f(r.uniformNames);try{for(a.s();!(n=a.n()).done;){var o=n.value;t.push({name:o,property:i,binding:r.getBinding(e,o)})}}catch(s){a.e(s)}finally{a.f()}}}return t}},{key:"setUniforms",value:function(e,t,i,r,n){var a,o=f(i);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.name,u=s.property,c=s.binding;this.binders[u].setUniform(e,c,n,r.get(u),l)}}catch(h){o.e(h)}finally{o.f()}}},{key:"updatePaintBuffers",value:function(e){for(var t in this._buffers=[],this.binders){var i=this.binders[t];if(e&&i instanceof ns){var r=2===e.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof is||i instanceof rs)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}},{key:"upload",value:function(e){for(var t in this.binders){var i=this.binders[t];(i instanceof is||i instanceof rs||i instanceof ns)&&i.upload(e)}this.updatePaintBuffers()}},{key:"destroy",value:function(){for(var e in this.binders){var t=this.binders[e];(t instanceof is||t instanceof rs||t instanceof ns)&&t.destroy()}}}]),e}(),os=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};v(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 No,this._bufferOffset=0}return y(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}(),ss={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
1pwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"line-dasharray":["dash_to","dash_from"]};function ls(e,t){return ss[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}var us={"line-pattern":{source:Qa,composite:Qa},"fill-pattern":{source:Qa,composite:Qa},"fill-extrusion-pattern":{source:Qa,composite:Qa},"line-dasharray":{source:eo,composite:eo}},cs={color:{source:go,composite:$a},number:{source:po,composite:go}};function hs(e,t,i){var r=us[e];return r&&r[i]||cs[t][i]}An(es,"ConstantBinder"),An(ts,"CrossFadedConstantBinder"),An(is,"SourceExpressionBinder"),An(ns,"CrossFadedCompositeBinder"),An(rs,"CompositeExpressionBinder"),An(as,"ProgramConfiguration",{omit:["_buffers"]}),An(os,"ProgramConfigurationSet");var fs="-transition",ps=function(e){d(i,e);var t=m(i);function i(e,r){var n;if(v(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=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 Da(r.layout)),r.paint)){for(var a in n._transitionablePaint=new Ca(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 Ba(r.paint)}return l(n)}return y(i,[{key:"getCrossfadeParameters",value:function(){return this._crossfadeParameters}},{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(bn,"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 V(e,fs)?this._transitionablePaint.getTransition(e.slice(0,-fs.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(xn,"layers.".concat(this.id,".paint.").concat(e),e,t,i))return!1;if(V(e,fs))return this._transitionablePaint.setTransition(e.slice(0,-fs.length),t||void 0),!1;var r=this._transitionablePaint._values[e],n="cross-faded-data-driven"===r.property.specification["property-type"],a=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);var s=this._transitionablePaint._values[e].value;return s.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(e,o,s)}},{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.minzoom)||!!(this.maxzoom&&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){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),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.t
1ype,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),N(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)&&kn(this,e.call(gn,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:at,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 La&&vr(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=qr(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}(nt),ds=Wa([{name:"a_pos",components:2,type:"Int16"}],4),ms=Wa([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),vs=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];v(this,e),this.segments=t}return y(e,[{key:"prepareSegment",value:function(t,i,r,n){var a=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&q("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}();vs.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,An(vs,"SegmentVector");var ys=8192,_s=function(){function e(t,i){v(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 y(e,[{key:"setNorthEast",value:function(e){return this._ne=e instanceof xs?new xs(e.lng,e.lat):xs.convert(e),this}},{key:"setSouthWest",value:function(e){return this._sw=e instanceof xs?new xs(e.lng,e.lat):xs.convert(e),this}},{key:"extend",value:function(t){var i,r,n=this._sw,a=this._ne;if(t instanceof xs)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(xs.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 xs(i.lng,i.lat),this._ne=new xs(r.lng,r.lat)),this}},{key:"getCenter",value:function(){return new xs((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 xs(this.getWest(),this.getNorth())}},{key:"getSouthEast",value:function(){return new xs(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=xs.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}}
1],[{key:"convert",value:function(t){return!t||t instanceof e?t:new e(t)}}]),e}(),gs=6371008.8,xs=function(){function e(t,i){if(v(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 y(e,[{key:"wrap",value:function(){return new e(C(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 gs*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 _s(new e(this.lng-i,this.lat-t),new e(this.lng+i,this.lat+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: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}]),e}(),bs=2*Math.PI*gs;function ws(e){return bs*Math.cos(e*Math.PI/180)}function ks(e){return(180+e)/360}function Ts(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Es(e,t){return e/ws(t)}function Ss(e){return 360*e-180}function As(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Ms(e,t){return e*ws(As(t))}var Is=85.051129;function Cs(e){return 1/Math.cos(e*Math.PI/180)}var zs=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;v(this,e),this.x=+t,this.y=+i,this.z=+r}return y(e,[{key:"toLngLat",value:function(){return new xs(Ss(this.x),As(this.y))}},{key:"toAltitude",value:function(){return Ms(this.z,this.y)}},{key:"meterInMercatorCoordinateUnits",value:function(){return 1/bs*Cs(As(this.y))}}],[{key:"fromLngLat",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=xs.convert(t);return new e(ks(r.lng),Ts(r.lat),Es(i,r.lat))}}]),e}();function Ps(e,t,i,r,n,a,o,s,l){var u=(t+r)/2,c=(i+n)/2,h=new _(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?(Ps(e,t,i,u,c,a,h,s,l),Ps(e,u,c,r,n,h,o,s,l)):e.push(o)}function Ds(e,t,i){var r=e[0],n=r.x,a=r.y;t(r);for(var o=[r],s=1;s<e.length;s++){var l=e[s],u=l.x,c=l.y;t(l),Ps(o,n,a,u,c,r,l,t,i),n=u,a=c,r=l}return o}function Ls(e,t,i,r,n){if(n(t,i)){var a=t.add(i).mult(.5);r(a),Ls(e,t,a,r,n),Ls(e,a,i,r,n)}else e.push(i)}function Bs(e,t,i){var r=e[0];t(r);for(var n=[r],a=1;a<e.length;a++){var o=e[a];t(o),Ls(n,r,o,t,i),r=o}return n}var Rs=Math.pow(2,14)-1,Fs=-Rs-1;function Os(e,t){var i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=M(i,Fs,Rs),e.y=M(r,Fs,Rs),(i<e.x||i>e.x+1||r<e.y||r>e.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Us(e,t,i){var r=e.loadGeometry(),n=e.extent,a=ys/n;if(t&&i&&i.projection.isReprojectedInTileSpace)for(var o=1<<t.z,s=i.scale,l=i.x,u=i.y,c=i.projection,h=function(e){var i=Ss((t.x+e.x/n)/o),r=As((t.y+e.y/n)/o),a=c.project(i,r);e.x=(a.x*s-l)*n,e.y=(a.y*s-u)*n},p=0;p<r.length;p++)if(1!==e.type)r[p]=Ds(r[p],h,1);else{var d,m=[],v=f(r[p]);try{for(v.s();!(d=v.n()).done;){var y=d.value;y.x<0||y.x>=n||y.y<0||y.y>=n||(h(y),m.push(y))}}catch(k){v.e(k)}finally{v.f()}r[p]=m}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;)Os(x.value,a)}catch(k){w.e(k)}finally{w.f()}}}catch(k){g.e(k)}finally{g.f()}return r}function Vs(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Us(e):[]}}function js(e,t,i,r,n){e.emplaceBack(2*t+(r+1)/2,2*i+(n+1)/2)}function Ns(e,t,i){var r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}var Gs=function(){function e(t){v(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 Ha,this.indexArray=new co,this.segments=new vs,this.programConfigurations=new os(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()}
1)).map((function(e){return e.id}))}return y(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,p=u.index,d=u.sourceLayerIndex,m=this.layers[0]._featureFilter.needGeometry,v=Vs(c,m);if(this.layers[0]._featureFilter.filter(new Aa(this.zoom),v,i)){var y=o?o.evaluate(v,{},i):void 0,_={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:p,geometry:m?v.geometry:Us(c,i,r),patterns:{},sortKey:y};a.push(_)}}}catch(A){l.e(A)}finally{l.f()}o&&a.sort((function(e,t){return e.sortKey-t.sortKey}));var g=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Bo,g=r.projection);for(var x=0,b=a;x<b.length;x++){var w=b[x],k=w.geometry,T=w.index,E=w.sourceLayerIndex,S=e[T].feature;this.addFeature(w,k,T,t.availableImages,i,g),t.featureIndex.insert(S,k,T,E,this.index)}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ds.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ms.members))),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}},{key:"addFeature",value:function(e,t,i,r,n,a){var o,s=f(t);try{for(s.s();!(o=s.n()).done;){var l,u=o.value,c=f(u);try{for(c.s();!(l=c.n()).done;){var h=l.value,p=h.x,d=h.y;if(!(p<0||p>=ys||d<0||d>=ys)){if(a){var m=a.projectTilePoint(p,d,n),v=a.upVector(n,p,d),y=this.globeExtVertexArray;Ns(y,m,v),Ns(y,m,v),Ns(y,m,v),Ns(y,m,v)}var _=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),g=_.vertexLength;js(this.layoutVertexArray,p,d,-1,-1),js(this.layoutVertexArray,p,d,1,-1),js(this.layoutVertexArray,p,d,1,1),js(this.layoutVertexArray,p,d,-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 Zs(e,t){for(var i=0;i<e.length;i++)if(Qs(t,e[i]))return!0;for(var r=0;r<t.length;r++)if(Qs(e,t[r]))return!0;return!!Hs(e,t)}function qs(e,t,i){return!!Qs(e,t)||!!Ks(t,e,i)}function Ws(e,t){if(1===e.length)return $s(t,e[0]);for(var i=0;i<t.length;i++)for(var r=t[i],n=0;n<r.length;n++)if(Qs(e,r[n]))return!0;for(var a=0;a<e.length;a++)if($s(t,e[a]))return!0;for(var o=0;o<t.length;o++)if(Hs(e,t[o]))return!0;return!1}function Xs(e,t,i){if(e.length>1){if(Hs(e,t))return!0;for(var r=0;r<t.length;r++)if(Ks(t[r],e,i))return!0}for(var n=0;n<e.length;n++)if(Ks(e[n],t,i))return!0;return!1}function Hs(e,t){if(0===e.length||0===t.length)return!1;for(var i=0;i<e.length-1;i++)for(var r=e[i],n=e[i+1],a=0;a<t.length-1;a++)if(Ys(r,n,t[a],t[a+1]))return!0;return!1}function Ys(e,t,i,r){return W(e,i,r)!==W(t,i,r)&&W(e,t,i)!==W(e,t,r)}function Ks(e,t,i){var r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(var n=1;n<t.length;n++)if(Js(e,t[n-1],t[n])<r)return!0;return!1}function Js(e,t,i){var r=t.distSqr(i);if(0===r)return e.distSqr(t);var n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function $s(e,t){for(var i,r,n,a=!1,o=0;o<e.length;o++)for(var s=0,l=(i=e[o]).length-1;s<i.length;l=s++)r=i[s],n=i[l],r.y>t.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 Qs(e,t){for(var i=!1,r=0,n=e.length-1;r<e.length;n=r++){var a=e[r],o=e[n];a.y>t.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 el(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(p){o.e(p)}finally{o.f()}var l=[new _(t,i),new _(t,n),new _(r,n),new _(r,i)];if(e.length>2){var u,c=f(l);try{for(c.s();!(u=c.n()).done;)if(Qs(e,u.value))return!0}catch(p){c.e(p)}finally{c.f()}}for(var h=0;h<e.length-1;h++)if(tl(e[h],e[h+1],l))return!0;return!1}function tl(e,t,i){var r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;var a=W(e,t,i[0]);return a!==W(e,t,i[1])||a!==W(e,t,i[2])||a!==W(e,t,i[3])}function il(e,t,i){var r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function rl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function nl(e,t,i,r,n){if(!t[0]&&!t[1])return e;var a=_.convert(t)._mult(n);"viewport"===i&&a._rotate(-r);for(var o=[],s=0;s<e.length;s++)o.push(e[s].sub(a));return o}function al(e,t,i,r){var n=_.convert(e)._mult(r);return"viewport"===t&&n._rotate(-i),n}An(Gs,"CircleBucket",{omit:["layers"]});var ol=new ja({"circle-sort-key":new Fa(at.layout_circle["circle-sort-key"])}),sl={paint:new ja({"circle-radius":new Fa(at.paint_circle["circle-radius"]),"circle-color":new Fa(at.paint_circle["circle-color"]),"circle-blur":new Fa(at.paint_circle["circle-blur"]),"circle-opacity":new Fa(at.paint_circle["circle-opacity"]),"circle-translate":new Ra(at.paint_circle["circle-translate"]),"circle-translate-anchor":new Ra(at.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ra(at.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ra(at.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Fa(at.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Fa(at.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Fa(at.paint_circle["circle-stroke-opacity"])}),layout:ol},ll=1e-6,ul="undefined"!=typeof Float32Array?Float32Array:Array;function cl(){var e=new ul(9);return ul!=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 hl(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
vendor: 6,142 bytes, line 1
1]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function fl(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],p=t[11],d=t[12],m=t[13],v=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*m-h*d,E=c*v-f*d,S=c*y-p*d,A=h*v-f*m,M=h*y-p*m,I=f*y-p*v,C=_*I-g*M+x*A+b*S-w*E+k*T;return C?(e[0]=(s*I-l*M+u*A)*(C=1/C),e[1]=(n*M-r*I-a*A)*C,e[2]=(m*k-v*w+y*b)*C,e[3]=(f*w-h*k-p*b)*C,e[4]=(l*S-o*I-u*E)*C,e[5]=(i*I-n*S+a*E)*C,e[6]=(v*x-d*k-y*g)*C,e[7]=(c*k-f*x+p*g)*C,e[8]=(o*M-s*S+u*T)*C,e[9]=(r*S-i*M-a*T)*C,e[10]=(d*w-m*x+y*_)*C,e[11]=(h*x-c*w-p*_)*C,e[12]=(s*E-o*A-l*T)*C,e[13]=(i*A-r*E+n*T)*C,e[14]=(m*g-d*b-v*_)*C,e[15]=(c*b-h*g+f*_)*C,e):null}function pl(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],p=t[10],d=t[11],m=t[12],v=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*m,e[1]=g*n+x*l+b*f+w*v,e[2]=g*a+x*u+b*p+w*y,e[3]=g*o+x*c+b*d+w*_,e[4]=(g=i[4])*r+(x=i[5])*s+(b=i[6])*h+(w=i[7])*m,e[5]=g*n+x*l+b*f+w*v,e[6]=g*a+x*u+b*p+w*y,e[7]=g*o+x*c+b*d+w*_,e[8]=(g=i[8])*r+(x=i[9])*s+(b=i[10])*h+(w=i[11])*m,e[9]=g*n+x*l+b*f+w*v,e[10]=g*a+x*u+b*p+w*y,e[11]=g*o+x*c+b*d+w*_,e[12]=(g=i[12])*r+(x=i[13])*s+(b=i[14])*h+(w=i[15])*m,e[13]=g*n+x*l+b*f+w*v,e[14]=g*a+x*u+b*p+w*y,e[15]=g*o+x*c+b*d+w*_,e}function dl(e,t,i){var r,n,a,o,s,l,u,c,h,f,p,d,m=i[0],v=i[1],y=i[2];return t===e?(e[12]=t[0]*m+t[4]*v+t[8]*y+t[12],e[13]=t[1]*m+t[5]*v+t[9]*y+t[13],e[14]=t[2]*m+t[6]*v+t[10]*y+t[14],e[15]=t[3]*m+t[7]*v+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],p=t[10],d=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]=p,e[11]=d,e[12]=r*m+s*v+h*y+t[12],e[13]=n*m+l*v+f*y+t[13],e[14]=a*m+u*v+p*y+t[14],e[15]=o*m+c*v+d*y+t[15]),e}function ml(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 vl(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 yl(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 _l(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 gl(e,t,i){var r,n,a,o=i[0],s=i[1],l=i[2],u=Math.hypot(o,s,l);return u<ll?null:(o*=u=1/u,s*=u,l*=u,r=Math.sin(t),n=Math.cos(t),e[0]=o*o*(a=1-n)+n,e[1]=s*o*a+l*r,e[2]=l*o*a-s*r,e[3]=0,e[4]=o*s*a-l*r,e[5]=s*s*a+n,e[6]=l*s*a+o*r,e[7]=0,e[8]=o*l*a+s*r,e[9]=s*l*a-o*r,e[10]=l*l*a+n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var xl=pl;function bl(){var e=new ul(3);return ul!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function wl(e){var t=new ul(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function kl(e){return Math.hypot(e[0],e[1],e[2])}function Tl(e,t,i){var r=new ul(3);return r[0]=e,r[1]=t,r[2]=i,r}function El(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function Sl(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function Al(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function Ml(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function Il(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function Cl(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function zl(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function Pl(e,t){var i=t[0],r=t[1],n=t[2],a=i*i+r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function Dl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ll(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 Bl(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 Rl(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,p=a*u-r*h,d=r*c-n*u,m=2*i[3];return c*=m,h*=m,p*=2,d*=2,e[0]=o+(u*=m)+(f*=2),e[1]=s+c+p,e[2]=l+h+d,e}var Fl,Ol=Sl,Ul=Al,Vl=kl;function jl(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 Nl(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 Gl(){var e=new ul(4);return ul!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Zl(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ql(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 Wl(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}bl(),Fl=new ul(4),ul!=Float32Array&&(Fl[0]=0,Fl[1]=0,Fl[2]=0,Fl[3]=0),bl(),Tl(1,0,0),Tl(0,1,0),Gl(),Gl(),cl();var Xl=function(){function e(t,i){v(this,e),this.pos=t,this.dir=i}return y(e,[{key:"intersectsPlane",value:function(e,t,i){var r=Dl(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];
1return Math.abs(i-a)<=ll*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=ll*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=ll*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),p=f*f-4*c*(s*s+l*l+u*u-t*t);if(p<0){var d=Math.max(-f/2,0),m=s+n*d,v=l+a*d,y=u+o*d,_=Math.hypot(m,v,y);return i[0]=m*t/_,i[1]=v*t/_,i[2]=y*t/_,!1}var g=(-f-Math.sqrt(p))/(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}(),Hl=function(){function e(t,i,r,n,a){v(this,e),this.TL=t,this.TR=i,this.BR=r,this.BL=n,this.horizon=a}return y(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(Bl(n,n,t),Bl(a,a,t),Bl(o,o,t),Bl(s,s,t),i/r)}}]),e}(),Yl=function(){function e(t,i){v(this,e),this.points=t,this.planes=i}return y(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=Nl([],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=Pl([],Ll([],Ol([],o[e[0]],o[e[1]]),Ol([],o[e[2]],o[e[1]]))),i=-Dl(t,o[e[1]]);return t.concat(i)}));return new e(o,s)}}]),e}(),Kl=function(){function e(t,i){v(this,e),this.min=t,this.max=i,this.center=Cl([],El([],this.min,this.max),.5)}return y(e,null,[{key:"fromPoints",value:function(t){var i,r=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],n=[Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE],a=f(t);try{for(a.s();!(i=a.n()).done;){var o=i.value;r[0]=Math.min(r[0],o[0]),r[1]=Math.min(r[1],o[1]),r[2]=Math.min(r[2],o[2]),n[0]=Math.max(n[0],o[0]),n[1]=Math.max(n[1],o[1]),n[2]=Math.max(n[2],o[2])}}catch(s){a.e(s)}finally{a.f()}return new e(r,n)}}]),y(e,[{key:"quadrant",value:function(t){for(var i=[t%2==0,t<2],r=wl(this.min),n=wl(this.max),a=0;a<i.length;a++)r[a]=i[a]?this.min[a]:this.center[a],n[a]=i[a]?this.center[a]:this.max[a];return n[2]=this.max[2],new e(r,n)}},{key:"distanceX",value:function(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}},{key:"distanceY",value:function(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}},{key:"distanceZ",value:function(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}},{key:"getCorners",value:function(){var e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}},{key:"intersects",value:function(e){for(var t=this.getCorners(),i=!0,r=0;r<e.planes.length;r++){for(var n=e.planes[r],a=0,o=0;o<t.length;o++)a+=Dl(n,t[o])+n[3]>=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;c<e.points.length;c++){var h=e.points[c][s]-this.min[s];l=Math.min(l,h),u=Math.max(u,h)}if(u<0||l>this.max[s]-this.min[s])return 0}return 1}}]),e}();function Jl(e,t,i,r,n,a,o,s,l){if(a&&e.queryGeometry.isAboveHorizon)return!1;a&&(l*=e.pixelToTileUnitsFactor);var u,c=e.tileID.canonical,h=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile,p=f(t);try{for(p.s();!(u=p.n()).done;){var d,m=u.value,v=f(m);try{var y=function(){var t=d.value,u=t.add(s),f=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(u.x,u.y,!0):0,p=i.projection.projectTilePoint(u.x,u.y,c);if(f>0){var m=i.projection.upVector(c,u.x,u.y);p.x+=m[0]*h*f,p.y+=m[1]*h*f,p.z+=m[2]*h*f}var v=a?u:$l(p.x,p.y,p.z,r),y=a?e.tilespaceRays.map((function(e){return tu(e,f)})):e.queryGeometry.screenGeometry,_=Nl([],[p.x,p.y,p.z,1],r);if(!o&&a?l*=_[3]/i.cameraToCenterDistance:o&&!a&&(l*=i.cameraToCenterDistance/_[3]),a){var g=As((t.y/ys+c.y)/(1<<c.z));l/=i.projection.pixelsPerMeter(g,1)/Es(1,g)}if(qs(y,v,l))return{v:!0}};for(v.s();!(d=v.n()).done;){var _=y();if("object"===typeof _)return _.v}}catch(g){v.e(g)}finally{v.f()}}}catch(g){p.e(g)}finally{p.f()}return!1}function $l(e,t,i,r){var n=Nl([],[e,t,i,1],r);return new _(n[0]/n[3],n[1]/n[3])}var Ql=Tl(0,0,0),eu=Tl(0,0,1);function tu(e,t){var i=bl();return Ql[2]=t,e.intersectsPlane(Ql,eu,i),new _(i[0],i[1])}var iu=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return i}(Gs);
1function ru(e,t,i,r){var n=t.width,a=t.height;if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==n*a*i)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*a*i);return e.width=n,e.height=a,e.data=r,e}function nu(e,t,i){var r=t.width,n=t.height;r===e.width&&n===e.height||(au(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,r),height:Math.min(e.height,n)},i),e.width=r,e.height=n,e.data=t.data)}function au(e,t,i,r,n,a){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range 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;l<n.height;l++)for(var u=((i.y+l)*e.width+i.x)*a,c=((r.y+l)*t.width+r.x)*a,h=0;h<n.width*a;h++)s[c+h]=o[u+h];return t}An(iu,"HeatmapBucket",{omit:["layers"]});var ou=function(){function e(t,i){v(this,e),ru(this,t,1,i)}return y(e,[{key:"resize",value:function(t){nu(this,new e(t),1)}},{key:"clone",value:function(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}}],[{key:"copy",value:function(e,t,i,r,n){au(e,t,i,r,n,1)}}]),e}(),su=function(){function e(t,i){v(this,e),ru(this,t,4,i)}return y(e,[{key:"resize",value:function(t){nu(this,new e(t),4)}},{key:"replace",value:function(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}},{key:"clone",value:function(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}}],[{key:"copy",value:function(e,t,i,r,n){au(e,t,i,r,n,4)}}]),e}();An(ou,"AlphaImage"),An(su,"RGBAImage");var lu={paint:new ja({"heatmap-radius":new Fa(at.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Fa(at.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ra(at.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Va(at.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ra(at.paint_heatmap["heatmap-opacity"])})};function uu(e){var t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new su({width:i,height:r}),a=function(i,r,a){t[e.evaluationKey]=a;var o=e.expression.evaluate(t);n.data[i+r+0]=Math.floor(255*o.r/o.a),n.data[i+r+1]=Math.floor(255*o.g/o.a),n.data[i+r+2]=Math.floor(255*o.b/o.a),n.data[i+r+3]=Math.floor(255*o.a)};if(e.clips)for(var o=0,s=0;o<r;++o,s+=4*i)for(var l=0,u=0;l<i;l++,u+=4){var c=l/(i-1),h=e.clips[o];a(s,u,h.start*(1-c)+h.end*c)}else for(var f=0,p=0;f<i;f++,p+=4)a(0,p,f/(i-1));return n}var cu={paint:new ja({"hillshade-illumination-direction":new Ra(at.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ra(at.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ra(at.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ra(at.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ra(at.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ra(at.paint_hillshade["hillshade-accent-color"])})},hu=Wa([{name:"a_pos",components:2,type:"Int16"}],4).members,fu=du,pu=du;function du(e,t,i){i=i||2;var r,n,a,o,s,l,u,c=t&&t.length,h=c?t[0]*i:e.length,f=mu(e,0,h,i,!0),p=[];if(!f||f.next===f.prev)return p;if(c&&(f=function(e,t,i,r){var n,a,o,s=[];for(n=0,a=t.length;n<a;n++)(o=mu(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Su(o));for(s.sort(wu),n=0;n<s.length;n++)i=ku(s[n],i);return i}(e,t,f,i)),e.length>80*i){r=a=e[0],n=o=e[1];for(var d=i;d<h;d+=i)(s=e[d])<r&&(r=s),(l=e[d+1])<n&&(n=l),s>a&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-r,o-n))?32767/u:0}return yu(f,p,i,r,n,u,0),p}function mu(e,t,i,r,n){var a,o;if(n===Uu(e,t,i,r)>0)for(a=t;a<i;a+=r)o=Ru(a,e[a],e[a+1],o);else for(a=i-r;a>=t;a-=r)o=Ru(a,e[a],e[a+1],o);return o&&Cu(o,o.next)&&(Fu(o),o=o.next),o}function vu(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!Cu(r,r.next)&&0!==Iu(r.prev,r,r.next))r=r.next;else{if(Fu(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function yu(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=Eu(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;t<u&&(s++,r=r.nextZ);t++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,l--),a?a.nextZ=n:e
vendor: 2,048 bytes, line 1
1=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?gu(e,r,n,a):_u(e))t.push(s.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),Fu(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?yu(e=xu(vu(e),t,i),t,i,r,n,a,2):2===o&&bu(e,t,i,r,n,a):yu(vu(e),t,i,r,n,a,1);break}}}function _u(e){var t=e.prev,i=e,r=e.next;if(Iu(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=n<a?n<o?n:o:a<o?a:o,h=s<l?s<u?s:u:l<u?l:u,f=n>a?n>o?n:o:a>o?a:o,p=s>l?s>u?s:u:l>u?l:u,d=r.next;d!==t;){if(d.x>=c&&d.x<=f&&d.y>=h&&d.y<=p&&Au(n,s,a,l,o,u,d.x,d.y)&&Iu(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function gu(e,t,i,r){var n=e.prev,a=e,o=e.next;if(Iu(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,p=s<l?s<u?s:u:l<u?l:u,d=c<h?c<f?c:f:h<f?h:f,m=s>l?s>u?s:u:l>u?l:u,v=c>h?c>f?c:f:h>f?h:f,y=Eu(p,d,t,i,r),_=Eu(m,v,t,i,r),g=e.prevZ,x=e.nextZ;g&&g.z>=y&&x&&x.z<=_;){if(g.x>=p&&g.x<=m&&g.y>=d&&g.y<=v&&g!==n&&g!==o&&Au(s,c,l,h,u,f,g.x,g.y)&&Iu(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,x.x>=p&&x.x<=m&&x.y>=d&&x.y<=v&&x!==n&&x!==o&&Au(s,c,l,h,u,f,x.x,x.y)&&Iu(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=p&&g.x<=m&&g.y>=d&&g.y<=v&&g!==n&&g!==o&&Au(s,c,l,h,u,f,g.x,g.y)&&Iu(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=_;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=v&&x!==n&&x!==o&&Au(s,c,l,h,u,f,x.x,x.y)&&Iu(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function xu(e,t,i){var r=e;do{var n=r.prev,a=r.next.next;!Cu(n,a)&&zu(n,r,r.next,a)&&Lu(n,a)&&Lu(a,n)&&(t.push(n.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),Fu(r),Fu(r.next),r=e=a),r=r.next}while(r!==e);return vu(r)}function bu(e,t,i,r,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Mu(o,s)){var l=Bu(o,s);return o=vu(o,o.next),l=vu(l,l.next),yu(o,t,i,r,n,a,0),void yu(l,t,i,r,n,a,0)}s=s.next}o=o.next}while(o!==e)}function wu(e,t){return e.x-t.x}function ku(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
vendor: 5,362 bytes, line 1
1);if(s<=n&&s>o&&(o=s,i=r.x<r.next.x?r:r.next,s===n))return i}r=r.next}while(r!==t);if(!i)return null;var l,u=i,c=i.x,h=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&Au(a<h?n:o,a,c,h,a<h?o:n,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(n-r.x),Lu(r,e)&&(l<f||l===f&&(r.x>i.x||r.x===i.x&&Tu(i,r)))&&(i=r,f=l)),r=r.next}while(r!==u);return i}(e,t);if(!i)return t;var r=Bu(i,e);return vu(r,r.next),vu(i,i.next)}function Tu(e,t){return Iu(e.prev,e,t.prev)<0&&Iu(t.next,e,e.next)<0}function Eu(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 Su(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function Au(e,t,i,r,n,a,o,s){return(n-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(i-o)*(t-s)&&(i-o)*(a-s)>=(n-o)*(r-s)}function Mu(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&&zu(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Lu(e,t)&&Lu(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)&&(Iu(e.prev,e,t.prev)||Iu(e,t.prev,t))||Cu(e,t)&&Iu(e.prev,e,e.next)>0&&Iu(t.prev,t,t.next)>0)}function Iu(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Cu(e,t){return e.x===t.x&&e.y===t.y}function zu(e,t,i,r){var n=Du(Iu(e,t,i)),a=Du(Iu(e,t,r)),o=Du(Iu(i,r,e)),s=Du(Iu(i,r,t));return n!==a&&o!==s||!(0!==n||!Pu(e,i,t))||!(0!==a||!Pu(e,r,t))||!(0!==o||!Pu(i,e,r))||!(0!==s||!Pu(i,t,r))}function Pu(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 Du(e){return e>0?1:e<0?-1:0}function Lu(e,t){return Iu(e.prev,e,e.next)<0?Iu(e,t,e.next)>=0&&Iu(e,e.prev,t)>=0:Iu(e,t,e.prev)<0||Iu(e,e.next,t)<0}function Bu(e,t){var i=new Ou(e.i,e.x,e.y),r=new Ou(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 Ru(e,t,i,r){var n=new Ou(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 Fu(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 Ou(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 Uu(e,t,i,r){for(var n=0,a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}function Vu(e,t,i,r,n){ju(e,t,i||0,r||e.length-1,n||Gu)}function ju(e,t,i,r,n){for(;r>i;){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);ju(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(Nu(e,i,t),n(e[r],c)>0&&Nu(e,i,r);h<f;){for(Nu(e,h,f),h++,f--;n(e[h],c)<0;)h++;for(;n(e[f],c)>0;)f--}0===n(e[i],c)?Nu(e,i,f):Nu(e,++f,r),f<=t&&(i=f+1),t<=f&&(r=f-1)}}function Nu(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function Gu(e,t){return e<t?-1:e>t?1:0}function Zu(e,t){var i=e.length;if(i<=1)return[e];for(var r,n,a=[],o=0;o<i;o++){var s=X(e[o]);0!==s&&(e[o].area=Math.abs(s),void 0===n&&(n=s<0),n===s<0?(r&&a.push(r),r=[e[o]]):r.push(e[o]))}if(r&&a.push(r),t>1)for(var l=0;l<a.length;l++)a[l].length<=t||(Vu(a[l],t,1,a[l].length-1,qu),a[l]=a[l].slice(0,t));return a}function qu(e,t){return t.area-e.area}function Wu(e,t,i){var r,n=i.patternDependencies,a=!1,o=f(t);try{for(o.s();!(r=o.n()).done;){var s=r.value.paint.get("".concat(e,"-pattern"));s.isConstant()||(a=!0);var l=s.constantOr(null);l&&(a=!0,n[l.to]=!0,n[l.from]=!0)}}catch(u){o.e(u)}finally{o.f()}return a}function Xu(e,t,i,r,n){var a,o=n.patternDependencies,s=f(t);try{for(s.s();!(a=s.n()).done;){var l=a.value,u=l.paint.get("".concat(e,"-pattern")).value;if("constant"!==u.kind){var c=u.evaluate({zoom:r-1},i,{},n.availableImages),h=u.evaluate({zoom:r},i,{},n.availableImages),p=u.evaluate({zoom:r+1},i,{},n.availableImages);c=c&&c.name?c.name:c,h=h&&h.name?h.name:h,p=p&&p.name?p.name:p,o[c]=!0,o[h]=!0,o[p]=!0,i.patterns[l.id]={min:c,mid:h,max:p}}}}catch(d){s.e(d)}finally{s.f()}return i}du.deviation=function(e,t,i,r){var n=t&&t.length,a=Math.abs(Uu(e,0,n?t[0]*i:e.length,i));if(n)for(var o=0,s=t.length;o<s;o++)a-=Math.abs(Uu(e,t[o]*i,o<s-1?t[o+1]*i:e.length,i));var l=0;for(o=0;o<r.length;o+=3){var u=r[o]*i,c=r[o+1]*i,h=r[o+2]*i;l+=Math.abs((e[u]-e[h])*(e[c+1]-e[u+1])-(e[u]-e[c])*(e[h+1]-e[u+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},du.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var a=0;a<e[n].length;a++)for(var o=0;o<t;o++)i.vertices.push(e[n][a][o]);n>0&&i.holes.push(r+=e[n-1].length)}return i},fu.default=pu;var Hu=function(){function e(t){v(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 Ha,this.indexArray=new co,this.indexArray2=new yo,this.programConfigurations=new os(t.layers,t.zoom),this.segments=new vs,this.segments2=new vs,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()}
1)).map((function(e){return e.id})),this.projection=t.projection}return y(e,[{key:"populate",value:function(e,t,i,r){this.hasPattern=Wu("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,p=l.sourceLayerIndex,d=this.layers[0]._featureFilter.needGeometry,m=Vs(u,d);if(this.layers[0]._featureFilter.filter(new Aa(this.zoom),m,i)){var v=a?a.evaluate(m,{},i,t.availableImages):void 0,y={id:c,properties:u.properties,type:u.type,sourceLayerIndex:p,index:h,geometry:d?m.geometry:Us(u,i,r),patterns:{},sortKey:v};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;_<g.length;_++){var x=g[_],b=x.geometry,w=x.index,k=x.sourceLayerIndex;if(this.hasPattern){var T=Xu("fill",this.layers,x,this.zoom,t);this.patternFeatures.push(T)}else this.addFeature(x,b,w,i,{},t.availableImages);t.featureIndex.insert(e[w].feature,b,w,k,this.index)}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"addFeatures",value:function(e,t,i,r,n){var a,o=f(this.patternFeatures);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.addFeature(s,s.geometry,s.index,t,i,r)}}catch(l){o.e(l)}finally{o.f()}}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}},{key:"addFeature",value:function(e,t,i,r,n){var a,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],s=f(Zu(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 p,d=this.segments.prepareSegment(c,this.layoutVertexArray,this.indexArray),m=d.vertexLength,v=[],y=[],_=f(u);try{for(_.s();!(p=_.n()).done;){var g=p.value;if(0!==g.length){g!==u[0]&&y.push(v.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),v.push(g[0].x),v.push(g[0].y);for(var w=1;w<g.length;w++)this.layoutVertexArray.emplaceBack(g[w].x,g[w].y),this.indexArray2.emplaceBack(b+w-1,b+w),v.push(g[w].x),v.push(g[w].y);x.vertexLength+=g.length,x.primitiveLength+=g.length}}}catch(E){_.e(E)}finally{_.f()}for(var k=fu(v,y),T=0;T<k.length;T+=3)this.indexArray.emplaceBack(m+k[T],m+k[T+1],m+k[T+2]);d.vertexLength+=c,d.primitiveLength+=k.length/3}}catch(E){s.e(E)}finally{s.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r)}}]),e}();An(Hu,"FillBucket",{omit:["layers","patternFeatures"]});var Yu=new ja({"fill-sort-key":new Fa(at.layout_fill["fill-sort-key"])}),Ku={paint:new ja({"fill-antialias":new Ra(at.paint_fill["fill-antialias"]),"fill-opacity":new Fa(at.paint_fill["fill-opacity"]),"fill-color":new Fa(at.paint_fill["fill-color"]),"fill-outline-color":new Fa(at.paint_fill["fill-outline-color"]),"fill-translate":new Ra(at.paint_fill["fill-translate"]),"fill-translate-anchor":new Ra(at.paint_fill["fill-translate-anchor"]),"fill-pattern":new Oa(at.paint_fill["fill-pattern"])}),layout:Yu},Ju=Wa([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),$u=Wa([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Qu=Wa([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),ec=Ju.members,tc=ic;function ic(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(rc,this,t)}function rc(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function nc(e){for(var t,i,r=0,n=0,a=e.length,o=a-1;n<a;o=n++)r+=((i=e[o]).x-(t=e[n]).x)*(t.y+i.y);return r}ic.types=["Unknown","Point","LineString","Polygon"],ic.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,r=1,n=0,a=0,o=0,s=[];e.pos<i;){if(n<=0){var l=e.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)a+=e.readSVarint(),o+=e.readSVarint(),1===r&&(t&&s.push(t),t=[]),t.push(new _(a,o));else{if(7!==r)throw new Error("unknown command "+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},ic.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<t;){if(r<=0){var c=e.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)(n+=e.readSVarint())<o&&(o=n),n>
1s&&(s=n),(a+=e.readSVarint())<l&&(l=a),a>u&&(u=a);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,s,u]},ic.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=ic.types[this.type];function c(e){for(var t=0;t<e.length;t++){var i=e[t];e[t]=[360*(i.x+o)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/a)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(r=0;r<l.length;r++)h[r]=l[r][0];c(l=h);break;case 2:for(r=0;r<l.length;r++)c(l[r]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var i,r,n=[],a=0;a<t;a++){var o=nc(e[a]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(i&&n.push(i),i=[e[a]]):i.push(e[a]))}return i&&n.push(i),n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)c(l[r][n])}1===l.length?l=l[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(f.id=this.id),f};var ac=oc;function oc(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(sc,this,t),this.length=this._features.length}function sc(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>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))}function lc(e,t,i){if(3===e){var r=new ac(i,i.readVarint()+i.pos);r.length&&(t[r.name]=r)}}oc.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 tc(this._pbf,t,this.extent,this._keys,this._values)};var uc={VectorTile:function(e,t){this.layers=e.readFields(lc,{},t)},VectorTileFeature:tc,VectorTileLayer:ac};function cc(e,t,i,r){var n,a=[],o=0===r?function(e,t,i,r,n,a){e.push(new _(a,i+(a-t)/(r-t)*(n-i)))}:function(e,t,i,r,n,a){e.push(new _(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 p=l.value;if(!(p.length<=2)){for(var d=[],m=0;m<p.length-1;m++){var v=p[m].x,y=p[m].y,g=p[m+1].x,x=p[m+1].y,b=0===r?v:y,w=0===r?g:x;b<t?w>t&&o(d,v,y,g,x,t):b>i?w<i&&o(d,v,y,g,x,i):d.push(p[m]),w<t&&b>=t&&o(d,v,y,g,x,t),w>i&&b<=i&&o(d,v,y,g,x,i)}var k=p[p.length-1],T=0===r?k.x:k.y;T>=t&&T<=i&&d.push(k),d.length&&(k=d[d.length-1],d[0].x===k.x&&d[0].y===k.y||d.push(d[0]),c.push(d))}}}catch(E){h.e(E)}finally{h.f()}c.length&&a.push(c)}}catch(E){s.e(E)}finally{s.f()}return a}var hc=uc.VectorTileFeature.types,fc=Math.pow(2,13);function pc(e,t,i,r,n,a,o,s){e.emplaceBack((t<<1)+o,(i<<1)+a,(Math.floor(r*fc)<<1)+n,Math.round(s))}function dc(e,t,i){var r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}var mc=function(){function e(){v(this,e),this.acc=new _(0,0),this.polyCount=[]}return y(e,[{key:"startRing",value:function(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new _(e.x,e.y),this.max=new _(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.x<i.x?i.x=e.x:e.x>r.x&&(r.x=e.x),e.y<i.y?i.y=e.y:e.y>r.y&&(r.y=e.y),((0===e.x||e.x===ys)&&e.x===t.x)!=((0===e.y||e.y===ys)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,wi(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>ys!=e.x>ys&&this.addBorderIntersection(1,wi(t.y,e.y,(ys-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,wi(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>ys!=e.y>ys&&this.addBorderIntersection(3,wi(t.x,e.x,(ys-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];t<i[0]&&(i[0]=t),t>i[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 _(0,0)}},{key:"span",value:function(){return new _(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}(),vc=function(){function e(t){v(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 Ka,this.centroidVertexArray=new Do,this.indexArray=new co,this.programConfigurations=new os(t.layers,t.zoom),this.segments=new vs,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()}
1)).map((function(e){return e.id})),this.enableTerrain=t.enableTerrain}return y(e,[{key:"populate",value:function(e,t,i,r){this.features=[],this.hasPattern=Wu("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<<e.z)*2));return 80150034*t/(t*t+1)/ys/(1<<e.z)}(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;var n,a=f(e);try{for(a.s();!(n=a.n()).done;){var o=n.value,s=o.feature,l=o.id,u=o.index,c=o.sourceLayerIndex,h=this.layers[0]._featureFilter.needGeometry,p=Vs(s,h);if(this.layers[0]._featureFilter.filter(new Aa(this.zoom),p,i)){var d={id:l,sourceLayerIndex:c,index:u,geometry:h?p.geometry:Us(s,i,r),properties:s.properties,type:s.type,patterns:{}},m=this.layoutVertexArray.length;this.hasPattern?this.features.push(Xu("fill-extrusion",this.layers,d,this.zoom,t)):this.addFeature(d,d.geometry,u,i,{},t.availableImages,r),t.featureIndex.insert(s,d.geometry,u,c,this.index,m)}}}catch(v){a.e(v)}finally{a.f()}this.sortBorders()}},{key:"addFeatures",value:function(e,t,i,r,n){var a,o=f(this.features);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.geometry;this.addFeature(s,l,s.index,t,i,r,n)}}catch(u){o.e(u)}finally{o.f()}this.sortBorders()}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ec),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Qu.members,!0))),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"uploadCentroid",value:function(e){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,$u.members,!0),this.needsCentroidUpdate=!1)}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}},{key:"addFeature",value:function(e,t,i,r,n,a,o){var s=[new _(0,0),new _(ys,ys)],l=o.projection,u="globe"===l.name,c=this.enableTerrain&&!u?new mc:null,h="Polygon"===hc[e.type];u&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new bo);for(var p,d,m=Zu(t,500),v=m.length-1;v>=0;v--){var y=m[v];(0===y.length||(p=y[0]).every((function(e){return e.x<=0}))||p.every((function(e){return e.x>=ys}))||p.every((function(e){return e.y<=0}))||p.every((function(e){return e.y>=ys})))&&m.splice(v,1)}if(u)d=Tc(m,s,r);else{d=[];var g,x=f(m);try{for(x.s();!(g=x.n()).done;){var b=g.value;d.push({polygon:b,bounds:s})}}catch(Ie){x.e(Ie)}finally{x.f()}}var w,k=h?this.edgeRadius:0,T=f(d);try{for(T.s();!(w=T.n()).done;){var E,S=w.value,A=S.polygon,M=S.bounds,I=0,C=0,z=f(A);try{for(z.s();!(E=z.n()).done;){var P=E.value;h&&!P[0].equals(P[P.length-1])&&P.push(P[0]),C+=h?P.length-1:P.length}}catch(Ie){z.e(Ie)}finally{z.f()}var D=this.segments.prepareSegment((h?5:4)*C,this.layoutVertexArray,this.indexArray);if(h){var L=[],B=[];I=D.vertexLength;var R,F=f(A);try{for(F.s();!(R=F.n()).done;){var O=R.value,U=void 0,V=void 0;O.length&&O!==A[0]&&B.push(L.length/2),U=O[1].sub(O[0])._perp()._unit();for(var j=1;j<O.length;j++){var N=O[j],G=O[j===O.length-1?1:j+1],Z=N.x,q=N.y;if(k){V=G.sub(N)._perp()._unit();var W=U.add(V)._unit(),X=k*Math.min(4,1/(U.x*W.x+U.y*W.y));Z+=X*W.x,q+=X*W.y,U=V}pc(this.layoutVertexArray,Z,q,0,0,1,1,0),D.vertexLength++,L.push(N.x,N.y),u&&dc(this.layoutVertexExtArray,l.projectTilePoint(Z,q,r),l.upVector(r,Z,q))}}}catch(Ie){F.e(Ie)}finally{F.f()}for(var H=fu(L,B),Y=0;Y<H.length;Y+=3)this.indexArray.emplaceBack(I+H[Y],I+H[Y+2],I+H[Y+1]),D.primitiveLength++}var K,J=f(A);try{for(J.s();!(K=J.n()).done;){var $=K.value;c&&$.length&&c.startRing($[0]);var Q=void 0,ee=void 0,te=void 0,ie=$.length>4&&bc($[$.length-2],$[0],$[1]),re=k?_c($[$.length-2],$[0],$[1],k):0;ee=$[1].sub($[0])._perp()._unit();for(var ne=1,ae=0;ne<$.length;ne++){var oe=$[ne-1],se=$[ne],le=$[ne===$.length-1?1:ne+1];if(c&&h&&c.currentPolyCount.top++,xc(se,oe,M))k&&(ee=le.sub(se)._perp()._unit());else{c&&c.append(se,oe);var ue=se.sub(oe)._perp(),ce=ue.x/(Math.abs(ue.x)+Math.abs(ue.y)),he=ue.y>0?1:0,fe=oe.dist(se);if(ae+fe>32768&&(ae=0),k){te=le.sub(se)._perp()._unit();var pe=gc(oe,se,le,yc(ee,te),k);isNaN(pe)&&(pe=0);var de=se.sub(oe)._unit();oe=oe.add(de.mult(re))._round(),se=se.add(de.mult(-pe))._round(),re=pe,ee=te}var me=D.vertexLength,ve=$.length>4&&bc(oe,se,le),ye=wc(ae,ie,!0);if(pc(this.layoutVertexArray,oe.x,oe.y,ce,he,0,0,ye),pc(this.layoutVertexArray,oe.x,oe.y,ce,he,0,1,ye),ye=wc(ae+=fe,ve,!1),ie=ve,pc(this.layoutVertexArray,se.x,se.y,ce,he,0,0,ye),pc(this.layoutVertexArray,se.x,se.y,ce,he,0,1,ye),D.vertexLength+=4,this.indexArray.emplaceBack(me+0,me+1,me+2),this.indexArray.emplaceBack(me+1,me+3,me+2),D.primitiveLength+=2,k){var _e=I+(1===ne?$.length-2:ne-2),ge=1===ne?I:_e+1;if(this.indexArray.emplaceBack(me+1,_e,me+3),this.indexArray.emplaceBack(_e,ge,me+3),D.primitiveLength+=2,void 0===Q&&(Q=me),!xc(le,$[ne],M)){var xe=ne===$.length-1?Q:D.vertexLength;this.indexArray.emplaceBack(me+2,me+3,xe),this.indexArray.emplaceBack(me+3,xe+1,xe),this.indexArray.emplaceBack(me+3,ge,xe+1),D.primitiveLength+=3}}if(u){var be=this.layoutVertexExtArray,we=l.projectTilePoint(oe.x,oe.y,r),ke=l.projectTilePoint(se.x,se.y,r),Te=l.upVector(r,oe.x,oe.y),Ee=l.upVector(r,se.x,se.y);dc(be,we,Te),dc(be,we,Te),dc(be,ke,Ee),dc(be,ke,Ee)}}}h&&(I+=$.length-1)}}catch(Ie){J.e(Ie)}finally{J.f()}}}
1catch(Ie){T.e(Ie)}finally{T.f()}if(c&&c.polyCount.length>0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;for(var Se=c.borders,Ae=this.featuresOnBorder.push(c)-1,Me=0;Me<4;Me++)Se[Me][0]!==Number.MAX_VALUE&&this.borders[Me].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;c<u.top;c++)this.centroidVertexArray.emplace(s++,i,r);for(var h=0;h<2*u.edges;h++)this.centroidVertexArray.emplace(s++,0,r),this.centroidVertexArray.emplace(s++,i,r)}}catch(p){l.e(p)}finally{l.f()}}}]),e}();function yc(e,t){var i=e.add(t)._unit();return e.x*i.x+e.y*i.y}function _c(e,t,i,r){var n=t.sub(e)._perp()._unit(),a=i.sub(t)._perp()._unit();return gc(e,t,i,yc(n,a),r)}function gc(e,t,i,r,n){var a=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*a/r)}function xc(e,t,i){return e.x<i[0].x&&t.x<i[0].x||e.x>i[1].x&&t.x>i[1].x||e.y<i[0].y&&t.y<i[0].y||e.y>i[1].y&&t.y>i[1].y}function bc(e,t,i){if(e.x<0||e.x>=ys||t.x<0||t.x>=ys||i.x<0||i.x>=ys)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 wc(e,t,i){var r=t?2|e:-3&e;return i?1|r:-2&r}function kc(){var e=Math.PI/32,t=Math.tan(e),i=gs;return i*Math.sqrt(1+2*t*t)-i}function Tc(e,t,i){var r=1<<i.z,n=Ss(i.x/r),a=Ss((i.x+1)/r),o=As(i.y/r),s=As((i.y+1)/r);return function(e,t,i,r){var n=arguments.length>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=[],p=0;p<Math.abs(c);p++)h.push(c>0?0:1);for(var d=0;d<Math.min(l,u);d++)h.push(0),h.push(1);var m=e;if(m=cc(m,t[0].y-n,t[1].y+n,1),!(m=cc(m,t[0].x-n,t[1].x+n,0)).length)return o;var v=[];for(h.length?v.push({polygons:m,bounds:t,depth:0}):s(m,t);v.length;){var y=v.pop(),g=y.depth,x=h[g],b=y.bounds[0],w=y.bounds[1],k=0===x?b.x:b.y,T=0===x?w.x:w.y,E=a?a(x,k,T):.5*(k+T),S=cc(y.polygons,k-n,E+n,x),A=cc(y.polygons,E-n,T+n,x);if(S.length){var M=[b,new _(0===x?E:w.x,1===x?E:w.y)];h.length>g+1?v.push({polygons:S,bounds:M,depth:g+1}):s(S,M)}if(A.length){var I=[new _(0===x?E:b.x,1===x?E:b.y),w];h.length>g+1?v.push({polygons:A,bounds:I,depth:g+1}):s(A,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=As((i.y+t/ys)/r);return(Ts(.5*(As((i.y+n/ys)/r)+a))*r-i.y)*ys}))}An(vc,"FillExtrusionBucket",{omit:["layers","features"]}),An(mc,"PartMetadata");var Ec=new ja({"fill-extrusion-edge-radius":new Ra(at["layout_fill-extrusion"]["fill-extrusion-edge-radius"])}),Sc={paint:new ja({"fill-extrusion-opacity":new Ra(at["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Fa(at["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ra(at["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ra(at["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Oa(at["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Fa(at["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Fa(at["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ra(at["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ra(at["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ra(at["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:Ec};function Ac(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 Mc=function(){function e(t,i,r){v(this,e),this.z=t,this.x=i,this.y=r,this.key=zc(0,t,t,i,r)}return y(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=Ac(256*e,256*(t=Math.pow(2,i)-t-1),i),n=Ac(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<<a-1)?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",r).replace("{bbox-epsg-3857}",i)}},{key:"toString",value:function(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}}]),e}(),Ic=function e(t,i){v(this,e),this.wrap=t,this.canonical=i,this.key=zc(t,i.z,i.z,i.x,i.y)},Cc=function(){function e(t,i,r,n,a){v(this,e),this.overscaledZ=t,this.wrap=i,this.canonical=new Mc(r,+n,+a),this.key=0===i&&t===r?this.canonical.key:zc(i,t,r,n,a)}return y(e,[{key:"equals",value:function(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}},{key:"scaledTo",value:function(t){var i=this.canonical.z-t;return t>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 zc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);var i=this.canonical.z-e;return zc(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<this.overscaledZ&&e.canonical.x===this.canonical.x>>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.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>
1e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}},{key:"wrapped",value:function(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}},{key:"unwrapTo",value:function(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}},{key:"overscaleFactor",value:function(){return Math.pow(2,this.overscaledZ-this.canonical.z)}},{key:"toUnwrapped",value:function(){return new Ic(this.wrap,this.canonical)}},{key:"toString",value:function(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}}]),e}();function zc(e,t,i,r,n){var a=1<<Math.min(i,22),o=a*(n%a)+r%a;return e&&i<22&&(o+=a*a*((e<0?-2*e-1:2*e)%(1<<2*(22-i)))),16*(32*o+i)+(t-i)}function Pc(e,t){return e.x*t.x+e.y*t.y}function Dc(e,t){if(1===e.length){for(var i,r=0,n=t[r++];!i||n.equals(i);)if(!(i=t[r++]))return 1/0;for(;r<t.length;r++){var a=t[r],o=e[0],s=i.sub(n),l=a.sub(n),u=o.sub(n),c=Pc(s,s),h=Pc(s,l),p=Pc(l,l),d=Pc(u,s),m=Pc(u,l),v=c*p-h*h,y=(p*d-h*m)/v,_=(c*m-h*d)/v,g=n.z*(1-y-_)+i.z*y+a.z*_;if(isFinite(g))return g}return 1/0}var x,b=1/0,w=f(t);try{for(w.s();!(x=w.n()).done;){var k=x.value;b=Math.min(b,k.z)}}catch(T){w.e(T)}finally{w.f()}return b}function Lc(e){var t=new _(e[0],e[1]);return t.z=e[2],t}function Bc(e,t,i,r,n,a,o,s){var l=o*n.getElevationAt(e,t,!0,!0),u=0!==a[0],c=u?0===a[1]?o*(a[0]/7-450):o*function(e,t,i){var r=Math.floor(t[0]/8),n=Math.floor(t[1]/8),a=10*(t[0]-8*r),o=10*(t[1]-8*n),s=e.getElevationAt(r,n,!0,!0),l=e.getMeterToDEM(i),u=Math.floor(.5*(a*l-1)),c=Math.floor(.5*(o*l-1)),h=e.tileCoordToPixel(r,n),f=2*u+1,p=2*c+1,d=function(e,t,i,r,n){return[e.getElevationAtPixel(t,i,!0),e.getElevationAtPixel(t+n,i,!0),e.getElevationAtPixel(t,i+n,!0),e.getElevationAtPixel(t+r,i+n,!0)]}(e,h.x-u,h.y-c,f,p),m=Math.abs(d[0]-d[1]),v=Math.abs(d[2]-d[3]),y=Math.abs(d[0]-d[2])+Math.abs(d[1]-d[3]),_=Math.min(.25,.5*l*(m+v)/f),g=Math.min(.25,.5*l*y/p);return s+Math.max(_*a,g*o)}(n,a,s):l;return{base:l+(0===i)?-1:i,top:u?Math.max(c+r,l+i+2):l+r}}An(Mc,"CanonicalTileID"),An(Cc,"OverscaledTileID",{omit:["projMatrix"]});var Rc=Wa([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4).members,Fc=Wa([{name:"a_packed",components:4,type:"Float32"}]).members,Oc=uc.VectorTileFeature.types,Uc=Math.cos(Math.PI/180*37.5),Vc=function(){function e(t){var i=this;v(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.projection=t.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((function(e){i.gradients[e.id]={}})),this.layoutVertexArray=new Ja,this.layoutVertexArray2=new $a,this.indexArray=new co,this.programConfigurations=new os(t.layers,t.zoom),this.segments=new vs,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id}))}return y(e,[{key:"populate",value:function(e,t,i,r){this.hasPattern=Wu("line",this.layers,t);var n,a=this.layers[0].layout.get("line-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,p=l.sourceLayerIndex,d=this.layers[0]._featureFilter.needGeometry,m=Vs(u,d);if(this.layers[0]._featureFilter.filter(new Aa(this.zoom),m,i)){var v=a?a.evaluate(m,{},i):void 0,y={id:c,properties:u.properties,type:u.type,sourceLayerIndex:p,index:h,geometry:d?m.geometry:Us(u,i,r),patterns:{},sortKey:v};o.push(y)}}}catch(M){s.e(M)}finally{s.f()}a&&o.sort((function(e,t){return e.sortKey-t.sortKey}));for(var _=t.lineAtlas,g=t.featureIndex,x=this.addConstantDashes(_),b=0,w=o;b<w.length;b++){var k=w[b],T=k.geometry,E=k.index,S=k.sourceLayerIndex;if(x&&this.addFeatureDashes(k,_),this.hasPattern){var A=Xu("line",this.layers,k,this.zoom,t);this.patternFeatures.push(A)}else this.addFeature(k,T,E,i,_.positions,t.availableImages);g.insert(e[E].feature,T,E,S,this.index)}}},{key:"addConstantDashes",value:function(e){var t,i=!1,r=f(this.layers);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=n.paint.get("line-dasharray").value,o=n.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==o.kind)i=!0;else{var s=o.value,l=a.value;if(!l)continue;e.addDash(l.from,s),e.addDash(l.to,s),l.other&&e.addDash(l.other,s)}}}catch(u){r.e(u)}finally{r.f()}return i}},{key:"addFeatureDashes",value:function(e,t){var i,r=this.zoom,n=f(this.layers);try{for(n.s();!(i=n.n()).done;){var a=i.value,o=a.paint.get("line-dasharray").value,s=a.layout.get("line-cap").value;if("constant"!==o.kind||"constant"!==s.kind){var l=void 0,u=void 0,c=void 0,h=void 0,p=void 0,d=void 0;if("constant"===o.kind){var m=o.value;if(!m)continue;l=m.other||m.to,u=m.to,c=m.from}else l=o.evaluate({zoom:r-1},e),u=o.evaluate({zoom:r},e),c=o.evaluate({zoom:r+1},e);"constant"===s.kind?h=p=d=s.value:(h=s.evaluate({zoom:r-1},e),p=s.evaluate({zoom:r},e),d=s.evaluate({zoom:r+1},e)),t.addDash(l,h),t.addDash(u,p),t.addDash(c,d);var v=t.getKey(l,h),y=t.getKey(u,p),_=t.getKey(c,d);e.patterns[a.id]={min:v,mid:y,max:_}}}}catch(g){n.e(g)}finally{n.f()}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"addFeatures",value:function(e,t,i,r,n){var a,o=f(this.patternFeatures);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.addFeature(s,s.geometry,s.index,t,i,r)}}catch(l){o.e(l)}finally{o.f()}}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Fc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}},{key:"lineFeatureClips",value:function(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}},{key:"addFeature",value:function(e,t,i,r,n,a){var o=this.layers[0].layout,s=o.get("line-join").evaluate(e,{}),l=o.get("line-cap").evaluate(e,{}),u=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);var h,p=f(t);try{for(p.s();!(h=p.n()).done;){var d=h.value;this.addLine(d,e,s,l,u,c)}}catch(m){p.e(m)}finally{p.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,a,r)}},{key:"addLine",value:function(e,t,i,r,n,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
1oFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var o=0;o<e.length-1;o++)this.totalDistance+=e[o].dist(e[o+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var s="Polygon"===Oc[t.type],l=e.length;l>=2&&e[l-1].equals(e[l-2]);)l--;for(var u=0;u<l-1&&e[u].equals(e[u+1]);)u++;if(!(l<(s?3:2))){"bevel"===i&&(n=1.05);var c,h,f,p,d,m=this.overscaling<=16?122880/(512*this.overscaling):0,v=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,s&&(c=e[l-2],d=e[u].sub(c)._unit()._perp());for(var y=u;y<l;y++)if(!(f=y===l-1?s?e[u+1]:void 0:e[y+1])||!e[y].equals(f)){d&&(p=d),c&&(h=c),c=e[y],d=f?f.sub(c)._unit()._perp():p;var _=(p=p||d).add(d);0===_.x&&0===_.y||_._unit();var g=p.x*d.x+p.y*d.y,x=_.x*d.x+_.y*d.y,b=0!==x?1/x:1/0,w=2*Math.sqrt(2-2*x),k=x<Uc&&h&&f,T=p.x*d.y-p.y*d.x>0;if(k&&y>u){var E=c.dist(h);if(E>2*m){var S=c.sub(c.sub(h)._mult(m/E)._round());this.updateDistance(h,S),this.addCurrentVertex(S,p,0,0,v),h=S}}var A=h&&f,M=A?i:s?"butt":r;if(A&&"round"===M&&(b<a?M="miter":b<=2&&(M="fakeround")),"miter"===M&&b>n&&(M="bevel"),"bevel"===M&&(b>2&&(M="flipbevel"),b<n&&(M="miter")),h&&this.updateDistance(h,c),"miter"
1===M)_._mult(b),this.addCurrentVertex(c,_,0,0,v);else if("flipbevel"===M){if(b>100)_=d.mult(-1);else{var I=b*p.add(d).mag()/p.sub(d).mag();_._perp()._mult(I*(T?-1:1))}this.addCurrentVertex(c,_,0,0,v),this.addCurrentVertex(c,_.mult(-1),0,0,v)}else if("bevel"===M||"fakeround"===M){var C=-Math.sqrt(b*b-1),z=T?C:0,P=T?0:C;if(h&&this.addCurrentVertex(c,p,z,P,v),"fakeround"===M)for(var D=Math.round(180*w/Math.PI/20),L=1;L<D;L++){var B=L/D;if(.5!==B){var R=B-.5;B+=B*R*(B-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*R*R+(.848013+g*(.215638*g-1.06021)))}var F=d.sub(p)._mult(B)._add(p)._unit()._mult(T?-1:1);this.addHalfVertex(c,F.x,F.y,!1,T,0,v)}f&&this.addCurrentVertex(c,d,-z,-P,v)}else if("butt"===M)this.addCurrentVertex(c,_,0,0,v);else if("square"===M){var O=h?1:-1;h||this.addCurrentVertex(c,_,O,O,v),this.addCurrentVertex(c,_,0,0,v),h&&this.addCurrentVertex(c,_,O,O,v)}else"round"===M&&(h&&(this.addCurrentVertex(c,p,0,0,v),this.addCurrentVertex(c,p,1,1,v,!0)),f&&(this.addCurrentVertex(c,d,-1,-1,v,!0),this.addCurrentVertex(c,d,0,0,v)));if(k&&y<l-1){var U=c.dist(f);if(U>2*m){var V=c.add(f.sub(c)._mult(m/U)._round());this.updateDistance(c,V),this.addCurrentVertex(V,d,0,0,v),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}();An(Vc,"LineBucket",{omit:["layers","patternFeatures"]});var jc=new ja({"line-cap":new Fa(at.layout_line["line-cap"]),"line-join":new Fa(at.layout_line["line-join"]),"line-miter-limit":new Ra(at.layout_line["line-miter-limit"]),"line-round-limit":new Ra(at.layout_line["line-round-limit"]),"line-sort-key":new Fa(at.layout_line["line-sort-key"])}),Nc={paint:new ja({"line-opacity":new Fa(at.paint_line["line-opacity"]),"line-color":new Fa(at.paint_line["line-color"]),"line-translate":new Ra(at.paint_line["line-translate"]),"line-translate-anchor":new Ra(at.paint_line["line-translate-anchor"]),"line-width":new Fa(at.paint_line["line-width"]),"line-gap-width":new Fa(at.paint_line["line-gap-width"]),"line-offset":new Fa(at.paint_line["line-offset"]),"line-blur":new Fa(at.paint_line["line-blur"]),"line-dasharray":new Oa(at.paint_line["line-dasharray"]),"line-pattern":new Oa(at.paint_line["line-pattern"]),"line-gradient":new Va(at.paint_line["line-gradient"]),"line-trim-offset":new Ra(at.paint_line["line-trim-offset"])}),layout:jc},Gc=new(function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"possiblyEvaluate",value:function(e,t){return t=new Aa(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),o(s(i.prototype),"possiblyEvaluate",this).call(this,e,t)}},{key:"evaluate",value:function(e,t,r,n){return t=D({},t,{zoom:Math.floor(t.zoom)}),o(s(i.prototype),"evaluate",this).call(this,e,t,r,n)}}]),i}(Fa))(Nc.paint.properties["line-width"].specification);function Zc(e,t){return t>0?t+2*e:e}Gc.useIntegerZoom=!0;var qc=Wa([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Wc=Wa([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Xc=Wa([{name:"a_projected_pos",components:4,type:"Float32"}],4);Wa([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var Hc=Wa([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Yc=Wa([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Wa([{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 Kc=Wa([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Jc=Wa([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Wa([{name:"triangle",components:3,type:"Uint16"}]),Wa([{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"}]),Wa([{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"}]),Wa([{type:"Float32",name:"offsetX"}]),Wa([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var $c=24,Qc=128;function eh(e,t){var i=t.expression;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Aa(e+1))};if("source"===i.kind)return{kind:"source"};for(var r=i.zoomStops,n=i.interpolationType,a=0;a<r.length&&r[a]<=e;)a++;for(var o=a=Math.max(0,a-1);o<r.length&&r[o]<e+1;)o++;o=Math.min(r.length-1,o);var s=r[a],l=r[o];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n}:{kind:"camera",minZoom:s,maxZoom:l,minSize:i.evaluate(new Aa(s)),maxSize:i.evaluate(new Aa(l)),interpolationType:n}}function th(e,t,i){var r=t.uSize,n=t.uSizeT,a=i.lowerSize,o=i.upperSize;return"source"===e.kind?a/Qc:"composite"===e.kind?wi(a/Qc,o/Qc,n):r}function ih(e,t){var i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){var n=e.interpolationType,a=e.minZoom,o=e.maxZoom,s=n?M(Gi.interpolationFactor(n,t,a,o),0,1):0;"camera"===e.kind?r=wi(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}}var rh=Object.freeze({__proto__:null,getSizeData:eh,evaluateSizeForFeature:th,evaluateSizeForZoom:ih,SIZE_PACK_FACTOR:Qc});function nh(e,t,i){return e.sections.forEach((function(e){e.text=function(e,t,i){var r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Sa.applyArabicShaping&&(e=Sa.applyArabicShaping(e)),e}(e.text,t,i)})),e}var ah={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"};function oh(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 sh(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f"===e}var lh=function(e,t,i,r,n){var a,o,s=8*n-r-1,l=(1<<s)-1,u=l>>
vendor: 5,360 bytes, line 1
11,c=-7,h=i?n-1:0,f=i?-1:1,p=e[t+h];for(h+=f,a=p&(1<<-c)-1,p>>=-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*(p?-1:1);o+=Math.pow(2,r),a-=u}return(p?-1:1)*o*Math.pow(2,a-r)},uh=function(e,t,i,r,n,a){var o,s,l,u=8*a-n-1,c=(1<<u)-1,h=c>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,m=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+p]=255&s,p+=d,s/=256,n-=8);for(o=o<<n|s,u+=n;u>0;e[i+p]=255&o,p+=d,o/=256,u-=8);e[i+p-d]|=128*m},ch=hh;function hh(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}hh.Varint=0,hh.Fixed64=1,hh.Bytes=2,hh.Fixed32=5;var fh=4294967296,ph=1/fh,dh="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function mh(e){return e.type===hh.Bytes?e.readVarint()+e.pos:e.pos+1}function vh(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function yh(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 _h(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function gh(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function xh(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function bh(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function wh(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function kh(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function Th(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Eh(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function Sh(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function Ah(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function Mh(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function Ih(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Ch(e,t,i){t.glyphs=[],1===e&&i.readMessage(zh,t)}function zh(e,t,i){if(3===e){var r=i.readMessage(Ph,{}),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 ou({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 Ph(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 Dh(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(v){n.e(v)}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,p=s.length-1;p>=0;p--){var d=s[p];if(!(h.w>d.w||h.h>d.h)){if(h.x=d.x,h.y=d.y,u=Math.max(u,h.y+h.h),l=Math.max(l,h.x+h.w),h.w===d.w&&h.h===d.h){var m=s.pop();p<s.length&&(s[p]=m)}else h.h===d.h?(d.x+=h.w,d.w-=h.w):h.w===d.w?(d.y+=h.h,d.h-=h.h):(s.push({x:d.x+h.w,y:d.y,w:d.w-h.w,h:h.h}),d.y+=h.h,d.h-=h.h);break}}}catch(v){c.e(v)}finally{c.f()}return{w:l,h:u,fill:i/(l*u)||0}}hh.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>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=Ah(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Ih(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ah(this.buf,this.pos)+Ah(this.buf,this.pos+4)*fh;return this.pos+=8,e},readSFixed64:function(){var e=Ah(this.buf,this.pos)+Ih(this.buf,this.pos+4)*fh;return this.pos+=8,e},readFloat:function(){var e=lh(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=lh(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 vh(e,r,t);if(r|=(127&(n=a[i.pos++]))<<3,n<128)return vh(e,r,t);if(r|=(127&(n=a[i.pos++]))<<10,n<128)return vh(e,r,t);if(r|=(127&(n=a[i.pos++]))<<17,n<128)return vh(e,r,t);if(r|=(127&(n=a[i.pos++]))<<24,n<128)return vh(e,r,t);if(r|=(1&(n=a[i.pos++]))<<31,n<128)return vh(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&&dh?function(e,t,i){return dh.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n<i;){var a,o,s,l=e[n],u=null,c=l>239?4:l>223?3:l>191?2:1;if(n+c>i)break;
vendor: 6,250 bytes, line 1
11===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!==hh.Bytes)return e.push(this.readVarint(t));var i=mh(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==hh.Bytes)return e.push(this.readSVarint());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==hh.Bytes)return e.push(this.readBoolean());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==hh.Bytes)return e.push(this.readFloat());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==hh.Bytes)return e.push(this.readDouble());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==hh.Bytes)return e.push(this.readFixed32());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==hh.Bytes)return e.push(this.readSFixed32());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==hh.Bytes)return e.push(this.readFixed64());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==hh.Bytes)return e.push(this.readSFixed64());var t=mh(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===hh.Varint)for(;this.buf[this.pos++]>127;);else if(t===hh.Bytes)this.pos=this.readVarint()+this.pos;else if(t===hh.Fixed32)this.pos+=4;else{if(t!==hh.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;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Mh(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Mh(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Mh(this.buf,-1&e,this.pos),Mh(this.buf,Math.floor(e*ph),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Mh(this.buf,-1&e,this.pos),Mh(this.buf,Math.floor(e*ph),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||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;a<t.length;a++){if((r=t.charCodeAt(a))>55295&&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&&yh(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),uh(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),uh(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<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&yh(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,hh.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,_h,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,gh,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,wh,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,xh,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,bh,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,kh,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Th,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Eh,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Sh,t)},writeBytesField:function(e,t){this.writeTag(e,hh.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,hh.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,hh.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,hh.Fixed64),this.writeFixed64
1(t)},writeSFixed64Field:function(e,t){this.writeTag(e,hh.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,hh.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,hh.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,hh.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,hh.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,hh.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var Lh=function(){function e(t,i){var r=i.pixelRatio,n=i.version,a=i.stretchX,o=i.stretchY,s=i.content;v(this,e),this.paddedRect=t,this.pixelRatio=r,this.stretchX=a,this.stretchY=o,this.content=s,this.version=n}return y(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}(),Bh=function(){function e(t,i){v(this,e);var r={},n={};this.haveRenderCallbacks=[];var a=[];this.addImages(t,r,a),this.addImages(i,n,a);var o=Dh(a),s=o.w,l=o.h,u=new su({width:s||1,height:l||1});for(var c in t){var h=t[c],f=r[c].paddedRect;su.copy(h.data,u,{x:0,y:0},{x:f.x+1,y:f.y+1},h.data)}for(var p in i){var d=i[p],m=n[p].paddedRect,y=m.x+1,_=m.y+1,g=d.data.width,x=d.data.height;su.copy(d.data,u,{x:0,y:0},{x:y,y:_},d.data),su.copy(d.data,u,{x:0,y:x-1},{x:y,y:_-1},{width:g,height:1}),su.copy(d.data,u,{x:0,y:0},{x:y,y:_+x},{width:g,height:1}),su.copy(d.data,u,{x:g-1,y:0},{x:y-1,y:_},{width:1,height:x}),su.copy(d.data,u,{x:0,y:0},{x:y+g,y:_},{width:1,height:x})}this.image=u,this.iconPositions=r,this.patternPositions=n}return y(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 Lh(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}();An(Lh,"ImagePosition"),An(Bh,"ImageAtlas");var Rh={horizontal:1,vertical:2,horizontalOnly:3},Fh=function(){function e(){v(this,e),this.scale=1,this.fontStack="",this.imageName=null}return y(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}(),Oh=function(){function e(){v(this,e),this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}return y(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<e.length;r++){var n=e.charCodeAt(r+1)||null,a=e.charCodeAt(r-1)||null;i+=!t&&(n&&ha(n)&&!ah[e[r+1]]||a&&ha(a)&&!ah[e[r-1]])||!ah[e[r]]?e[r]:ah[e[r]]}return i}(this.text,e)}},{key:"trim",value:function(){for(var e=0,t=0;t<this.text.length&&Vh[this.text.charCodeAt(t)];t++)e++;for(var i=this.text.length,r=this.text.length-1;r>=0&&r>=e&&Vh[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)}
1),0)}},{key:"addTextSection",value:function(e,t){this.text+=e.text,this.sections.push(Fh.forText(e.scale,e.fontStack||t));for(var i=this.sections.length-1,r=0;r<e.text.length;++r)this.sectionIndex.push(i)}},{key:"addImageSection",value:function(e){var t=e.image?e.image.name:"";if(0!==t.length){var i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(Fh.forImage(t)),this.sectionIndex.push(this.sections.length-1)):q("Reached maximum number of images 6401")}else q("Can't add FormattedSection with an empty image.")}},{key:"getNextImageSectionCharCode",value:function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}],[{key:"fromFeature",value:function(t,i){for(var r=new e,n=0;n<t.sections.length;n++){var a=t.sections[n];a.image?r.addImageSection(a):r.addTextSection(a,i)}return r}}]),e}();function Uh(e,t,i,r,n,a,o,s,l,u,c,h,p,d,m,v){var y,_=Oh.fromFeature(e,n);h===Rh.vertical&&_.verticalizePunctuation(p);var g=Sa.processBidirectionalText,x=Sa.processStyledBidirectionalText;if(g&&1===_.sections.length){y=[];var b,w=g(_.toString(),Xh(_,u,a,t,r,d,m)),k=f(w);try{for(k.s();!(b=k.n()).done;){var T=b.value,E=new Oh;E.text=T,E.sections=_.sections;for(var S=0;S<T.length;S++)E.sectionIndex.push(0);y.push(E)}}catch(L){k.e(L)}finally{k.f()}}else if(x){y=[];var A,M=x(_.text,_.sectionIndex,Xh(_,u,a,t,r,d,m)),I=f(M);try{for(I.s();!(A=I.n()).done;){var C=A.value,z=new Oh;z.text=C[0],z.sectionIndex=C[1],z.sections=_.sections,y.push(z)}}catch(L){I.e(L)}finally{I.f()}}else y=function(e,t){var i,r=[],n=e.text,a=0,o=f(t);try{for(o.s();!(i=o.n()).done;){var s=i.value;r.push(e.substring(a,s)),a=s}}catch(L){o.e(L)}finally{o.f()}return a<n.length&&r.push(e.substring(a,n.length)),r}(_,Xh(_,u,a,t,r,d,m));var P=[],D={positionedLines:P,text:_.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,t,i,r,n,a,o,s,l,u,c,h){var p,d=0,m=0,v=0,y="right"===s?1:"left"===s?0:.5,_=!1,g=f(n);try{for(g.s();!(p=g.n()).done;){var x,b=p.value.getSections(),w=f(b);try{for(w.s();!(x=w.n()).done;){var k=x.value;if(!k.imageName){var T=t[k.fontStack];if(T&&!(_=void 0!==T.ascender&&void 0!==T.descender))break}}}catch(L){w.e(L)}finally{w.f()}if(!_)break}}catch(L){g.e(L)}finally{g.f()}var E,S,A=0,M=f(n);try{for(M.s();!(E=M.n()).done;){var I=E.value;I.trim();var C=I.getMaxScale(),z=(C-1)*$c,P={positionedGlyphs:[],lineOffset:0};e.positionedLines[A]=P;var D=P.positionedGlyphs,B=0;if(I.length()){for(var R=0,F=0,O=0;O<I.length();O++){var U=I.getSection(O),V=I.getSectionIndex(O),j=I.getCharCode(O),N=U.scale,G=null,Z=null,q=null,W=$c,X=0,H=!(l===Rh.horizontal||!c&&!ca(j)||c&&(Vh[j]||(S=j,Ln(S)||Bn(S)||Rn(S)||ta(S)||aa(S))));if(U.imageName){var Y=r[U.imageName];if(!Y)continue;q=U.imageName,e.iconsInText=e.iconsInText||!0,Z=Y.paddedRect;var K=Y.displaySize;N=N*$c/h,G={width:K[0],height:K[1],left:1,top:-3,advance:H?K[1]:K[0],localGlyph:!1},X=_?-G.height*N:C*$c-17-K[1]*N,W=G.advance;var J=(H?K[0]:K[1])*N-$c*C;J>0&&J>B&&(B=J)}else{var $=i[U.fontStack];if(!$)continue;$[j]&&(Z=$[j]);var Q=t[U.fontStack];if(!Q)continue;var ee=Q.glyphs[j];if(!ee)continue;if(G=ee.metrics,W=8203!==j?$c: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)*N;R<re&&(R=re,F=(te-ie)/2*N),X=-te*N}else X=(C-N)*$c-17}H?(e.verticalizable=!0,D.push({glyph:j,imageName:q,x:d,y:m+X,vertical:H,scale:N,localGlyph:G.localGlyph,fontStack:U.fontStack,sectionIndex:V,metrics:G,rect:Z}),d+=W*N+u):(D.push({glyph:j,imageName:q,x:d,y:m+X,vertical:H,scale:N,localGlyph:G.localGlyph,fontStack:U.fontStack,sectionIndex:V,metrics:G,rect:Z}),d+=G.advance*N+u)}0!==D.length&&(v=Math.max(d-u,v),_?Yh(D,y,B,F,a*C/2):Yh(D,y,B,0,a/2)),d=0;var ne=a*C+B;P.lineOffset=Math.max(B,z),m+=ne,++A}else m+=a,++A}}catch(L){M.e(L)}finally{M.f()}var ae=m,oe=Hh(o),se=oe.horizontalAlign,le=oe.verticalAlign;(function(e,t,i,r,n,a){var o,s=(t-i)*n,l=-a*r,u=f(e);try{for(u.s();!(o=u.n()).done;){var c,h=o.value,p=f(h.positionedGlyphs);try{for(p.s();!(c=p.n()).done;){var d=c.value;d.x+=s,d.y+=l}}catch(L){p.e(L)}finally{p.f()}}}catch(L){u.e(L)}finally{u.f()}})(e.positionedLines,y,se,le,v,ae),e.top+=-le*ae,e.bottom=e.top+ae,e.left+=-se*v,e.right=e.left+v,e.hasBaseline=_}(D,t,i,r,y,o,s,l,h,u,p,v),!function(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(0!==t.value.positionedGlyphs.length)return!1}catch(L){i.e(L)}finally{i.f()}return!0}(P)&&D}var Vh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},jh={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Nh(e,t,i,r,n,a){if(t.imageName){var o=r[t.imageName];return o?o.displaySize[0]*t.scale*$c/a+n:0}var s=i[t.fontStack],l=s&&s.glyphs[e];return l?l.metrics.advance*t.scale+n:0}function Gh(e,t,i,r){var n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function Zh(e,t,i){var r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function qh(e,t,i,r,n,a){var o,s=null,l=Gh(t,i,n,a),u=f(r);try{for(u.s();!(o=u.n()).done;){var c=o.value,h=Gh(t-c.x,i,n,a)+c.badness;h<=l&&(s=c,l=h)}}catch(p){u.e(p)}finally{u.f()}return{index:e,x:t,priorBreak:s,badness:l}}function Wh(e){return e?Wh(e.priorBreak).concat(e.index):[]}function Xh(e,t,i,r,n,a,o){if("point"!==a)return[];if(!e)return[];for(var s,l=[],u=function(e,t,i,r,n,a){for(var o=0,s=0;s<e.length();s++){var l=e.getSection(s);o+=Nh(e.getCharCode(s),l,r,n,t,a)}return o/Math.max(1,Math.ceil(o/i))}(e,t,i,r,n,o),c=e.text.indexOf("\u200b")>=0,h=0,f=0;f<e.length();f++){var p=e.getSection(f),d=e.getCharCode(f);if(Vh[d]||(h+=Nh(d,p,r,n,t,o)),f<e.length()-1){var m=!((s=d)<11904||!(Zn(s)||Gn(s)||ra(s)||ea(s)||Hn(s)||Fn(s)||qn(s)||Vn(s)||Yn(s)||Kn(s)||Xn(s)||oa(s)||jn(s)||Un(s)||On(s)||Wn(s)||Nn(s)||ia(s)||$n(s)||Jn(s)));(jh[d]||m||p.imageName)&&l.push(qh(f+1,h,u,l,Zh(d,e.getCharCode(f+1),m&&c),!1))}}return Wh(qh(e.length(),h,u,l,0,!0))}function Hh(e){var t=.5,i=.5;
1switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function Yh(e,t,i,r,n){if(t||i||r||n)for(var a=e.length-1,o=e[a],s=(o.x+o.metrics.advance*o.scale)*t,l=0;l<=a;l++)e[l].x-=s,e[l].y+=i+r+n}function Kh(e,t,i){var r=Hh(i),n=r.horizontalAlign,a=r.verticalAlign,o=t[0]-e.displaySize[0]*n,s=t[1]-e.displaySize[1]*a;return{image:e,top:s,bottom:s+e.displaySize[1],left:o,right:o+e.displaySize[0]}}function Jh(e,t,i,r,n,a){var o,s=e.image;if(s.content){var l=s.content,u=s.pixelRatio||1;o=[l[0]/u,l[1]/u,s.displaySize[0]-l[2]/u,s.displaySize[1]-l[3]/u]}var c,h,f,p,d=t.left*a,m=t.right*a;"width"===i||"both"===i?(p=n[0]+d-r[3],h=n[0]+m+r[1]):h=(p=n[0]+(d+m-s.displaySize[0])/2)+s.displaySize[0];var v=t.top*a,y=t.bottom*a;return"height"===i||"both"===i?(c=n[1]+v-r[0],f=n[1]+y+r[2]):f=(c=n[1]+(v+y-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:c,right:h,bottom:f,left:p,collisionPadding:o}}var $h=function(e){d(i,e);var t=m(i);function i(e,r,n,a,o){var s;return v(this,i),(s=t.call(this,e,r)).angle=a,s.z=n,void 0!==o&&(s.segment=o),s}return y(i,[{key:"clone",value:function(){return new i(this.x,this.y,this.z,this.angle,this.segment)}}]),i}(_);function Qh(e,t,i,r,n){if(void 0===t.segment)return!0;for(var a=t,o=t.segment+1,s=0;s>-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;s<i/2;){var c=e[o],h=e[o+1];if(!h)return!1;var f=e[o-1].angleTo(c)-c.angleTo(h);for(f=Math.abs((f+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:f}),u+=f;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>n)return!1;o++,s+=c.dist(h)}return!0}function ef(e){for(var t=0,i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function tf(e,t,i){return e?.6*t*i:0}function rf(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function nf(e,t,i,r,n,a){for(var o=tf(i,n,a),s=rf(i,r)*a,l=0,u=ef(e)/2,c=0;c<e.length-1;c++){var h=e[c],f=e[c+1],p=h.dist(f);if(l+p>u){var d=(u-l)/p,m=wi(h.x,f.x,d),v=wi(h.y,f.y,d),y=new $h(m,v,0,f.angleTo(h),c);return!o||Qh(e,y,s,o,t)?y:void 0}l+=p}}function af(e,t,i,r,n,a,o,s,l){var u=tf(r,a,o),c=rf(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<t/4&&(t=h+t/4),of(e,f?t/2*s%t:(c/2+2*a)*o*s%t,t,u,i,h,f,!1,l)}function of(e,t,i,r,n,a,o,s,l){for(var u=a/2,c=ef(e),h=0,f=t-i,p=[],d=0;d<e.length-1;d++){for(var m=e[d],v=e[d+1],y=m.dist(v),_=v.angleTo(m);f+i<h+y;){var g=((f+=i)-h)/y,x=wi(m.x,v.x,g),b=wi(m.y,v.y,g);if(x>=0&&x<l&&b>=0&&b<l&&f-u>=0&&f+u<=c){var w=new $h(x,b,0,_,d);w._round(),r&&!Qh(e,w,a,r,n)||p.push(w)}}h+=y}return s||p.length||o||(p=of(e,h/2,i,r,n,a,o,!0,l)),p}function sf(e,t,i,r,n){for(var a=[],o=0;o<e.length;o++)for(var s=e[o],l=void 0,u=0;u<s.length-1;u++){var c=s[u],h=s[u+1];c.x<t&&h.x<t||(c.x<t?c=new _(t,c.y+(t-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x<t&&(h=new _(t,c.y+(t-c.x)/(h.x-c.x)*(h.y-c.y))._round()),c.y<i&&h.y<i||(c.y<i?c=new _(c.x+(i-c.y)/(h.y-c.y)*(h.x-c.x),i)._round():h.y<i&&(h=new _(c.x+(i-c.y)/(h.y-c.y)*(h.x-c.x),i)._round()),c.x>=r&&h.x>=r||(c.x>=r?c=new _(r,c.y+(r-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x>=r&&(h=new _(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 _(c.x+(n-c.y)/(h.y-c.y)*(h.x-c.x),n)._round():h.y>=n&&(h=new _(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}An($h,"Anchor");var lf=1e20;function uf(e,t,i,r,n,a,o,s,l){for(var u=t;u<t+r;u++)cf(e,i*a+u,a,n,o,s,l);for(var c=i;c<i+n;c++)cf(e,c*a+t,1,r,o,s,l)}function cf(e,t,i,r,n,a,o){a[0]=0,o[0]=-lf,o[1]=lf,n[0]=e[t];for(var s=1,l=0,u=0;s<r;s++){n[s]=e[t+s*i];var c=s*s;do{var h=a[l];u=(n[s]-n[h]+c-h*h)/(s-h)/2}while(u<=o[l]&&--l>-1);a[++l]=s,o[l]=u,o[l+1]=lf}for(var f=0,p=0;f<r;f++){for(;o[p+1]<f;)p++;var d=a[p],m=f-d;e[t+f*i]=n[d]+m*m}}var hf={none:0,ideographs:1,all:2},ff=function(){function e(t,i,r){v(this,e),this.requestManager=t,this.localGlyphMode=i,this.localFontFamily=r,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}return y(e,[{key:"setURL",value:function(e){this.url=e}},{key:"getGlyphs",value:function(t,i){var r=this,n=[];for(var a in t){var o,s=f(t[a]);try{for(s.s();!(o=s.n()).done;){var l=o.value;n.push({stack:a,id:l})}}catch(u){s.e(u)}finally{s.f()}}z(n,(function(t,i){var n=t.stack,a=t.id,o=r.entries[n];o||(o=r.entries[n]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});var s=o.glyphs[a];if(void 0===s){if(s=r._tinySDF(o,n,a))return o.glyphs[a]=s,void i(null,{stack:n,id:a,glyph:s});var l=Math.floor(a/256);if(256*l>65535)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!==hf.none&&(this.localGlyphMode===hf.all?!!this.localFontFamily:!!this.localFontFamily&&
1(Kn(e)||Qn(e)||jn(e)||Nn(e)||Vn(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,p=l.glyphHeight,d=l.glyphLeft,m=l.glyphTop,v=l.glyphAdvance;return this.localGlyphs[a.fontWeight][r]={id:r,bitmap:new ou({width:c,height:h},u),metrics:{width:f/2,height:p/2,left:d/2,top:m/2-27,advance:v/2,localGlyph:!0}}}}}]),e}();function pf(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]],p=function(e,t){return e+t[1]-t[0]},d=h.reduce(p,0),m=f.reduce(p,0),v=s-d,y=l-m,g=0,x=d,b=0,w=m,k=0,T=v,E=0,S=y;if(a.content&&r){var A=a.content;g=df(h,0,A[0]),b=df(f,0,A[1]),x=df(h,A[0],A[2]),w=df(f,A[1],A[3]),k=A[0]-g,E=A[1]-b,T=A[2]-A[0]-x,S=A[3]-A[1]-w}var M=function(r,n,s,l){var h=vf(r.stretch-g,x,u,e.left),f=yf(r.fixed-k,T,r.stretch,d),p=vf(n.stretch-b,w,c,e.top),v=yf(n.fixed-E,S,n.stretch,m),y=vf(s.stretch-g,x,u,e.left),A=yf(s.fixed-k,T,s.stretch,d),M=vf(l.stretch-b,w,c,e.top),I=yf(l.fixed-E,S,l.stretch,m),C=new _(h,p),z=new _(y,p),P=new _(y,M),D=new _(h,M),L=new _(f/o,v/o),B=new _(A/o,I/o),R=t*Math.PI/180;if(R){var F=Math.sin(R),O=Math.cos(R),U=[O,-F,F,O];C._matMult(U),z._matMult(U),D._matMult(U),P._matMult(U)}var V=r.stretch+r.fixed,j=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+j,w:s.stretch+s.fixed-V,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:B,minFontScaleX:T/o/u,minFontScaleY:S/o/c,isSDF:i}};if(r&&(a.stretchX||a.stretchY))for(var I=mf(h,v,d),C=mf(f,y,m),z=0;z<I.length-1;z++)for(var P=I[z],D=I[z+1],L=0;L<C.length-1;L++)n.push(M(P,C[L],D,C[L+1]));else n.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return n}function df(e,t,i){var r,n=0,a=f(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;n+=Math.max(t,Math.min(i,o[1]))-Math.max(t,Math.min(i,o[0]))}}catch(s){a.e(s)}finally{a.f()}return n}function mf(e,t,i){var r,n=[{fixed:-1,stretch:0}],a=f(e);try{for(a.s();!(r=a.n()).done;){var o=h(r.value,2),s=o[0],l=o[1],u=n[n.length-1];n.push({fixed:s-u.stretch,stretch:u.stretch}),n.push({fixed:s-u.stretch,stretch:u.stretch+(l-s)})}}catch(c){a.e(c)}finally{a.f()}return n.push({fixed:t+1,stretch:i}),n}function vf(e,t,i,r){return e/t*i+r}function yf(e,t,i,r){return e-t*i/r}function _f(e,t,i,r){var n=t+e.positionedLines[r].lineOffset;return 0===r?i+n/2:i+(n+(t+e.positionedLines[r-1].lineOffset))/2}ff.loadGlyphRange=function(e,t,i,r,n){var a=256*t,o=a+255,s=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}","".concat(a,"-").concat(o)),Ne.Glyphs);We(s,(function(e,t){if(e)n(e);else if(t){var i,r={},a=function(e){return new ch(e).readFields(Ch,{})}(t),o=f(a.glyphs);try{for(o.s();!(i=o.n()).done;){var s=i.value;r[s.id]=s}}catch(l){o.e(l)}finally{o.f()}n(null,{glyphs:r,ascender:a.ascender,descender:a.descender})}}))},ff.TinySDF=function(){function e(){var t=arguments.length>0&&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,d=t.fontStyle,m=void 0===d?"normal":d;v(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 y(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.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),p=new Uint8ClampedArray(f),d={data:p,width:c,height:h,glyphWidth:l,glyphHeight:u,glyphTop:s,glyphLeft:0,glyphAdvance:i};if(0===l||0===u)return d;var m=this.ctx,v=this.buffer,y=this.gridInner,_=this.gridOuter;m.clearRect(v,v,l,u),m.fillText(e,v,v+s);var g=m.getImageData(v,v,l,u);_.fill(lf,0,f),y.fill(0,0,f);for(var x=0;x<u;x++)for(var b=0;b<l;b++){var w=g.data[4*(x*l+b)+3]/255;if(0!==w){var k=(x+v)*c+b+v;if(1===w)_[k]=0,y[k]=lf;else{var T=.5-w;_[k]=T>0?T*T:0,y[k]=T<0?T*T:0}}}uf(_,0,0,c,h,c,this.f,this.v,this.z),uf(y,v,v,l,u,c,this.f,this.v,this.z);for(var E=0;E<f;E++){var S=Math.sqrt(_[E])-Math.sqrt(y[E]);p[E]=Math.round(255-255*(S/this.radius+this.cutoff))}return d}}]),e}();var gf=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xf;if(v(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 y(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<r;){var a=1+(e<<1),o=t[a],s=a+1;if(s<this.length&&i(t[s],o)<0&&(a=s,o=t[s]),i(o,n)>=0)break;t[e]=o,e=a}t[e]=n}}]),e}();function xf(e,t){return e<t?-1:e>t?1:0}function bf(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;l<s.length;l++){var u=s[l];(!l||u.x<r)&&(r=u.x),(!l||u.y<n)&&(n=u.y),(!l||u.x>a)&&(a=u.x),(!l||u.y>o)&&(o=u.y)}var c=Math.min(a-r,o-n),h=c/2,f=new gf([],wf);if(0===c)return new _(r,n);for(var p=r;p<a;p+=c)for(var d=n;d<o;d+=c)f.push(new kf(p+h,d+h,h,e));for(var m=function(e){for(var t=0,i=0,r=0,n=e[0],a=0,o=n.length,s=o-1;a<o;s=a++){var l=n[a],u=n[s],c=l.x*u.y-u.x*l.y;i+=(l.x+u.x)*c,r+=(l.y+u.y)*c,t+=3*c}return new kf(i/t,r/t,0,e)}(e),v=f.length;f.length;){var y=f.pop();(y.d>m.d||!m.d)&&(m=y,i&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,v)),y.max-m.d<=t||(h=y.h/2,f.push(new kf(y.p.x-h,y.p.y-h,h,e)),f.push(new kf(y.p.x+h,y.p.y-h,h,e)),f.push(new kf(y.p.x-h,y.p.y+h,h,e)),f.push(new kf(y.p.x+h,y.p.y+h,h,e)),v+=4)}return i&&(console.log("num probes: ".concat(v)),console.log("best distance: ".concat(m.d))),m.p}function wf(e,t){return t.max-e.max}function kf(e,t,i,r){this.p=new _(e,t),this.h=i,this.d=function(e,t){for(var i=!1,r=1/0,n=0;n<t.length;n++)for(var a=t[n],o=0,s=a.length,l=s-1;o<s;l=o++){var u=a[o],c=a[l];u.y>e.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,Js(e,u,c)
1)}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var Tf=Number.POSITIVE_INFINITY,Ef=Math.sqrt(2);function Sf(e,t){return t[1]!==Tf?function(e,t,i){var r=0,n=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,n]}(e,t[0],t[1]):function(e,t){var i=0,r=0;t<0&&(t=0);var n=t/Ef;switch(e){case"top-right":case"top-left":r=n-7;break;case"bottom-right":case"bottom-left":r=7-n;break;case"bottom":r=7-t;break;case"top":r=t-7}switch(e){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=t;break;case"right":i=-t}return[i,r]}(e,t[0])}function Af(e,t,i,r,n,a,o,s,l,u){e.createArrays(),e.tilePixelRatio=ys/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;var c=e.layers[0].layout,h=e.layers[0]._unevaluatedLayout._values,p={};if("composite"===e.textSizeData.kind){var d=e.textSizeData,m=d.minZoom,v=d.maxZoom;p.compositeTextSizes=[h["text-size"].possiblyEvaluate(new Aa(m),s),h["text-size"].possiblyEvaluate(new Aa(v),s)]}if("composite"===e.iconSizeData.kind){var y=e.iconSizeData,_=y.minZoom,g=y.maxZoom;p.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new Aa(_),s),h["icon-size"].possiblyEvaluate(new Aa(g),s)]}p.layoutTextSize=h["text-size"].possiblyEvaluate(new Aa(l+1),s),p.layoutIconSize=h["icon-size"].possiblyEvaluate(new Aa(l+1),s),p.textMaxSize=h["text-size"].possiblyEvaluate(new Aa(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=x.value,l=c.get("text-font").evaluate(a,{},s).join(","),h=w.evaluate(a,{},s),f=p.layoutTextSize.evaluate(a,{},s),d=(p.layoutIconSize.evaluate(a,{},s),{horizontal:{},vertical:void 0}),m=a.text,v=void 0,y=[0,0];if(m){var _=m.toString(),g=c.get("text-letter-spacing").evaluate(a,{},s)*$c,k=c.get("text-line-height").evaluate(a,{},s)*$c,T=la(_)?g:0,E=c.get("text-anchor").evaluate(a,{},s),S=c.get("text-variable-anchor");if(!S){var A=c.get("text-radial-offset").evaluate(a,{},s);y=A?Sf(E,[A*$c,Tf]):c.get("text-offset").evaluate(a,{},s).map((function(e){return e*$c}))}var M=b?"center":c.get("text-justify").evaluate(a,{},s),I=c.get("symbol-placement"),C="point"===I,z="point"===I?c.get("text-max-width").evaluate(a,{},s)*$c:0,P=function(r){e.allowVerticalPlacement&&sa(_)&&(d.vertical=Uh(m,t,i,n,l,z,k,E,r,T,y,Rh.vertical,!0,I,f,h))};if(!b&&S){for(var D="auto"===M?S.map((function(e){return Mf(e)})):[M],L=!1,B=0;B<D.length;B++){var R=D[B];if(!d.horizontal[R])if(L)d.horizontal[R]=d.horizontal[0];else{var F=Uh(m,t,i,n,l,z,k,"center",R,T,y,Rh.horizontal,!1,I,f,h);F&&(d.horizontal[R]=F,L=1===F.positionedLines.length)}}P("left")}else{if("auto"===M&&(M=Mf(E)),C||c.get("text-writing-mode").indexOf("horizontal")>=0||!sa(_)){var O=Uh(m,t,i,n,l,z,k,E,M,T,y,Rh.horizontal,!1,I,f,h);O&&(d.horizontal[M]=O)}P("point"===I?"left":M)}}var U=!1;if(a.icon&&a.icon.name){var V=r[a.icon.name];V&&(v=Kh(n[a.icon.name],c.get("icon-offset").evaluate(a,{},s),c.get("icon-anchor").evaluate(a,{},s)),U=V.sdf,void 0===e.sdfIcons?e.sdfIcons=V.sdf:e.sdfIcons!==V.sdf&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(V.pixelRatio!==e.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}var j=Pf(d.horizontal)||d.vertical;e.iconsInText||(e.iconsInText=!!j&&j.iconsInText),(j||v)&&If(e,a,d,v,r,p,f,0,y,U,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 Mf(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 If(e,t,i,r,n,a,o,s,l,u,c,p,d){var m=a.textMaxSize.evaluate(t,{},p);void 0===m&&(m=o);var v,y,_=e.layers[0].layout,g=_.get("icon-offset").evaluate(t,{},p),x=Pf(i.horizontal)||i.vertical,b="globe"===d.name,k=o/24,T=e.tilePixelRatio*m/24,E=(v=e.overscaling,e.zoom>18&&v>2&&(v>>=1),Math.max(ys/(512*v),1)*_.get("symbol-spacing")),S=_.get("text-padding")*e.tilePixelRatio,A=_.get("icon-padding")*e.tilePixelRatio,M=w(_.get("text-max-angle")),I="map"===_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),C="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),z=_.get("symbol-placement"),P=E/2,D=_.get("icon-text-fit");r&&"none"!==D&&(e.allowVerticalPlacement&&i.vertical&&(y=Jh(r,i.vertical,D,_.get("icon-text-fit-padding"),g,k)),x&&(r=Jh(r,x,D,_.get("icon-text-fit-padding"),g,k)));var L=function(o,s,f){if(!(s.x<0||s.x>=ys||s.y<0||s.y>=ys)){var m=null;
1if(b){var v=d.projectTilePoint(s.x,s.y,f),_=v.x,x=v.y,w=v.z;m={anchor:new $h(_,x,w,0,void 0),up:d.upVector(f,s.x,s.y)}}!function(e,t,i,r,n,a,o,s,l,u,c,f,p,d,m,v,y,_,g,x,b,w,k,T,E){var S,A,M,I,C,z,P,D,L,B=e.addToLineVertexArray(t,r),R=0,F=0,O=0,U=0,V=-1,j=-1,N={},G=Vo(""),Z=i?i.anchor:t,W=0,X=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?(S=l.layout.get("text-offset").evaluate(b,{},E).map((function(e){return e*$c})),W=(A=h(S,2))[0],X=A[1]):(W=l.layout.get("text-radial-offset").evaluate(b,{},E)*$c,X=Tf),e.allowVerticalPlacement&&n.vertical){var H=n.vertical;if(m)D=Lf(H),s&&(L=Lf(s));else{var Y=l.layout.get("text-rotate").evaluate(b,{},E)+90;C=Df(u,Z,t,c,f,p,H,d,Y,v),s&&(z=Df(u,Z,t,c,f,p,s,_,Y))}}if(a){var K=l.layout.get("icon-rotate").evaluate(b,{},E),J="none"!==l.layout.get("icon-text-fit"),$=pf(a,K,k,J),Q=s?pf(s,K,k,J):void 0;I=Df(u,Z,t,c,f,p,a,_,K),R=4*$.length;var ee=e.iconSizeData,te=null;"source"===ee.kind?(te=[Qc*l.layout.get("icon-size").evaluate(b,{},E)])[0]>Cf&&q("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===ee.kind&&((te=[Qc*w.compositeIconSizes[0].evaluate(b,{},E),Qc*w.compositeIconSizes[1].evaluate(b,{},E)])[0]>Cf||te[1]>Cf)&&q("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".')),e.addSymbols(e.icon,$,te,x,g,b,!1,i,t,B.lineStartIndex,B.lineLength,-1,T,E),V=e.icon.placedSymbolArray.length-1,Q&&(F=4*Q.length,e.addSymbols(e.icon,Q,te,x,g,b,Rh.vertical,i,t,B.lineStartIndex,B.lineLength,-1,T,E),j=e.icon.placedSymbolArray.length-1)}for(var ie in n.horizontal){var re=n.horizontal[ie];M||(G=Vo(re.text),m?P=Lf(re):M=Df(u,Z,t,c,f,p,re,d,l.layout.get("text-rotate").evaluate(b,{},E),v));var ne=1===re.positionedLines.length;if(O+=zf(e,i,t,re,o,l,m,b,v,B,n.vertical?Rh.horizontal:Rh.horizontalOnly,ne?Object.keys(n.horizontal):[ie],N,V,w,T,E),ne)break}n.vertical&&(U+=zf(e,i,t,n.vertical,o,l,m,b,v,B,Rh.vertical,["vertical"],N,j,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>=Zp.MAX_GLYPHS&&q("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,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,V,j,G,void 0!==M?M:e.collisionBoxArray.length,void 0!==M?M+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,O,U,R,F,se,0,W,X,ae)}(e,s,m,o,i,r,n,y,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,S,I,l,0,A,C,g,t,a,u,c,p)}};if("line"===z){var B,R=f(sf(t.geometry,0,0,ys,ys));try{for(R.s();!(B=R.n()).done;){var F,O=B.value,U=af(O,E,M,i.vertical||x,r,24,T,e.overscaling,ys),V=f(U);try{for(V.s();!(F=V.n()).done;){var j=F.value;x&&Bf(e,x.text,P,j)||L(O,j,p)}}catch(oe){V.e(oe)}finally{V.f()}}}catch(oe){R.e(oe)}finally{R.f()}}else if("line-center"===z){var N,G=f(t.geometry);try{for(G.s();!(N=G.n()).done;){var Z=N.value;if(Z.length>1){var W=nf(Z,M,i.vertical||x,r,24,T);W&&L(Z,W,p)}}}catch(oe){G.e(oe)}finally{G.f()}}else if("Polygon"===t.type){var X,H=f(Zu(t.geometry,0));try{for(H.s();!(X=H.n()).done;){var Y=X.value,K=bf(Y,16);L(Y[0],new $h(K.x,K.y,0,0,void 0),p)}}catch(oe){H.e(oe)}finally{H.f()}}else if("LineString"===t.type){var J,$=f(t.geometry);try{for($.s();!(J=$.n()).done;){var Q=J.value;L(Q,new $h(Q[0].x,Q[0].y,0,0,void 0),p)}}catch(oe){$.e(oe)}finally{$.f()}}else if("Point"===t.type){var ee,te=f(t.geometry);try{for(te.s();!(ee=te.n()).done;){var ie,re=ee.value,ne=f(re);try{for(ne.s();!(ie=ne.n()).done;){var ae=ie.value;L([ae],new $h(ae.x,ae.y,0,0,void 0),p)}}catch(oe){ne.e(oe)}finally{ne.f()}}}catch(oe){te.e(oe)}finally{te.f()}}}var Cf=32640;function zf(e,t,i,r,n,o,s,l,u,h,p,d,m,v,y,g,x){var b=function(e,t,i,r,n,o,s,l){var u=[];
1if(0===t.positionedLines.length)return u;var h,p=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,d=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),m=Math.abs(t.top-t.bottom),v=f(t.positionedLines);try{for(v.s();!(h=v.n()).done;)m-=h.value.lineOffset}catch(oe){v.e(oe)}finally{v.f()}for(var y=t.positionedLines.length,g=m/y,x=t.top-i[1],b=0;b<y;++b){var w=t.positionedLines[b];x=_f(t,g,x,b);var k,T=f(w.positionedGlyphs);try{for(T.s();!(k=T.n()).done;){var E=k.value;if(E.rect){var S=E.rect||{},A=4,M=!0,I=1,C=0;if(E.imageName){var z=s[E.imageName];if(!z)continue;if(z.sdf){q("SDF images are not supported in formatted text and will be ignored.");continue}M=!1,A=1/(I=z.pixelRatio)}var P=(n||l)&&E.vertical,D=E.metrics.advance*E.scale/2,L=E.metrics,B=E.rect;if(null!==B){l&&t.verticalizable&&(C=E.imageName?D-E.metrics.width*E.scale/2:0);var R=n?[E.x+D,E.y]:[0,0],F=[0,0],O=[0,0],U=!1;n||(P?(O=[E.x+D+d[0],E.y+d[1]-C],U=!0):F=[E.x+D+i[0],E.y+i[1]-C]);var V=B.w*E.scale/(I*(E.localGlyph?2:1)),j=B.h*E.scale/(I*(E.localGlyph?2:1)),N=void 0,G=void 0,Z=void 0,W=void 0;if(P){var X=E.y-x,H=new _(-D,D-X),Y=-Math.PI/2,K=a(_,c(O));(N=new _(-D+F[0],F[1]))._rotateAround(Y,H)._add(K),N.x+=-X+D,N.y-=(L.left-A)*E.scale;var J=E.imageName?L.advance*E.scale:$c*E.scale,$=String.fromCharCode(E.glyph);oh($)?N.x+=(1-A)*E.scale:sh($)?N.x+=J-L.height*E.scale+(-A-1)*E.scale:N.x+=E.imageName||L.width+2*A===B.w&&L.height+2*A===B.h?(J-j)/2:(J-(L.height+2*A)*E.scale)/2,G=new _(N.x,N.y-V),Z=new _(N.x+j,N.y),W=new _(N.x+j,N.y-V)}else{var Q=(L.left-A)*E.scale-D+F[0],ee=(-L.top-A)*E.scale+F[1],te=Q+V,ie=ee+j;N=new _(Q,ee),G=new _(te,ee),Z=new _(Q,ie),W=new _(te,ie)}if(p){var re=void 0;re=n?new _(0,0):U?new _(d[0],d[1]):new _(i[0],i[1]),N._rotateAround(p,re),G._rotateAround(p,re),Z._rotateAround(p,re),W._rotateAround(p,re)}var ne=new _(0,0),ae=new _(0,0);u.push({tl:N,tr:G,bl:Z,br:W,tex:S,writingMode:t.writingMode,glyphOffset:R,sectionIndex:E.sectionIndex,isSDF:M,pixelOffsetTL:ne,pixelOffsetBR:ae,minFontScaleX:0,minFontScaleY:0})}}}}catch(oe){T.e(oe)}finally{T.f()}}return u}(0,r,u,o,s,l,n,e.allowVerticalPlacement),w=e.textSizeData,k=null;"source"===w.kind?(k=[Qc*o.layout.get("text-size").evaluate(l,{},x)])[0]>Cf&&q("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===w.kind&&((k=[Qc*y.compositeTextSizes[0].evaluate(l,{},x),Qc*y.compositeTextSizes[1].evaluate(l,{},x)])[0]>Cf||k[1]>Cf)&&q("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".')),e.addSymbols(e.text,b,k,u,s,l,p,t,i,h.lineStartIndex,h.lineLength,v,g,x);var T,E=f(d);try{for(E.s();!(T=E.n()).done;)m[T.value]=e.text.placedSymbolArray.length-1}catch(S){E.e(S)}finally{E.f()}return 4*b.length}function Pf(e){for(var t in e)return e[t];return null}function Df(e,t,i,r,n,a,o,s,l,u){var c=o.top,h=o.bottom,f=o.left,p=o.right,d=o.collisionPadding;if(d&&(f-=d[0],c-=d[1],p+=d[2],h+=d[3]),l){var m=new _(f,c),v=new _(p,c),y=new _(f,h),g=new _(p,h),x=w(l),b=new _(0,0);u&&(b=new _(u[0],u[1])),m._rotateAround(x,b),v._rotateAround(x,b),y._rotateAround(x,b),g._rotateAround(x,b),f=Math.min(m.x,v.x,y.x,g.x),p=Math.max(m.x,v.x,y.x,g.x),c=Math.min(m.y,v.y,y.y,g.y),h=Math.max(m.y,v.y,y.y,g.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,f,c,p,h,s,r,n,a),e.length-1}function Lf(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 Bf(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])<i)return!0}else n[t]=[];return n[t].push(r),!1}var Rf=Wa([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]).members,Ff=Wa([{name:"a_pos_3",components:3,type:"Int16"}]),Of=Wa([{name:"a_pos",type:"Int16",components:2}]),Uf=ys/Math.PI/2,Vf=2*Es(1,0)*Uf*Math.PI,jf=[64,32,16],Nf=-Uf,Gf=Uf,Zf=[new Kl([Nf,Nf,Nf],[Gf,Gf,Gf]),new Kl([Nf,Nf,Nf],[0,0,Gf]),new Kl([0,Nf,Nf],[Gf,0,Gf]),new Kl([Nf,0,Nf],[0,Gf,Gf]),new Kl([0,0,Nf],[Gf,Gf,Gf])];function qf(e,t,i){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=Cl([],e._camera.position,e.worldSize),a=[t,i,1,1];Nl(a,a,e.pixelMatrixInverse),jl(a,a,1/a[3]);var o=Pl([],Ol([],a,n)),s=e.globeMatrix,l=[s[12],s[13],s[14]],u=Ol([],l,n),c=kl(u),h=Pl([],u),f=e.worldSize/(2*Math.PI),p=Dl(h,o),d=Math.asin(f/c);if(d<Math.acos(p)){if(!r)return null;var m=[],v=[];Cl(m,o,c/p),Pl(v,Ol(v,m,u)),Pl(o,El(o,u,Cl(o,v,Math.tan(d)*c)))}var y=[];new Xl(n,o).closestPointOnSphere(l,f,y);var _=Pl([],Q(s,0)),g=Pl([],Q(s,1)),x=Pl([],Q(s,2)),b=Dl(_,y),w=Dl(g,y),T=Dl(x,y),E=k(Math.asin(-w/f)),S=k(Math.atan2(b,T)),A=ks(S=e.center.lng+function(e,t){var i=(t-e+180)%360-180;return i<-180?i+360:i}(e.center.lng,S)),I=M(Ts(E),0,1);return new zs(A,I)}var Wf=function e(t,i,r){v(this,e),this.a=Ol([],t,r),this.b=Ol([],i,r),this.center=r;var n=Pl([],this.a),a=Pl([],this.b);this.angle=Math.acos(Dl(n,a))};function Xf(e,t){return 0===e.angle||(i=0===e.a[t]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[t]/e.a[t]/Math.sin(e.angle)-1/Math.tan(e.angle)))<0||i>1?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,M(i,0,1))+e.center[t];var i}function Hf(e){if(e.z<=1)return Zf[e.z+2*e.y+e.x];var t=Qf($f(e));return Kl.fromPoints(t)}function Yf(e,t){var i=lp(t.zoom);if(0===i)return Hf(e);var r=$f(e),n=Qf(r),a=ks(r.getWest())*t.worldSize,o=ks(r.getEast())*t.worldSize,s=Ts(r.getNorth())*t.worldSize,l=Ts(r.getSouth())*t.worldSize,u=[a,s,0],c=[o,s,0],h=[a,l,0],f=[o,l,0],p=fl([],t.globeMatrix);return Bl(u,u,p),Bl(c,c,p),Bl(h,h,p),Bl(f,f,p),n[0]=ki(n[0],h,i),n[1]=ki(n[1],f,i),n[2]=ki(n[2],c,i),n[3]=ki(n[3],u,i),Kl.fromPoints(n)}function Kf(e,t,i,r,n){var a,o=f(i);try{for(o.s();!(a=o.n()).done;){var s=a.value;Bl(s,s,r),Cl(s,s,n),Ml(e,e,s),Il(t,t,s)}}catch(l){o.e(l)}finally{o.f()}}function Jf(e,t,i){var r=t/e.worldSize,n=Number.MAX_VALUE,a=[-n,-n,-n],o=[n,n,n],s=e.globeMatrix;if(i.z<=1)return Kf(o,a,Hf(i).getCorners(),s,r),new Kl(o,a);var l=$f(i),u=Qf(l);
1if(Kf(o,a,u,s,r),l.contains(e.center)){a[2]=0;var c=e.point,h=[c.x*r,c.y*r,0];return Ml(o,o,h),Il(a,a,h),new Kl(o,a)}var f=[s[12]*r,s[13]*r,s[14]*r],p=l.getCenter(),d=M(e.center.lat,-85.051129,Is),m=M(p.lat,-85.051129,Is),v=ks(e.center.lng),y=Ts(d),_=v-ks(p.lng),g=y-Ts(m);_>.5?_-=1:_<-.5&&(_+=1);var x=0;Math.abs(_)>Math.abs(g)?x=_>=0?1:3:(x=g>=0?0:2,zl(f,f,[s[4]*r,s[5]*r,s[6]*r],-Math.sin(w(g>=0?l.getSouth():l.getNorth()))*Uf));var b=u[x],k=u[(x+1)%4],T=new Wf(b,k,f),E=[Xf(T,0)||b[0],Xf(T,1)||b[1],Xf(T,2)||b[2]];return o[2]=Math.min(b[2],k[2]),Ml(o,o,E),Il(a,a,E),new Kl(o,a)}function $f(e){var t=e.x,i=e.y,r=1/(1<<e.z),n=new xs(Ss(t*r),As((i+1)*r)),a=new xs(Ss((t+1)*r),As(i*r));return new _s(n,a)}function Qf(e){var t=w(e.getNorth()),i=w(e.getSouth()),r=Math.cos(t),n=Math.cos(i),a=Math.sin(t),o=Math.sin(i),s=e.getWest(),l=e.getEast();return[ep(n,o,s),ep(n,o,l),ep(r,a,l),ep(r,a,s)]}function ep(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Uf;return i=w(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function tp(e,t,i){return ep(Math.cos(w(e)),Math.sin(w(e)),t,i)}function ip(e,t,i,r){var n=1<<i.z,a=(e/ys+i.x)/n;return tp(As((t/ys+i.y)/n),Ss(a),r)}function rp(e){var t=e.min,i=e.max;return 16383/Math.max(i[0]-t[0],i[1]-t[1],i[2]-t[2])}var np=new Float64Array(16);function ap(e){var t,i,r=rp(e),n=_l(np,[r,r,r]);return dl(n,n,((t=[])[0]=-(i=e.min)[0],t[1]=-i[1],t[2]=-i[2],t))}function op(e){var t,i,r=(i=e.min,(t=np)[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t),n=1/rp(e);return ml(r,r,[n,n,n])}function sp(e,t,i,r,n){var a=function(e){var t=ys/(2*Math.PI);return e/(2*Math.PI)/t}(i),o=[e,t,-i/(2*Math.PI)],s=hl(new Float64Array(16));return dl(s,s,o),ml(s,s,[a,a,a]),vl(s,s,w(-n)),yl(s,s,w(-r)),s}function lp(e){return I(5,6,e)}function up(e,t){var i,r,n,a,o,s,l,u,c,h,f=tp(t.lat,t.lng);return n=(i=Sl([],function(e){var t=tp(e._center.lat,e._center.lng),i=Ll([],Tl(0,1,0),t),r=gl([],-e.angle,t);i=Bl(i,i,r),gl(r,-e._pitch,i);var n=Pl([],t);return Cl(n,n,e.cameraToCenterDistance/e.pixelsPerMeter*Vf),Bl(n,n,r),El([],t,n)}(e),f))[0],a=i[1],o=i[2],s=(r=f)[0],l=r[1],u=r[2],h=(c=Math.sqrt(n*n+a*a+o*o)*Math.sqrt(s*s+l*l+u*u))&&Dl(i,r)/c,Math.acos(Math.min(Math.max(h,-1),1))}var cp=w(85),hp=Math.cos(cp),fp=Math.sin(cp);function pp(e,t){var i=e.fovAboveCenter,r=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=(e._camera.position[2]*e.worldSize-r)/Math.cos(e._pitch),a=Math.sin(i)*n/Math.sin(Math.max(Math.PI/2-e._pitch-i,.01)),o=Math.sin(e._pitch)*a+n;return Math.min(1.01*o,n*(1/e._horizonShift))}function dp(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};var i=Math.pow(2,-e.z),r=e.x*i,n=(e.x+1)*i,a=e.y*i,o=(e.y+1)*i,s=Ss(r),l=Ss(n),u=As(a),c=As(o),h=t.project(s,u),f=t.project(l,u),p=t.project(l,c),d=t.project(s,c),m=Math.min(h.x,f.x,p.x,d.x),v=Math.min(h.y,f.y,p.y,d.y),y=Math.max(h.x,f.x,p.x,d.x),_=Math.max(h.y,f.y,p.y,d.y),g=i/16;function x(e,i,r,n,a,o){var s=(r+a)/2,l=(n+o)/2,u=t.project(Ss(s),As(l)),c=Math.max(0,m-u.x,v-u.y,u.x-y,u.y-_);m=Math.min(m,u.x),y=Math.max(y,u.x),v=Math.min(v,u.y),_=Math.max(_,u.y),c>g&&(x(e,u,r,n,s,l),x(u,i,s,l,a,o))}x(h,f,r,a,n,a),x(f,p,n,a,n,o),x(p,d,n,o,r,o),x(d,h,r,o,r,a),m-=g,v-=g,y+=g,_+=g;var b=1/Math.max(y-m,_-v);return{scale:b,x:m*b,y:v*b,x2:y*b,y2:_*b,projection:t}}var mp=hl(new Float32Array(16)),vp=function(){function e(t){v(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 y(e,[{key:"project",value:function(e,t){return{x:0,y:0,z:0}}},{key:"unproject",value:function(e,t){return new xs(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 Es(1,e)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){return 1}},{key:"farthestPixelDistance",value:function(e){return pp(e,e.pixelsPerMeter)}},{key:"pointCoordinate",value:function(e,t,i,r){var n=e.horizonLineFromTop(!1),a=new _(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(a,r))}},{key:"pointCoordinate3D",value:function(e,t,i){var r=new _(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.y<i}},{key:"createInversionMatrix",value:function(e,t){return mp}},{key:"createTileMatrix",value:function(e,t,i){var r,n,a,o=i.canonical,s=hl(ne
1w Float64Array(16));if(this.isReprojectedInTileSpace){var l=dp(o,this);r=1,n=l.x+i.wrap*l.scale,a=l.y,ml(s,s,[r/l.scale,r/l.scale,e.pixelsPerMeter/t])}else r=t/e.zoomScale(o.z),n=(o.x+Math.pow(2,o.z)*i.wrap)*r,a=o.y*r;return dl(s,s,[n,a,0]),ml(s,s,[r/ys,r/ys,1]),s}},{key:"upVector",value:function(e,t,i){return[0,0,1]}},{key:"upVectorScale",value:function(e,t,i){return{metersToTile:1}}}]),e}(),yp=function(e){d(i,e);var t=m(i);function i(e){var r;v(this,i),(r=t.call(this,e)).range=[4,7],r.center=e.center||[-96,37.5];var n=r.parallels=e.parallels||[29.5,45.5],a=h(n,2),o=a[0],s=a[1],l=Math.sin(w(o));return r.n=(l+Math.sin(w(s)))/2,r.c=1+l*(2*r.n-l),r.r0=Math.sqrt(r.c)/r.n,r}return y(i,[{key:"project",value:function(e,t){var i=this.n,r=this.c,n=this.r0,a=w(e-this.center[0]),o=w(t),s=Math.sqrt(r-2*i*Math.sin(o))/i;return{x:s*Math.sin(a*i),y:s*Math.cos(a*i)-n,z:0}}},{key:"unproject",value:function(e,t){var i=this.n,r=this.c,n=this.r0+t,a=Math.atan2(e,Math.abs(n))*Math.sign(n);n*i<0&&(a-=Math.PI*Math.sign(e)*Math.sign(n));var o=w(this.center[0])*i,s=k((a=C(a,-Math.PI-o,Math.PI-o))/i)+this.center[0],l=Math.asin(M((r-(e*e+n*n)*i*i)/(2*i),-1,1)),u=M(k(l),-85.051129,Is);return new xs(s,u)}}]),i}(vp),_p=1.340264,gp=-.081106,xp=893e-6,bp=.003796,wp=Math.sqrt(3)/2,kp=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"project",value:function(e,t){t=t/180*Math.PI,e=e/180*Math.PI;var i=Math.asin(wp*Math.sin(t)),r=i*i,n=r*r*r;return{x:.5*(e*Math.cos(i)/(wp*(_p+3*gp*r+n*(7*xp+9*bp*r)))/Math.PI+.5),y:1-.5*(i*(_p+gp*r+n*(xp+bp*r))/Math.PI+1),z:0}}},{key:"unproject",value:function(e,t){e=(2*e-.5)*Math.PI;for(var i,r=t=(2*(1-t)-1)*Math.PI,n=r*r,a=n*n*n,o=0;o<12&&(a=(n=(r=M(r-(i=(r*(_p+gp*n+a*(xp+bp*n))-t)/(_p+3*gp*n+a*(7*xp+9*bp*n))),-Math.PI/3,Math.PI/3))*r)*n*n,!(Math.abs(i)<1e-12));++o);var s=wp*e*(_p+3*gp*n+a*(7*xp+9*bp*n))/Math.cos(r),l=Math.asin(Math.sin(r)/wp),u=M(180*s/Math.PI,-180,180),c=M(180*l/Math.PI,-85.051129,Is);return new xs(u,c)}}]),i}(vp),Tp=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).wrap=!0,r.supportsWorldCopies=!0,r}return y(i,[{key:"project",value:function(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}},{key:"unproject",value:function(e,t){var i=360*(e-.5),r=M(360*(.5-t),-85.051129,Is);return new xs(i,r)}}]),i}(vp),Ep=Math.PI/2;function Sp(e){return Math.tan((Ep+e)/2)}var Ap=function(e){d(i,e);var t=m(i);function i(e){var r;v(this,i),(r=t.call(this,e)).center=e.center||[0,30];var n=r.parallels=e.parallels||[30,30],a=h(n,2),o=a[0],s=a[1],l=w(o),u=w(s),c=Math.cos(l);return r.n=l===u?Math.sin(l):Math.log(c/Math.cos(u))/Math.log(Sp(u)/Sp(l)),r.f=c*Math.pow(Sp(l),r.n)/r.n,r}return y(i,[{key:"project",value:function(e,t){t=w(t),e=w(e-this.center[0]);var i=1e-6,r=this.n,n=this.f;n>0?t<-Ep+i&&(t=-Ep+i):t>Ep-i&&(t=Ep-i);var a=n/Math.pow(Sp(t),r),o=a*Math.sin(r*e),s=n-a*Math.cos(r*e);return{x:.5*(o/Math.PI+.5),y:1-.5*(s/Math.PI+.5),z:0}}},{key:"unproject",value:function(e,t){e=(2*e-.5)*Math.PI,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=M(k(s/i)+this.center[0],-180,180),u=M(k(2*Math.atan(Math.pow(r/o,1/i))-Ep),-85.051129,Is);return new xs(l,u)}}]),i}(vp),Mp=function(e){d(i,e);var t=m(i);function i(e){var r;return v(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 y(i,[{key:"project",value:function(e,t){return{x:ks(e),y:Ts(t),z:0}}},{key:"unproject",value:function(e,t){var i=Ss(e),r=As(t);return new xs(i,r)}}]),i}(vp),Ip=w(Is),Cp=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"project",value:function(e,t){var i=(t=w(t))*t,r=i*i;return{x:.5*((e=w(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=M(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)))),-Ip,Ip)}while(Math.abs(n)>1e-6&&--r>0);var s=M(k(e/(.8707+(a=i*i)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))),-180,180),l=k(i);return new xs(s,l)}}]),i}(vp),zp=w(Is),Pp=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"project",value:function(e,t){t=w(t),e=w(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,p=Math.cos(i/2),d=Math.sin(i/2),m=2*p*d,v=d*d,y=1-f*p*p,_=y?1/y:0,g=y?Math.acos(l*p)*Math.sqrt(1/y):0,x=.5*(2*g*l*d+2*i/Math.PI)-e,b=.5*(g*u+r)-t,w=.5*_*(f*v+g*l*p*h)+1/Math.PI,T=_*(m*c/4-g*u*d),E=.125*_*(c*d-g*u*f*m),S=.5*_*(h*p+g*v*l)+.5,A=T*E-S*w;s=(x*E-b*w)/A,i=M(i-(o=(b*T-x*S)/A),-Math.PI,Math.PI),r=M(r-s,-zp,zp)}while((Math.abs(o)>a||Math.abs(s)>a)&&--n>0);return new xs(k(i),k(r))}}]),i}(vp),Dp=function(e){d(i,e);var t=m(i);function i(e){var r;return v(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(w(r.parallels[0]))),r.scale=1/(2*Math.max(Math.PI*r.cosPhi,1/r.cosPhi)),r.wrap=!0,r.supportsWorldCopies=!0,r}return y(i,[{key:"project",value:function(e,t){var i=this.scale,r=this.cosPhi;return{x:w(e)*r*i+.5,y:-Math.sin(w(t))/r*i+.5,z:0}}},{key:"unproject",value:function(e,t){var i=this.scale,r=this.cosPhi,n=-(t-.5)/i,a=M(k((e-.5)/i)/r,-180,180),o=Math.asin(M(n*r,-1,1)),s=M(k(o),-85.051129,Is);return new xs(a,s)}}]),i}(vp),Lp=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).requiresDraping=!0,r.supportsWorldCopies=!1,r.supportsFog=!0,r.zAxisUnit="pixels",r.unsupportedLayers=["debug","custom"],r.range=[3,5],r}return y(i,[{key:"projectTilePoint",value:function(e,t,i){var r=ip(e,t,i);return Bl(r,r,ap(Hf(i))),{x:r[0],y:r[1],z:r[2]}}},{key:"locationPoint",value:function(e,t){var i=tp(t.lat,t.lng),r=Pl([],i),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;
1zl(i,i,r,Es(1,0)*ys*n);var a=hl(new Float64Array(16));return pl(a,e.pixelMatrix,e.globeMatrix),Bl(i,i,a),new _(i[0],i[1])}},{key:"pixelsPerMeter",value:function(e,t){return Es(1,0)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){var r=wi(Es(1,45)*t,Es(1,e)*t,i);return this.pixelsPerMeter(e,t)/r}},{key:"createTileMatrix",value:function(e,t,i){var r=op(Hf(i.canonical));return pl(new Float64Array(16),e.globeMatrix,r)}},{key:"createInversionMatrix",value:function(e,t){var i=e.center,r=ap(Hf(t));return yl(r,r,w(i.lng)),vl(r,r,w(i.lat)),ml(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}},{key:"pointCoordinate",value:function(e,t,i,r){return qf(e,t,i,!0)||new zs(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!qf(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=El([],Cl([],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=Cl([],a.up(),h),p=Cl([],a.right(),h*c),d=Pl([],El([],El([],o,f),p)),m=[];if(new Xl(s,d).closestPointOnSphere(u,l,m)){var v=El([],m,u),y=Ol([],v,s);i=Math.cos(e.fovAboveCenter)*kl(y)}else{var _=Ol([],s,u),g=Ol([],u,s);Pl(g,g);var x=kl(_)-l;i=Math.sqrt(x*(x+2*l));var b=Math.acos(i/(l+x))-Math.acos(Dl(o,g));i*=Math.cos(b)}return 1.01*i}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=lp(e.zoom);if(i>0){var r=pp(e,Es(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),a=Math.max(e.width,e.height)/e.worldSize*Math.PI;return wi(t,r+n*(1-Math.cos(a)),Math.pow(i,10))}return t}},{key:"upVector",value:function(e,t,i){return ip(t,i,e,1)}},{key:"upVectorScale",value:function(e){return{metersToTile:Vf*rp(Hf(e))}}}]),i}(Mp);function Bp(e){var t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Mp(e);case"equirectangular":return new Tp(e);case"naturalEarth":return new Cp(e);case"equalEarth":return new kp(e);case"winkelTripel":return new Pp(e);case"albers":return i?new Dp(e):new yp(e);case"lambertConformalConic":return i?new Dp(e):new Ap(e);case"globe":return new Lp(e)}throw new Error("Invalid projection name: ".concat(e.name))}var Rp=uc.VectorTileFeature.types,Fp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Op(e,t,i,r,n,a,o,s,l,u,c,h,f){var p=s?Math.min(Cf,Math.round(s[0])):0,d=s?Math.min(Cf,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),a,o,(p<<1)+(l?1:0),d,16*u,16*c,256*h,256*f)}function Up(e,t,i,r,n,a,o){e.emplaceBack(t,i,r,n,a,o)}function Vp(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 jp(e){var t,i=f(e.sections);try{for(i.s();!(t=i.n()).done;)if(da(t.value.text))return!0}catch(r){i.e(r)}finally{i.f()}return!1}var Np=function(){function e(t){v(this,e),this.layoutVertexArray=new io,this.indexArray=new co,this.programConfigurations=t,this.segments=new vs,this.dynamicLayoutVertexArray=new $a,this.opacityVertexArray=new no,this.placedSymbolArray=new Eo,this.globeExtVertexArray=new ro}return y(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,qc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Xc.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Fp,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Wc.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}();An(Np,"SymbolBuffers");var Gp=function(){function e(t,i,r){v(this,e),this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new r,this.segments=new vs,this.collisionVertexArray=new lo,this.collisionVertexArrayExt=new uo}return y(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,Hc.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Yc.members,!0)}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
1stroy())}}]),e}();An(Gp,"CollisionBuffers");var Zp=function(){function e(t){v(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=hl([]),this.placementViewportMatrix=hl([]);var i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=eh(this.zoom,i["text-size"]),this.iconSizeData=eh(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 Rh[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 y(e,[{key:"createArrays",value:function(){this.text=new Np(new os(this.layers,this.zoom,(function(e){return/^text/.test(e)}))),this.icon=new Np(new os(this.layers,this.zoom,(function(e){return/^icon/.test(e)}))),this.glyphOffsetArray=new Mo,this.lineVertexArray=new Io,this.symbolInstances=new Ao}},{key:"calculateGlyphDependencies",value:function(e,t,i,r,n){for(var a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,r&&n){var o=ah[e.charAt(a)];o&&(t[o.charCodeAt(0)]=!0)}}},{key:"populate",value:function(e,t,i,r){var n=this.layers[0],a=n.layout,o="globe"===this.projection.name,s=a.get("text-font"),l=a.get("text-field"),u=a.get("icon-image"),c=("constant"!==l.value.kind||l.value.value instanceof Dt&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),h="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,p=a.get("symbol-sort-key");if(this.features=[],c||h){var d,m=t.iconDependencies,v=t.glyphDependencies,y=t.availableImages,_=new Aa(this.zoom),g=f(e);try{for(g.s();!(d=g.n()).done;){var x=d.value,b=x.feature,w=x.id,k=x.index,T=x.sourceLayerIndex,E=n._featureFilter.needGeometry,S=Vs(b,E);if(n._featureFilter.filter(_,S,i)){E||(S.geometry=Us(b,i,r)),o&&1!==b.type&&i.z<=5&&function(){for(var e=S.geometry,t=.98078528056,r=0;r<e.length;r++)e[r]=Bs(e[r],(function(e){return e}),(function(e,r){return Dl(ip(e.x,e.y,i,1),ip(r.x,r.y,i,1))<t}))}();var A=void 0,M=void 0;if(c){var I=n.getValueAndResolveTokens("text-field",S,i,y),C=Dt.factory(I);jp(C)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Ta()||this.hasRTLText&&Sa.isParsed())&&(A=nh(C,n,S))}if(h){var z=n.getValueAndResolveTokens("icon-image",S,i,y);M=z instanceof Lt?z:Lt.fromString(z)}if(A||M){var P=this.sortFeaturesByKey?p.evaluate(S,{},i):void 0;if(this.features.push({id:w,text:A,icon:M,index:k,sourceLayerIndex:T,geometry:S.geometry,properties:b.properties,type:Rp[b.type],sortKey:P}),M&&(m[M.name]=!0),A){var D=s.evaluate(S,{},i).join(","),L="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Rh.vertical)>=0;var B,R=f(A.sections);try{for(R.s();!(B=R.n()).done;){var F=B.value;if(F.image)m[F.image.name]=!0;else{var O=sa(A.toString()),U=F.fontStack||D,V=v[U]=v[U]||{};this.calculateGlyphDependencies(F.text,V,L,this.allowVerticalPlacement,O)}}}catch(j){R.e(j)}finally{R.f()}}}}}}catch(j){g.e(j)}finally{g.f()}"line"===a.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<e.length;u++){var c=e[u],h=c.geometry,f=c.text?c.text.toString():null;if(f){var p=l(f,h),d=l(f,h,!0);if(p in i&&d in t&&i[p]!==t[d]){var m=s(p,d,h),v=o(p,d,r[m].geometry);delete t[p],delete i[d],i[l(f,r[v].geometry,!0)]=v,r[m].geometry=null}else p in i?o(p,d,h):d in t?s(p,d,h):(a(u),t[p]=n-1,i[d]=n-1)}else a(u)}return r.filter((function(e){return e.geometry}))}(this.features)),this.sortFeaturesByKey&&this.features.sort((function(e,t){return e.sortKey-t.sortKey}
1))}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i,r),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i,r))}},{key:"isEmpty",value:function(){return 0===this.symbolInstances.length&&!this.hasRTLText}},{key:"uploadPending",value:function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}},{key:"upload",value:function(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}},{key:"destroyDebugData",value:function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}},{key:"getProjection",value:function(){return this.projectionInstance||(this.projectionInstance=Bp(this.projection)),this.projectionInstance}},{key:"destroy",value:function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}},{key:"addToLineVertexArray",value:function(e,t){var i=this.lineVertexArray.length,r=e.segment;if(void 0!==r){for(var n=e.dist(t[r+1]),a=e.dist(t[r]),o={},s=r+1;s<t.length;s++)o[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:n},s<t.length-1&&(n+=t[s+1].dist(t[s]));for(var l=r||0;l>=0;l--)o[l]={x:t[l].x,y:t[l].y,tileUnitDistanceFromAnchor:a},l>0&&(a+=t[l-1].dist(t[l]));for(var u=0;u<t.length;u++){var c=o[u];this.lineVertexArray.emplaceBack(c.x,c.y,c.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}},{key:"addSymbols",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,p){for(var d=e.indexArray,m=e.layoutVertexArray,v=e.globeExtVertexArray,y=e.segments.prepareSegment(4*t.length,m,d,this.canOverlap?a.sortKey:void 0),_=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&o===Rh.vertical?Math.PI/2:0,b=a.text&&a.text.sections,w=0;w<t.length;w++){var k=t[w],T=k.tl,E=k.tr,S=k.bl,A=k.br,M=k.tex,I=k.pixelOffsetTL,C=k.pixelOffsetBR,z=k.minFontScaleX,P=k.minFontScaleY,D=k.glyphOffset,L=k.isSDF,B=k.sectionIndex,R=y.vertexLength,F=D[1];if(Op(m,l.x,l.y,T.x,F+T.y,M.x,M.y,i,L,I.x,I.y,z,P),Op(m,l.x,l.y,E.x,F+E.y,M.x+M.w,M.y,i,L,C.x,I.y,z,P),Op(m,l.x,l.y,S.x,F+S.y,M.x,M.y+M.h,i,L,I.x,C.y,z,P),Op(m,l.x,l.y,A.x,F+A.y,M.x+M.w,M.y+M.h,i,L,C.x,C.y,z,P),s){var O=s.anchor,U=s.up;Up(v,O.x,O.y,O.z,U[0],U[1],U[2]),Up(v,O.x,O.y,O.z,U[0],U[1],U[2]),Up(v,O.x,O.y,O.z,U[0],U[1],U[2]),Up(v,O.x,O.y,O.z,U[0],U[1],U[2]),Vp(e.dynamicLayoutVertexArray,O.x,O.y,O.z,x)}else Vp(e.dynamicLayoutVertexArray,l.x,l.y,l.z,x);d.emplaceBack(R,R+1,R+2),d.emplaceBack(R+1,R+2,R+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),w!==t.length-1&&B===t[w+1].sectionIndex||e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,p,b&&b[B])}var V=s?s.anchor:l;e.placedSymbolArray.emplaceBack(V.x,V.y,V.z,l.x,l.y,_,this.glyphOffsetArray.length-_,g,u,c,l.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],o,0,!1,0,h,0)}},{key:"_commitLayoutVertex",value:function(e,t,i,r,n,a,o){e.emplaceBack(t,i,r,n,a,Math.round(o.x),Math.round(o.y))}},{key:"_addCollisionDebugVertices",value:function(e,t,i,r,n,a,o){for(var s=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=s.vertexLength,u=o.tileAnchorX,c=o.tileAnchorY,h=0;h<4;h++)i.collisionVertexArray.emplaceBack(0,0,0,0);i.collisionVertexArrayExt.emplaceBack(t,-e.padding,-e.padding),i.collisionVertexArrayExt.emplaceBack(t,e.padding,-e.padding),i.collisionVertexArrayExt.emplaceBack(t,e.padding,e.padding),i.collisionVertexArrayExt.emplaceBack(t,-e.padding,e.padding),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new _(e.x1,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new _(e.x2,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new _(e.x2,e.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new _(e.x1,e.y2)),s.vertexLength+=4;var f=i.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),s.primitiveLength+=4}},{key:"_addTextDebugCollisionBoxes",value:function(e,t,i,r,n,a){for(var o=r;o<n;o++){var s=i.get(o),l=this.getSymbolInstanceTextSize(e,a,t,o);this._addCollisionDebugVertices(s,l,this.textCollisionBox,s.projectedAnchorX,s.projectedAnchorY,s.projectedAnchorZ,a)}}},{key:"_addIconDebugCollisionBoxes",value:function(e,t,i,r,n,a){for(var o=r;o<n;o++){var s=i.get(o),l=this.getSymbolInstanceIconSize(e,t,o);this._addCollisionDebugVertices(s,l,this.iconCollisionBox,s.projectedAnchorX,s.projectedAnchorY,s.projectedAnchorZ,a)}}},{key:"generateCollisionDebugBuffers",value:function(e,t){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Gp(oo,Kc.members,yo),this.iconCollisionBox=new Gp(oo,Kc.members,yo);for(var i=ih(this.iconSizeData,e),r=ih(this.textSizeData,e),n=0;n<this.symbolInstances.length;n++){var a=this.symbolInstances.get(n);this._addTextDebugCollisionBoxes(r,e,t,a.textBoxStartIndex,a.textBoxEndIndex,a),this._addTextDebugCollisionBoxes(r,e,t,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a),this._addIconDebugCollisionBoxes(i,e,t,a.iconBoxStartIndex,a.iconBoxEndIndex,a),this._addIconDebugCollisionBoxes(i,e,t,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a)}}},{key:"getSymbolInstanceTextSize",value:function(e,t,i,r){var n=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),a=th(this.textSizeData,e,n)/$c;return this.tilePixelRatio*a}},{key:"getSymbolInstanceIconSize",value:function(e,t,i){var r=this.icon.placedSymbolArray.get(i),n=th(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;o<n;o++){var s=i.get(o),l=this.getSymbolInstanceTextSize(e,a,t,o);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,l,s.padding)}}},{key:"_updateIconDebugCollisionBoxes",value:function(e,t,i,r,n){for(var a=r;a<n;a++){var o=i.get(a),s=this.getSymbolInstanceIconSize(e,t,a);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,s,o.padding)}}},{key:"updateCollisionDebugBuffers",value:function(e,t){if(this.hasDebugData()){this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();for(var i=ih(this.iconSizeData,e),r=ih(this.textSizeData,e),n=0;n<this.symbolInstances.length;n++){var a=this.symbolInstances.get(n);this._updateTextDebugCollisionBoxes(r,e,t,a.textBoxStartIndex,a.textBoxEndIndex,a),this._updateTextDebugCollisionBoxes(r,e,t,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a),this._updateIconDebugCollisionBoxes(i,e,t,a.iconBoxStartIndex,a.iconBoxEndIndex),this._updateIconDebugCollisionBoxes(i,e,t,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}}},{key:"_deserializeCollisionBoxesForSymbol",value:function(e,t,i,r,n,a,o,s,l){for(var u={},c=t;c<i;c++){var h=e.get(c);u.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,padding:h.padding,projectedAnchorX:h.projectedAnchorX,projectedAnchorY:h.projectedAnchorY,projectedAnchorZ:h.projectedAnchorZ,tileAnchorX:h.tileAnchorX,tileAnchorY:h.tileAnchorY},u.textFeatureIndex=h.featureIndex;break}for(var f=r;f<n;f++){var p=e.get(f);u.verticalTextBox={x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,padding:p.padding,projectedAnchorX:p.projectedAnchorX,projectedAnchorY:p.projectedAnchorY,projectedAnchorZ:p.projectedAnchorZ,tileAnchorX:p.tileAnchorX,tileAnchorY:p.tileAnchorY},u.verticalTextFeatureIndex=p.featureIndex;break}for(var d=a;d<o;d++){var m=e.get(d);u.iconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,padding:m.padding,projectedAnchorX:m.projectedAnchorX,projectedAnchorY:m.projectedAnchorY,projectedAnchorZ:m.projectedAnchorZ,tileAnchorX:m.tileAnchorX,tileAnchorY:m.tileAnchorY},u.iconFeatureIndex=m.featureIndex;break}for(var v=s;v<l;v++){var y=e.get(v);u.verticalIconBox={x1:y.x1,y1:y.y1,x2:y.x2,y2:y.y2,padding:y.padding,projectedAnchorX:y.projectedAnchorX,projectedAnchorY:y.projectedAnchorY,projectedAnchorZ:y.projectedAnchorZ,tileAnchorX:y.tileAnchorX,tileAnchorY:y.tileAnchorY},u.verticalIconFeatureIndex=y.featureIndex;break}return u}},{key:"deserializeCollisionBoxes",value:function(e){this.collisionArrays=[];for(var t=0;t<this.symbolInstances.length;t++){var i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}},{key:"hasTextData",value:function(){return this.text.segments.get().length>0}},{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;n<r;n+=4)e.indexArray.emplaceBack(n,n+1,n+2),e.indexArray.emplaceBack(n+1,n+2,n+3)}}
1,{key:"getSortedSymbolIndexes",value:function(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;for(var t=Math.sin(e),i=Math.cos(e),r=[],n=[],a=[],o=0;o<this.symbolInstances.length;++o){a.push(o);var s=this.symbolInstances.get(o);r.push(0|Math.round(t*s.tileAnchorX+i*s.tileAnchorY)),n.push(s.featureIndex)}return a.sort((function(e,t){return r[e]-r[t]||n[t]-n[e]})),a}},{key:"addToSortKeyRanges",value:function(e,t){var i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}},{key:"sortFeatures",value:function(e){var t=this;if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];var i,r=f(this.symbolInstanceIndexes);try{for(r.s();!(i=r.n()).done;){var n=i.value,a=this.symbolInstances.get(n);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((function(e,i,r){e>=0&&r.indexOf(e)===i&&t.addIndicesForPlacedSymbol(t.text,e)})),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}}catch(o){r.e(o)}finally{r.f()}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}]),e}();An(Zp,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Zp.MAX_GLYPHS=65535,Zp.addDynamicAttributes=Vp;var qp=new ja({"symbol-placement":new Ra(at.layout_symbol["symbol-placement"]),"symbol-spacing":new Ra(at.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ra(at.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Fa(at.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ra(at.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ra(at.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ra(at.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ra(at.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ra(at.layout_symbol["icon-rotation-alignment"]),"icon-size":new Fa(at.layout_symbol["icon-size"]),"icon-text-fit":new Ra(at.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ra(at.layout_symbol["icon-text-fit-padding"]),"icon-image":new Fa(at.layout_symbol["icon-image"]),"icon-rotate":new Fa(at.layout_symbol["icon-rotate"]),"icon-padding":new Ra(at.layout_symbol["icon-padding"]),"icon-keep-upright":new Ra(at.layout_symbol["icon-keep-upright"]),"icon-offset":new Fa(at.layout_symbol["icon-offset"]),"icon-anchor":new Fa(at.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ra(at.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ra(at.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ra(at.layout_symbol["text-rotation-alignment"]),"text-field":new Fa(at.layout_symbol["text-field"]),"text-font":new Fa(at.layout_symbol["text-font"]),"text-size":new Fa(at.layout_symbol["text-size"]),"text-max-width":new Fa(at.layout_symbol["text-max-width"]),"text-line-height":new Fa(at.layout_symbol["text-line-height"]),"text-letter-spacing":new Fa(at.layout_symbol["text-letter-spacing"]),"text-justify":new Fa(at.layout_symbol["text-justify"]),"text-radial-offset":new Fa(at.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ra(at.layout_symbol["text-variable-anchor"]),"text-anchor":new Fa(at.layout_symbol["text-anchor"]),"text-max-angle":new Ra(at.layout_symbol["text-max-angle"]),"text-writing-mode":new Ra(at.layout_symbol["text-writing-mode"]),"text-rotate":new Fa(at.layout_symbol["text-rotate"]),"text-padding":new Ra(at.layout_symbol["text-padding"]),"text-keep-upright":new Ra(at.layout_symbol["text-keep-upright"]),"text-transform":new Fa(at.layout_symbol["text-transform"]),"text-offset":new Fa(at.layout_symbol["text-offset"]),"text-allow-overlap":new Ra(at.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ra(at.layout_symbol["text-ignore-placement"]),"text-optional":new Ra(at.layout_symbol["text-optional"])}),Wp={paint:new ja({"icon-opacity":new Fa(at.paint_symbol["icon-opacity"]),"icon-color":new Fa(at.paint_symbol["icon-color"]),"icon-halo-color":new Fa(at.paint_symbol["icon-halo-color"]),"icon-halo-width":new Fa(at.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Fa(at.paint_symbol["icon-halo-blur"]),"icon-translate":new Ra(at.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ra(at.paint_symbol["icon-translate-anchor"]),"text-opacity":new Fa(at.paint_symbol["text-opacity"]),"text-color":new Fa(at.paint_symbol["text-color"],{runtimeType:mt,getOverride:function(e){return e.textColor},hasOverride:function(e){return!!e.textColor}}),"text-halo-color":new Fa(at.paint_symbol["text-halo-color"]),"text-halo-width":new Fa(at.paint_symbol["text-halo-width"]),"text-halo-blur":new Fa(at.paint_symbol["text-halo-blur"]),"text-translate":new Ra(at.paint_symbol["text-translate"]),"text-translate-anchor":new Ra(at.paint_symbol["text-translate-anchor"])}),layout:qp},Xp=function(){function e(t){v(this,e),this.type=t.property.overrides?t.property.overrides.runtimeType:ht,this.defaultValue=t}return y(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}();An(Xp,"FormatSectionOverride",{omit:["defaultValue"]});var Hp=function(e){d(i,e);var t=m(i);function i(e){return v(this,i),t.call(this,e,Wp)}return y(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()||Ir(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 Zp(e)}},{key:"queryRadius",value:function(){return 0}},{key:"queryIntersectsFeature",value:function(){return!1}},{key:"_setPaintOverrides",value:function(){var e,t=f(Wp.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 Xp(n),o=new Mr(a,n.property.specification),s=null;s="constant"===n.value.kind||"source"===n.value.kind?new zr("source",o):new Pr("composite",o,n.value.zoomStops,n.value._interpolationType),this.paint._values[r]=new La(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=Wp.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 Dt)a(i.value.value.sections);else if("source"===i.value.kind){var o=function e(t){n||(t instanceof Ut&&Ft(t.value)===gt?a(t.value.sections):t instanceof Gt?a(t.sections):t.eachChild(e))},s=i.value;s._styleExpression&&o(s._styleExpression.expression)}return n}}]),i}(ps),Yp={paint:new ja({"background-color":new Ra(at.paint_background["background-color"]),"background-pattern":new Ua(at.paint_background["background-pattern"]),"background-opacity":new Ra(at.paint_background["background-opacity"])})},Kp={paint:new ja({"raster-opacity":new Ra(at.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ra(at.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ra(at.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ra(at.paint_raster["raster-brightness-max"]),"raster-saturation":new Ra(at.paint_raster["raster-saturation"]),"raster-contrast":new Ra(at.paint_raster["raster-contrast"]),"raster-resampling":new Ra(at.paint_raster["raster-resampling"]),"raster-fade-duration":new Ra(at.paint_raster["raster-fade-duration"])})},Jp=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e,{})).implementation=e,r}return y(i,[{key:"is3D",value:function(){return"3d"===this.implementation.renderingMode}},{key:"hasOffscreenPass",value:function(){return void 0!==this.implementation.prerender}},{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}(ps),$p={paint:new ja({"sky-type":new Ra(at.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ra(at.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ra(at.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ra(at.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ra(at.paint_sky["sky-gradient-radius"]),"sky-gradient":new Va(at.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ra(at.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ra(at.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ra(at.paint_sky["sky-opacity"])})};function Qp(e,t,i){var r=[0,0,1],n=Zl([]);return Wl(n,n,i?-w(e)+Math.PI:w(e)),ql(n,n,-w(t)),Rl(r,r,n),Pl(r,r)}var ed={circle:function(e){d(i,e);var t=m(i);function i(e){return v(this,i),t.call(this,e,sl)}return y(i,[{key:"createBucket",value:function(e){return new Gs(e)}},{key:"queryRadius",value:function(e){var t=e;return il("circle-radius",this,t)+il("circle-stroke-width",this,t)+rl(this.paint.get("circle-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s){var l=al(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 Jl(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}(ps),heatmap:function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e,lu))._updateColorRamp(),r}return y(i,[{key:"createBucket",value:function(e){return new iu(e)}}]),y(i,[{key:"_handleSpecialPaintPropertyUpdate",value:function(e){"heatmap-color"===e&&this._updateColorRamp()}},{key:"_updateColorRamp",value:function(){this.colorRamp=uu({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 il("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 Jl(e,r,a,o,s,!0,!0,new _(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}(ps),hillshade:function(e){d(i,e);var t=m(i);function i(e){return v(this,i),t.call(this,e,cu)}return y(i,[{key:"hasOffscreenPass",value:function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},{key:"getProgramIds",value:function(){return["hillshade","hillshadePrepare"]}}]),i}(ps),fill:function(e){d(i,e);var t=m(i);function i(e){return v(this,i),t.call(this,e,Ku)}return y(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 Hu(e)}},{key:"queryRadius",value:function(){return rl(this.paint.get("fill-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a){return!e.queryGeometry.isAboveHorizon&&Ws(nl(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}(ps),"fill-extrusion":function(e){d(i,e);var t=m(i);function i(e){return v(this,i),t.call(this,e,Sc)}return y(i,[{key:"createBucket",value:function(e){return new vc(e)}},{key:"queryRadius",value:function(){return rl(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=al(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),h=this.paint.get("fill-extrusion-base").evaluate(t,i),p=[0,0],d=s&&a.elevation,m=a.elevation?a.elevation.exaggeration():1,v=e.tile.getBucket(this);if(d&&v instanceof vc){var y=v.centroidVertexArray,g=l+1;if(g<y.length){var x=y.get(g);p[0]=x.a_centroid_pos0,p[1]=x.a_centroid_pos1}}if(0===p[0]&&1===p[1])return!1;"globe"===a.projection.name&&(r=Tc([r],[new _(0,0),new _(ys,ys)],e.tileID.canonical).map((function(e){return e.polygon})).flat());var b=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=[],p=[],d=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,m=[0,0,0,1],v=[0,0,0,1],y=function(e,t,i,r){e[0]=t,e[1]=i,e[2]=r,e[3]=1},_=kc();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.va
1lue,A=S.x+n.x,M=S.y+n.y,I=e.projection.projectTilePoint(A,M,c),C=e.projection.upVector(c,S.x,S.y),z=i,P=r;if(o){var D=Bc(A,M,i,r,o,s,l,u);z+=D.base,P+=D.top}0!==i?y(m,I.x+C[0]*d*z,I.y+C[1]*d*z,I.z+C[2]*d*z):y(m,I.x,I.y,I.z),y(v,I.x+C[0]*d*P,I.y+C[1]*d*P,I.z+C[2]*d*P),Bl(m,m,a),Bl(v,v,a),k.push(Lc(m)),T.push(Lc(v))}}catch(L){E.e(L)}finally{E.f()}h.push(k),p.push(T)}}catch(L){x.e(L)}finally{x.f()}return[h,p]}(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=[],p=[0,0,0,1],d=f(e);try{for(d.s();!(u=d.n()).done;){var m,v=u.value,y=[],_=[],g=f(v);try{for(g.s();!(m=g.n()).done;){var x=m.value,b=x.x+r.x,w=x.y+r.y,k=Bc(b,w,t,i,a,o,s,l);p[0]=b,p[1]=w,p[2]=k.base,p[3]=1,Nl(p,p,n),p[3]=Math.max(p[3],1e-5);var T=Lc([p[0]/p[3],p[1]/p[3],p[2]/p[3]]);p[0]=b,p[1]=w,p[2]=k.top,p[3]=1,Nl(p,p,n),p[3]=Math.max(p[3],1e-5);var E=Lc([p[0]/p[3],p[1]/p[3],p[2]/p[3]]);y.push(T),_.push(E)}}catch(S){g.e(S)}finally{g.f()}c.push(y),h.push(_)}}catch(S){d.e(S)}finally{d.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,p=n[8]*i,d=n[9]*i,m=n[10]*i,v=n[11]*i,y=f(e);try{for(y.s();!(a=y.n()).done;){var g,x=a.value,b=[],w=[],k=f(x);try{for(k.s();!(g=k.n()).done;){var T=g.value,E=T.x+r.x,S=T.y+r.y,A=n[0]*E+n[4]*S+n[12],M=n[1]*E+n[5]*S+n[13],I=n[2]*E+n[6]*S+n[14],C=n[3]*E+n[7]*S+n[15],z=A+l,P=M+u,D=I+c,L=Math.max(C+h,1e-5),B=A+p,R=M+d,F=I+m,O=Math.max(C+v,1e-5),U=new _(z/L,P/L);U.z=D/L,b.push(U);var V=new _(B/O,R/O);V.z=F/O,w.push(V)}}catch(j){k.e(j)}finally{k.f()}o.push(b),s.push(w)}}catch(j){y.e(j)}finally{y.f()}return[o,s]}(t,i,r,n,a)}(a,r,h,c,u,o,d?s:null,p,m,a.center.lat,e.tileID.canonical),w=e.queryGeometry;return function(e,t,i){var r=1/0;Ws(i,t)&&(r=Dc(i,t[0]));for(var n=0;n<t.length;n++)for(var a=t[n],o=e[n],s=0;s<a.length-1;s++){var l=a[s],u=[l,a[s+1],o[s+1],o[s],l];Zs(i,u)&&(r=Math.min(r,Dc(i,u)))}return r!==1/0&&r}(b[0],b[1],w.isPointQuery()?w.screenBounds:w.screenGeometry)}}]),i}(ps),line:function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e,Nc)).gradientVersion=0,r}return y(i,[{key:"_handleSpecialPaintPropertyUpdate",value:function(e){if("line-gradient"===e){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof bi,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}},{key:"gradientExpression",value:function(){return this._transitionablePaint._values["line-gradient"].value.expression}},{key:"recalculate",value:function(e,t){o(s(i.prototype),"recalculate",this).call(this,e,t),this.paint._values["line-floorwidth"]=Gc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}},{key:"createBucket",value:function(e){return new Vc(e)}},{key:"getProgramIds",value:function(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}},{key:"getProgramConfiguration",value:function(e){return new as(this,e)}},{key:"queryRadius",value:function(e){var t=e,i=Zc(il("line-width",this,t),il("line-gap-width",this,t)),r=il("line-offset",this,t);return i/2+Math.abs(r)+rl(this.paint.get("line-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a){if(e.queryGeometry.isAboveHorizon)return!1;var o=nl(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),s=e.pixelToTileUnitsFactor/2*Zc(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){for(var i=[],r=new _(0,0),n=0;n<e.length;n++){for(var a=e[n],o=[],s=0;s<a.length;s++){var l=a[s-1],u=a[s],c=a[s+1],h=0===s?r:u.sub(l)._unit()._perp(),f=s===a.length-1?r:c.sub(u)._unit()._perp(),p=h._add(f)._unit();p._mult(1/(p.x*f.x+p.y*f.y)),o.push(p._mult(t)._add(u))}i.push(o)}return i}(r,l*e.pixelToTileUnitsFactor)),function(e,t,i){for(var r=0;r<t.length;r++){var n=t[r];if(e.length>=3)for(var a=0;a<n.length;a++)if(Qs(e,n[a]))return!0;if(Xs(e,n,i))return!0}return!1}(o,r,s)}},{key:"isTileClipped",value:function(){return!0}}]),i}(ps),symbol:Hp,background:function(e){d(i,e);var t=m(i);function i(e){return v(this,i),t.call(this,e,Yp)}return y(i,[{key:"getProgramIds",value:function(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}}]),i}(ps),raster:function(e){d(i,e);var t=m(i);function i(e){return v(this,i),t.call(this,e,Kp)}return y(i,[{key:"getProgramIds",value:function(){return["raster"]}}]),i}(ps),sky:function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e,$p))._updateColorRamp(),r}return y(i,[{key:"_handleSpecialPaintPropertyUpdate",value:function(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvali
1dated=!0)}},{key:"_updateColorRamp",value:function(){this.colorRamp=uu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}},{key:"needsSkyboxCapture",value:function(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){var t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}},{key:"getCenter",value:function(e,t){if("atmosphere"===this.paint.get("sky-type")){var i=this.paint.get("sky-atmosphere-sun"),r=!i,n=e.style.light,a=n.properties.get("position");return r&&"viewport"===n.properties.get("anchor")&&q("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),r?Qp(a.azimuthal,90-a.polar,t):Qp(i[0],90-i[1],t)}var o=this.paint.get("sky-gradient-center");return Qp(o[0],90-o[1],t)}},{key:"is3D",value:function(){return!1}},{key:"isSky",value:function(){return!0}},{key:"markSkyboxValid",value:function(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}},{key:"hasOffscreenPass",value:function(){return!0}},{key:"getProgramIds",value:function(){var e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}}]),i}(ps)},td=function(){function e(t,i,r,n){v(this,e),this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(i,n)}return y(e,[{key:"update",value:function(e,i,r){var n=e.width,a=e.height,o=this.context,s=o.gl,l=t.HTMLImageElement,u=t.HTMLCanvasElement,c=t.HTMLVideoElement,h=t.ImageData,f=t.ImageBitmap;if(s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!i||!1!==i.premultiply)),r||this.size&&this.size[0]===n&&this.size[1]===a){var p=r||{x:0,y:0},d=p.x,m=p.y;e instanceof l||e instanceof u||e instanceof c||e instanceof h||f&&e instanceof f?s.texSubImage2D(s.TEXTURE_2D,0,d,m,s.RGBA,s.UNSIGNED_BYTE,e):s.texSubImage2D(s.TEXTURE_2D,0,d,m,n,a,s.RGBA,s.UNSIGNED_BYTE,e.data)}else this.size=[n,a],e instanceof l||e instanceof u||e instanceof c||e instanceof h||f&&e instanceof f?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,e):s.texImage2D(s.TEXTURE_2D,0,this.format,n,a,0,this.format,s.UNSIGNED_BYTE,e.data);this.useMipmap=Boolean(i&&i.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}},{key:"bind",value:function(e,t){var i=this.context.gl;i.bindTexture(i.TEXTURE_2D,this.texture),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.useMipmap?e===i.NEAREST?i.NEAREST_MIPMAP_NEAREST:i.LINEAR_MIPMAP_NEAREST:e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}},{key:"isSizePowerOfTwo",value:function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}},{key:"destroy",value:function(){this.context.gl.deleteTexture(this.texture),this.texture=null}}]),e}(),id=function(){function e(t,i){v(this,e),this.width=t,this.height=i,this.nextRow=0,this.image=new ou({width:t,height:i}),this.positions={},this.uploaded=!1}return y(e,[{key:"getDash",value:function(e,t){var i=this.getKey(e,t);return this.positions[i]}},{key:"trim",value:function(){var e=this.width,t=this.height=F(this.nextRow);this.image.resize({width:e,height:t})}},{key:"getKey",value:function(e,t){return e.join(",")+t}},{key:"getDashRanges",value:function(e,t,i){var r=[],n=e.length%2==1?-e[e.length-1]*i:0,a=e[0]*i,o=!0;r.push({left:n,right:a,isDash:o,zeroLength:0===e[0]});for(var s=e[0],l=1;l<e.length;l++){o=!o;var u=e[l];n=s*i,a=(s+=u)*i,r.push({left:n,right:a,isDash:o,zeroLength:0===u})}return r}},{key:"addRoundDash",value:function(e,t,i){for(var r=t/2,n=-i;n<=i;n++)for(var a=this.width*(this.nextRow+i+n),o=0,s=e[o],l=0;l<this.width;l++){l/s.right>1&&(s=e[++o]);
1var u=Math.abs(l-s.left),c=Math.abs(l-s.right),h=Math.min(u,c),f=void 0,p=n/i*(r+1);if(s.isDash){var d=r-Math.abs(p);f=Math.sqrt(h*h+d*d)}else f=r-Math.sqrt(h*h+p*p);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;c<this.width;c++){c/u.right>1&&(u=e[++l]);var h=Math.abs(c-u.left),f=Math.abs(c-u.right),p=Math.min(h,f);this.image.data[s+c]=Math.max(0,Math.min(255,(u.isDash?p:-p)+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 q("LineAtlas out of space"),null;0===e.length&&e.push(1);for(var o=0,s=0;s<e.length;s++)e[s]<0&&(q("Negative value is found in line dasharray, replacing values with 0"),e[s]=0),o+=e[s];if(0!==o){var l=this.width/o,u=this.getDashRanges(e,this.width,l);r?this.addRoundDash(u,l,n):this.addRegularDash(u,"square"===t?.5*l:0)}var c=this.nextRow+n;this.nextRow+=a;var h={tl:[c,n],br:[o,0]};return this.positions[i]=h,h}}]),e}();An(id,"LineAtlas");for(var rd=function(){function e(t){var i=this;v(this,e),this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){i._triggered=!1,i._callback()})}return y(e,[{key:"trigger",value:function(){var e=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((function(){e._triggered=!1,e._callback()}),0))}},{key:"remove",value:function(){this._channel=void 0,this._callback=function(){}}}]),e}(),nd=function(){function e(){v(this,e),this.tasks={},this.taskQueue=[],U(["process"],this),this.invoker=new rd(this.process),this.nextId=0}return y(e,[{key:"add",value:function(e,t){var i=this,r=this.nextId++,n=function(e){var t=e.type,i=e.isSymbolTile,r=e.zoom;return r=r||0,"message"===t?0:"maybePrepare"!==t||i?"parseTile"!==t||i?"parseTile"===t&&i?300-r:"maybePrepare"===t&&i?400-r:500:200-r:100-r}(t);if(0===n){H();try{e()}finally{}return{cancel:function(){}}}return this.tasks[r]={fn:e,metadata:t,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:function(){delete i.tasks[r]}}}},{key:"process",value:function(){var e=this;H();try{if(this.taskQueue=this.taskQueue.filter((function(t){return!!e.tasks[t]})),!this.taskQueue.length)return;var t=this.pick();if(null===t)return;var i=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}},{key:"pick",value:function(){for(var e=null,t=1/0,i=0;i<this.taskQueue.length;i++){var r=this.tasks[this.taskQueue[i]];r.priority<t&&(t=r.priority,e=i)}if(null===e)return null;var n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}},{key:"remove",value:function(){this.invoker.remove()}}]),e}(),ad=function(){function e(t){v(this,e),this._stringToNumber={},this._numberToString=[];for(var i=0;i<t.length;i++){var r=t[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}return y(e,[{key:"encode",value:function(e){return this._stringToNumber[e]}},{key:"decode",value:function(e){return this._numberToString[e]}}]),e}(),od=["tile","layer","source","sourceLayer","state"],sd=function(){function e(t,i,r,n,a){v(this,e),this.type="Feature",this._vectorTileFeature=t,this._z=i,this._x=r,this._y=n,this.properties=t.properties,this.id=a}return y(e,[{key:"toJSON",value:function(){var e={type:"Feature",geometry:this.geometry,properties:this.properties};void 0!==this.id&&(e.id=this.id);var t,i=f(od);try{for(i.s();!(t=i.n()).done;){var r=t.value;void 0!==this[r]&&(e[r]=this[r])}}catch(n){i.e(n)}finally{i.f()}return e}},{key:"geometry",get:function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry},set:function(e){this._geometry=e}}]),e}(),ld=32,ud=33,cd=new Uint16Array(8184),hd=0;hd<2046;hd++){var fd=hd+2,pd=0,dd=0,md=0,vd=0,yd=0,_d=0;for(1&fd?md=vd=yd=ld:pd=dd=_d=ld;(fd>>=1)>1;){var gd=pd+md>>1,xd=dd+vd>>1;1&fd?(md=pd,vd=dd,pd=yd,dd=_d):(pd=md,dd=vd,md=yd,vd=_d),yd=gd,_d=xd}var bd=4*hd;cd[bd+0]=pd,cd[bd+1]=dd,cd[bd+2]=md,cd[bd+3]=vd}var wd=new Uint16Array(2178),kd=new Uint8Array(1089),Td=new Uint16Array(1089);function Ed(e){return 0===e?-.03125:32===e?.03125:0}var Sd=Wa([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Ad={type:2,extent:ys,loadGeometry:function(){return[[new _(0,0),new _(8193,0),new _(8193,8193),new _(0,8193),new _(0,0)]]}},Md=function(){function e(t,i,r,n,a){v(this,e),this.tileID=t,this.uid=B(),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 y(e,[{key:"registerFadeDuration",value:function(e){var t=e+this.timeAdded;t<ce.now()||this.fadeEndTime&&t<this.fadeEndTime||(this.fadeEndTime=t)}},{key:"wasRequested",value:function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}},{key:"loadVectorData",value:function(e,t,i){if(this.unloadVectorData(),this.state="loaded",e){for(var r in e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){var i={};if(!t)return i;var r,n=f(e);try{var a=function(){var e=r.value,n=e.layerIds.map((function(e){return t.getLayer(e)}
1)).filter(Boolean);if(0!==n.length){e.layers=n,e.stateDependentLayerIds&&(e.stateDependentLayers=e.stateDependentLayerIds.map((function(e){return n.filter((function(t){return t.id===e}))[0]})));var a,o=f(n);try{for(o.s();!(a=o.n()).done;){var s=a.value;i[s.id]=e}}catch(l){o.e(l)}finally{o.f()}}};for(n.s();!(r=n.n()).done;)a()}catch(o){n.e(o)}finally{n.f()}return i}(e.buckets,t.style),this.hasSymbolBuckets=!1,this.buckets){var n=this.buckets[r];if(n instanceof Zp){if(this.hasSymbolBuckets=!0,!i)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var a in this.buckets){var o=this.buckets[a];if(o instanceof Zp&&o.hasRTLText){this.hasRTLText=!0,Sa.isLoading()||Sa.isLoaded()||"deferred"!==Ta()||Ea();break}}for(var s in this.queryPadding=0,this.buckets){var l=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(s).queryRadius(l))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new ko}},{key:"unloadVectorData",value:function(){if(this.hasData()){for(var e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}},{key:"getBucket",value:function(e){return this.buckets[e.id]}},{key:"upload",value:function(e){for(var t in this.buckets){var i=this.buckets[t];i.uploadPending()&&i.upload(e)}var r=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new td(e,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new td(e,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new td(e,this.lineAtlas.image,r.ALPHA),this.lineAtlas.uploaded=!0)}},{key:"prepare",value:function(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}},{key:"queryRenderedFeatures",value:function(e,t,i,r,n,a,o,s){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:o,transform:a,params:n,tileTransform:this.tileTransform},e,t,i):{}}},{key:"querySourceFeatures",value:function(e,t){var i=this.latestFeatureIndex;if(i&&i.rawTileData){var r=i.loadVTLayers(),n=t?t.sourceLayer:"",a=r._geojsonTileLayer||r[n];if(a)for(var o=qr(t&&t.filter),s=this.tileID.canonical,l=s.z,u=s.x,c=s.y,h={z:l,x:u,y:c},f=0;f<a.length;f++){var p=a.feature(f);if(o.needGeometry){var d=Vs(p,!0);if(!o.filter(new Aa(this.tileID.overscaledZ),d,this.tileID.canonical))continue}else if(!o.filter(new Aa(this.tileID.overscaledZ),p))continue;var m=i.getId(p,n),v=new sd(p,l,u,c,m);v.tile=h,e.push(v)}}}},{key:"hasData",value:function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}},{key:"patternsLoaded",value:function(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}},{key:"setExpiryData",value:function(e){var t=this.expirationTime;if(e.cacheControl){var i=Y(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){var r=Date.now(),n=!1;if(this.expirationTime>r)n=!1;else if(t)if(this.expirationTime<t)n=!0;else{var a=this.expirationTime-t;a?this.expirationTime=r+Math.max(a,3e4):n=!0}else n=!0;n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}},{key:"getExpiryTimeout",value:function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}},{key:"setFeatureState",value:function(e,t){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(e).length&&t){var i=this.latestFeatureIndex.loadVTLayers(),r=t.style.listImages();for(var n in this.buckets)if(t.style.hasLayer(n)){var a=this.buckets[n],o=a.layers[0].sourceLayer||"_geojsonTileLayer",s=i[o],l=e[o];if(s&&l&&0!==Object.keys(l).length){if(a.update(l,s,r,this.imageAtlas&&this.imageAtlas.patternPositions||{}),a instanceof Vc||a instanceof Hu){var u=t.style._getSourceCache(a.layers[0].source);t._terrain&&t._terrain.enabled&&u&&a.programConfigurations.needsUpload&&t._terrain._clearRenderCacheForTile(u.id,this.tileID)}var c=t&&t.style&&t.style.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(a)))}}}}},{key:"holdingForFade",value:function(){return void 0!==this.symbolFadeHoldUntil}},{key:"symbolFadeFinished",value:function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ce.n
1ow()}},{key:"clearFadeHold",value:function(){this.symbolFadeHoldUntil=void 0}},{key:"setHoldDuration",value:function(e){this.symbolFadeHoldUntil=ce.now()+e}},{key:"setTexture",value:function(e,t){var i=t.context,r=i.gl;this.texture=t.getTileTexture(e.width),this.texture?this.texture.update(e,{useMipmap:!0}):(this.texture=new td(i,e,r.RGBA,{useMipmap:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),i.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax))}},{key:"setDependencies",value:function(e,t){var i,r={},n=f(t);try{for(n.s();!(i=n.n()).done;)r[i.value]=!0}catch(a){n.e(a)}finally{n.f()}this.dependencies[e]=r}},{key:"hasDependency",value:function(e,t){var i,r=f(e);try{for(r.s();!(i=r.n()).done;){var n=i.value,a=this.dependencies[n];if(a){var o,s=f(t);try{for(s.s();!(o=s.n()).done;)if(a[o.value])return!0}catch(l){s.e(l)}finally{s.f()}}}}catch(l){r.e(l)}finally{r.f()}return!1}},{key:"clearQueryDebugViz",value:function(){}},{key:"_makeDebugTileBoundsBuffers",value:function(e,t){if(t&&"mercator"!==t.name&&!this._tileDebugBuffer){for(var i=Us(Ad,this.tileID.canonical,this.tileTransform)[0],r=new Ha,n=new _o,a=0;a<i.length;a++){var o=i[a],s=o.x,l=o.y;r.emplaceBack(s,l),n.emplaceBack(a)}n.emplaceBack(0),this._tileDebugIndexBuffer=e.createIndexBuffer(n),this._tileDebugBuffer=e.createVertexBuffer(r,Of.members),this._tileDebugSegments=vs.simpleSegment(0,0,r.length,n.length)}}},{key:"_makeTileBoundsBuffers",value:function(e,t){if(!this._tileBoundsBuffer&&t&&"mercator"!==t.name){var i,r,n=Us(Ad,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){var a=function(e,t){for(var i=dp(e,t),r=Math.pow(2,e.z),n=0;n<ud;n++)for(var a=0;a<ud;a++){var o=Ss((e.x+(a+Ed(a))/ld)/r),s=As((e.y+(n+Ed(n))/ld)/r),l=t.project(o,s),u=n*ud+a;wd[2*u+0]=Math.round((l.x*i.scale-i.x)*ys),wd[2*u+1]=Math.round((l.y*i.scale-i.y)*ys)}kd.fill(0),Td.fill(0);for(var c=2045;c>=0;c--){var h=4*c,f=cd[h+0],p=cd[h+1],d=cd[h+2],m=cd[h+3],v=f+d>>1,y=p+m>>1,_=v+y-p,g=y+f-v,x=p*ud+f,b=m*ud+d,w=y*ud+v,k=Math.hypot((wd[2*x+0]+wd[2*b+0])/2-wd[2*w+0],(wd[2*x+1]+wd[2*b+1])/2-wd[2*w+1])>=16;if(kd[w]=kd[w]||(k?1:0),c<1022){var T=(p+g>>1)*ud+(f+_>>1),E=(m+g>>1)*ud+(d+_>>1);kd[w]=kd[w]||kd[T]||kd[E]}}var S=new Ka,A=new co,M=0;function I(e,t){var i=t*ud+e;return 0===Td[i]&&(S.emplaceBack(wd[2*i+0],wd[2*i+1],e*ys/ld,t*ys/ld),Td[i]=++M),Td[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&&kd[s*ud+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);A.emplaceBack(l,u,c)}}return C(0,0,ld,ld,ld,0),C(ld,ld,0,0,0,ld),{vertices:S,indices:A}}(this.tileID.canonical,t);i=a.vertices,r=a.indices}else{i=new Ka,r=new co;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(d){s.e(d)}finally{s.f()}for(var h=fu(i.int16,void 0,4),p=0;p<h.length;p+=3)r.emplaceBack(h[p],h[p+1],h[p+2])}this._tileBoundsBuffer=e.createVertexBuffer(i,Sd.members),this._tileBoundsIndexBuffer=e.createIndexBuffer(r),this._tileBoundsSegments=vs.simpleSegment(0,0,i.length,r.length)}}},{key:"_makeGlobeTileDebugBuffers",value:function(e,t){var i=t.projection;if(i&&"globe"===i.name&&!t.freezeTileCoverage){var r,n=this.tileID.canonical,a=ap(Yf(n,t)),o=lp(t.zoom);o>0&&(r=fl(new Float64Array(16),t.globeMatrix));var s=(n.x+.5)/(1<<n.z)-ks(t.center.lng),l=0;s>.5?l=-1:s<-.5&&(l=1),this._makeGlobeTileDebugBorderBuffer(e,n,t,a,r,o,l),this._makeGlobeTileDebugTextBuffer(e,n,t,a,r,o,l)}}},{key:"_globePoint",value:function(e,t,i,r,n,a,o,s){var l=ip(e,t,i);if(a){var u=1<<i.z,c=[((e/ys+i.x)/u+s)*r,(t/ys+i.y)/u*r,0];Bl(c,c,a),l=ki(l,c,o)}return Bl(l,l,n)}},{key:"_makeGlobeTileDebugBorderBuffer",value:function(e,t,i,r,n,a,o){var s=this,l=new Ha,u=new _o,c=new Ya,h=function(e,h,f,p,d){for(var m=(f-e)/(d-1),v=(p-h)/(d-1),y=l.length,_=0;_<d;_++){var g=e+_*m,x=h+_*v;l.emplaceBack(g,x);var b=s._globePoint(g,x,t,i.worldSize,r,n,a,o);c.emplaceBack(b[0],b[1],b[2]),u.emplaceBack(y+_)}},f=ys;h(0,0,f,0,16),h(f,0,f,f,16),h(f,f,0,f,16),h(0,f,0,0,16),this._tileDebugIndexBuffer=e.createIndexBuffer(u),this._tileDebugBuffer=e.createVertexBuffer(l,Of.members),this._globeTileDebugBorderBuffer=e.createVertexBuffer(c,Ff.members),this._tileDebugSegments=vs.simpleSegment(0,0,l.length,u.length)}},{key:"_makeGlobeTileDebugTextBuffer",value:function(e,t,i,r,n,a,o){var s=new Ha,l=new co,u=new Ya,c=25;l.reserve(32),s.reserve(c),u.reserve(c);for(var h=function(e,t){return c*e+t},f=0;f<c;f++)for(var p=2048*f,d=0;d<c;d++){var m=2048*d;s.emplaceBack(m,p);var v=this._globePoint(m,p,t,i.worldSize,r,n,a,o);u.emplaceBack(v[0],v[1],v[2])}for(var y=0;y<4;y++)for(var _=0;_<4;_++){var g=h(y,_),x=h(y,_+1),b=h(y+1,_),w=h(y+1,_+1);l.emplaceBack(g,x,b),l.emplaceBack(b,x,w)}this._tileDebugTextIndexBuffer=e.createIndexBuffer(l),this._tileDebugTextBuffer=e.createVertexBuffer(s,Of.members),this._globeTileDebugTextBuffer=e.createVertexBuffer(u,Ff.members),this._tileDebugTextSegments=vs.simpleSegment(0,0,c,32)}},{key:"tileTransform",get:function(){return this._tileTransform||(this._tileTransform=dp(this.tileID.canonical,this.projection)),this._tileTransform}}]),e}(),Id=function(){function e(){v(this,e),this.state={},this.stateChanges={},this.deletedStates={}}return y(e,[{key:"updateState",value:function(e,t,i){var r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},D(this.stateChanges[e][r],i),null===this.deletedStates[e])for(var n in this.deletedStates[e]={},this.state[e])n!==r&&(this.deletedStates[e][n]=null);else if(this.deletedStates[e]&&null===this.deletedStates[e][r])for(var a in this.deletedStates[e][r]={},this.state[e][r])i[a]||(this.deletedStates[e][r][a]=null);else for(var o in i)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][o]&&delete this.deletedStates[e][r][o]}},{key:"removeFeatureState",value:function(e,t,i){if(null!==this.deletedStates[e]){var r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}}},{key:"getState",value:function(e,t){var i=String(t),r=D({},(this.state[e]||{})[i],(this.stateChanges[e]||{})[i]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){var n=this.deletedStates[e][t];if(null===n)return{};for(var a in n)delete r[a]}return r}},{key:"initializeTileState",value:function(e,t){e.setFeatureState(this.state,t)}},{key:"coalesceChanges",value:function(e,t){var i={};for(var r in this.stateChanges){this.state[r]=this.state[r]||{};var n={};for(var a in this.stateChanges[r])this.state[r][a]||(this.state[r][a]={}),D(this.state[r][a],this.stateChanges[r][a]),n[a]=this.state[r][a];i[r]=n}for(var o in this.deletedStates){this.state[o]=this.state[o]||{};var s={};if(null===this.deletedStates[o])for(var l in this.state[o])s[l]={},this.state[o][l]={};else for(var u in this.deletedStates[o]){if(null===this.deletedStates[o][u])this.state[o][u]={};else for(var c=0,h=Object.keys(this.deletedStates[o][u]);c<h.length;c++){var f=h[c];delete this.state[o][u][f]}s[u]=this.state[o][u]}i[o]=i[o]||{},D(i[o],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(var p in e)e[p].setFeatureState(i,t)}}]),e}(),Cd=function(){function e(t){v(this,e),this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}return y(e,[{key:"getElevation",value:function(e,t){var i=this.toIdx(e,t);return{min:this.minimums[i],max:this.maximums[i]}}},{key:"isLeaf",value:function(e,t){return this.leaves[this.toIdx(e,t)]}},{key:"toIdx",value:function(e,t){return t*this.size+e}}]),e}();function zd(e,t,i,r){for(var n=0,a=Number.MAX_VALUE,o=0;o<3;o++)if(Math.abs(r[o])<1e-15){if(i[o]<e[o]||i[o]>t[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),u<a&&(a=u),n>a)return null}return n}function Pd(e,t,i,r,n,a,o,s,l,u,c){var h=r-e,f=n-t,p=a-i,d=o-e,m=s-t,v=l-i,y=c[1]*v-c[2]*m,_=c[2]*d-c[0]*v,g=c[0]*m-c[1]*d,x=h*y+f*_+p*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*p-T*f,A=T*h-w*p,M=w*f-k*h,I=(c[0]*S+c[1]*A+c[2]*M)*b;return I<0||E+I>1?null:(d*S+m*A+v*M)*b}function Dd(e,t,i){return(e-t)/(i-t)}function Ld(e,t,i,r,n,a,o,s,l){var u=1<<i,c=a-r,h=o-n,f=(e+1)/u*c+r,p=(t+0)/u*h+n,d=(t+1)/u*h+n;s[0]=(e+0)/u*c+r,s[1]=p,l[0]=f,l[1]=d}var Bd=function(){function e(t){if(v(this,e),this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],this.dem){var i=function(e){for(var t=Math.ceil(Math.log2(e.dim/8)),i=[],r=Math.ceil(Math.pow(2,t)),n=1/r,a=function(e,t,i,r,n){var a=r?1:0,o=(e+1)*i-a,s=t*i,l=(t+1)*i-a;n[0]=e*i,n[1]=s,n[2]=o,n[3]=l},o=new Cd(r),s=[],l=0;l<r*r;l++){a(l%r,Math.floor(l/r),n,!1,s);var u=Fd(s[0],s[1],e),c=Fd(s[2],s[1],e),h=Fd(s[2],s[3],e),f=Fd(s[0],s[3],e);o.minimums.push(Math.min(u,c,h,f)),o.maximums.push(Math.max(u,c,h,f)),o.leaves.push(1)}for(i.push(o),r/=2;r>=1;r/=2){var p=i[i.length-1];o=new Cd(r);for(var d=0;d<r*r;d++){a(d%r,Math.floor(d/r),2,!0,s);var m=p.getElevation(s[0],s[1]),v=p.getElevation(s[2],s[1]),y=p.getElevation(s[2],s[3]),_=p.getElevation(s[0],s[3]),g=p.isLeaf(s[0],s[1]),x=p.isLeaf(s[2],s[1]),b=p.isLeaf(s[2],s[3]),w=p.isLeaf(s[0],s[3]),k=Math.min(m.min,v.min,y.min,_.min),T=
1Math.max(m.max,v.max,y.max,_.max),E=g&&x&&b&&w;o.maximums.push(T),o.minimums.push(k),o.leaves.push(T-k<=5&&E?1:0)}i.push(o)}return i}(this.dem),r=i.length-1,n=i[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(i,0,0,r,0)}}return y(e,[{key:"raycastRoot",value:function(e,t,i,r,n,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;return zd([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 p=f.pop(),d=p.idx,m=p.t,v=p.nodex,y=p.nodey,_=p.depth;if(this.leaves[d]){Ld(v,y,_,e,t,i,r,c,h);var g=1<<_,x=(v+0)/g,b=(v+1)/g,w=(y+0)/g,k=(y+1)/g,T=Fd(x,w,this.dem)*o,E=Fd(b,w,this.dem)*o,S=Fd(b,k,this.dem)*o,A=Fd(x,k,this.dem)*o,M=Pd(c[0],c[1],T,h[0],c[1],E,h[0],h[1],S,n,a),I=Pd(h[0],h[1],S,c[0],h[1],A,c[0],c[1],T,n,a),C=Math.min(null!==M?M:Number.MAX_VALUE,null!==I?I:Number.MAX_VALUE);if(C!==Number.MAX_VALUE)return C;var z=zl([],n,a,m);if(Rd(T,E,A,S,Dd(z[0],c[0],h[0]),Dd(z[1],c[1],h[1]))>=z[2])return m}else{for(var P=0,D=0;D<this._siblingOffset.length;D++){Ld((v<<1)+this._siblingOffset[D][0],(y<<1)+this._siblingOffset[D][1],_+1,e,t,i,r,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[d]+D]*o;var L=zd(c,h,n,a);if(null!=L){var B=L;l[D]=B;for(var R=!1,F=0;F<P&&!R;F++)B>=l[u[F]]&&(u.splice(F,0,D),R=!0);R||(u[P]=D),P++}}for(var O=0;O<P;O++){var U=u[O];f.push({idx:this.childOffsets[d]+U,t:l[U],nodex:(v<<1)+this._siblingOffset[U][0],nodey:(y<<1)+this._siblingOffset[U][1],depth:_+1})}}}return null}},{key:"_addNode",value:function(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}},{key:"_construct",value:function(e,t,i,r,n){if(1!==e[r].isLeaf(t,i)){this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);for(var a=r-1,o=e[a],s=0,l=0,u=0;u<this._siblingOffset.length;u++){var c=2*t+this._siblingOffset[u][0],h=2*i+this._siblingOffset[u][1],f=o.getElevation(c,h),p=o.isLeaf(c,h),d=this._addNode(f.min,f.max,p);p&&(s|=1<<u),l||(l=d)}for(var m=0;m<this._siblingOffset.length;m++)s&1<<m||this._construct(e,2*t+this._siblingOffset[m][0],2*i+this._siblingOffset[m][1],a,l+m)}}}]),e}();function Rd(e,t,i,r,n,a){return wi(wi(e,i,a),wi(t,r,a),n)}function Fd(e,t,i){var r=i.dim,n=M(e*r-.5,0,r-1),a=M(t*r-.5,0,r-1),o=Math.floor(n),s=Math.floor(a),l=Math.min(o+1,r-1),u=Math.min(s+1,r-1);return Rd(i.get(o,s),i.get(l,s),i.get(o,u),i.get(l,u),n-o,a-s)}var Od={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]},Ud=function(){function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(v(this,e),this.uid=t,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return q('"'.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;l<o;l++)s[this._idx(-1,l)]=s[this._idx(0,l)],s[this._idx(o,l)]=s[this._idx(o-1,l)],s[this._idx(l,-1)]=s[this._idx(l,0)],s[this._idx(l,o)]=s[this._idx(l,o-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(o,-1)]=s[this._idx(o-1,0)],s[this._idx(-1,o)]=s[this._idx(0,o-1)],s[this._idx(o,o)]=s[this._idx(o-1,o-1)],a&&this._buildQuadTree()}}return y(e,[{key:"tree",get:function(){return this._tree||this._buildQuadTree(),this._tree}}]),y(e,[{key:"_buildQuadTree",value:function(){this._tree=new Bd(this)}},{key:"get",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(e=M(e,-1,this.dim),t=M(t,-1,this.dim));var i=4*this._idx(e,t);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}},{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:"_unpackMapbox",value:function(e,t,i){return(256*e*256+256*t+i)/10-1e4}},{key:"_unpackTerrarium",value:function(e,t,i){return 256*e+t+i/256-32768}},{key:"getPixels",value:function(){return new su({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;u<o;u++)for(var c=r;c<n;c++){var h=4*this._idx(c,u),f=4*this._idx(c+s,u+l);this.pixels[h+0]=e.pixels[f+0],this.pixels[h+1]=e.pixels[f+1],this.pixels[h+2]=e.pixels[f+2],this.pixels[h+3]=e.pixels[f+3]}}},{key:"onDeserialize",value:function(){this._tree&&(this._tree.dem=this)}},{key:"unpackVector",get:function(){return Od[this.encoding]}}],[{key:"getUnpackVector",value:function(e){return Od[e]}},{key:"pack",value:function(t,i){var r=[0,0,0,0],n=e.getUnpackVector(i),a=Math.floor((t+n[3])/n[2]);return r[2]=a%256,a=Math.floor(a/256),r[1]=a%256,a=Math.floor(a/256),r[0]=a,r}}]),e}();An(Ud,"DEMData"),An(Bd,"DemMinMaxQuadTree",{omit:["dem"]});var Vd=function(){function e(t,i){v(this,e),this.max=t,this.onRemove=i,this.reset()}return y(e,[{key:"reset",value:function(){for(var e in this.data){var t,i=f(this.data[e]);try{for(i.s();!(t=i.n()).done;){var r=t.value;r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value)}}catch(n){i.e(n)}finally{i.f()}}return this.data={},this.order=[],this}},{key:"add",value:function(e,t,i){var r=this,n=e.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);var a={value:t,timeout:void 0};if(void 0!==i&&(a.timeout=setTimeout((function(){r.remove(e,a)}
1),i)),this.data[n].push(a),this.order.push(n),this.order.length>this.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;o<s.length;o++){var l=s[o];this.remove(l.value.tileID,l)}}}]),e}(),jd=function e(t,i,r){v(this,e),this.func=t,this.mask=i,this.range=r};jd.ReadOnly=!1,jd.ReadWrite=!0,jd.disabled=new jd(519,jd.ReadOnly,[0,1]);var Nd=7680,Gd=function e(t,i,r,n,a,o){v(this,e),this.test=t,this.ref=i,this.mask=r,this.fail=n,this.depthFail=a,this.pass=o};Gd.disabled=new Gd({func:519,mask:0},0,0,Nd,Nd,Nd);var Zd=function e(t,i,r){v(this,e),this.blendFunction=t,this.blendColor=i,this.mask=r};Zd.Replace=[1,0],Zd.disabled=new Zd(Zd.Replace,Ct.transparent,[!1,!1,!1,!1]),Zd.unblended=new Zd(Zd.Replace,Ct.transparent,[!0,!0,!0,!0]),Zd.alphaBlended=new Zd([1,771],Ct.transparent,[!0,!0,!0,!0]);var qd=1029,Wd=2305,Xd=function e(t,i,r){v(this,e),this.enable=t,this.mode=i,this.frontFace=r};Xd.disabled=new Xd(!1,qd,Wd),Xd.backCCW=new Xd(!0,qd,Wd),Xd.backCW=new Xd(!0,qd,2304),Xd.frontCW=new Xd(!0,1028,2304),Xd.frontCCW=new Xd(!0,1028,Wd);var Hd=function(e){d(i,e);var t=m(i);function i(e,r,a){var o;return v(this,i),(o=t.call(this)).id=e,o._onlySymbols=a,r.on("data",(function(e){"source"===e.dataType&&"metadata"===e.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),r.on("error",(function(){o._sourceErrored=!0})),o._source=r,o._tiles={},o._cache=new Vd(0,o._unloadTile.bind(n(o))),o._timers={},o._cacheTimers={},o._minTileCacheSize=r.minTileCacheSize,o._maxTileCacheSize=r.maxTileCacheSize,o._loadedParentTiles={},o._coveredTiles={},o._state=new Id,o._isRaster="raster"===o._source.type||"raster-dem"===o._source.type||"custom"===o._source.type&&"raster"===o._source._dataType,o}return y(i,[{key:"onAdd",value:function(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}},{key:"loaded",value:function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(var e in this._tiles){var t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}},{key:"getSource",value:function(){return this._source}},{key:"pause",value:function(){this._paused=!0}},{key:"resume",value:function(){if(this._paused){var e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}}},{key:"_loadTile",value:function(e,t){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,t)}},{key:"_unloadTile",value:function(e){if(this._source.unloadTile)return this._source.unloadTile(e,(function(){}))}},{key:"_abortTile",value:function(e){if(this._source.abortTile)return this._source.abortTile(e,(function(){}))}},{key:"serialize",value:function(){return this._source.serialize()}},{key:"prepare",value:function(e){if(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._source.prepareTile)for(var t in this._tiles){var i=this._tiles[t];this._source.prepareTile(i)&&this.map.painter.terrain&&this.map.painter.terrain._clearRenderCacheForTile(this.id,i.tileID),i.upload(e),i.prepare(this.map.style.imageManager)}else for(var r in this._tiles){var n=this._tiles[r];n.upload(e),n.prepare(this.map.style.imageManager)}}},{key:"getIds",value:function(){return P(this._tiles).map((function(e){return e.tileID})).sort(Yd).map((function(e){return e.key}))}},{key:"getRenderableIds",value:function(e){var t=this,i=[];for(var r in this._tiles)this._isIdRenderable(+r,e)&&i.push(this._tiles[r]);return e?i.sort((function(e,i){var r=e.tileID,n=i.tileID,a=new _(r.canonical.x,r.canonical.y)._rotate(t.transform.angle),o=new _(n.canonical.x,n.canonical.y)._rotate(t.transform.angle);return r.overscaledZ-n.overscaledZ||o.y-a.y||o.x-a.x})).map((function(e){return e.tileID.key})):i.map((function(e){return e.tileID})).sort(Yd).map((function(e){return e.key}))}},{key:"hasRenderableParent",value:function(e){var t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}},{key:"_isIdRenderable",value:function(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}},{key:"reload",value:function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var e in this._cache.reset(),this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}},{key:"_reloadTile",value:function(e,t){var i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}},{key:"_tileLoaded",value:function(e,t,i,r){if(r)if(e.state="errored",404!==r.status)this._source.fire(new rt(r,{tile:e}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){var n=this.map.painter.terrain;this.update(this.transform,n.getScaledDemTileSize(),!0),n.resetTileLookupCache(this.id
1)}else this.update(this.transform);else e.timeAdded=ce.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new it("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}},{key:"_backfillDEM",value:function(e){for(var t=this.getRenderableIds(),i=0;i<t.length;i++){var r=t[i];if(e.neighboringTiles&&e.neighboringTiles[r]){var n=this.getTileByID(r);a(e,n),a(n,e)}}function a(e,t){if(e.dem&&!e.dem.borderReady){e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;var i=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),a=t.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),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 Cc(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(Kd(this._source.type)&&0!==a.length){for(var s={},l={},u=0,c=Object.keys(o);u<c.length;u++){var h=c[u],p=o[h],d=this._tiles[h];if(d&&!(d.fadeEndTime&&d.fadeEndTime<=ce.now())){var m=this.findLoadedParent(p,Math.max(p.overscaledZ-i.maxOverzooming,this._source.minzoom));m&&(this._addTile(m.tileID),s[m.tileID.key]=m.tileID),l[h]=p}}var v=a[a.length-1].overscaledZ;for(var y in this._tiles){var _=this._tiles[y];if(!o[y]&&_.hasData())for(var g=_.tileID;g.overscaledZ>v;){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,A=this._tiles[S];A.hasSymbolBuckets&&!A.holdingForFade()?A.setHoldDuration(this.map._fadeDuration):A.hasSymbolBuckets&&!A.symbolFadeFinished()||this._removeTile(+S)}}catch(M){E.e(M)}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={}
1,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,p=this._addTile(h);t[h.key]=h,p.hasData()||a<this._source.maxzoom&&(u[h.key]=h)}}catch(T){c.e(T)}finally{c.f()}this._retainLoadedChildren(u,a,l,t);var d,m=f(e);try{for(m.s();!(d=m.n()).done;){var v=d.value,y=this._tiles[v.key];if(!y.hasData()){if(v.canonical.z>=this._source.maxzoom){var _=v.children(this._source.maxzoom)[0],g=this.getTile(_);if(g&&g.hasData()){t[_.key]=_;continue}}else{var x=v.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=v.overscaledZ-1;w>=s;--w){var k=v.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){m.e(T)}finally{m.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;a<o.length;a++){var s=o[a];this._loadedParentTiles[s]=i}}}},{key:"_addTile",value:function(e){var t=this._tiles[e.key];if(t)return this._source.prepareTile&&this._source.prepareTile(t),t;(t=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));var i=Boolean(t);if(!i){var r=this.map?this.map.painter:null;t=new Md(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,r,this._isRaster),this._source.prepareTile&&this._source.prepareTile(t)||this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,i||this._source.fire(new it("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}},{key:"_setTileReloadTimer",value:function(e,t){var i=this;e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);var r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout((function(){i._reloadTile(e,"expired"),delete i._timers[e]}),r))}},{key:"_removeTile",value:function(e){var t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}},{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=ks(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 p=[Math.abs(M.apply(void 0,[o].concat(c(Jd(h,-1))))-o),Math.abs(M.apply(void 0,[o].concat(c(Jd(h,1))))-o)];u=[0,2*p.indexOf(Math.min.apply(Math,p))-1]}else{var d=[Math.abs(M.apply(void 0,[o].concat(c(Jd(h,-1))))-o),Math.abs(M.apply(void 0,[o].concat(c(Jd(h,0))))-o),Math.abs(M.apply(void 0,[o].concat(c(Jd(h,1))))-o)];u=[d.indexOf(Math.min.apply(Math,d))-1]}}else u=[0];var m,v=f(u);try{for(v.s();!(m=v.n()).done;){var y=m.value,_=e.containsTile(l,n,t,y);_&&r.push(_)}}catch(g){v.e(g)}finally{v.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;
1if(Kd(this._source.type))for(var e in this._tiles){var t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=ce.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}),p=f(h);try{for(p.s();!(u=p.n()).done;){var d=u.value;n.set(d.key,d)}}catch(m){p.e(m)}finally{p.f()}this.usedForTerrain&&c.updateElevation(!1)}}catch(m){l.e(m)}finally{l.f()}z(Array.from(n.values()),(function(e,t){var i=new Md(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}(nt);function Yd(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 Kd(e){return"raster"===e||"image"===e||"video"===e}function Jd(e,t){var i=1<<e.z;return[e.x/i+t,(e.x+1)/i+t]}Hd.maxOverzooming=10,Hd.maxUnderzooming=3;var $d=function(){function e(t,i,r){v(this,e),this._demTile=t,this._dem=this._demTile.dem,this._scale=i,this._offset=r}return y(e,[{key:"tileCoordToPixel",value:function(e,t){var i=t*this._scale+this._offset[1],r=Math.floor(e*this._scale+this._offset[0]),n=Math.floor(i);return new _(r,n)}},{key:"getElevationAt",value:function(e,t,i,r){var n=e*this._scale+this._offset[0],a=t*this._scale+this._offset[1],o=Math.floor(n),s=Math.floor(a),l=this._dem;return r=!!r,i?wi(wi(l.get(o,s,r),l.get(o,s+1,r),a-s),wi(l.get(o+1,s,r),l.get(o+1,s+1,r),a-s),n-o):l.get(o,s,r)}},{key:"getElevationAtPixel",value:function(e,t,i){return this._dem.get(e,t,!!i)}},{key:"getMeterToDEM",value:function(e){return(1<<this._demTile.tileID.canonical.z)*Es(1,e)*this._dem.stride}}],[{key:"create",value:function(t,i,r){var n=r||t.findDEMTileFor(i);if(n&&n.dem){var a=n.dem,o=n.tileID,s=1<<i.canonical.z-o.canonical.z;return new e(n,n.tileSize/ys/s,[(i.canonical.x/s-o.canonical.x)*a.dim,(i.canonical.y/s-o.canonical.y)*a.dim])}}}]),e}(),Qd=function(){function e(t,i){v(this,e),this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Tn(ys,16,0),this.featureIndexArray=new zo,this.promoteId=i}return y(e,[{key:"insert",value:function(e,t,i,r,n){var a=arguments.length>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<t.length;l++){for(var u=t[l],c=[1/0,1/0,-1/0,-1/0],h=0;h<u.length;h++){var f=u[h];c[0]=Math.min(c[0],f.x),c[1]=Math.min(c[1],f.y),c[2]=Math.max(c[2],f.x),c[3]=Math.max(c[3],f.y)}c[0]<ys&&c[1]<ys&&c[2]>=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 uc.VectorTile(new ch(this.rawTileData)).layers,this.sourceLayerCoder=new ad(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=qr(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 el(s.bufferedTilespaceGeometry,e,t,i,r)}));c.sort(tm);var h=null;l.elevation&&c.length>0&&(h=$d.create(l.elevation,this.tileID));for(var f,p={},d=function(l){var u=c[l];if(u===f)return"continue";f=u;var d=n.featureIndexArray.get(u),m=null;
1n.loadMatchingFeature(p,d,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 m||(m=Us(t,n.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(s,t,r,m,n.z,e.transform,e.pixelPosMatrix,h,a)}))},m=0;m<c.length;m++)d(m);return p}},{key:"loadMatchingFeature",value:function(e,t,i,r,n,a,o,s,l){var u=t.featureIndex,c=t.bucketIndex,h=t.sourceLayerIndex,f=t.layoutVertexArrayOffset,p=this.bucketLayerIDs[c];if(!r||function(e,t){for(var i=0;i<e.length;i++)if(t.indexOf(e[i])>=0)return!0;return!1}(r,p)){var d=this.sourceLayerCoder.decode(h),m=this.vtLayers[d].feature(u);if(i.needGeometry){var v=Vs(m,!0);if(!i.filter(new Aa(this.tileID.overscaledZ),v,this.tileID.canonical))return}else if(!i.filter(new Aa(this.tileID.overscaledZ),m))return;for(var y=this.getId(m,d),_=0;_<p.length;_++){var g=p[_];if(!(r&&r.indexOf(g)<0)){var x=a[g];if(x){var b={};void 0!==y&&s&&(b=s.getState(x.sourceLayer||"_geojsonTileLayer",y));var w=D({},o[g]);w.paint=em(w.paint,x.paint,m,b,n),w.layout=em(w.layout,x.layout,m,b,n);var k=!l||l(m,x,b,f);if(k){var T=new sd(m,this.z,this.x,this.y,y);T.layer=w;var E=e[g];void 0===E&&(E=e[g]=[]),E.push({featureIndex:u,feature:T,intersectionZ:k})}}}}}}},{key:"lookupSymbolFeatures",value:function(e,t,i,r,n,a,o,s){var l={};this.loadVTLayers();var u,c=qr(n),h=f(e);try{for(h.s();!(u=h.n()).done;){var p=u.value;this.loadMatchingFeature(l,{bucketIndex:i,sourceLayerIndex:r,featureIndex:p,layoutVertexArrayOffset:0},c,a,o,s,t)}}catch(d){h.e(d)}finally{h.f()}return l}},{key:"loadFeature",value:function(e){var t=e.featureIndex,i=e.sourceLayerIndex;this.loadVTLayers();var r=this.sourceLayerCoder.decode(i),n=this.vtFeatures[r];if(n[t])return n[t];var a=this.vtLayers[r].feature(t);return n[t]=a,a}},{key:"hasLayer",value:function(e){var t,i=f(this.bucketLayerIDs);try{for(i.s();!(t=i.n()).done;){var r,n=t.value,a=f(n);try{for(a.s();!(r=a.n()).done;)if(e===r.value)return!0}catch(o){a.e(o)}finally{a.f()}}}catch(o){i.e(o)}finally{i.f()}return!1}},{key:"getId",value:function(e,t){var i=e.id;return this.promoteId&&"boolean"==typeof(i=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]]
1)&&(i=Number(i)),i}}]),e}();function em(e,t,i,r,n){return j(e,(function(e,a){var o=t instanceof Ba?t.get(a):null;return o&&o.evaluate?o.evaluate(i,r,n):o}))}function tm(e,t){return t-e}An(Qd,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var im=function e(t){v(this,e);var i={},r=[];for(var n in t){var a=t[n],o=i[n]={};for(var s in a.glyphs){var l=a.glyphs[+s];if(l&&0!==l.bitmap.width&&0!==l.bitmap.height){var u=l.metrics.localGlyph?2:1,c={x:0,y:0,w:l.bitmap.width+2*u,h:l.bitmap.height+2*u};r.push(c),o[s]=c}}}var h=Dh(r),f=h.w,p=h.h,d=new ou({width:f||1,height:p||1});for(var m in t){var y=t[m];for(var _ in y.glyphs){var g=y.glyphs[+_];if(g&&0!==g.bitmap.width&&0!==g.bitmap.height){var x=i[m][_],b=g.metrics.localGlyph?2:1;ou.copy(g.bitmap,d,{x:0,y:0},{x:x.x+b,y:x.y+b},g.bitmap)}}}this.image=d,this.positions=i};An(im,"GlyphAtlas");var rm=function(){function e(t){v(this,e),this.tileID=new Cc(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile,this.tileTransform=dp(t.tileID.canonical,t.projection),this.projection=t.projection}return y(e,[{key:"parse",value:function(e,t,i,r,n){var a=this;this.status="parsing",this.data=e,this.collisionBoxArray=new ko;var o=new ad(Object.keys(e.layers).sort()),s=new Qd(this.tileID,this.promoteId);s.bucketLayerIDs=[];var l,u,c,h,p={},d=new id(256,256),m={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:d,availableImages:i},v=t.familiesBySource[this.source];for(var y in v){var _=e.layers[y];if(_){var g,x=!1,b=!1,w=f(v[y]);try{for(w.s();!(g=w.n()).done;)"symbol"===g.value[0].type?x=!0:b=!0}catch(O){w.e(O)}finally{w.f()}if((!0!==this.isSymbolTile||x)&&(!1!==this.isSymbolTile||b)){1===_.version&&q('Vector tile source "'.concat(this.source,'" layer "').concat(y,'" does not use vector tile spec v2 and therefore may have some rendering errors.'));for(var k=o.encode(y),T=[],E=0;E<_.length;E++){var S=_.feature(E),A=s.getId(S,y);T.push({feature:S,id:A,index:E,sourceLayerIndex:k})}var M,I=f(v[y]);try{for(I.s();!(M=I.n()).done;){var C=M.value,z=C[0];void 0!==this.isSymbolTile&&"symbol"===z.type!==this.isSymbolTile||z.minzoom&&this.zoom<Math.floor(z.minzoom)||z.maxzoom&&this.zoom>=z.maxzoom||"none"!==z.visibility&&(nm(C,this.zoom,i),(p[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,m,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(C.map((function(e){return e.id}))))}}catch(O){I.e(O)}finally{I.f()}}}}d.trim();var D={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},L=j(m.glyphDependencies,(function(e){return Object.keys(e).map(Number)}));Object.keys(L).length?r.send("getGlyphs",{uid:this.uid,stacks:L},(function(e,t){l||(l=e,u=t,F.call(a))}),void 0,!1,D):u={};var B=Object.keys(m.iconDependencies);B.length?r.send("getImages",{icons:B,source:this.source,tileID:this.tileID,type:"icons"},(function(e,t){l||(l=e,c=t,F.call(a))}),void 0,!1,D):c={};var R=Object.keys(m.patternDependencies);function F(){if(l)return n(l);if(u&&c&&h){var e=new im(u),t=new Bh(c,h);for(var r in p){var a=p[r];a instanceof Zp?(nm(a.layers,this.zoom,i),Af(a,u,e.positions,c,t.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):a.hasPattern&&(a instanceof Vc||a instanceof Hu||a instanceof vc)&&(nm(a.layers,this.zoom,i),a.addFeatures(m,this.tileID.canonical,t.patternPositions,i,this.tileTransform))}this.status="done",n(null,{buckets:P(p).filter((function(e){return!e.isEmpty()})),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:d,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,F.call(a))}),void 0,!1,D):h={},F.call(this)}}]),e}();function nm(e,t,i){var r,n=new Aa(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 am=function(){function e(t){v(this,e),this.entries={}
1,this.scheduler=t}return y(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 om(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=We(e.request,(function(e,r,n,a){e?t(e):r&&t(null,{vectorTile:i?void 0:new uc.VectorTile(new ch(r)),rawData:r,cacheControl:n,expires:a})}));return function(){r.cancel(),t()}}),t)}e.ARRAY_TYPE=ul,e.AUTH_ERR_MSG=ye,e.Aabb=Kl,e.Actor=function(){function e(i,r,n){v(this,e),this.target=i,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},U(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=H()?i:t,this.scheduler=new nd}return y(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=J(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:r,mustQueue:a,sourceMapId:this.mapId,data:zn(t,l)},l),{cancel:function(){i&&delete n.callbacks[s],n.target.postMessage({id:s,type:"<cancel>",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("<cancel>"===i.type){var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n.cancel()}else if(i.mustQueue||H()){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("<response>"===t.type){var r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(Pn(t.error)):r(null,Pn(t.data)))}else{var n=J(this.globalScope)?void 0:[],a=t.hasCallback?function(t,r){delete i.cancelCallbacks[e],i.target.postMessage({id:e,type:"<response>",sourceMapId:i.mapId,error:t?zn(t):null,data:zn(r,n)},n)}:function(e){},o=Pn(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=Mc,e.Color=Ct,e.ColorMode=Zd,e.CullFaceMode=Xd,e.DEMData=Ud,e.DataConstantProperty=Ra,e.DedupedRequest=am,e.DepthMode=jd,e.EXTENT=ys,e.Elevation=function(){function e(){v(this,e)}return y(e,[{key:"isDataAvailableAtPoint",value:function(e){var t=this._source();if(!t||e.y<0||e.y>1)return!1;var i=t.getSource().maxzoom,r=1<<i,n=Math.floor(e.x),a=Math.floor((e.x-n)*r),o=Math.floor(e.y*r),s=this.findDEMTileFor(new Cc(i,n,i,a,o));return!(!s||!s.dem)}},{key:"getAtPointOrZero",value:function(e){var t=arguments.length>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];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<<n,o=Math.floor(e.x),s=e.x-o,l=new Cc(n,o,n,Math.floor(s*a),Math.floor(e.y*a)),u=this.findDEMTileFor(l);if(!u||!u.dem)return t;var c=u.dem,h=1<<u.tileID.canonical.z,f=(s*h-u.tileID.canonical.x)*c.dim,p=(e.y*h-u.tileID.canonical.y)*c.dim,d=Math.floor(f),m=Math.floor(p);return(i?this.exaggeration():1)*wi(wi(c.get(d,m),c.get(d,m+1),p-m),wi(c.get(d+1,m),c.get(d+1,m+1),p-m),f-d)}},{key:"getAtTileOffset",value:function(e,t,i){var r=1<<e.canonical.z;return this.getAtPointOrZero(new zs(e.wrap+(e.canonical.x+t/ys)/r,(e.canonical.y+i/ys)/r))}},{key:"getAtTileOffsetFunc",value:function(e,t,i,r){var n=this;return function(a){var o=n.getAtTileOffset(e,a.x,a.y),s=r.upVector(e.canonical,a.x,a.y);return Cl(s,s,o*r.upVectorScale(e.canonical,t,i).metersToTile),s}}},{key:"getForTilePoints",value:function(e,t,i,r){var n=this,a=$d.create(this,e,r);return!!a&&(t.forEach((function(e){e[2]=n.exaggeration()*a.getElevationAt(e[0],e[1],i)})),!0)}},{key:"getMinMaxForTile",value:function(e){var t=this.findDEMTileFor(e);if(!t||!t.dem)return null;for(var i=t.dem.tree,r=t.tileID,n=1<<e.canonical.z-r.canonical.z,a=e.canonical.x/n-r.canonical.x,o=e.canonical.y/n-r.canonical.y,s=0,l=0;l<e.canonical.z-r.canonical.z&&!i.leaves[s];l++){a*=2,o*=2;var u=2*Math.floor(o)+Math.floor(a);s=i.childOffsets[s]+u,a%=1,o%=1}return{min:this.exaggeration()*i.minimums[s],max:this.exaggeration()*i.maximums[s]}}},{key:"getMinElevationBelowMSL",value:function(){throw new Error("Pure virtual method called.")}},{key:"raycast",value:function(e,t,i){throw new Error("Pure virtual method called.")}},{key:"pointCoordinate",value:function(e){throw new Error("Pure virtual method called.")}},{key:"_source",value:function(){throw new Error("Pure virtual method called.")}},{key:"exaggeration",value:function(){throw new Error("Pure virtual method called.")}},{key:"findDEMTileFor",value:function(e){throw new Error("Pure virtual method called.")}},{key:"visibleDemTiles",get:function(){throw new Error("Getter must be implemented in subclass.")}}]),e}(),e.ErrorEvent=rt,e.EvaluationParameters=Aa,e.Event=it,e.Evented=nt,e.FillExtrusionBucket=vc,e.Frustum=Yl,e.FrustumCorners=Hl,e.GLOBE_METERS_TO_ECEF=Vf,e.GLOBE_RADIUS=Uf,e.GLOBE_SCALE_MATCH_LATITUDE=45,e.GLOBE_ZOOM_THRESHOLD_MAX=6,e.GLOBE_ZOOM_THRESHOLD_MIN=5,e.GlobeSharedBuffers=function(){function e(t){v(this,e),this._createGrid(t),this._createPoles(t)}return y(e,[{key:"destroy",value:function(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();var e,t=f(this._poleSegments);try{for(t.s();!(e=t.n()).done;)e.value.destroy()}catch(o){t.e(o)}finally{t.f()}var i,r=f(this._gridSegments);try{for(r.s();!(i=r.n()).done;)i.value.destroy()}catch(o){r.e(o)}finally{r.f()}if(this._wireframeIndexBuffer){this._wireframeIndexBuffer.destroy();var n,a=f(this._wireframeSegments);try{for(a.s();!(n=a.n()).done;)n.value.destroy()}catch(o){a.e(o)}finally{a.f()}}}},{key:"_createGrid",value:function(e){for(var t=new Ha,i=new co,r=65,n=0;n<r;n++)for(var a=0;a<r;a++)t.emplaceBack(a,n);this._gridSegments=[];for(var o=0,s=0;o<jf.length;o++){for(var l=jf[o],u=0;u<l;u++)for(var c=0;c<64;c++){var h=u*r+c;i.emplaceBack(h+1,h,h+r),i.emplaceBack(h+r,h+r+1,h+1)}var f=64*l*2;this._gridSegments.push(vs.simpleSegment(0,s,(l+1)*r,f)),s+=f}this._gridBuffer=e.createVertexBuffer(t,Of.members),this._gridIndexBuffer=e.createIndexBuffer(i,!0)}},{key:"_createPoles",value:function(e){for(var t=new co,i=0;i<=64;i++)t.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=e.createIndexBuffer(t,!0);var r=new mo,n=new mo;this._poleSegments=[];for(var a=0,o=0;a<5;a++){var s=360/(1<<a);r.emplaceBack(0,-Uf,0,.5,0),n.emplaceBack(0,-Uf,0,.5,1);for(var l=0;l<=64;l++){var u=l/64,c=wi(0,s,u),f=ep(hp,fp,c,Uf),p=h(f,3),d=p[0],m=p[1],v=p[2];r.emplaceBack(d,m,v,u,0),n.emplaceBack(d,m,v,u,1)}
1this._poleSegments.push(vs.simpleSegment(o,0,66,64)),o+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,Rf,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(n,Rf,!1)}},{key:"getGridBuffers",value:function(e){return[this._gridBuffer,this._gridIndexBuffer,this._gridSegments[e]]}},{key:"getPoleBuffers",value:function(e){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},{key:"getWirefameBuffers",value:function(e,t){if(!this._wireframeSegments){var i=new yo,r=64,n=r+1;this._wireframeSegments=[];for(var a=0,o=0;a<jf.length;a++){for(var s=jf[a],l=0;l<s;l++)for(var u=0;u<r;u++){var c=l*n+u;i.emplaceBack(c,c+1),i.emplaceBack(c,c+n),i.emplaceBack(c,c+n+1)}var h=s*r*3;this._wireframeSegments.push(vs.simpleSegment(0,o,(s+1)*n,h)),o+=h}this._wireframeIndexBuffer=e.createIndexBuffer(i)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[t]]}}]),e}(),e.GlyphManager=ff,e.ImagePosition=Lh,e.LineAtlas=id,e.LngLat=xs,e.LngLatBounds=_s,e.LocalGlyphMode=hf,e.MAX_MERCATOR_LATITUDE=Is,e.MercatorCoordinate=zs,e.ONE_EM=$c,e.OverscaledTileID=Cc,e.Properties=ja,e.RGBAImage=su,e.Ray=Xl,e.RequestManager=function(){function e(t,i,r){v(this,e),this._transformRequestFn=t,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}return y(e,[{key:"_createSkuToken",value:function(){var e=function(){for(var e="",t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",ve,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}},{key:"_isSkuTokenExpired",value:function(){return Date.now()>this._skuTokenExpiresAt}},{key:"transformRequest",value:function(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}},{key:"normalizeStyleURL",value:function(e,t){if(!_e(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(!_e(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(!_e(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 _e(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),we(n))}},{key:"normalizeTileURL",value:function(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!_e(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(fe.supported?".webp":"$1")),"raster"===r.authority?r.path="/".concat(he.RASTER_URL_PREFIX).concat(r.path):(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/".concat(he.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)||he.ACCESS_TOKEN;return he.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(he.RASTER_URL_PREFIX,"/"),"")):r+="tiles/".concat(i.path.replace("/".concat(he.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&&_e(t),n=[],a=f(e.tiles||[]);try{for(a.s();!(i=a.n()).done;){var o=i.value;ge(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://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",r=be(he.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)),!he.REQUIRE_ACCESS_TOKEN)return we(e);if(t=t||he.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||"")),we(e)}}]),e}(),e.ResourceType=Ne,e.SegmentVector=vs,e.SourceCache=Hd,e.StencilMode=Gd,e.StructArrayLayout1ui2=_o,e.StructArrayLayout2f1f2i16=so,e.StructArrayLayout2i4=Ha,e.StructArrayLayout2ui4=yo,e.StructArrayLayout3f12=uo,e.StructArrayLayout3ui6=co,e.StructArrayLayout4i8=Ka,e.StructArrayLayout5f20=mo,e.Texture=td,e.Tile=M
1d,e.Transitionable=Ca,e.Uniform1f=Xo,e.Uniform1i=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=0,r}return y(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}(Wo),e.Uniform2f=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=[0,0],r}return y(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}(Wo),e.Uniform3f=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=[0,0,0],r}return y(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}(Wo),e.Uniform4f=Ho,e.UniformColor=Yo,e.UniformMatrix2f=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=$o,r}return y(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}(Wo),e.UniformMatrix3f=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=Jo,r}return y(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}(Wo),e.UniformMatrix4f=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).current=Ko,r}return y(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}(Wo),e.UnwrappedTileID=Ic,e.ValidationError=Rr,e.VectorTileWorkerSource=function(e){d(i,e);var t=m(i);function i(e,r,n,a,o){var s;return v(this,i),(s=t.call(this)).actor=e,s.layerIndex=r,s.availableImages=n,s.loadVectorData=o||om,s.loading={},s.loaded={},s.deduped=new am(e.scheduler),s.isSpriteLoaded=a,s.scheduler=e.scheduler,s}return y(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 rm(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 uc.VectorTile(new ch(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=te(n);o.length>0&&(r.resourceTiming=JSON.parse(JSON.stringify(o)))}t(null,D({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}
1):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=dp(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}(nt),e.WritingMode=Rh,e.ZoomHistory=Dn,e.add=El,e.addDynamicAttributes=Vp,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=z,e.bezier=S,e.bindAll=U,e.boundsAttributes=Sd,e.bufferConvexPolygon=function(e,t){for(var i=[],r=0;r<e.length;r++){var n=C(r-1,-1,e.length-1),a=C(r+1,-1,e.length-1),o=e[r],s=e[a],l=e[n].sub(o).unit(),u=s.sub(o).unit(),c=u.angleWithSep(l.x,l.y),h=l.add(u).unit().mult(-1*t/Math.sin(c/2));i.push(o.add(h))}return i},e.cacheEntryPossiblyAdded=function(e){++je>Le&&(e.getActor().send("enforceCacheSizeLimit",De),je=0)},e.calculateGlobeLabelMatrix=function(e,t){var i=e.point,r=sp(i.x,i.y,e.worldSize/e._pixelsPerMercatorPixel,0,0);return pl(r,r,op(Hf(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 sp(i,r,e.worldSize,a,o)},e.calculateGlobeMercatorMatrix=function(e){var t=e.pixelsPerMeter,i=t/Es(1,e.center.lat),r=hl(new Float64Array(16));return dl(r,r,[e.point.x,e.point.y,0]),ml(r,r,[i,i,t]),Float32Array.from(r)},e.circumferenceAtLatitude=ws,e.clamp=M,e.clearTileCache=function(e){var t=Fe(),i=[];for(var r in Be)t&&i.push(t.delete(r)),delete Be[r];e&&Promise.all(i).catch(e).then((function(){return e()}))},e.clipLine=sf,e.clone=function(e){var t=new ul(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=G,e.collisionCircleLayout=Jc,e.config=he,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 ul(16);return ul!=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=cl,e.createExpression=Cr,e.createLayout=Wa,e.createStyleLayer=function(e){return"custom"===e.type?new Jp(e):new ed[e.type](e)},e.cross=Ll,e.degToRad=w,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=Dl,e.ease=A,e.easeCubicInOut=E,e.emitValidationErrors=kn,e.endsWith=V,e.enforceCacheSizeLimit=function(e){for(var t in Be)Oe(t),Be[t].then((function(t){t.keys().then((function(i){for(var r=0;r<i.length-e;r++)t.delete(i[r])}))}))},e.evaluateSizeForFeature=th,e.evaluateSizeForZoom=ih,e.evaluateVariableOffset=Sf,e.evented=ka,e.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.exactEquals$1=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},e.exported=ce,e.exported$1=fe,e.extend=D,e.extend$1=ot,e.fillExtrusionHeightLift=kc,e.filterObject=N,e.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},e.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,c=r*o,h=r*s,f=n*o,p=n*s,d=n*l,m=a*o,v=a*s,y=a*l;return e[0]=1-h-d,e[1]=c+y,e[2]=f-v,e[3]=0,e[4]=c-y,e[5]=1-u-d,e[6]=p+m,e[7]=0,e[8]=f+v,e[9]=p-m,e[10]=1-u-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.fromScaling=_l,e.furthestTileCorner=function(e){var t=Math.round((e+45+360)%360/90)%4;return T[t]},e.getAABBPointSquareDist=function(e,t,i){for(var r=0,n=0;n<2;++n){var a=i?i[n]:0;e[n]>a&&(r+=(e[n]-a)*(e[n]-a)),t[n]<a&&(r+=(a-t[n])*(a-t[n]))}return r},e.getAnchorAlignment=Hh,e.getAnchorJustification=Mf,e.getBounds=function(e){var t,i=1/0,r=1/0,n=-1/0,a=-1/0,o=f(e);try{for(o.s();!(t=o.n()).done;){var s=t.value;i=Math.min(i,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),a=Math.max(a,s.y)}}catch(l){o.e(l)}finally{o.f()}return{min:new _(i,r),max:new _(n,a)}},e.getColumn=Q,e.getGridMatrix=function(e,t,i){var r=t.getNorth(),n=t.getSouth(),a=t.getWest(),o=.015625;return[0,(t.getEast()-a)*o,1<<e.z,(n-r)/jf[i],0,e.y,r,a,o]},e.getImage=Qe,e.getJSON=function(e,t){return qe(D(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){var t=80.051129;e=M(e,-80.051129,t)/t*90;var i=Math.pow(Math.abs(Math.sin(w(e))),3);return Math.round(i*(jf.length-1))},e.getMapSessionAPI=ze,e.getPerformanceMeasurement=te,e.getProjection=Bp,e.getRTLTextPluginStatus=Ta,e.getReferrer=Ze,e.getTilePoint=function(e,t){var i=t.x,r=t.y;return new _(((i-(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0))*e.scale-e.x)*ys,(r*e.scale-e.y)*ys)},e.getTileVec3=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Tl(((t.x-i)*e.scale-e.x)*ys,(t.y*e.scale-e.y)*ys,Ms(t.z,t.y))},e.getVideo=function(e,i){var r=t.document.createElement("video");r.muted=!0,r.onloadstart=function(){i(null,r)};for(var n=0;n<e.length;n++){var a=t.document.createElement("source");Ye(e[n])||(r.crossOrigin="Anonymous"),a.src=e[n],r.appendChild(a)}return{cancel:function(){}}},e.globeCenterToScreenPoint=function(e){var t=[0,0,0],i=hl(new Float64Array(16));return pl(i,e.pixelMatrix,e.globeMatrix),Bl(t,t,i),new _(t[0],t[1])},e.globeDenormalizeECEF=op,e.globeECEFOrigin=function(e,t){var i=[0,0,0];return Bl(i,i,ap(Hf(t.canonical))),Bl(i,i,e),i},e.globeNormalizeECEF=ap,e.globePixelsToTileUnits=function(e,t){return ys/(512*Math.pow(2,e))*rp(Hf(t))},e.globePoleMatrixForTile=function(e,t,i){var r=hl(new Float64Array(16)),n=(t/(1<<e)-.5)*Math.PI*2;return yl(r,i.globeMatrix,n),Float32Array.from(r)},e.globeTileBounds=Hf,e.globeTiltAtLngLat=up,e.globeToMercatorTransition=lp,e.globeUseCustomAntiAliasing=function(e,t,i){var r=lp(i.zoom),n=e.style.map._antialias,a=!!t.extStandardDerivatives,o=t.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===r&&!n&&!o&&a}
1,e.identity=hl,e.identity$1=Zl,e.invert=fl,e.isFullscreen=function(){return!!t.document.fullscreenElement||!!t.document.webkitFullscreenElement},e.isLngLatBehindGlobe=function(e,t){return up(e,t)>Math.PI/2*1.01},e.isMapAuthenticated=function(e){return Pe.has(e)},e.isMapboxURL=_e,e.isSafariWithAntialiasingBug=function(e){var t=e.navigator?e.navigator.userAgent:null;return!!J(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=As,e.len=Vl,e.length=kl,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.loadVectorTile=om,e.makeRequest=qe,e.mapValue=function(e,t,i,r,n){return M((e-t)/(i-t)*(n-r)+r,r,n)},e.mercatorScale=Cs,e.mercatorXfromLng=ks,e.mercatorYfromLat=Ts,e.mercatorZfromAltitude=Es,e.mul=xl,e.mul$1=Ul,e.multiply=pl,e.multiply$1=function(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],p=i[1],d=i[2],m=i[3],v=i[4],y=i[5],_=i[6],g=i[7],x=i[8];return e[0]=f*r+p*o+d*u,e[1]=f*n+p*s+d*c,e[2]=f*a+p*l+d*h,e[3]=m*r+v*o+y*u,e[4]=m*n+v*s+y*c,e[5]=m*a+v*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},e.multiply$2=Al,e.nextPowerOfTwo=F,e.normalize=Pl,e.normalize$1=function(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},e.number=wi,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=ch,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;r<t.length;r++){var n=t[r];n in e&&(i[n]=e[n])}return i},e.plugin=Sa,e.pointGeometry=_,e.polygonContainsPoint=Qs,e.polygonIntersectsBox=el,e.polygonIntersectsPolygon=Zs,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 _(i,i),a=e.sub(n),o=t.add(n),s=[a,new _(o.x,a.y),o,new _(a.x,o.y)];return r&&s.push(a.clone()),s},e.posAttributes=Of,e.postMapLoadEvent=Ie,e.postTurnstileEvent=Ae,e.potpack=Dh,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=k,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:ga,pluginURL:xa}),ka.on("pluginStateChange",e),e},e.removeAuthState=function(e){Pe.delete(e)},e.renderColorRamp=uu,e.resample=Ds,e.rotateX=vl,e.rotateX$1=ql,e.rotateY=yl,e.rotateY$1=Wl,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=ml,e.scale$1=jl,e.scale$2=Cl,e.scaleAndAdd=zl,e.setCacheLimits=function(e,t){De=e,Le=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(ga===ma||ga===va||ga===ya)throw new Error("setRTLTextPlugin cannot be called multiple times.");xa=ce.resolveURL(e),ga=ma,_a=t,wa(),i||Ea()},e.smoothstep=I,e.spec=at,e.storeAuthState=function(e,t){t?Pe.add(e):Pe.delete(e)},e.sub=Ol,e.subtract=Sl,e.symbolSize=rh,e.tileAABB=function(e,t,i,r,n,a,o,s,l){if("globe"===l.name)return Jf(e,t,new Mc(i,r,n));var u=dp({z:i,x:r,y:n},l);return new Kl([(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=$f,e.tileTransform=dp,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=Bl,e.transformMat4$1=Nl,e.transformQuat=Rl,e.transitionTileAABBinECEF=Yf,e.translate=dl,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=ba,e.uniqueId=B,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 wn(nn(e))},e.validateFog=function(e){return wn(mn(e))},e.validateLayer=function(e){return wn(un(e))},e.validateLight=function(e){return wn(pn(e))},e.validateSource=function(e){return wn(fn(e))},e.validateStyle=gn,e.validateTerrain=function(e){return wn(dn(e))}
1,e.values=P,e.vectorTile=uc,e.version=ue,e.warnOnce=q,e.window=t,e.wrap=C})),_(["./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){v(this,t),this.keyCache={},e&&this.replace(e)}return y(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,p=function(e,t){for(var r={},n=0;n<e.length;n++){var a=t&&t[e[n].id]||i(e[n]);t&&(t[e[n].id]=a);var o=r[a];o||(o=r[a]=[]),o.push(e[n])}var s=[];for(var l in r)s.push(r[l]);return s}(e.values(this._layerConfigs),this.keyCache),d=f(p);try{for(d.s();!(h=d.n()).done;){var m=h.value.map((function(e){return a._layers[e.id]})),v=m[0];if("none"!==v.visibility){var y=v.source||"",_=this.familiesBySource[y];_||(_=this.familiesBySource[y]={});var g=v.sourceLayer||"_geojsonTileLayer",x=_[g];x||(x=_[g]=[]),x.push(m)}}}catch(b){d.e(b)}finally{d.f()}}}]),t}(),n=function(){function t(){v(this,t)}return y(t,[{key:"loadTile",value:function(t,i){var r=t.uid,n=t.encoding,a=t.rawImageData,o=t.padding,s=t.buildQuadTree,l=e.window.ImageBitmap&&a instanceof e.
1window.ImageBitmap?this.getImageData(a,o):a;i(null,new e.DEMData(r,l,n,o<1,s))}},{key:"getImageData",value:function(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}]),t}(),a=function e(t,i){var r,n=t&&t.type;if("FeatureCollection"===n)for(r=0;r<t.features.length;r++)e(t.features[r],i);else if("GeometryCollection"===n)for(r=0;r<t.geometries.length;r++)e(t.geometries[r],i);else if("Feature"===n)e(t.geometry,i);else if("Polygon"===n)l(t.coordinates,i);else if("MultiPolygon"===n)for(r=0;r<t.coordinates.length;r++)l(t.coordinates[r],i);return t};function l(e,t){if(0!==e.length){u(e[0],t);for(var i=1;i<e.length;i++)u(e[i],!t)}}function u(e,t){for(var i=0,r=0,n=0,a=e.length,o=a-1;n<a;o=n++){var s=(e[n][0]-e[o][0])*(e[o][1]+e[n][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!t&&e.reverse()}var c=e.vectorTile.VectorTileFeature.prototype.toGeoJSON,p=function(){function t(i){v(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 y(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(d){r.e(d)}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 p=l.value;c.push(new e.pointGeometry(p[0],p[1]))}}catch(d){h.e(d)}finally{h.f()}o.push(c)}}catch(d){s.e(d)}finally{s.f()}return o}},{key:"toGeoJSON",value:function(e,t,i){return c.call(this,e,t,i)}}]),t}(),_=function(){function t(i){v(this,t),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=i.length,this._features=i}return y(t,[{key:"feature",value:function(e){return new p(this._features[e])}}]),t}(),g=e.vectorTile.VectorTileFeature,x=b;function b(e,t){this.options=t||{},this.features=e,this.length=e.length}function w(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}b.prototype.feature=function(e){return new w(this.features[e],this.options.extent)},w.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var i=0;i<t.length;i++){for(var r=t[i],n=[],a=0;a<r.length;a++)n.push(new e.pointGeometry(r[a][0],r[a][1]));this.geometry.push(n)}return this.geometry},w.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,i=-1/0,r=1/0,n=-1/0,a=0;a<e.length;a++)for(var o=e[a],s=0;s<o.length;s++){var l=o[s];t=Math.min(t,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[t,r,i,n]},w.prototype.toGeoJSON=g.prototype.toGeoJSON;var k=E,T=x;function E(t){var i=new e.pbf;return function(e,t){for(var i in e.layers)t.writeMessage(3,S,e.layers[i])}(t,i),i.finish()}function S(e,t){var i;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,A,r);var n=r.keys;for(i=0;i<n.length;i++)t.writeStringField(3,n[i]);var a=r.values;for(i=0;i<a.length;i++)t.writeMessage(4,P,a[i])}function A(e,t){var i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,M,e),t.writeVarintField(3,i.type),t.writeMessage(4,z,i)}function M(e,t){var i=e.feature,r=e.keys,n=e.values,a=e.keycache,o=e.valuecache;for(var s in i.properties){var l=i.properties[s],u=a[s];if(null!==l){void 0===u&&(r.push(s),a[s]=u=r.length-1),t.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,f=o[h];void 0===f&&(n.push(l),o[h]=f=n.length-1),t.writeVarint(f)}}}function I(e,t){return(t<<3)+(7&e)}function C(e){return e<<1^e>>31}function z(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,a=0,o=i.length,s=0;s<o;s++){var l=i[s],u=1;1===r&&(u=l.length),t.writeVarint(I(1,u));for(var c=3===r?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==r&&t.writeVarint(I(2,c-1));var f=l[h].x-n,p=l[h].y-a;t.writeVarint(C(f)),t.writeVarint(C(p)),n+=f,a+=p}3===r&&t.writeVarint(I(7,1))}}function P(e,t){var i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}function D(e,t,i,r,n,a){if(!(n-r<=i)){var o=r+n>>1;L(e,t,o,r,n,a%2),D(e,t,i,r,o-1,a+1),D(e,t,i,o+1,n,a+1)}}function L(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);L(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,p=n;for(B(e,t,r,i),t[2*n+a]>h&&B(e,t,r,n);f<p;){for(B(e,t,f,p),f++,p--;t[2*f+a]<h;)f++;for(;t[2*p+a]>h;)p--}t[2*r+a]===h?B(e,t,r,p):B(e,t,++p,n),p<=i&&(r=p+1),i<=p&&(n=p-1)}}function B(e,t,i,r){R(e,i,r),R(t,2*i,2*r),R(t,2*i+1,2*r+1)}function R(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function F(e,t,i,r){var n=e-i,a=t-r;return n*n+a*a}k.fromVectorTileJs=E,k.fromGeojsonVt=function(e,t){t=t||{};var i={};for(var r in e)i[r]=new x(e[r].features,t),i[r].name=r,i[r].version=t.version,i[r].extent=t.extent;return E({layers:i})},k.GeoJSONWrapper=T;var O,U=function(e){return e[0]},V=function(e){return e[1]},j=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:U,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:V,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Float64Array;v(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<t.length;u++)s[u]=u,l[2*u]=i(t[u]),l[2*u+1]=r(t[u]);D(s,l,n,0,s.length-1,0)}return y(e,[{key:"range",value:function(e,t,i,r){return function(e,t,i,r,n,a,o){for(var s,l,u=[0,e.length-1,0],c=[];u.length;){var h=u.pop(),f=u.pop(),p=u.pop();if(f-p<=o)for(var d=p;d<=f;d++)s=t[2*d],l=t[2*d+1],s>=i&&s<=n&&l>=r&&l<=a&&c.push(e[d]);else{var m=Math.floor((p+f)/2);s=t[2*m],l=t[2*m+1],s>=i&&s<=n&&l>=r&&l<=a&&c.push(e[m]);var v=(h+1)%2;
1(0===h?i<=s:r<=l)&&(u.push(p),u.push(m-1),u.push(v)),(0===h?n>=s:a>=l)&&(u.push(m+1),u.push(f),u.push(v))}}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++)F(t[2*f],t[2*f+1],i,r)<=l&&s.push(e[f]);else{var p=Math.floor((h+c)/2),d=t[2*p],m=t[2*p+1];F(d,m,i,r)<=l&&s.push(e[p]);var v=(u+1)%2;(0===u?i-n<=d:r-n<=m)&&(o.push(h),o.push(p-1),o.push(v)),(0===u?i+n>=d:r+n>=m)&&(o.push(p+1),o.push(c),o.push(v))}}return s}(this.ids,this.coords,e,t,i,this.nodeSize)}}]),e}(),N={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(e){return e}},G=Math.fround||(O=new Float32Array(1),function(e){return O[0]=+e,O[0]}),Z=function(){function e(t){v(this,e),this.options=$(Object.create(N),t),this.trees=new Array(this.options.maxZoom+1)}return y(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<e.length;l++)e[l].geometry&&s.push(W(e[l],l));this.trees[n+1]=new j(s,Q,ee,a,Float32Array),i&&console.timeEnd(o);for(var u=n;u>=r;u--){var c=+Date.now();s=this._cluster(s,u),this.trees[u]=new j(s,Q,ee,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(Y(i),K(a),Y(n),K(r)),h=[],p=f(c);try{for(p.s();!(l=p.n()).done;){var d=l.value,m=u.points[d];h.push(m.numPoints?X(m):this.points[m.index])}}catch(v){p.e(v)}finally{p.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,p=n.points[h];p.parentId===e&&u.push(p.numPoints?X(p):this.points[p.index])}}catch(d){c.e(d)}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):n<r?n++:e.push(l),e.length===i)break}}catch(c){s.e(c)}finally{s.f()}return n}},{key:"_addTileFeatures",value:function(e,t,i,r,n,a){var o,s=f(e);try{for(s.s();!(o=s.n()).done;){var l=t[o.value],u=l.numPoints,c=void 0,h=void 0,p=void 0;if(u)c=H(l),h=l.x,p=l.y;else{var d=this.points[l.index];c=d.properties,h=Y(d.geometry.coordinates[0]),p=K(d.geometry.coordinates[1])}var m={type:1,geometry:[[Math.round(this.options.extent*(h*n-i)),Math.round(this.options.extent*(p*n-r))]],tags:c},v=void 0;u?v=l.id:this.options.generateId?v=l.index:this.points[l.index].id&&(v=this.points[l.index].id),void 0!==v&&(m.id=v),a.features.push(m)}}catch(y){s.e(y)}finally{s.f()}}},{key:"_limitZoom",value:function(e){return Math.max(this.options.minZoom,Math.min(+e,this.options.maxZoom+1))}},{key:"_cluster",value:function(e,t){for(var i=[],r=this.options,n=r.radius,a=r.extent,o=r.reduce,s=r.minPoints,l=n/(a*Math.pow(2,t)),u=0;u<e.length;u++){var c=e[u];if(!(c.zoom<=t)){c.zoom=t;var h,p=this.trees[t+1],d=p.within(c.x,c.y,l),m=c.numPoints||1,v=m,y=f(d);try{for(y.s();!(h=y.n()).done;){var _=h.value,g=p.points[_];g.zoom>t&&(v+=g.numPoints||1)}}catch(D){y.e(D)}finally{y.f()}if(v>m&&v>=s){var x,b=c.x*m,w=c.y*m,k=o&&m>1?this._map(c,!0):null,T=(u<<5)+(t+1)+this.points.length,E=f(d);try{for(E.s();!(x=E.n()).done;){var S=x.value,A=p.points[S];if(!(A.zoom<=t)){A.zoom=t;var M=A.numPoints||1;b+=A.x*M,w+=A.y*M,A.parentId=T,o&&(k||(k=this._map(c,!0)),o(k,this._map(A)))}}}catch(D){E.e(D)}finally{E.f()}c.parentId=T,i.push(q(b/v,w/v,T,v,k))}else if(i.push(c),v>1){var I,C=f(d);try{for(C.s();!(I=C.n()).done;){var z=I.value,P=p.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?$({},e.properties):e.properties;var i=this.points[e.index].properties,r=this.options.map(i);return t&&r===i?$({},r):r}}]),e}();function q(e,t,i,r,n){return{x:G(e),y:G(t),zoom:1/0,id:i,parentId:-1,numPoints:r,properties:n}}function W(e,t){var i=h(e.geometry.coordinates,2),r=i[0],n=i[1];return{x:G(Y(r)),y:G(K(n)),zoom:1/0,index:t,parentId:-1}}function X(e){return{type:"Feature",id:e.id,properties:H(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),J(e.y)]}};var t}function H(e){var t=e.numPoints,i=t>=1e4?"".concat(Math.round(t/1e3),"k"):t>=1e3?Math.round(t/100)/10+"k":t;return $($({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:i})}function Y(e){return e/360+.5}function K(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 J(e){var t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function $(e,t){for(var i in t)e[i]=t[i];return e}function Q(e){return e.x}function ee(e){return e.y}function te(e,t,i,r){for(var n,a=r,o=i-t>>
vendor: 9,999 bytes, line 1
11,s=i-t,l=e[t],u=e[t+1],c=e[i],h=e[i+1],f=t+3;f<i;f+=3){var p=ie(e[f],e[f+1],l,u,c,h);if(p>a)n=f,a=p;else if(p===a){var d=Math.abs(f-o);d<s&&(n=f,s=d)}}a>r&&(n-t>3&&te(e,t,n,r),e[n+2]=a,i-n>3&&te(e,n,i,r))}function ie(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 re(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)ne(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<t.length;r++)ne(e,t[r]);else if("MultiPolygon"===i)for(r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)ne(e,t[r][n])}(n),n}function ne(e,t){for(var i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function ae(e,t,i,r){if(t.geometry){var n=t.geometry.coordinates,a=t.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===a)oe(n,s);else if("MultiPoint"===a)for(var u=0;u<n.length;u++)oe(n[u],s);else if("LineString"===a)se(n,s,o,!1);else if("MultiLineString"===a){if(i.lineMetrics){for(u=0;u<n.length;u++)se(n[u],s=[],o,!1),e.push(re(l,"LineString",s,t.properties));return}le(n,s,o,!1)}else if("Polygon"===a)le(n,s,o,!0);else{if("MultiPolygon"!==a){if("GeometryCollection"===a){for(u=0;u<t.geometry.geometries.length;u++)ae(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<n.length;u++){var c=[];le(n[u],c,o,!0),s.push(c)}}e.push(re(l,a,s,t.properties))}}function oe(e,t){t.push(ue(e[0])),t.push(ce(e[1])),t.push(0)}function se(e,t,i,r){for(var n,a,o=0,s=0;s<e.length;s++){var l=ue(e[s][0]),u=ce(e[s][1]);t.push(l),t.push(u),t.push(0),s>0&&(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,te(t,0,c,i),t[c+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function le(e,t,i,r){for(var n=0;n<e.length;n++){var a=[];se(e[n],a,i,r),t.push(a)}}function ue(e){return e/360+.5}function ce(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 he(e,t,i,r,n,a,o,s){if(r/=t,a>=(i/=t)&&o<r)return e;if(o<i||a>=r)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],h=c.geometry,f=c.type,p=0===n?c.minX:c.minY,d=0===n?c.maxX:c.maxY;if(p>=i&&d<r)l.push(c);else if(!(d<i||p>=r)){var m=[];if("Point"===f||"MultiPoint"===f)fe(h,m,i,r,n);else if("LineString"===f)pe(h,m,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===f)me(h,m,i,r,n,!1);else if("Polygon"===f)me(h,m,i,r,n,!0);else if("MultiPolygon"===f)for(var v=0;v<h.length;v++){var y=[];me(h[v],y,i,r,n,!0),y.length&&m.push(y)}if(m.length){if(s.lineMetrics&&"LineString"===f){for(v=0;v<m.length;v++)l.push(re(c.id,f,m[v],c.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===m.length?(f="LineString",m=m[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===m.length?"Point":"MultiPoint"),l.push(re(c.id,f,m,c.tags))}}}return l.length?l:null}function fe(e,t,i,r,n){for(var a=0;a<e.length;a+=3){var o=e[a+n];o>=i&&o<=r&&(t.push(e[a]),t.push(e[a+1]),t.push(e[a+2]))}}function pe(e,t,i,r,n,a,o){for(var s,l,u=de(e),c=0===n?ye:_e,h=e.start,f=0;f<e.length-3;f+=3){var p=e[f],d=e[f+1],m=e[f+2],v=e[f+3],y=e[f+4],_=0===n?p:d,g=0===n?v:y,x=!1;o&&(s=Math.sqrt(Math.pow(p-v,2)+Math.pow(d-y,2))),_<i?g>i&&(l=c(u,p,d,v,y,i),o&&(u.start=h+s*l)):_>r?g<r&&(l=c(u,p,d,v,y,r),o&&(u.start=h+s*l)):ve(u,p,d,m),g<i&&_>=i&&(l=c(u,p,d,v,y,i),x=!0),g>r&&_<=r&&(l=c(u,p,d,v,y,r),x=!0),!a&&x&&(o&&(u.end=h+s*l),t.push(u),u=de(e)),o&&(h+=s)}var b=e.length-3;p=e[b],d=e[b+1],m=e[b+2],(_=0===n?p:d)>=i&&_<=r&&ve(u,p,d,m),b=u.length-3,a&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&ve(u,u[0],u[1],u[2]),u.length&&t.push(u)}function de(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function me(e,t,i,r,n,a){for(var o=0;o<e.length;o++)pe(e[o],t,i,r,n,a,!1)}function ve(e,t,i,r){e.push(t),e.push(i),e.push(r)}function ye(e,t,i,r,n,a){var o=(a-t)/(r-t);return e.push(a),e.push(i+(n-i)*o),e.push(1),o}function _e(e,t,i,r,n,a){var o=(a-i)/(n-i);return e.push(t+(r-t)*o),e.push(a),e.push(1),o}function ge(e,t){for(var i=[],r=0;r<e.length;r++){var n,a=e[r],o=a.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)n=xe(a.geometry,t);else if("MultiLineString"===o||"Polygon"===o){n=[];for(var s=0;s<a.geometry.length;s++)n.push(xe(a.geometry[s],t))}else if("MultiPolygon"===o)for(n=[],s=0;s<a.geometry.length;s++){for(var l=[],u=0;u<a.geometry[s].length;u++)l.push(xe(a.geometry[s][u],t));n.push(l)}i.push(re(a.id,o,n,a.tags))}return i}function xe(e,t){var i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(var r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function be(e,t){if(e.transformed)return e;var i,r,n,a=1<<e.z,o=e.x,s=e.y;for(i=0;i<e.features.length;i++){var l=e.features[i],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<u.length;r+=2)l.geometry.push(we(u[r],u[r+1],t,a,o,s));else for(r=0;r<u.length;r++){var h=[];for(n=0;n<u[r].length;n+=2)h.push(we(u[r][n],u[r][n+1],t,a,o,s));l.geometry.push(h)}}return e.transformed=!0,e}function we(e,t,i,r,n,a){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-a))]}function ke(e,t,i,r,n){for(var a=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){o.numFeatures++,Te(o,e[s],a,n);var l=e[s].minX,u=e[s].minY,c=e[s].maxX,h=e[s].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),c>o.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function Te(e,t,i,r){var n=t.geometry,a=t.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s<n.length;s+=3)o.push(n[s]),o.push(n[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===a)Ee(o,n,e,i,!1,!1);else if("MultiLineString"===a||"Polygon"===a)for(s=0;s<n.length;s++)Ee(o,n[s],e,i,"Polygon"===a,0===s);else if("MultiPolygon"===a)for(var l=0;l<n.length;l++){var u=n[l];for(s=0;s<u.length;s++)Ee(o,u[s],e,i,!0,0===s)}if(o.length){var c=t.tags||null;if("LineString"===a&&r.lineMetrics){for(var h in c={},t.tags)c[h]=t.tags[h];c.mapbox_clip_start=n.start/n.size,c.mapbox_clip_end=n.end/n.size}var f={geometry:o,type:"Polygon"===a||"MultiPolygon"===a?3:"LineString"===a||"MultiLineString"===a?2:1,tags:c};null!==t.id&&(f.id=t.id),e.features.push(f)}}function Ee(e,t,i,r,n,a){var o=r*r;if(r>0&&t.size<(n?o:r))i.numPoints+=t.length/3;else{for(var s=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>o)&&(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;r<n;a=r,r+=2)i+=(e[r]-e[a])*(e[r+1]+e[a+1]);if(i>0===t)for(r=0,n=e.length;r<n/2;r+=2){var o=e[r],s=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=o,e[n-1-r]=s}}(s,a),e.push(s)}}function Se(e,t){var i=(t=this.options=function(e,t){for(var i in t)e[i]=t[i];return e}(Object.create(this.options),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)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;r<e.features.length;r++)ae(i,e.features[r],t,r);else ae(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(r=function(e,t){var i=t.buffer/t.extent,r=e,n=he(e,1,-1-i,i,0,-1,2,t),a=he(e,1,1-i,2+i,0,-1,2,t);return(n||a)&&(r=he(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=ge(n,1).concat(r)),a&&(r=r.concat(ge(a,-1)))),r}(r,t)).length&&this.splitTile(r,0,0,0),i&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ae(e,t,i){return 32*((1<<e)*i+t)+e}function Me(e,t){var i=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);var r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return t(null,null);var n=new _(r.features),a=k(n);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),t(null,{vectorTile:n,rawData:a.buffer})}Se.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Se.prototype.splitTile=function(e,t,i,r,n,a,o){for(var s=[e,t,i,r],l=this.options,u=l.debug;s.length;){r=s.pop(),i=s.pop(),t=s.pop(),e=s.pop();var c=1<<t,h=Ae(t,i,r),f=this.tiles[h];if(!f&&(u>1&&console.time("creation"),f=this.tiles[h]=ke(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 p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(f.source=e,n){if(t===l.maxZoom||t===n)continue;var d=1<<n-t;if(i!==Math.floor(a/d)||r!==Math.floor(o/d))continue}else if(t===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,0!==e.length){u>1&&console.time("clipping");var m,v,y,_,g,x,b=.5*l.buffer/l.extent,w=.5-b,k=.5+b,T=1+b;m=v=y=_=null,g=he(e,c,i-b,i+k,0,f.minX,f.maxX,l),x=he(e,c,i+w,i+T,0,f.minX,f.maxX,l),e=null,g&&(m=he(g,c,r-b,r+k,1,f.minY,f.maxY,l),v=he(g,c,r+w,r+T,1,f.minY,f.maxY,l),g=null),x&&(y=he(x,c,r-b,r+k,1,f.minY,f.maxY,l),_=he(x,c,r+w,r+T,1,f.minY,f.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],t+1,2*i,2*r),s.push(v||[],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)}}},Se.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,a=r.debug;if(e<0||e>24)return null;
1var o=1<<e,s=Ae(e,t=(t%o+o)%o,i);if(this.tiles[s])return be(this.tiles[s],n);a>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[Ae(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]?be(this.tiles[s],n):null):null};var Ie=function(t){d(r,t);var i=m(r);function r(e,t,n,a,o){var s;return v(this,r),s=i.call(this,e,t,n,a,Me),o&&(s.loadGeoJSON=o),s}return y(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 Z(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<c.length;u++){var p=c[u],d=h(r[p],2),m=d[0],v=d[1],y=e.createExpression(v),_=e.createExpression("string"==typeof m?[m,["accumulated"],["get",p]]:m);n[p]=y.value,a[p]=_.value}return i.map=function(e){s.properties=e;var t,i={},r=f(l);try{for(r.s();!(t=r.n()).done;){var a=t.value;i[a]=n[a].evaluate(o,s)}}catch(u){r.e(u)}finally{r.f()}return i},i.reduce=function(e,t){s.properties=t;var i,r=f(l);try{for(r.s();!(i=r.n()).done;){var n=i.value;o.accumulated=e[n],e[n]=a[n].evaluate(o,s)}}catch(u){r.e(u)}finally{r.f()}},i}(t)).load(l.features):function(e,t){return new Se(e,t)}(l,t.geojsonVtOptions)}catch(s){return i(s)}r.loaded={};var p={};if(o){var d=e.getPerformanceMeasurement(n);d&&(p.resourceTiming={},p.resourceTiming[t.source]=JSON.parse(JSON.stringify(d)))}i(null,p)}))}},{key:"reloadTile",value:function(e,t){var i=this.loaded;return i&&i[e.uid]?o(s(r.prototype),"reloadTile",this).call(this,e,t):this.loadTile(e,t)}},{key:"loadGeoJSON",value:function(t,i){if(t.request)e.getJSON(t.request,i);else{if("string"!=typeof t.data)return i(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")))}}}},{key:"getClusterExpansionZoom",value:function(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}},{key:"getClusterChildren",value:function(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}},{key:"getClusterLeaves",value:function(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}]),r}(e.VectorTileWorkerSource),Ce=function(){function t(i){var r=this;v(this,t),this.self=i,this.actor=new e.Actor(i,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:"mercator"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:Ie},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(e,t){if(r.workerSourceTypes[e])throw new Error('Worker source with name "'.concat(e,'" already registered.'));r.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=function(t){if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}return y(t,[{key:"clearCaches",value:function(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],i()}},{key:"checkIfReady",value:function(e,t,i){i()}},{key:"setReferrer",value:function(e,t){this.referrer=t}},{key:"spriteLoaded",value:function(t,i){for(var r in this.isSpriteLoaded[t]=i,this.workerSources[t]){var n=this.workerSources[t][r];for(var a in n)n[a]instanceof e.VectorTileWorkerSource&&(n[a].isSpriteLoaded=i,n[a].fire(new e.Event("isSpriteLoaded")))}}},{key:"setImages",value:function(e,t,i){for(var r in this.availableImages[e]=t,this.workerSources[e]){var n=this.workerSources[e][r];for(var a in n)n[a].availableImages=t}i()}},{key:"enableTerrain",value:function(e,t,i){this.terrain=t,i()}},{key:"setProjection",value:function(t,i){this.projections[t]=e.getProjection(i)}},{key:"setLayers",value:function(e,t,i){this.getLayerIndex(e).replace(t),i()}},{key:"updateLayers",value:function(e,t,i){this.getLayerIndex(e).update(t.layers,t.removedIds),i()}},{key:"loadTile",value:function(t,i,r){var n=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).loadTile(n,r)}},{key:"loadDEMTile",value:function(t,i,r){var n=this.enableTerrain?e.extend({buildQuadTree:this.terrain},i):i;this.getDEMWorkerSource(t,i.source).loadTile(n,r)}},{key:"reloadTile",value:function(t,i,r){var n=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).reloadTile(n,r)}},{key:"abortTile",value:function(e,t,i){this.getWorkerSource(e,t.type,t.source).abortTile(t,i)}},{key:"removeTile",value:function(e,t,i){this.getWorkerSource(e,t.type,t.source).removeTile(t,i)}},{key:"removeSource",value:function(e,t,i){if(this.workerSources[e]&&this.workerSources[e][t.type]&&this.workerSources[e][t.type][t.source]){var r=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,i):i()}}},{key:"loadWorkerSource",value:function(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}},{key:"syncRTLPluginState",value:function(t,i,r){try{e.plugin.setState(i);var n=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=n){this.self.importScripts(n);var a=e.plugin.isParsed();r(a?void 0:new Error("RTL Text Plugin failed to import scripts from ".concat(n)),a)}}catch(e){r(e.toString())}}},{key:"getAvailableImages",value:function(e){var t=this.availableImages[e];return t||(t=[]),t}},{key:"getLayerIndex",value:function(e){var t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new r),t}},{key:"getWorkerSource",value:function(e,t,i){var r=this;return this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),this.workerSources[e][t][i]||(this.workerSources[e][t][i]=new this.workerSourceTypes[t]({send:function(t,i,n,a,o,s){r.actor.send(t,i,n,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])),this.workerSources[e][t][i]}},{key:"getDEMWorkerSource",value:function(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new n),this.demWorkerSources[e][t]}},{key:"enforceCacheSizeLimit",value:function(t,i){e.enforceCacheSizeLimit(i)}},{key:"getWorkerPerformanceMetrics",value:function(e,t,i){i(void 0,void 0)}}]),t}();return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Ce(self)),Ce})),_(["./shared"],(function(e){function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(var r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;
1for(var n in e)if(!t(e[n],i[n]))return!1;return!0}return e===i}var i=u;function u(e){return!function(e){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{t=new Worker(r),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),e}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===p[t=e&&e.failIfMajorPerformanceCaveat]&&(p[t]=function(e){var t,i=function(e){var t=document.createElement("canvas"),i=Object.create(u.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=e,t.getContext("webgl",i)||t.getContext("experimental-webgl",i)}(e);if(!i)return!1;try{t=i.createShader(i.VERTEX_SHADER)}catch(e){return!1}return!(!t||i.isContextLost())&&(i.shaderSource(t,"void main() {}"),i.compileShader(t),!0===i.getShaderParameter(t,i.COMPILE_STATUS))}(t)),p[t]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var t}(e)}var p={};function _(t,i,r){var n=e.window.document.createElement(t);return void 0!==i&&(n.className=i),r&&r.appendChild(n),n}function g(t,i,r){for(var n=e.window.document.createElementNS("http://www.w3.org/2000/svg",t),a=0,o=Object.keys(i);a<o.length;a++){var s=o[a];n.setAttributeNS(null,s,i[s])}return r&&r.appendChild(n),n}u.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};var x,b=e.window.document&&e.window.document.documentElement.style,w=b&&void 0!==b.userSelect?"userSelect":"WebkitUserSelect";function k(){b&&w&&(x=b[w],b[w]="none")}function T(){b&&w&&(b[w]=x)}function E(t){t.preventDefault(),t.stopPropagation(),e.window.removeEventListener("click",E,!0)}function S(){e.window.addEventListener("click",E,!0),e.window.setTimeout((function(){e.window.removeEventListener("click",E,!0)}),0)}function A(e,t){var i=e.getBoundingClientRect();return C(e,i,t)}function M(e,t){for(var i=e.getBoundingClientRect(),r=[],n=0;n<t.length;n++)r.push(C(e,i,t[n]));return r}function I(t){return void 0!==e.window.InstallTrigger&&2===t.button&&t.ctrlKey&&e.window.navigator.platform.toUpperCase().indexOf("MAC")>=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){d(r,t);var i=m(r);function r(){var t;return v(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 y(r,[{key:"isLoaded",value:function(){return this.loaded}}
1,{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]<r||a[1]<a[0]||t<a[1])return!1;r=a[1]}}catch(o){n.e(o)}finally{n.f()}return!0}},{key:"_validateContent",value:function(e,t){return!(e&&(4!==e.length||e[0]<0||t.data.width<e[0]||e[1]<0||t.data.height<e[1]||e[2]<0||t.data.width<e[2]||e[3]<0||t.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}},{key:"updateImage",value:function(e,t){t.version=this.images[e].version+1,this.images[e]=t,this.updatedImages[e]=!0}},{key:"removeImage",value:function(e){var t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}},{key:"listImages",value:function(){return Object.keys(this.images)}},{key:"getImages",value:function(e,t){var i=!0;if(!this.isLoaded()){var r,n=f(e);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.images[a]||(i=!1)}}catch(o){n.e(o)}finally{n.f()}}this.isLoaded()||i?this._notify(e,t):this.requestors.push({ids:e,callback:t})}},{key:"_notify",value:function(t,i){var r,n={},a=f(t);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.images[o]||this.fire(new e.Event("styleimagemissing",{id:o}));var s=this.images[o];s?n[o]={data:s.data.clone(),pixelRatio:s.pixelRatio,sdf:s.sdf,version:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,hasRenderCallback:Boolean(s.userImage&&s.userImage.render)}:e.warnOnce('Image "'.concat(o,'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.'))}}catch(l){a.e(l)}finally{a.f()}i(null,n)}},{key:"getPixelSize",value:function(){var e=this.atlasImage;return{width:e.width,height:e.height}}},{key:"getPattern",value:function(t){var i=this.patterns[t],r=this.getImage(t);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{var n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},a=new e.ImagePosition(n,r);this.patterns[t]={bin:n,position:a}}return this._updatePatternAtlas(),this.patterns[t].position}},{key:"bind",value:function(t){var i=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new e.Texture(t,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}},{key:"_updatePatternAtlas",value:function(){var t=[];for(var i in this.patterns)t.push(this.patterns[i].bin);var r=e.potpack(t),n=r.w,a=r.h,o=this.atlasImage;for(var s in o.resize({width:n||1,height:a||1}),this.patterns){var l=this.patterns[s].bin,u=l.x+1,c=l.y+1,h=this.images[s].data,f=h.width,p=h.height;e.RGBAImage.copy(h,o,{x:0,y:0},{x:u,y:c},{width:f,height:p}),e.RGBAImage.copy(h,o,{x:0,y:p-1},{x:u,y:c-1},{width:f,height:1}),e.RGBAImage.copy(h,o,{x:0,y:0},{x:u,y:c+p},{width:f,height:1}),e.RGBAImage.copy(h,o,{x:f-1,y:0},{x:u-1,y:c},{width:1,height:p}),e.RGBAImage.copy(h,o,{x:0,y:0},{x:u+f,y:c},{width:1,height:p})}this.dirty=!0}},{key:"beginFrame",value:function(){this.callbackDispatchedThisFrame={}}},{key:"dispatchRenderCallbacks",value:function(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(!this.callbackDispatchedThisFrame[r]){this.callbackDispatchedThisFrame[r]=!0;var n=this.images[r];P(n)&&this.updateImage(r,n)}}}catch(a){i.e(a)}finally{i.f()}}}]),r}(e.Evented),L=new e.Properties({anchor:new e.DataConstantProperty(e.spec.light.anchor),position:new(function(){function t(){v(this,t),this.specification=e.spec.light.position}
1return y(t,[{key:"possiblyEvaluate",value:function(t,i){return function(t){var i=h(t,3),r=i[0],n=i[1],a=i[2],o=e.degToRad(n+90),s=e.degToRad(a);return{x:r*Math.cos(o)*Math.sin(s),y:r*Math.sin(o)*Math.sin(s),z:r*Math.cos(s),azimuthal:n,polar:a}}(t.expression.evaluate(i))}},{key:"interpolate",value:function(t,i,r){return{x:e.number(t.x,i.x,r),y:e.number(t.y,i.y,r),z:e.number(t.z,i.z,r),azimuthal:e.number(t.azimuthal,i.azimuthal,r),polar:e.number(t.polar,i.polar,r)}}}]),t}()),color:new e.DataConstantProperty(e.spec.light.color),intensity:new e.DataConstantProperty(e.spec.light.intensity)}),B="-transition",R=function(t){d(r,t);var i=m(r);function r(t){var n;return v(this,r),(n=i.call(this))._transitionable=new e.Transitionable(L),n.setLight(t),n._transitioning=n._transitionable.untransitioned(),n}return y(r,[{key:"getLight",value:function(){return this._transitionable.serialize()}},{key:"setLight",value:function(t){var i=arguments.length>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,B)?this._transitionable.setTransition(r.slice(0,-B.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),F=new e.Properties({source:new e.DataConstantProperty(e.spec.terrain.source),exaggeration:new e.DataConstantProperty(e.spec.terrain.exaggeration)}),O="-transition",U=function(t){d(r,t);var i=m(r);function r(t,n){var a;return v(this,r),(a=i.call(this))._transitionable=new e.Transitionable(F),a.set(t),a._transitioning=a._transitionable.untransitioned(),a.drapeRenderMode=n,a}return y(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,O)?this._transitionable.setTransition(i.slice(0,-O.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=j(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 j(e,t){var i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}var N=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){d(r,t);var i=m(r);function r(t,n){var a;return v(this,r),(a=i.call(this))._transitionable=new e.Transitionable(N),a.set(t),a._transitioning=a._transitionable.untransitioned(),a._transform=n,a}return y(r,[{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);r<n.length;r++){var a=n[r];t&&void 0===t[a]&&(t[a]=e.spec.fog[a].default)}for(var o in t){var s=t[o];e.endsWith(o,G)?this._transitionable.setTransition(o.slice(0,-G.length),s):this._transitionable.setValue(o,s)}}}},{key:"getOpacity",value:function(t){if(!this._transform.projection.supportsFog)return 0;var i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.smoothstep(45,65,t))*i.a}},{key:"getOpacityAtLatLng",value:function(t,i){return this._transform.projection.supportsFog?function(t,i,r){var n=e.MercatorCoordinate.fromLngLat(i),a=r.elevation?r.elevation.getAtPointOrZero(n):0,o=[n.x,n.y,a];return e.transformMat4(o,o,r.mercatorFogMatrix),V(t,o,r.pitch,r._fov)}(this.state,t,i):0}},{key:"getFovAdjustedRange",value:function(e){return this._transform.projection.supportsFog?j(this.state,e):[0,1]}},{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})))}},{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}}}]),r}(e.Evented),q=function(){function t(i,r){var n=this;v(this,t),this.workerPool=i,this.actors=[],this.currentActor=0,this.id=e.uniqueId();
1for(var a=this.workerPool.acquire(this.id),o=0;o<a.length;o++){var s=new t.Actor(a[o],r,this.id);s.name="Worker ".concat(o),this.actors.push(s)}this.ready=!1,this.broadcast("checkIfReady",null,(function(){n.ready=!0}))}return y(t,[{key:"broadcast",value:function(t,i,r){e.asyncAll(this.actors,(function(e,r){e.send(t,i,r)}),r=r||function(){})}},{key:"getActor",value:function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}},{key:"remove",value:function(){this.actors.forEach((function(e){e.remove()})),this.actors=[],this.workerPool.release(this.id)}}]),t}();function W(t,i,r){return i*(e.EXTENT/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}q.Actor=e.Actor;var X=function(){function t(e,i,r,n){v(this,t),this.screenBounds=e,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,n)}return y(t,[{key:"isPointQuery",value:function(){return 1===this.screenBounds.length}},{key:"bufferedScreenGeometry",value:function(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}},{key:"bufferedCameraGeometry",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,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x<r.x?n.splice(3,0,this.cameraPoint):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),p=e.getTileVec3(t.tileTransform,f,s),d=c.map((function(t){var i=e.sub(t,t,p);return e.normalize(i,i),new e.Ray(p,i)})),m=W(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:h,tilespaceRays:d,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:m}}}},{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]<o[3],h=e.polygonContainsPoint(t,l)&&a[3]<o[3];if(!u&&!h)return null;var f=function(e,t,i){for(var r=1;r<e.length;r++){var n=Y(t.pointCoordinate3D(e[r-1]).x),a=Y(t.pointCoordinate3D(e[r]).x);if(i<0){if(n<a)return{idx:r,t:-n/(a-1-n)}}else if(a<n)return{idx:r,t:(1-n)/(a+1-n)}}return null}(t,i,u?-1:1);if(!f)return null;var p=f.idx,d=f.t,m=p>1?H(t.slice(0,p),i):[],v=p<t.length?H(t.slice(p),i):[];m=m.map((function(t){return new e.pointGeometry(Y(t.x),t.y)})),v=v.map((function(t){return new e.pointGeometry(Y(t.x),t.y)}));var y=c(m);0===y.length&&y.push(v[v.length-1]);var _,g=e.number(y[y.length-1].y,(0===v.length?m[0]:v[0]).y,d);return _=u?[new e.pointGeometry(0,g),new e.pointGeometry(0,0),new e.pointGeometry(1,0),new e.pointGeometry(1,g)]:[new e.pointGeometry(1,g),new e.pointGeometry(1,1),new e.pointGeometry(0,1),new e.pointGeometry(0,g)],y.push.apply(y,c(_)),0===v.length?y.push(m[0]):y.push.apply(y,c(v)),{polygon:y.map((function(t){return new e.MercatorCoordinate(t.x,t.y)}
1)),unwrapped:!1}}(t,i);if(r)return r;var n=function(t,i){for(var r=!1,n=-1/0,a=0,o=0;o<t.length-1;o++)t[o].x>n&&(n=t[o].x,a=o);for(var s=0;s<t.length-1;s++){var l=(a+s)%(t.length-1),u=t[l],c=t[l+1];Math.abs(u.x-c.x)>.5&&(u.x<c.x?(u.x+=1,0===l&&(t[t.length-1].x+=1)):(c.x+=1,l+1===t.length-1&&(t[0].x+=1)),r=!0)}var h=e.mercatorXfromLng(i.center.lng);return r&&h<Math.abs(h-1)&&t.forEach((function(e){e.x-=1})),{polygon:t,unwrapped:r}}(H(t,i).map((function(t){return new e.pointGeometry(Y(t.x),t.y)})),i);return{polygon:n.polygon.map((function(t){return new e.MercatorCoordinate(t.x,t.y)})),unwrapped:n.unwrapped}}}],[{key:"createFromScreenPoints",value:function(i,r){var n,a;if(i instanceof e.pointGeometry||"number"==typeof i[0]){var o=e.pointGeometry.convert(i);n=[e.pointGeometry.convert(i)],a=r.isPointAboveHorizon(o)}else{var s=e.pointGeometry.convert(i[0]),l=e.pointGeometry.convert(i[1]);n=[s,l],a=e.polygonizeBounds(s,l).every((function(e){return r.isPointAboveHorizon(e)}))}return new t(n,r.getCameraPoint(),a,r)}}]),t}();function H(t,i){return e.resample(t,(function(e){var t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function Y(e){return e<0?1+e%1:e%1}function K(e){return 100*e|0}function J(t,i,r,n,a){var o=function(r,n){if(r)return a(r);if(n){var o=e.pick(e.extend(n,t),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(o.vectorLayers=n.vector_layers,o.vectorLayerIds=o.vectorLayers.map((function(e){return e.id}))),n.language_options&&(o.languageOptions=n.language_options),n.language&&n.language[n.id]&&(o.language=n.language[n.id]),n.worldview_options&&(o.worldviewOptions=n.worldview_options),n.worldview?o.worldview=n.worldview[n.id]:n.worldview_default&&(o.worldview=n.worldview_default),o.tiles=i.canonicalizeTileset(o,t.url),a(null,o)}};return t.url?e.getJSON(i.transformRequest(i.normalizeSourceURL(t.url,null,r,n),e.ResourceType.Source),o):e.exported.frame((function(){return o(null,t)}))}var $,Q=function(){function t(i,r,n){v(this,t),this.bounds=e.LngLatBounds.convert(this.validateBounds(i)),this.minzoom=r||0,this.maxzoom=n||24}return y(t,[{key:"validateBounds",value:function(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}},{key:"contains",value:function(t){var i=Math.pow(2,t.z),r=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*i),n=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*i),a=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*i),o=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*i);return t.x>=r&&t.x<a&&t.y>=n&&t.y<o}}]),t}(),ee=function(){function e(t,i,r){v(this,e),this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||i.destroy()}return y(e,[{key:"bind",value:function(){this.context.bindElementBuffer.set(this.buffer)}},{key:"updateData",value:function(e){var t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}},{key:"destroy",value:function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}]),e}(),te={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},ie=function(){function e(t,i,r,n){v(this,e),this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=n,this.context=t;var a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||i.destroy()}return y(e,[{key:"bind",value:function(){this.context.bindVertexBuffer.set(this.buffer)}},{key:"updateData",value:function(e){var t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}},{key:"enableAttributes",value:function(e,t){for(var i=0;i<this.attributes.length;i++){var r=t.attributes[this.attributes[i].name];void 0!==r&&e.enableVertexAttribArray(r)}}},{key:"setVertexAttribPointers",value:function(e,t,i){for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r],a=t.attributes[n.name];void 0!==a&&e.vertexAttribPointer(a,n.components,e[te[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}},{key:"destroy",value:function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}]),e}(),re=function(){function e(t){v(this,e),this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}return y(e,[{key:"get",value:function(){return this.current}},{key:"set",value:function(e){}},{key:"getDefault",value:function(){return this.default}},{key:"setDefault",value:function(){this.set(this.default)}}]),e}(),ne=function(t){d(r,t);var i=m(r);function r(){return v(this,r),i.apply(this,arguments)}return y(r,[{key:"getDefault",value:function(){return e.Color.transparent}},{key:"set",value:function(e){var t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}]),r}(re),ae=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return 1}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}]),i}(re),oe=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return 0}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}]),i}(re),se=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}
1return y(i,[{key:"getDefault",value:function(){return[!0,!0,!0,!0]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}]),i}(re),le=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return!0}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}]),i}(re),ue=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return 255}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}]),i}(re),ce=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return{func:this.gl.ALWAYS,ref:0,mask:255}}},{key:"set",value:function(e){var t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}]),i}(re),he=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){var e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}]),i}(re),fe=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}}]),i}(re),pe=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return[0,1]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}]),i}(re),de=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}}]),i}(re),me=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return this.gl.LESS}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}]),i}(re),ve=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}}]),i}(re),ye=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){var e=this.gl;return[e.ONE,e.ZERO]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}]),i}(re),_e=function(t){d(r,t);var i=m(r);function r(){return v(this,r),i.apply(this,arguments)}return y(r,[{key:"getDefault",value:function(){return e.Color.transparent}},{key:"set",value:function(e){var t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}]),r}(re),ge=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return this.gl.FUNC_ADD}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}]),i}(re),xe=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}}]),i}(re),be=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return this.gl.BACK}
1},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}]),i}(re),we=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return this.gl.CCW}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}]),i}(re),ke=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}]),i}(re),Te=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return this.gl.TEXTURE0}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}]),i}(re),Ee=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){var e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}]),i}(re),Se=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}}]),i}(re),Ae=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}}]),i}(re),Me=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}}]),i}(re),Ie=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}}]),i}(re),Ce=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){var t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}]),i}(re),ze=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this,e)).vao=e.extVertexArrayObject,r}return y(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){this.vao&&(e!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(e),this.current=e,this.dirty=!1)}}]),i}(re),Pe=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return 4}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}}]),i}(re),De=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}}]),i}(re),Le=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}}]),i}(re),Be=function(e){d(i,e);var t=m(i);function i(e,r){var n;return v(this,i),(n=t.call(this,e)).context=e,n.parent=r,n}return y(i,[{key:"getDefault",value:function(){return null}}]),i}(re),Re=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"setDirty",value:function(){this.dirty=!0}},{key:"set",value:function(e){if(e!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}}]),i}(Be),Fe=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"attachment",value:function(){return this.gl.DEPTH_ATTACHMENT}},{key:"set",value:function(e){if(e!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}}]),i}(Be),Oe=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"attachment",value:function(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}]),i}(Fe),Ue=function(){function e(t,i,r,n){v(this,e),this.context=t,this.width=i,this.height=r;var a=this.framebuffer=t.gl.createFramebuffer();
1this.colorAttachment=new Re(t,a),n&&(this.depthAttachment=new Fe(t,a))}return y(e,[{key:"destroy",value:function(){var e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){var i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}}]),e}(),Ve=function(){function i(e){v(this,i),this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),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 pe(this),this.depthTest=new de(this),this.depthFunc=new me(this),this.blend=new ve(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 Ae(this),this.bindTexture=new Me(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.extTextureHalfFloat=e.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(e.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=e.getExtension("OES_standard_derivatives"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}return y(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)}}
1,{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}(),je=function(t){d(r,t);var i=m(r);function r(t,a,o,s){var l;return v(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 y(r,[{key:"load",value:function(){var t=this;this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=J(this._options,this.map._requestManager,null,null,(function(i,r){t._tileJSONRequest=null,t._loaded=!0,i?t.fire(new e.ErrorEvent(i)):r&&(e.extend(t,r),r.bounds&&(t.tileBounds=new Q(r.bounds,t.minzoom,t.maxzoom)),e.postTurnstileEvent(r.tiles),t.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),t.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})))}))}},{key:"loaded",value:function(){return this._loaded}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"onRemove",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}},{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:"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 Ne(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),p=e.transformMat3(c,c,e.transpose(f,f)),d=h(p,3),m=d[0],v=d[1],y=d[2];return e.multiply$1(u,[m,0,0,0,v,0,0,0,y],u)}var Ge=function(t){d(r,t);var i=m(r);function r(e,t,n,a){var o;return v(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}return y(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,e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),(function(i,n){if(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.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.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.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)}}
1catch(p){s.e(p)}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=Ne(0,0,t,0,0,i,t,i),f=Ne(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.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._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),Ze={vector:function(t){d(r,t);var i=m(r);function r(t,a,o,s){var u;if(v(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 y(r,[{key:"load",value:function(t){var i=this;this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"}));var r=this.language||this.map._language,n=this.worldview||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. 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:"setSourceProperty",value:function(e){var t=this;this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load((function(){var e,i=t.map.style._getSourceCaches(t.id),r=f(i);try{for(r.s();!(e=r.n()).done;)e.value.clearTiles()}catch(n){r.e(n)}finally{r.f()}}))}},{key:"setTiles",value:function(e){var t=this;return this.setSourceProperty((function(){t._options.tiles=e})),this}},{key:"setUrl",value:function(e){var t=this;return this.setSourceProperty((function(){t.url=e,t._options.url=e})),this}}
1,{key:"_setLanguage",value:function(e){var t=this;return e===this.language||this.setSourceProperty((function(){t.language=e})),this}},{key:"_setWorldview",value:function(e){var t=this;return e===this.worldview?this:this.worldviewOptions&&e&&!this.worldviewOptions[e]?(console.warn('Vector tile source "'.concat(this.id,'" does not support worldview "').concat(e,'".')),this):(this.setSourceProperty((function(){t.worldview=e})),this)}},{key:"onRemove",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}},{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.t
1ype,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={}}}]),r}(e.Evented),raster:je,"raster-dem":function(t){d(r,t);var i=m(r);function r(t,n,a,o){var s;return v(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 y(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});
1var 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+1<r&&(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}),l}},{key:"unloadTile",value:function(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded"}}]),r}(je),geojson:function(t){d(r,t);var i=m(r);function r(t,n,a,o){var s;v(this,r),(s=i.call(this)).id=t,s.type="geojson",s.minzoom=0,s.maxzoom=18,s.tileSize=512,s.isTileClipped=!0,s.reparseOverscaled=!0,s._loaded=!1,s.actor=a.getActor(),s.setEventedParent(o),s._data=n.data,s._options=e.extend({},n),s._collectResourceTiming=n.collectResourceTiming,void 0!==n.maxzoom&&(s.maxzoom=n.maxzoom),n.type&&(s.type=n.type),n.attribution&&(s.attribution=n.attribution),s.promoteId=n.promoteId;var l=e.EXTENT/s.tileSize;return s.workerOptions=e.extend({source:s.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*l,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*l,extent:e.EXTENT,maxZoom:s.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?n.clusterMaxZoom:s.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:e.EXTENT,radius:(void 0!==n.clusterRadius?n.clusterRadius:50)*l,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),s}return y(r,[{key:"onAdd",value:function(e){this.map=e,this.setData(this._data)}},{key:"setData",value:function(e){return this._data=e,this._updateWorkerData(),this}},{key:"getClusterExpansionZoom",value:function(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},t),this}},{key:"getClusterChildren",value:function(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},t),this}},{key:"getClusterLeaves",value:function(e,t,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:i},r),this}},{key:"_updateWorkerData",value:function(){var t=this;if(this._pendingLoad)this._coalesce=!0;else{this.fire(new e.Event("dataloading",{dataType:"source"})),this._loaded=!1;var i=e.extend({},this.workerOptions),r=this._data;"string"==typeof r?(i.request=this.map._requestManager.transformRequest(e.exported.resolveURL(r),e.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(r),this._pendingLoad=this.actor.send("".concat(this.type,".loadData"),i,(function(i,r){if(t._loaded=!0,t._pendingLoad=null,i)t.fire(new e.ErrorEvent(i));else{var n={dataType:"source",sourceDataType:t._metadataFired?"content":"metadata"};t._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[t.id]&&(n.resourceTiming=r.resourceTiming[t.id]),t.fire(new e.Event("data",n)),t._metadataFired=!0}t._coalesce&&(t._updateWorkerData(),t._coalesce=!1)}))}}},{key:"loaded",value:function(){return this._loaded}},{key:"loadTile",value:function(t,i){var r=this,n=t.actor?"reloadTile":"loadTile";
1t.actor=this.actor,t.request=this.actor.send(n,{type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(e,a){return delete t.request,t.unloadVectorData(),t.aborted?i(null):e?i(e):(t.loadVectorData(a,r.map.painter,"reloadTile"===n),i(null))}),void 0,"loadTile"===n)}},{key:"abortTile",value:function(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}},{key:"unloadTile",value:function(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}},{key:"onRemove",value:function(){this._pendingLoad&&this._pendingLoad.cancel()}},{key:"serialize",value:function(){return e.extend({},this._options,{type:this.type,data:this._data})}},{key:"hasTransition",value:function(){return!1}}]),r}(e.Evented),video:function(t){d(r,t);var i=m(r);function r(e,t,n,a){var o;return v(this,r),(o=i.call(this,e,t,n,a)).roundZoom=!0,o.type="video",o.options=t,o}return y(r,[{key:"load",value:function(){var t=this;this._loaded=!1;var i=this.options;this.urls=[];var r,n=f(i.urls);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.urls.push(this.map._requestManager.transformRequest(a,e.ResourceType.Source).url)}}catch(o){n.e(o)}finally{n.f()}e.getVideo(this.urls,(function(i,r){t._loaded=!0,i?t.fire(new e.ErrorEvent(i)):r&&(t.video=r,t.video.loop=!0,t.video.setAttribute("playsinline",""),t.video.addEventListener("playing",(function(){t.map.triggerRepaint()})),t.map&&t.video.play(),t._finishLoading())}))}},{key:"pause",value:function(){this.video&&this.video.pause()}},{key:"play",value:function(){this.video&&this.video.play()}},{key:"seek",value:function(t){if(this.video){var i=this.video.seekable;t<i.start(0)||t>i.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}(Ge),image:Ge,canvas:function(t){d(r,t);var i=m(r);function r(t,n,a,o){var s;return v(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.
1window.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 y(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];e<t.length;e++){var i=t[e];if(isNaN(i)||i<=0)return!0}return!1}}]),r}(Ge),custom:function(t){d(r,t);var i=m(r);function r(t,a,o,s){var l;return v(this,r),(l=i.call(this)).id=t,l.type="custom",l._dataType="raster",l._dispatcher=o,l._implementation=a,l.setEventedParent(s),l.scheme="xyz",l.minzoom=0,l.maxzoom=22,l.tileSize=512,l._loaded=!1,l.roundZoom=!0,l._implementation||l.fire(new e.ErrorEvent(new Error("Missing implementation for ".concat(l.id," custom source")))),l._implementation.loadTile||l.fire(new e.ErrorEvent(new Error("Missing loadTile implementation for ".concat(l.id," custom source")))),l._implementation.bounds&&(l.tileBounds=new Q(l._implementation.bounds,l.minzoom,l.maxzoom)),a.update=l._update.bind(n(l)),a.coveringTiles=l._coveringTiles.bind(n(l)),e.extend(n(l),e.pick(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"])),l}return y(r,[{key:"serialize",value:function(){return e.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}},{key:"load",value:function(){this._loaded=!0,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}},{key:"loaded",value:function(){return this._loaded}},{key:"onAdd",value:function(t){this._map=t,this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}},{key:"onRemove",value:function(e){this._implementation.onRemove&&this._implementation.onRemove(e)}},{key:"hasTile",value:function(e){if(this._implementation.hasTile){var t=e.canonical,i=t.x,r=t.y,n=t.z;return this._implementation.hasTile({x:i,y:r,z:n})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"loadTile",value:function(t,i){var r=t.tileID.canonical,n=r.x,a=r.y,o=r.z,s=new e.window.AbortController,l=this._implementation.loadTile({x:n,y:a,z:o},{signal:s.signal});if(!l)return this.loadTileData(t,{width:this.tileSize,height:this.tileSize,data:null}),t.state="loaded",i(null);l.cancel=function(){return s.abort()},t.request=l.then(function(r){return delete t.request,t.aborted?(t.state="unloaded",i(null)):r?function(t){return t instanceof e.
1window.ImageData||t instanceof e.window.ImageBitmap||t instanceof e.window.HTMLCanvasElement}(r)?(this.loadTileData(t,r),t.state="loaded",void i(null)):(t.state="errored",i(new Error("Can't infer data type for ".concat(this.id,", only raster data supported at the moment")))):(this.loadTileData(t,{width:this.tileSize,height:this.tileSize,data:null}),t.state="loaded",i(null))}.bind(this)).catch((function(e){20!==e.code&&(t.state="errored",i(e))}))}},{key:"loadTileData",value:function(e,t){je.loadTileData(e,t,this._map.painter)}},{key:"unloadTileData",value:function(e){je.unloadTileData(e,this._map.painter)}},{key:"prepareTile",value:function(e){if(!this._implementation.prepareTile)return null;var t=e.tileID.canonical,i=t.x,r=t.y,n=t.z,a=this._implementation.prepareTile({x:i,y:r,z:n});return a?(this.loadTileData(e,a),e.state="loaded",a):null}},{key:"unloadTile",value:function(e,t){if(this.unloadTileData(e),this._implementation.unloadTile){var i=e.tileID.canonical,r=i.x,n=i.y,a=i.z;this._implementation.unloadTile({x:r,y:n,z:a})}t()}},{key:"abortTile",value:function(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t()}},{key:"hasTransition",value:function(){return!1}},{key:"_coveringTiles",value:function(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((function(e){return{x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}}))}},{key:"_update",value:function(){this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}}]),r}(e.Evented)},qe=function(t,i,r,n){var a=new Ze[i.type](t,i,r,n);if(a.id!==t)throw new Error("Expected Source id to be ".concat(t," instead of ").concat(a.id));return e.bindAll(["load","abort","unload","serialize","prepare"],a),a};function We(t,i){var r=e.identity([]);return e.scale(r,r,[.5*t.width,.5*-t.height,1]),e.translate(r,r,[1,-1,0]),e.multiply(r,r,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(r)}function Xe(e,t,i,r,n,a,o){var s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],l=e.tilesIn(r,o,s);l.sort(Ye);var u,c=[],h=f(l);try{for(h.s();!(u=h.n()).done;){var p=u.value;c.push({wrappedTileID:p.tile.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(t,i,e._state,p,n,a,We(e.transform,p.tile.tileID),s)})}}catch(v){h.e(v)}finally{h.f()}var d=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],p=l[u]=l[u]||{},d=i[u]=i[u]||[],m=f(h);try{for(m.s();!(c=m.n()).done;){var y=c.value;p[y.featureIndex]||(p[y.featureIndex]=!0,d.push(y))}}catch(v){m.e(v)}finally{m.f()}}}}catch(v){n.e(v)}finally{n.f()}return i}(c);for(var m in d)d[m].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 d}function He(e,t){for(var i=e.getRenderableIds().map((function(t){return e.getTileByID(t)})),r=[],n={},a=0;a<i.length;a++){var o=i[a],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(r,t))}return r}function Ye(e,t){var i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function Ke(){return null!=Ma.workerClass?new Ma.workerClass:new e.window.Worker(Ma.workerUrl)}var Je,$e="mapboxgl_preloaded_worker_pool",Qe=function(){function e(){v(this,e),this.active={}}return y(e,[{key:"acquire",value:function(t){if(!this.workers)for(this.workers=[];this.workers.length<e.workerCount;)this.workers.push(new Ke);return this.active[t]=!0,this.workers.slice()}},{key:"release",value:function(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach((function(e){e.terminate()})),this.workers=null)}},{key:"isPreloaded",value:function(){return!!this.active[$e]}},{key:"numActive",value:function(){return Object.keys(this.active).length}}]),e}();function et(){return Je||(Je=new Qe),Je}function tt(t,i){var r={};for(var n in t)"ref"!==n&&(r[n]=t[n]);
1return e.refProperties.forEach((function(e){e in i&&(r[e]=i[e])})),r}function it(e){e=e.slice();for(var t=Object.create(null),i=0;i<e.length;i++)t[e[i].id]=e[i];for(var r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=tt(e[r],t[e[r].ref]));return e}Qe.workerCount=2;var rt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setProjection:"setProjection"};function nt(e,t,i){i.push({command:rt.addSource,args:[e,t[e]]})}function at(e,t,i){t.push({command:rt.removeSource,args:[e]}),i[e]=!0}function ot(e,t,i,r){at(e,i,r),nt(e,t,i)}function st(e,i,r){var n;for(n in e[r])if(e[r].hasOwnProperty(n)&&"data"!==n&&!t(e[r][n],i[r][n]))return!1;for(n in i[r])if(i[r].hasOwnProperty(n)&&"data"!==n&&!t(e[r][n],i[r][n]))return!1;return!0}function lt(e,i,r,n,a,o){var s;for(s in i=i||{},e=e||{})e.hasOwnProperty(s)&&(t(e[s],i[s])||r.push({command:o,args:[n,s,i[s],a]}));for(s in i)i.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t(e[s],i[s])||r.push({command:o,args:[n,s,i[s],a]}))}function ut(e){return e.id}function ct(e,t){return e[t.id]=t,e}var ht=function(){function t(e,i){v(this,t),this.reset(e,i)}return y(t,[{key:"reset",value:function(e,t){this.points=e||[],this._distances=[0];for(var i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}},{key:"lerp",value:function(t){if(1===this.points.length)return this.points[0];t=e.clamp(t,0,1);for(var i=1,r=this._distances[i],n=t*this.paddedLength+this.padding;r<n&&i<this._distances.length;)r=this._distances[++i];var a=i-1,o=this._distances[a],s=r-o,l=s>0?(n-o)/s:0;return this.points[a].mult(1-l).add(this.points[i].mult(l))}}]),t}(),ft=function(){function e(t,i,r){v(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;o<this.xCellCount*this.yCellCount;o++)n.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=i,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}return y(e,[{key:"keysLength",value:function(){return this.boxKeys.length+this.circleKeys.length}},{key:"insert",value:function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}},{key:"insertCircle",value:function(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}},{key:"_insertBoxCell",value:function(e,t,i,r,n,a){this.boxCells[n].push(a)}},{key:"_insertCircleCell",value:function(e,t,i,r,n,a){this.circleCells[n].push(a)}},{key:"_query",value:function(e,t,i,r,n,a){if(i<0||e>this.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;s<this.boxKeys.length;s++)o.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var l=0;l<this.circleKeys.length;l++){var u=this.circles[3*l],c=this.circles[3*l+1],h=this.circles[3*l+2];o.push({key:this.circleKeys[l],x1:u-h,y1:c-h,x2:u+h,y2:c+h})}return a?o.filter(a):o}return this._forEachCell(e,t,i,r,this._queryCell,o,{hitTest:n,seenUids:{box:{},circle:{}}},a),n?o.length>0: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=[];
1return 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,p=f(u);try{for(p.s();!(c=p.n()).done;){var d=c.value;if(!l.box[d]){l.box[d]=!0;var m=4*d;if(e<=h[m+2]&&t<=h[m+3]&&i>=h[m+0]&&r>=h[m+1]&&(!s||s(this.boxKeys[d]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[d],x1:h[m],y1:h[m+1],x2:h[m+2],y2:h[m+3]})}}}}catch(E){p.e(E)}finally{p.f()}}var v=this.circleCells[n];if(null!==v){var y,_=this.circles,g=f(v);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,p=this.bboxes,d=f(c);try{for(d.s();!(h=d.n()).done;){var m=h.value;if(!u.box[m]){u.box[m]=!0;var v=4*m;if(this._circleAndRectCollide(l.x,l.y,l.radius,p[v+0],p[v+1],p[v+2],p[v+3])&&(!s||s(this.boxKeys[m])))return a.push(!0),!0}}}catch(k){d.e(k)}finally{d.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 p=u;p<=h;p++)if(n.call(this,e,t,i,r,this.xCellCount*p+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 dt(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=dt(e,t,i,r,n,a,o);return"globe"===a.name&&i||(s[2]=s[6]=s[10]=s[14]=0),s}function vt(t,i,r,n,a,o,s){if(r){if("globe"===o.name){var l=dt(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 yt(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=[t.x,t.y,r,1];r?e.transformMat4$1(n,n,i):Ct(n,n,i);var a=n[3];return{point:[n[0]/a,n[1]/a,n[2]/a],signedDistanceFromCamera:a}}function _t(t,i){var r=[t[0],t[1],t[2],1];e.transformMat4$1(r,r,i);var n=r[3];return{point:[r[0]/n,r[1]/n,r[2]/n],signedDistanceFromCamera:n}}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 h=r.transform,f=n?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(f,r.transform.zoom),d="globe"===h.projection.name,m=[256/r.width*2+1,256/r.height*2+1],v=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;v.clear();var y=null;d&&(y=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);for(var _=t.lineVertexArray,g=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=r.transform.width/r.transform.height,b=!1,w=0;w<g.length;w++){var k=g.get(w);if(k.writingMode!==e.WritingMode.vertical||b||0!==w&&g.get(w-1).writingMode===e.WritingMode.horizontal||(b=!0),!k.hidden&&k.writingMode!==e.WritingMode.vertical||b){b=!1;var T=new e.pointGeometry(k.tileAnchorX,k.tileAnchorY),E=u?u(T):[0,0,0],S=h.projection.projectTilePoint(T.x,T.y,c.canonical),A=[S.x+E[0],S.y+E[1],S.z+E[2]],M=[].concat(A,[1]);if(e.transformMat4$1(M,M,i),xt(M,m)){var I=gt(r.transform.cameraToCenterDistance,M[3]),C=e.evaluateSizeForFeature
1(f,p,k),z=s?C/I:C*I,P=yt(new e.pointGeometry(A[0],A[1]),a,A[2]);if(P.signedDistanceFromCamera<=0)It(k.numGlyphs,v);else{var D={},L=s?null:u,B=Tt(k,z,!1,l,i,a,o,t.glyphOffsetArray,_,v,y,P.point,T,D,x,L,h.projection,c,s);b=B.useVertical,L&&B.needsFlipping&&(D={}),(B.notEnoughRoom||b||B.needsFlipping&&Tt(k,z,!0,l,i,a,o,t.glyphOffsetArray,_,v,y,P.point,T,D,x,L,h.projection,c,s).notEnoughRoom)&&It(k.numGlyphs,v)}}else It(k.numGlyphs,v)}else It(k.numGlyphs,v)}n?(t.text.dynamicLayoutVertexBuffer.updateData(v),y&&t.text.globeExtVertexBuffer.updateData(y)):(t.icon.dynamicLayoutVertexBuffer.updateData(v),y&&t.icon.globeExtVertexBuffer.updateData(y))}function wt(e,t,i,r,n,a,o,s,l,u,c,h,f,p,d,m){var v=s.glyphStartIndex+s.numGlyphs,y=s.lineStartIndex,_=s.lineStartIndex+s.lineLength,g=t.getoffsetX(s.glyphStartIndex),x=t.getoffsetX(v-1),b=At(e*g,i,r,n,a,o,s.segment,y,_,l,u,c,h,f,!0,p,d,m);if(!b)return null;var w=At(e*x,i,r,n,a,o,s.segment,y,_,l,u,c,h,f,!0,p,d,m);return w?{first:b,last:w}:null}function kt(t,i,r,n){return t.writingMode===e.WritingMode.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:t.writingMode===e.WritingMode.vertical?i.y<r.y?{needsFlipping:!0}:null:0!==t.flipState&&function(e,t,i){var r=(t.x-e.x)*i;return 0===r||Math.abs((t.y-e.y)/r)>pt}(i,r,n)?1===t.flipState?{needsFlipping:!0}:null:i.x>r.x?{needsFlipping:!0}:null}function Tt(t,i,r,n,a,o,s,l,u,c,h,p,d,m,v,y,_,g,x){var b,w=i/24,k=t.lineOffsetX*w,T=t.lineOffsetY*w;if(t.numGlyphs>1){var E=t.glyphStartIndex+t.numGlyphs,S=t.lineStartIndex,A=t.lineStartIndex+t.lineLength,M=wt(w,l,k,T,r,p,d,t,u,o,m,y,!1,_,g,x);if(!M)return{notEnoughRoom:!0};var I=_t(M.first.point,s).point,C=_t(M.last.point,s).point,z=new e.pointGeometry(I[0],I[1]),P=new e.pointGeometry(C[0],C[1]);if(n&&!r){var D=kt(t,z,P,v);if(t.flipState=D&&D.needsFlipping?1:2,D)return D}b=[M.first];for(var L=t.glyphStartIndex+1;L<E-1;L++)b.push(At(w*l.getoffsetX(L),k,T,r,p,d,t.segment,S,A,u,o,m,y,!1,!1,_,g,x));b.push(M.last)}else{if(n&&!r){var B=yt(d,a).point,R=t.lineStartIndex+t.segment+1,F=new e.pointGeometry(u.getx(R),u.gety(R)),O=yt(F,a),U=O.signedDistanceFromCamera>0?O.point:St(d,F,B,1,a,void 0,_,g.canonical),V=kt(t,new e.pointGeometry(B[0],B[1]),new e.pointGeometry(U[0],U[1]),v);if(t.flipState=V&&V.needsFlipping?1:2,V)return V}var j=At(w*l.getoffsetX(t.glyphStartIndex),k,T,r,p,d,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,u,o,m,y,!1,!1,_,g,x);if(!j)return{notEnoughRoom:!0};b=[j]}if(h){var N,G=f(b);try{for(G.s();!(N=G.n()).done;){var Z=N.value;e.updateGlobeVertexNormal(h,c.length+0,Z.up[0],Z.up[1],Z.up[2]),e.updateGlobeVertexNormal(h,c.length+1,Z.up[0],Z.up[1],Z.up[2]),e.updateGlobeVertexNormal(h,c.length+2,Z.up[0],Z.up[1],Z.up[2]),e.updateGlobeVertexNormal(h,c.length+3,Z.up[0],Z.up[1],Z.up[2]),e.addDynamicAttributes(c,Z.point[0],Z.point[1],Z.point[2],Z.angle)}}catch(H){G.e(H)}finally{G.f()}}else{var q,W=f(b);try{for(W.s();!(q=W.n()).done;){var X=q.value;e.addDynamicAttributes(c,X.point[0],X.point[1],X.point[2],X.angle)}}catch(H){W.e(H)}finally{W.f()}}return{}}function Et(t,i,r,n,a){var o=n.projectTilePoint(t.x,t.y,i);if(!a)return yt(o,r,o.z);var s=a(t);return yt(new e.pointGeometry(o.x+s[0],o.y+s[1]),r,o.z+s[2])}function St(t,i,r,n,a,o,s,l){var u=Et(t.add(t.sub(i)._unit()),l,a,s,o).point,c=e.sub([],r,u);return e.scaleAndAdd([],r,c,n/e.length(c))}function At(t,i,r,n,a,o,s,l,u,c,h,f,p,d,m,v,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=x>0?l+s:l+s+1,k=a,T=a,E=0,S=0,A=Math.abs(g),M=[],I=[],C=o,z=function(){var t=w-x;return 0===E?o:new e.pointGeometry(c.getx(t),c.gety(t))},P=function(){return St(z(),C,T,A-E+1,h,p,v,y.canonical)};E+S<=A;){if((w+=x)<l||w>=u)return null;if(T=k,M.push(k),d&&I.push(C||z()),void 0===(k=f[w])){var D=Et(C=new e.pointGeometry(c.getx(w),c.gety(w)),y.canonical,h,v,p);k=D.signedDistanceFromCamera>0?f[w]=D.point:P()}else C=null;E+=S,S=e.distance(T,k)}C=C||new e.pointGeometry(c.getx(w),c.gety(w));var L=z();m&&p&&(f[w]=k=void 0===f[w]?k:P(),S=e.distance(T,k));var B=(A-E)/S,R=C.sub(L).mult(B)._add(L),F=e.sub([],k,T),O=e.scaleAndAdd([],T,F,B),U=[0,0,1],V=F[0],j=F[1];if(_&&(0!==(U=v.upVector(y.canonical,R.x,R.y))[0]||0!==U[1]||1!==U[2])){var N=[1,0,0],G=[0,1,0];N[0]=U[2],N[1]=0,N[2]=-U[0],e.cross(G,U,N),e.normalize(N,N),e.normalize(G,G),V=e.dot(F,N),j=e.dot(F,G)}if(r){var Z=e.cross([],U,F);e.normalize(Z,Z),e.scaleAndAdd(O,O,Z,r*x)}var q=b+Math.atan2(j,V);return M.push(O),d&&I.push(R),{point:O,angle:q,path:M,tilePath:I,up:U}}var Mt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function It(e,t){for(var i=0;i<e;i++){var r=t.length;t.resize(r+4),t.float32.set(Mt,4*r)}}function Ct(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 zt=100,Pt=function(){function t(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ft(e.width+200,e.height+200,25),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ft(e.width+200,e.height+200,25);v(this,t),this.transform=e,this.grid=r,this.ignoredGrid=n,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+zt,this.screenBottomBoundary=e.he
1ight+zt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=i}return y(t,[{key:"placeCollisionBox",value:function(e,t,i,r,n,a,o,s){var l=i.projectedAnchorX,u=i.projectedAnchorY,c=i.projectedAnchorZ,h=i.elevation,f=i.tileID;if(h&&f){var p=e.getProjection().upVector(f.canonical,i.tileAnchorX,i.tileAnchorY),d=e.getProjection().upVectorScale(f.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=p[0]*h*d,u+=p[1]*h*d,c+=p[2]*h*d}var m=this.projectAndGetPerspectiveRatio(o,[l,u,c],i.tileID,"globe"===e.projection.name||!!h||this.transform.pitch>0,e.getProjection()),v=a*m.perspectiveRatio,y=(i.x1*t+r.x-i.padding)*v+m.point.x,_=(i.y1*t+r.y-i.padding)*v+m.point.y,g=(i.x2*t+r.x+i.padding)*v+m.point.x,x=(i.y2*t+r.y+i.padding)*v+m.point.y,b=m.perspectiveRatio<=.55||m.occluded;return!this.isInsideGrid(y,_,g,x)||!n&&this.grid.hitTest(y,_,g,x,s)||b?{box:[],offscreen:!1,occluded:m.occluded}:{box:[y,_,g,x],offscreen:this.isOffscreen(y,_,g,x),occluded:!1}}},{key:"placeCollisionCircles",value:function(t,i,r,n,a,o,s,l,u,c,h,p,d,m,v){var y=[],_=this.transform.elevation,g=_?_.getAtTileOffsetFunc(v,this.transform.center.lat,this.transform.worldSize,t.getProjection()):function(e){return[0,0,0]},x=new e.pointGeometry(r.tileAnchorX,r.tileAnchorY),b=t.getProjection().projectTilePoint(r.tileAnchorX,r.tileAnchorY,v.canonical),w=g(x),k=[b.x+w[0],b.y+w[1],b.z+w[2]],T="globe"===t.projection.name,E=this.projectAndGetPerspectiveRatio(s,[k[0],k[1],k[2]],v,T||!!_||this.transform.pitch>0,t.getProjection()),S=E.perspectiveRatio,A=(h?o/S:o*S)/e.ONE_EM,M=yt(new e.pointGeometry(k[0],k[1]),l,k[2]).point,I=E.signedDistanceFromCamera>0?wt(A,a,r.lineOffsetX*A,r.lineOffsetY*A,!1,M,x,r,n,l,{},_&&!h?g:null,h&&!!_,t.getProjection(),v,h):null,C=!1,z=!1,P=!0;if(I&&!E.occluded){for(var D=.5*d*S+m,L=new e.pointGeometry(-100,-100),B=new e.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),R=new ht,F=I.first,O=I.last,U=[],V=F.path.length-1;V>=1;V--)U.push(F.path[V]);for(var j=1;j<O.path.length;j++)U.push(O.path[j]);var N=2.5*D;if(u){var G=U.map(_&&!T?function(e,t){var i=g(t<F.path.length-1?F.tilePath[F.path.length-1-t]:O.tilePath[t-F.path.length+2]);return e[2]=i[2],_t(e,u)}:function(e){return _t(e,u)});U=G.some((function(e){return e.signedDistanceFromCamera<=0}))?[]:G.map((function(e){return e.point}))}var Z=[];if(U.length>0){for(var q=U.map((function(t){return new e.pointGeometry(t[0],t[1])})),W=1/0,X=-1/0,H=1/0,Y=-1/0,K=0;K<q.length;K++)W=Math.min(W,q[K].x),H=Math.min(H,q[K].y),X=Math.max(X,q[K].x),Y=Math.max(Y,q[K].y);Z=W>=L.x&&X<=B.x&&H>=L.y&&Y<=B.y?[q]:X<L.x||W>B.x||Y<L.y||H>B.y?[]:e.clipLine([q],L.x,L.y,B.x,B.y)}var J,$=f(Z);try{for($.s();!(J=$.n()).done;){var Q=J.value;R.reset(Q,.25*D);var ee=0;ee=R.length<=.5*D?1:Math.ceil(R.paddedLength/N)+1;for(var te=0;te<ee;te++){var ie=te/Math.max(ee-1,1),re=R.lerp(ie),ne=re.x+zt,ae=re.y+zt;y.push(ne,ae,D,0);var oe=ne-D,se=ae-D,le=ne+D,ue=ae+D;if(P=P&&this.isOffscreen(oe,se,le,ue),z=z||this.isInsideGrid(oe,se,le,ue),!i&&this.grid.hitTestCircle(ne,ae,D,p)&&(C=!0,!c))return{circles:[],offscreen:!1,collisionDetected:C,occluded:!1}}}}catch(ce){$.e(ce)}finally{$.f()}}return{circles:!c&&C||!z?[]:y,offscreen:P,collisionDetected:C,occluded:E.occluded}}},{key:"queryRenderedSymbols",value:function(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};var i,r=[],n=1/0,a=1/0,o=-1/0,s=-1/0,l=f(t);try{for(l.s();!(i=l.n()).done;){var u=i.value,c=new e.pointGeometry(u.x+zt,u.y+zt);n=Math.min(n,c.x),a=Math.min(a,c.y),o=Math.max(o,c.x),s=Math.max(s,c.y),r.push(c)}}catch(x){l.e(x)}finally{l.f()}var h,p=this.grid.query(n,a,o,s).concat(this.ignoredGrid.query(n,a,o,s)),d={},m={},v=f(p);try{for(v.s();!(h=v.n()).done;){var y=h.value,_=y.key;if(void 0===d[_.bucketInstanceId]&&(d[_.bucketInstanceId]={}),!d[_.bucketInstanceId][_.featureIndex]){var g=[new e.pointGeometry(y.x1,y.y1),new e.pointGeometry(y.x2,y.y1),new e.pointGeometry(y.x2,y.y2),new e.pointGeometry(y.x1,y.y2)];e.polygonIntersectsPolygon(r,g)&&(d[_.bucketInstanceId][_.featureIndex]=!0,void 0===m[_.bucketInstanceId]&&(m[_.bucketInstanceId]=[]),m[_.bucketInstanceId].push(_.featureIndex))}}}catch(x){v.e(x)}finally{v.f()}return m}},{key:"insertCollisionBox",value:function(e,t,i,r,n){(t?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:n},e[0],e[1],e[2],e[3])}},{key:"insertCollisionCircles",value:function(e,t,i,r,n){for(var a=t?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:r,collisionGroupID:n},s=0;s<e.length;
1s+=4)a.insertCircle(o,e[s],e[s+1],e[s+2])}},{key:"projectAndGetPerspectiveRatio",value:function(t,i,r,n,a){var o=[i[0],i[1],i[2],1],s=!1;if(i[2]||this.transform.pitch>0){e.transformMat4$1(o,o,t);var l="globe"===a.name;this.fogState&&r&&!l&&(s=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[0],i[1],i[2],r.toUnwrapped(),this.transform)>.9)}else Ct(o,o,t);return{point:new e.pointGeometry((o[0]/o[3]+1)/2*this.transform.width+zt,(-o[1]/o[3]+1)/2*this.transform.height+zt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/o[3]*.5,1.5),signedDistanceFromCamera:o[3],occluded:n&&o[2]>o[3]||s}}},{key:"isOffscreen",value:function(e,t,i,r){return i<zt||e>=this.screenRightBoundary||r<zt||t>this.screenBottomBoundary}},{key:"isInsideGrid",value:function(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}},{key:"getViewportMatrix",value:function(){var t=e.identity([]);return e.translate(t,t,[-100,-100,0]),t}}]),t}();function Dt(t,i,r){var n=i.createTileMatrix(t,t.worldSize,r.toUnwrapped());return e.multiply(new Float32Array(16),t.projMatrix,n)}function Lt(e,t,i){if(t.projection.name===i.projection.name)return e.projMatrix;var r=i.clone();return r.setProjection(t.projection),Dt(r,t.getProjection(),e)}function Bt(e,t,i){return t.name===i.projection.name?e.projMatrix:Dt(i,t,e)}var Rt=function(){function e(t,i,r,n){v(this,e),this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):n&&r?1:0,this.placed=r}return y(e,[{key:"isHidden",value:function(){return 0===this.opacity&&!this.placed}}]),e}(),Ft=function(){function e(t,i,r,n,a){var o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];v(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 y(e,[{key:"isHidden",value:function(){return this.text.isHidden()&&this.icon.isHidden()}}]),e}(),Ot=function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];v(this,e),this.text=t,this.icon=i,this.skipFade=r,this.clipped=n},Ut=function t(){v(this,t),this.invProjMatrix=e.create(),this.viewportMatrix=e.create(),this.circles=[]},Vt=function e(t,i,r,n,a){v(this,e),this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=a},jt=function(){function e(t){v(this,e),this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}return y(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 Gt(t,i,r,n,a){var o=new e.pointGeometry(t,i);return r&&o._rotate(n?a:-a),o}var Zt=function(){function t(e,i,r,n,a){v(this,t),this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new Pt(this.transform,a),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new jt(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}return y(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 p,d,m,v=(p=r.tileID,d=a.getProjection(),m=this.transform,d.name===this.projection?m.calculateProjMatrix(p.toUnwrapped()):Dt(m,d,p)),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(v,r.tileID.canonical,y,_,this.transform,a.getProjection(),b),k=null;if(y){var T=vt(v,r.tileID.canonical,y,_,this.transform,a.getProjection(),b);
1k=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 Vt(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);var S={bucket:a,layout:s,posMatrix:v,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 A,M=f(a.sortKeyRanges);try{for(M.s();!(A=M.n()).done;){var I=A.value,C=I.sortKey,z=I.symbolInstanceStart,P=I.symbolInstanceEnd;t.push({sortKey:C,symbolInstanceStart:z,symbolInstanceEnd:P,parameters:S})}}catch(D){M.e(D)}finally{M.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,p,d,m,v,y){var _,g=[h.textOffset0,h.textOffset1],x=Nt(e,i,r,g,n),b=this.collisionIndex.placeCollisionBox(p,n,t,Gt(x.x,x.y,a,o,this.transform.angle),c,s,l,u.predicate);if((!m||0!==this.collisionIndex.placeCollisionBox(p,p.getSymbolInstanceIconSize(y,this.transform.zoom,f),m,Gt(x.x,x.y,a,o,this.transform.angle),c,s,l,u.predicate).box.length)&&b.box.length>0)return this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(_=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:g,width:i,height:r,anchor:e,textScale:n,prevAnchor:_},this.markUsedJustification(p,e,h,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,h),this.placedOrientations[h.crossTileID]=d),{shift:x,placedGlyphBoxes:b}}},{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,p=o.clippingData,d=o.textPixelRatio,m=o.holdingForFade,v=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"),A="viewport-y"===l.get("symbol-z-order");this.transform.setProjection(s.projection);var M=w&&(k||!s.hasIconData()||b),I=k&&(w||!s.hasTextData()||x);!s.collisionArrays&&v&&s.deserializeCollisionBoxes(v),r&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,v);var C=function(t,n,o){if(p){var v={zoom:a.transform.zoom,pitch:a.transform.pitch},A=null;if(p.dynamicFilterNeedsFeature){var C=a.retainedQueryData[s.bucketInstanceId];A=p.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:C.bucketIndex,sourceLayerIndex:C.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,p.dynamicFilter)(v,A,a.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.pointGeometry(t.tileAnchorX,t.tileAnchorY),a.transform.calculateDistanceTileData(p.unwrappedTileID)))return a.placements[t.crossTileID]=new Ot(!1,!1,!1,!0),void(i[t.crossTileID]=!0)}if(!i[t.crossTileID])if(m)a.placements[t.crossTileID]=new Ot(!1,!1,!1);else{var z=!1,P=!1,D=!0,L=!1,B=!1,R=null,F={box:null,offscreen:null,occluded:null},O={box:null,offscreen:null,occluded:null},U=null,V=null,j=null,N=0,G=0,Z=0;o.textFeatureIndex?N=o.textFeatureIndex:t.useRuntimeCollisionCircles&&(N=t.featureIndex),o.verticalTextFeatureIndex&&(G=o.verticalTextFeatureIndex);var q=function(e){e.tileID=a.retainedQueryData[s.bucketInstanceId].tileID,(a.transform.elevation||e.elevation)&&(e.elevation=a.transform.elevation?a.transform.elevation.getAtTileOffset(a.retainedQueryData[s.bucketInstanceId].tileID,e.tileAnchorX,e.tileAnchorY):0)},W=o.textBox;if(W){q(W);var X=function(i){var r=e.WritingMode.horizontal;if(s.allowVerticalPlacement&&!i&&a.prevPlacement){var n=a.prevPlacement.placedOrientations[t.crossTileID];n&&(a.placedOrientations[t.crossTileID]=n,r=n,a.markUsedOrientation(s,r,t))}return r},H=function(i,r){if(s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&o.verticalTextBox){var n,a=f(s.writingModes);try{for(a.s();!(n=a.n()).done&&(n.value===e.WritingMode.vertical?(F=r(),O=F):F=i(),!(F&&F.box&&F.box.length)););}catch(l){a.e(l)}finally{a.f()}}else F=i()};if(l.get("text-variable-anchor")){var Y=l.get("text-variable-anchor");if(a.prevPlacement&&a.prevPlacement.variableOffsets[t.crossTileID]){var K=a.prevPlacement.variableOffsets[t.crossTileID];Y.indexOf(K.anchor)>0&&(Y=Y.filter((function(e){return e!==K.anchor}))).unshift(K.anchor)}
1var J=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&&q(h);for(var f={box:[],offscreen:!1,occluded:!1},p=w?2*Y.length:Y.length,m=0;m<p;++m){var v=a.attemptAnchorPlacement(Y[m%Y.length],e,l,c,o,T,E,d,u,g,m>=Y.length,t,n,s,r,h,y,_);if(v&&(f=v.placedGlyphBoxes)&&f.box&&f.box.length){z=!0,R=v.shift;break}}return f};H((function(){return J(W,o.iconBox,e.WritingMode.horizontal)}),(function(){var i=o.verticalTextBox;return i&&q(i),s.allowVerticalPlacement&&!(F&&F.box&&F.box.length)&&t.numVerticalGlyphVertices>0&&i?J(i,o.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),F&&(z=F.box,D=F.offscreen,L=F.occluded);var $=X(F&&F.box);if(!z&&a.prevPlacement){var Q=a.prevPlacement.variableOffsets[t.crossTileID];Q&&(a.variableOffsets[t.crossTileID]=Q,a.markUsedJustification(s,Q.anchor,t,$))}}else{var ee=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,d,u,g.predicate);return l&&l.box&&l.box.length&&(a.markUsedOrientation(s,r,t),a.placedOrientations[t.crossTileID]=r),l};H((function(){return ee(W,e.WritingMode.horizontal)}),(function(){var i=o.verticalTextBox;return s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?(q(i),ee(i,e.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),X(F&&F.box&&F.box.length)}}if(z=(U=F)&&U.box&&U.box.length>0,D=U&&U.offscreen,L=U&&U.occluded,t.useRuntimeCollisionCircles){var te=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),ie=e.evaluateSizeForFeature(s.textSizeData,y,te),re=l.get("text-padding");V=a.collisionIndex.placeCollisionCircles(s,w,te,s.lineVertexArray,s.glyphOffsetArray,ie,u,c,h,r,E,g.predicate,t.collisionCircleDiameter*ie/e.ONE_EM,re,a.retainedQueryData[s.bucketInstanceId].tileID),z=w||V.circles.length>0&&!V.collisionDetected,D=D&&V.offscreen,L=V.occluded}if(o.iconFeatureIndex&&(Z=o.iconFeatureIndex),o.iconBox){var ne=function(t){q(t);var i=S&&R?Gt(R.x,R.y,T,E,a.transform.angle):new e.pointGeometry(0,0),r=s.getSymbolInstanceIconSize(_,a.transform.zoom,n);return a.collisionIndex.placeCollisionBox(s,r,t,i,k,d,u,g.predicate)};P=O&&O.box&&O.box.length&&o.verticalIconBox?(j=ne(o.verticalIconBox)).box.length>0:(j=ne(o.iconBox)).box.length>0,D=D&&j.offscreen,B=j.occluded}var ae=x||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,oe=b||0===t.numIconVertices;if(ae||oe?oe?ae||(P=P&&z):z=P&&z:P=z=P&&z,z&&U&&U.box&&a.collisionIndex.insertCollisionBox(U.box,l.get("text-ignore-placement"),s.bucketInstanceId,O&&O.box&&G?G:N,g.ID),P&&j&&a.collisionIndex.insertCollisionBox(j.box,l.get("icon-ignore-placement"),s.bucketInstanceId,Z,g.ID),V&&(z&&a.collisionIndex.insertCollisionCircles(V.circles,l.get("text-ignore-placement"),s.bucketInstanceId,N,g.ID),r)){var se=s.bucketInstanceId,le=a.collisionCircleArrays[se];void 0===le&&(le=a.collisionCircleArrays[se]=new Ut);for(var ue=0;ue<V.circles.length;ue+=4)le.circles.push(V.circles[ue+0]),le.circles.push(V.circles[ue+1]),le.circles.push(V.circles[ue+2]),le.circles.push(V.collisionDetected?1:0)}var ce="globe"!==s.projection.name;M=M&&(ce||!L),I=I&&(ce||!B),a.placements[t.crossTileID]=new Ot(z||M,P||I,D||s.justReloaded),i[t.crossTileID]=!0}};if(A)for(var z=s.getSortedSymbolIndexes(this.transform.angle),P=z.length-1;P>=0;--P){var D=z[P];C(s.symbolInstances.get(D),D,s.collisionArrays[D])}else for(var L=t.symbolInstanceStart;L<t.symbolInstanceEnd;L++)C(s.symbolInstances.get(L),L,s.collisionArrays[L]);if(r&&s.bucketInstanceId in this.collisionCircleArrays){var B=this.collisionCircleArrays[s.bucketInstanceId];e.invert(B.invProjMatrix,u),B.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}},{key:"markUsedJustification",value:function(t,i,r,n){var a;a=n===e.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[e.getAnchorJustification(i)];for(var o=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];o<s.length;o++){var l=s[o];l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=a>=0&&l!==a?0:r.crossTileID)}}},{key:"markUsedOrientation",value:function(t,i,r){for(var n=i===e.WritingMode.horizontal||i===e.WritingMode.horizontalOnly?i:0,a=i===e.WritingMode.vertical?i:0,o=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];o<s.length;o++){var l=s[o];t.text.placedSymbolArray.get(l).placedOrientation=n}r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).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 Ft(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 Ft(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];
1if(!this.opacities[c]){var f=new Ft(h,r,!1,!1);f.isHidden()||(this.opacities[c]=f,i=i||h.text.placed||h.icon.placed)}}for(var p in a)this.variableOffsets[p]||!this.opacities[p]||this.opacities[p].isHidden()||(this.variableOffsets[p]=a[p]);for(var d in o)this.placedOrientations[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.placedOrientations[d]=o[d]);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){var n=this;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 a=t.layers[0].layout,o=!!t.layers[0].dynamicFilter(),s=new Ft(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),u=a.get("icon-allow-overlap"),c=a.get("text-variable-anchor"),h="map"===a.get("text-rotation-alignment"),f="map"===a.get("text-pitch-alignment"),p="none"!==a.get("icon-text-fit"),d=new Ft(null,0,l&&(u||!t.hasIconData()||a.get("icon-optional")),u&&(l||!t.hasTextData()||a.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);for(var m=function(e,t,i){for(var r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i)},v=0,y=function(r){var a=t.symbolInstances.get(r),l=a.numHorizontalGlyphVertices,u=a.numVerticalGlyphVertices,y=a.crossTileID,_=n.opacities[y];i[y]?_=s:_||(_=d,n.opacities[y]=_),i[y]=!0;var g=l>0||u>0,x=a.numIconVertices>0,b=n.placedOrientations[a.crossTileID],w=b===e.WritingMode.vertical,k=b===e.WritingMode.horizontal||b===e.WritingMode.horizontalOnly;if(!g&&!x||_.isHidden()||v++,g){var T=Qt(_.text);m(t.text,l,w?ei:T),m(t.text,u,k?ei:T);var E=_.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((function(e){e>=0&&(t.text.placedSymbolArray.get(e).hidden=E||w?1:0)})),a.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=E||k?1:0);var S=n.variableOffsets[a.crossTileID];S&&n.markUsedJustification(t,S.anchor,a,b);var A=n.placedOrientations[a.crossTileID];A&&(n.markUsedJustification(t,"left",a,A),n.markUsedOrientation(t,A,a))}if(x){var M=Qt(_.icon);a.placedIconSymbolIndex>=0&&(m(t.icon,a.numIconVertices,w?ei:M),t.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=_.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,a.numVerticalIconVertices,k?ei:M),t.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=_.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){var I=t.collisionArrays[r];if(I){var C=new e.pointGeometry(0,0),z=!0;if(I.textBox||I.verticalTextBox){if(c){var P=n.variableOffsets[y];P?(C=Nt(P.anchor,P.width,P.height,P.textOffset,P.textScale),h&&C._rotate(f?n.transform.angle:-n.transform.angle)):z=!1}o&&(z=!_.clipped),I.textBox&&qt(t.textCollisionBox.collisionVertexArray,_.text.placed,!z||w,C.x,C.y),I.verticalTextBox&&qt(t.textCollisionBox.collisionVertexArray,_.text.placed,!z||k,C.x,C.y)}var D=z&&Boolean(!k&&I.verticalIconBox);I.iconBox&&qt(t.iconCollisionBox.collisionVertexArray,_.icon.placed,D,p?C.x:0,p?C.y:0),I.verticalIconBox&&qt(t.iconCollisionBox.collisionVertexArray,_.icon.placed,!D,p?C.x:0,p?C.y:0)}}},_=0;_<t.symbolInstances.length;_++)y(_);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 g=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=g.invProjMatrix,t.placementViewportMatrix=g.viewportMatrix,t.collisionCircleArray=g.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.lastPlacementChangeTime<this.fadeDuration}},{key:"stillRecent",value:function(e,t){var i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}},{key:"setStale",value:function(){this.stale=!0}}]),t}();function qt(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 Wt=Math.pow(2,25),Xt=Math.pow(2,24),Ht=Math.pow(2,17),Yt=Math.pow(2,16),Kt=Math.pow(2,9),Jt=Math.pow(2,8),$t=Math.pow(2,1);function Qt(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*Wt+t*Xt+i*Ht+t*Yt+i*Kt+t*Jt+i*$t+t}var ei=0,ti=function(){function e(t){v(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=[]}
1return y(e,[{key:"continuePlacement",value:function(e,t,i,r,n){for(var a=this._bucketParts;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((function(e,t){return e.sortKey-t.sortKey})));this._currentPartIndex<a.length;){var o=a[this._currentPartIndex];if(t.placeLayerBucketPart(o,this._seenCrossTileIDs,i,0===o.symbolInstanceStart),this._currentPartIndex++,n())return!0}return!1}}]),e}(),ii=function(){function t(e,i,r,n,a,o,s,l){v(this,t),this.placement=new Zt(e,a,o,s,l),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}return y(t,[{key:"isDone",value:function(){return this._done}},{key:"continuePlacement",value:function(t,i,r){for(var n=this,a=e.exported.now(),o=function(){var t=e.exported.now()-a;return!n._forceFullPlacement&&t>2};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 ti(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}(),ri=512/e.EXTENT/2,ni=function(){function t(e,i,r){v(this,t),this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;n<i.length;n++){var a=i.get(n),o=a.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:a.crossTileID,coord:this.getScaledCoordinates(a,e)})}}return y(t,[{key:"getScaledCoordinates",value:function(t,i){var r=ri/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*e.EXTENT+t.tileAnchorX)*r),y:Math.floor((i.canonical.y*e.EXTENT+t.tileAnchorY)*r)}}},{key:"findMatches",value:function(e,t,i){for(var r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z),n=0;n<e.length;n++){var a=e.get(n);if(!a.crossTileID){var o=this.indexedSymbolInstances[a.key];if(o){var s,l=this.getScaledCoordinates(a,t),u=f(o);try{for(u.s();!(s=u.n()).done;){var c=s.value;if(Math.abs(c.coord.x-l.x)<=r&&Math.abs(c.coord.y-l.y)<=r&&!i[c.crossTileID]){i[c.crossTileID]=!0,a.crossTileID=c.crossTileID;break}}}catch(h){u.e(h)}finally{u.f()}}}}}}]),t}(),ai=function(){function e(){v(this,e),this.maxCrossTileID=0}return y(e,[{key:"generate",value:function(){return++this.maxCrossTileID}}]),e}(),oi=function(){function e(){v(this,e),this.indexes={},this.usedCrossTileIDs={},this.lng=0}return y(e,[{key:"handleWrapJump",value:function(e){var t=Math.round((e-this.lng)/360);if(0!==t)for(var i in this.indexes){var r=this.indexes[i],n={};for(var a in r){var o=r[a];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+t),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=e}},{key:"addBucket",value:function(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(var r=0;r<t.symbolInstances.length;r++)t.symbolInstances.get(r).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});var n=this.usedCrossTileIDs[e.overscaledZ];for(var a in this.indexes){var o=this.indexes[a];if(Number(a)>e.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;c<t.symbolInstances.length;c++){var h=t.symbolInstances.get(c);h.crossTileID||(h.crossTileID=i.generate(),n[h.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ni(e,t.symbolInstances,t.bucketInstanceId),!0}},{key:"removeBucketCrossTileIDs",value:function(e,t){for(var i in t.indexedSymbolInstances){var r,n=f(t.indexedSymbolInstances[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value;delete this.usedCrossTileIDs[e][a.crossTileID]}}catch(o){n.e(o)}finally{n.f()}}}},{key:"removeStaleBuckets",value:function(e){var t=!1;for(var i in this.indexes){var r=this.indexes[i];for(var n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}}]),e}(),si=function(){function e(){v(this,e),this.layerIndexes={},this.crossTileIDs=new ai,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}return y(e,[{key:"addLayer",value:function(e,t,i,r){var n=this.layerIndexes[e.id];void 0===n&&(n=this.layerIndexes[e.id]=new oi);var a=!1,o={};"globe"!==r.name&&n.handleWrapJump(i);var s,l=f(t);try{for(l.s();!(s=l.n()).done;){var u=s.value,c=u.getBucket(e);c&&e.id===c.layerIds[0]&&(c.bucketInstanceId||(c.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(u.tileID,c,this.crossTileIDs)&&(a=!0),o[c.bucketInstanceId]=!0)}}catch(h){l.e(h)}finally{l.f()}return n.removeStaleBuckets(o)&&(a=!0),a}},{key:"pruneUnusedLayers",value:function(e){var t={};for(var i in e.forEach((function(e){t[e]=!0})),this.layerIndexes)t[i]||delete this.layerIndexes[i]}}]),e}
1(),li=function(t,i){return e.emitValidationErrors(t,i&&i.filter((function(e){return"source.canvas"!==e.identifier})))},ui=e.pick(rt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),ci=e.pick(rt,["setCenter","setZoom","setBearing","setPitch"]),hi={version:8,layers:[],sources:{}},fi={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0},pi=function(i){d(a,i);var r=m(a);function a(t){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};v(this,a),(i=r.call(this)).map=t,i.dispatcher=new q(et(),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.lineAtlas=new e.LineAtlas(256,512),i.crossTileSymbolIndex=new si,i._layers={},i._num3DLayers=0,i._numSymbolLayers=0,i._numCircleLayers=0,i._serializedLayers={},i._sourceCaches={},i._otherSourceCaches={},i._symbolSourceCaches={},i.zoomHistory=new e.ZoomHistory,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 y(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(hi,!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||!li(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=it(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;(s=e.createStyleLayer(s)).setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=s,this._serializedLayers[s.id]=s.serialize(),this._updateLayerCount(s,!0)}}catch(l){o.e(l)}finally{o.f()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new R(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}}
1,{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,p=l.sdf,d=l.pixelRatio,m=l.stretchX,v=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:d,sdf:p,stretchX:m,stretchY:v,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;
1r&&("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:"isLayerDraped",value:function(e){return!!this.terrain&&fi[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,p=f(this._order);try{for(p.s();!(h=p.n()).done;){var d=h.value,m=this._layers[d];if(m.recalculate(t,this._availableImages),!m.isHidden(t.zoom)){var v=this._getLayerSourceCache(m);v&&(v.used=!0)}var y=this.map.painter;if(y){var _=m.getProgramIds();if(!_)continue;var g,x=m.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){p.e(E)}finally{p.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(),li(this,e.validateStyle(i)))return!1;(i=e.clone$1(i)).layers=it(i.layers);var n=function(e,i){if(!e)return[{command:rt.setStyle,args:[i]}];var r=[];try{if(!t(e.version,i.version))return[{command:rt.setStyle,args:[i]}];t(e.center,i.center)||r.push({command:rt.setCenter,args:[i.center]}),t(e.zoom,i.zoom)||r.push({command:rt.setZoom,args:[i.zoom]}),t(e.bearing,i.bearing)||r.push({command:rt.setBearing,args:[i.bearing]}),t(e.pitch,i.pitch)||r.push({command:rt.setPitch,args:[i.pitch]}),t(e.sprite,i.sprite)||r.push({command:rt.setSprite,args:[i.sprite]}),t(e.glyphs,i.glyphs)||r.push({command:rt.setGlyphs,args:[i.glyphs]}),t(e.transition,i.transition)||r.push({command:rt.setTransition,args:[i.transition]}),t(e.light,i.light)||r.push({command:rt.setLight,args:[i.light]}),t(e.fog,i.fog)||r.push({command:rt.setFog,args:[i.fog]}),t(e.projection,i.projection)||r.push({command:rt.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)||at(a,r,n));for(a in i)i.hasOwnProperty(a)&&(e.hasOwnProperty(a)?t(e[a],i[a])||("geojson"===e[a].type&&"geojson"===i[a].type&&st(e,i,a)?r.pu
1sh({command:rt.setGeoJSONSourceData,args:[a,i[a].data]}):ot(a,i,r,n)):nt(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:rt.removeLayer,args:[e.id]}):o.push(e)}));var s=e.terrain;s&&n[s.source]&&(r.push({command:rt.setTerrain,args:[void 0]}),s=void 0),r=r.concat(a),t(s,i.terrain)||r.push({command:rt.setTerrain,args:[i.terrain]}),function(e,i,r){i=i||[];var n,a,o,s,l,u,c,h=(e=e||[]).map(ut),f=i.map(ut),p=e.reduce(ct,{}),d=i.reduce(ct,{}),m=h.slice(),v=Object.create(null);for(n=0,a=0;n<h.length;n++)o=h[n],d.hasOwnProperty(o)?a++:(r.push({command:rt.removeLayer,args:[o]}),m.splice(m.indexOf(o,a),1));for(n=0,a=0;n<f.length;n++)o=f[f.length-1-n],m[m.length-1-n]!==o&&(p.hasOwnProperty(o)?(r.push({command:rt.removeLayer,args:[o]}),m.splice(m.lastIndexOf(o,m.length-a),1)):a++,u=m[m.length-n],r.push({command:rt.addLayer,args:[d[o],u]}),m.splice(m.length-n,0,o),v[o]=!0);for(n=0;n<f.length;n++)if(s=p[o=f[n]],l=d[o],!v[o]&&!t(s,l))if(t(s.source,l.source)&&t(s["source-layer"],l["source-layer"])&&t(s.type,l.type)){for(c in lt(s.layout,l.layout,r,o,null,rt.setLayoutProperty),lt(s.paint,l.paint,r,o,null,rt.setPaintProperty),t(s.filter,l.filter)||r.push({command:rt.setFilter,args:[o,l.filter]}),t(s.minzoom,l.minzoom)&&t(s.maxzoom,l.maxzoom)||r.push({command:rt.setLayerZoomRange,args:[o,l.minzoom,l.maxzoom]}),s)s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?lt(s[c],l[c],r,o,c.slice(6),rt.setPaintProperty):t(s[c],l[c])||r.push({command:rt.setLayerProperty,args:[o,c,l[c]]}));for(c in l)l.hasOwnProperty(c)&&!s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?lt(s[c],l[c],r,o,c.slice(6),rt.setPaintProperty):t(s[c],l[c])||r.push({command:rt.setLayerProperty,args:[o,c,l[c]]}))}else r.push({command:rt.removeLayer,args:[o]}),u=m[m.lastIndexOf(o)+1],r.push({command:rt.addLayer,args:[l,u]})}(o,i.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:rt.setStyle,args:[i]}]}return r}(this.serialize(),i).filter((function(e){return!(e.command in ci)}));if(0===n.length)return!1;var a=n.filter((function(e){return!(e.command in ui)}));if(a.length>0)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=qe(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.get
1Source(e).setData(t),this._changed=!0}},{key:"getSource",value:function(e){var t=this._getSourceCache(e);return t&&t.getSource()}},{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(li(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;
1i&&-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;
1)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.stylesheet.terrain,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 p=c.value;n.push(p)}}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 d=[],m=this._order.length-1;m>=0;m--){var v=this._order[m];if(i(v))for(var y=n.length-1;y>=0;y--){var _=n[y].feature;if(r[_.layer.id]<m)break;d.push(_),n.pop()}else{var g,x=f(e);try{for(x.s();!(g=x.n()).done;){var b=g.value[v];if(b){var w,k=f(b);try{for(k.s();!(w=k.n()).done;){var T=w.value;d.push(T.feature)}}catch(E){k.e(E)}finally{k.f()}}}}catch(E){x.e(E)}finally{x.f()}}}return d}},{key:"queryRenderedFeatures",value:function(t,i,r){var n=this;i&&i.filter&&this._validate(e.validateFilter,"queryRenderedFeatures.filter",i.filter,null,i);var a={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.ErrorEvent(new Error("parameters.layers must be an Array."))),[];var o,s=f(i.layers);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=this._layers[l];if(!u)return this.fire(new e.ErrorEvent(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];a[u.source]=!0}}catch(v){s.e(v)}finally{s.f()}}var c=[];i.availableImages=this._availableImages;var h=i&&i.layers?i.layers.some((function(e){var t=n.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),p=X.createFromScreenPoints(t,r);for(var d in this._sourceCaches){var m=this._sourceCaches[d].getSource().id;i.layers&&!a[m]||c.push(Xe(this._sourceCaches[d],this._layers,this._serializedLayers,p,i,r,h,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(e,t,i,r,n,a,o){var s,l={},u=a.queryRenderedSymbols(r),c=[],h=f(Object.keys(u).map(Number));try{for(h.s();!(s=h.n()).done;){var p=s.value;c.push(o[p])}}catch(v){h.e(v)}finally{h.f()}c.sort(Ye);for(var d=function(){var i=y[m],r=i.featureIndex.lookupSymbolFeatures(u[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(var a in r){var o=l[a]=l[a]||[],s=r[a];s.sort((function(e,t){var r=i.featureSortOrder;if(r){var n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex}));var c,h=f(s);try{for(h.s();!(c=h.n()).done;){var p=c.value;o.push(p)}}catch(v){h.e(v)}finally{h.f()}}},m=0,y=c;
1m<y.length;m++)d();var _=function(t){l[t].forEach((function(r){var n=r.feature,a=i(e[t]).getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=a}))};for(var g in l)_(g);return l}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),p.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}},{key:"querySourceFeatures",value:function(t,i){i&&i.filter&&this._validate(e.validateFilter,"querySourceFeatures.filter",i.filter,null,i);var r,n=this._getSourceCaches(t),a=[],o=f(n);try{for(o.s();!(r=o.n()).done;){var s=r.value;a=a.concat(He(s,i))}}catch(l){o.e(l)}finally{o.f()}return a}},{key:"addSourceType",value:function(e,t,i){return a.getSourceType(e)?i(new Error('A source type called "'.concat(e,'" already exists.'))):(a.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}},{key:"getLight",value:function(){return this.light.getLight()}},{key:"setLight",value:function(e){var i=arguments.length>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);if(1===r){if("object"==typeof i.source){var n="terrain-dem-src";this.addSource(n,i.source),i=e.clone$1(i),i=e.extend(i,{source:n})}if(this._validate(e.validateTerrain,"terrain",i))return}if(!this.terrain||this.terrain&&r!==this.terrain.drapeRenderMode)this._createTerrain(i,r);else{for(var a=this.terrain,o=a.get(),s=0,l=Object.keys(e.spec.terrain);s<l.length;s++){var u=l[s];!i.hasOwnProperty(u)&&e.spec.terrain[u].default&&(i[u]=e.spec.terrain[u].default)}for(var c in i)if(!t(i[c],o[c])){a.set(i),this.stylesheet.terrain=i;var h=this._setTransitionParameters({duration:0});a.updateTransitions(h);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}},{key:"_createFog",value:function(e){var t=this.fog=new Z(e,this.map.transform);this.stylesheet.fog=e;var i=this._setTransitionParameters({duration:0});t.updateTransitions(i)}},{key:"_updateMarkersOpacity",value:function(){var e=this;0!==this.map._markers.length&&this.map._requestDomTask((function(){var t,i=f(e.map._markers);try{for(i.s();!(t=i.n()).done;)t.value._evaluateOpacity()}catch(r){i.e(r)}finally{i.f()}}))}},{key:"getFog",value:function(){return this.fog?this.fog.get():null}},{key:"setFog",value:function(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){var i=this.fog,r=i.get();for(var n in 0===Object.keys(e).length&&i.set(e),e)if(!t(e[n],r[n])){i.set(e),this.stylesheet.fog=e;var a=this._setTransitionParameters({duration:0});i.updateTransitions(a);break}}else this._createFog(e);this._markersNeedUpdate=!0}},{key:"_setTransitionParameters",value:function(t){return{now:e.exported.now(),transition:e.extend(t,this.stylesheet.transition)}}},{key:"_updateDrapeFirstLayers",value:function(){var e,t,i=this;if(this.map._optimizeForTerrain&&this.terrain){var r=this._order.filter((function(e){return i.isLayerDraped(i._layers[e])})),n=this._order.filter((function(e){return!i.isLayerDraped(i._layers[e])}));this._drapedFirstOrder=[],(e=this._drapedFirstOrder).push.apply(e,c(r)),(t=this._drapedFirstOrder).push.apply(t,c(n))}}},{key:"_createTerrain",value:function(e,t){var i=this.terrain=new U(e,t);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();var r=this._setTransitionParameters({duration:0});i.updateTransitions(r)}},{key:"_force3DLayerUpdate",value:function(){for(var e in this._layers){var t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}}
1,{key:"_forceSymbolLayerUpdate",value:function(){for(var e in this._layers){var t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}},{key:"_validate",value:function(t,i,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return(!a||!1!==a.validate)&&li(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:"_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{for(h.s();!(a=h.n()).done;){var p=a.value,d=this._layers[p];if("symbol"===d.type){if(!c[d.source]&&"continue"===function(){var e=o._getLayerSourceCache(d);if(!e)return"continue";c[d.source]=e.getRenderableIds(!0).map((function(t){return e.getTileByID(t)})).sort((function(e,t){return t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)}))}())continue;var m=this.crossTileSymbolIndex.addLayer(d,c[d.source],t.center.lng,t.projection);l=l||m}}}catch(x){h.e(x)}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 ii(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 v,y=f(this._order);try{for(y.s();!(v=y.n()).done;){var _=v.value,g=this._layers[_];"symbol"===g.type&&this.placement.updateLayerOpacities(g,c[g.source])}}catch(x){y.e(x)}finally{y.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)}},{key:"order",get:function(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}}]),a}(e.Evented);pi.getSourceType=function(e){return Ze[e]},pi.setSourceType=function(e,t){Ze[e]=t},pi.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",mi="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;
1void 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\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) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return 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);
1vec4 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;vec4 bounds=vec4(d,vec2(1.0)-d);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",yi="#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",_i="#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",gi={},xi={},bi=[];Si(di,bi),Si(vi,bi),Si(yi,bi),Si(_i,bi),gi=Ai("",vi),xi=Ai(_i,yi);var wi=Ai("\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);}
1vec3 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;}","\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."),ki=di,Ti="\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",Ei={background:Ai("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\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;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:Ai("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix);\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_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:Ai("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
1/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\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);\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(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);vec4 world_center=vec4(pos,1);\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 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,radiu
1s,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 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:Ai("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:Ai("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);\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;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=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:Ai("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:Ai("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:Ai("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:Ai("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
1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:Ai("#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 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:Ai("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 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:Ai("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\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 vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:Ai("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\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 vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:Ai("uniform lowp vec3 u_lightpos;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;varying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvoid main() {vec4 color=v_color;\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
1),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);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(v_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 highp vec3 v_normal;varying float v_depth;\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));base=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;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float 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);vec3 pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;vec3 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_normal=normal;v_depth=gl_Position.w;\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
1ntroid_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);directional*=(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\nv_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:Ai("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\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 vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute 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_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;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_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=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;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float 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);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=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_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}
1\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);directional*=(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\nv_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:Ai("#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);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=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+f+f+i)-(a+d+d+g),(g+h+h+i)-(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:Ai("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 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:Ai("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;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\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_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);
1float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nhighp vec4 out_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nvec4 out_color=color;\n#endif\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);}}\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\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 mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\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_from\n#pragma mapbox: define lowp vec4 dash_to\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_from\n#pragma mapbox: initialize lowp vec4 dash_to\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 tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.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:Ai("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\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_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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:Ai("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 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:Ai("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);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 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;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float 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) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetProjected_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);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_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 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\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:Ai("#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_
1color\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);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 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;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float 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) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetprojected_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);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_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 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\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:A
vendor: 6,676 bytes, line 1
1i("#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);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 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;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float 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);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_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 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\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:
1Ai("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\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\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;attribute vec2 a_texture_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 skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\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:Ai("#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;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:Ai("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1nd-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}",mi),skyboxGradient:Ai("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}",mi),skyboxCapture:A
vendor: 3,852 bytes, line 1
1i("\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:
1Ai("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() {\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);vec4 color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\nvec4 color=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;\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 idy=u_grid_matrix[1][2];float S=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=a_pos[0]*S;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;\n#ifdef GLOBE_POLES\nvec3 up_vector=normalize(globe_pos)*u_tile_up_scale;\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#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,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:Ai("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));
1return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat globe_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);\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));float 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\nfloat horizon_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 Si(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 Ai(e,t){var i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),n={},a=[].concat(bi);return Si(e,a),Si(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;
1\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(){v(this,e),this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}return y(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<r.length;l++)this.boundPaintVertexBuffers[l]!==r[l]&&(s=!0);for(var u=this.boundDynamicVertexBuffers.length!==o.length,c=0;!u&&c<o.length;c++)this.boundDynamicVertexBuffers[c]!==o[c]&&(u=!0);if(!e.extVertexArrayObject||!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||s||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==a)this.freshBind(t,i,r,n,a,o);else{e.bindVertexArrayOES.set(this.vao);var h,p=f(o);try{for(p.s();!(h=p.n()).done;){var d=h.value;d&&d.bind()}}catch(m){p.e(m)}finally{p.f()}n&&n.dynamicDraw&&n.bind()}}},{key:"freshBind",value:function(e,t,i,r,n,a){var o,s=e.numAttributes,l=this.context,u=l.gl;if(l.extVertexArrayObject)this.vao&&this.destroy(),this.vao=l.extVertexArrayObject.createVertexArrayOES(),l.bindVertexArrayOES.set(this.vao),o=0,this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=a;else{o=l.currentNumAttributes||0;for(var c=s;c<o;c++)u.disableVertexAttribArray(c)}t.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,n);var h,p=f(i);try{for(p.s();!(h=p.n()).done;){var d=h.value;d.enableAttributes(u,e),d.bind(),d.setVertexAttribPointers(u,e,n)}}catch(_){p.e(_)}finally{p.f()}var m,v=f(a);try{for(v.s();!(m=v.n()).done;){var y=m.value;y&&(y.enableAttributes(u,e),y.bind(),y.setVertexAttribPointers(u,e,n))}}catch(_){v.e(_)}finally{v.f()}r&&r.bind(),l.currentNumAttributes=s}},{key:"destroy",value:function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}]),e}();function Ii(t,i){var r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new e.MercatorCoordinate(0,n/r).toLngLat().lat,new e.MercatorCoordinate(0,(n+1)/r).toLngLat().lat]}function Ci(t,i,r,n,a,o,s){var l=t.context,u=l.gl,c=r.fbo;if(c){t.prepareDrawTile();var h=t.useProgram("hillshade");l.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get());var f=function(e,t,i,r){var n=i.paint.get("hillshade-shadow-color"),a=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color"),s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);var l=!e.options.moving;return{u_matrix:r||e.transform.calculateProjMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:Ii(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:a,u_accent:o}}(t,r,n,t.terrain?i.projMatrix:null);t.prepareDrawProgram(l,h,i.toUnwrapped());var p=t.getTileBoundsBuffers(r),d=p.tileBoundsBuffer,m=p.tileBoundsIndexBuffer,v=p.tileBoundsSegments;h.draw(l,u.TRIANGLES,a,o,s,e.CullFaceMode.disabled,f,n.id,d,m,v)}}function zi(t,i,r){if(i.needsDEMTextureUpload){var n=t.context,a=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(r.stride);var o=r.getPixels();i.demTexture?i.demTexture.update(o,{premultiply:!1}):i.demTexture=new e.Texture(n,o,a.RGBA,{premultiply:!1}),i.needsDEMTextureUpload=!1}}function Pi(t,i,r,n,a,o){var s=t.context,l=s.gl;if(i.dem){var u=i.dem;if(s.activeTexture.set(l.TEXTURE1),zi(t,i,u),i.demTexture){i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);var c=u.dim;s.activeTexture.set(l.TEXTURE0);var h=i.fbo;if(!h){var f=new e.Texture(s,{width:c,height:c,data:null},l.RGBA);f.bind(l.LINEAR,l.CLAMP_TO_EDGE),(h=i.fbo=s.createFramebuffer(c,c,!0)).colorAttachment.set(f.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,c,c]);var p=t.getMercatorTileBoundsBuffers(),d=p.tileBoundsBuffer,m=p.tileBoundsIndexBuffer,v=p.tileBoundsSegments;t.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,e.CullFaceMode.disabled,function(t,i){var r=i.stride,n=e.create();return e.ortho(n,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(n,n,[0,-e.EXTENT,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.unpackVector}}(i.tileID,u),r.id,d,m,v),i.needsHillshadePrepare=!1}}}var Di=function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image0:new e.Uniform1i(t),u_skirt_height:new e.Uniform1f(t)}},Li=function(e,t){return{u_matrix:e,u_image0:0,u_skirt_height:t}},Bi=function(e,t,i,r,n,a,o,s,l,u,c,h,f,p){return{u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:a,u_image0:0,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:h,u_viewport:f,u_grid_matrix:p?Float32Array.from(p):new Float32Array(9)}};function Ri(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}var Fi=new(function(){function e(){v(this,e),this.operations={}}return y(e,[{key:"newMorphing",value:function(e,t,i,r,n){if(e in this.operations){var a=this.operations[e];a.to.tileID.key!==i.tileID.key&&(a.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}},{key:"getMorphValuesForProxy",value:function(e){if(!(e in this.operations))return null;var t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}},{key:"update",value:function(e){for(var t in this.operations){var i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>
1=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 Ui(e,t){var i=1<<e.z;return!t&&(0===e.x||e.x===i-1)||0===e.y||e.y===i-1}var Vi=function(e){return{u_matrix:e}};function ji(t,i,r,n,a){if(a>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 Ni=function(e){d(i,e);var t=m(i);function i(e){var r;v(this,i);var a={type:"raster-dem",maxzoom:e.transform.maxZoom},o=new q(et(),null),s=qe("mock-dem",a,o,e.style);return r=t.call(this,"mock-dem",s,!1),s.setEventedParent(n(r)),r._sourceLoaded=!0,r}return y(i,[{key:"_loadTile",value:function(e,t){e.state="loaded",t(null)}}]),i}(e.SourceCache),Gi=function(t){d(r,t);var i=m(r);function r(e){var t;v(this,r);var a=qe("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new q(et(),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 y(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){d(i,e);var t=m(i);function i(e,r,n){var a;return v(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 i}(e.OverscaledTileID),qi=function(t){d(r,t);var i=m(r);function r(t,n){var a;v(this,r),(a=i.call(this)).painter=t,a.terrainTileForTile={},a.prevTerrainTileForTile={};var o=function(t){var i=new e.StructArrayLayout4i8,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;l<s;l+=a)for(var u=-a;u<s;u+=a){var c=u<0||u>o||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,h,f)}for(var p=function(e,t){var i=t*n+e;r.emplaceBack(i+1,i,i+n),r.emplaceBack(i+n,i+n+1,i+1)},d=1;d<129;d++)for(var m=1;m<129;m++)p(m,d);return[0,129].forEach((function(e){for(var t=0;t<130;t++)p(t,e),p(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.boundsAttributes.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,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 Ni(n.map),a}return y(r,[{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(!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);
1this._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:"exaggeration",value:function(){return this._exaggeration}},{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<<t.canonical.z)*t.wrap,t.canonical.y),a=new e.pointGeometry(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),o=n.mult(1<<t.canonical.z);return o.x-=.5,o.y-=.5,o.distSqr(r)-o.distSqr(a)}))}(a,this.painter),this._previousZoom=n.zoom;var o=this.proxyToSource||{};this.proxyToSource={},a.forEach((function(e){i.proxyToSource[e.key]={}})),this.terrainTileForTile={};var s=this._style._sourceCaches;for(var l in s){var u=s[l];if(u.used&&(u!==this.sourceCache&&this.resetTileLookupCache(u.id),this._setupProxiedCoordsForOrtho(u,t[l],o),!u.usedForTerrain)){var c=t[l];u.getSource().reparseOverscaled&&this._assignTerrainTiles(c)}}this.proxiedCoords[r.id]=a.map((function(e){return new Zi(e,e.key,i.orthoMatrix)})),this._assignTerrainTiles(a),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=e.exported.now();var h={};this._visibleDemTiles=[];var p,d=f(this.proxyCoords);try{for(d.s();!(p=d.n()).done;){var m=p.value,v=this.terrainTileForTile[m.key];if(v){var y=v.tileID.key;y in h||(this._visibleDemTiles.push(v),h[y]=y)}}}catch(_){d.e(_)}finally{d.f()}}}},{key:"_assignTerrainTiles",value:function(e){var t=this;this._initializing||e.forEach((function(e){if(!t.terrainTileForTile[e.key]){var i=t._findTileCoveringTileID(e,t.sourceCache);i&&(t.terrainTileForTile[e.key]=i)}}))}},{key:"_prepareDEMTextures",value:function(){var e=this.painter.context,t=e.gl;for(var i in this.terrainTileForTile){var r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),zi(this.painter,r,n))}}},{key:"_prepareDemTileUniforms",value:function(e,t,i,r){if(!t||null==t.demTexture)return!1;var n=e.tileID.canonical,a=Math.pow(2,t.tileID.canonical.z-n.z),o=r||"";return i["u_dem_tl".concat(o)]=[n.x*a%1,n.y*a%1],i["u_dem_scale".concat(o)]=a,!0}},{key:"_getLoadedAreaMinimum",value:function(){var e=0,t=this._visibleDemTiles.reduce((function(t,i){if(!i.dem)return t;var r=i.dem.tree.minimums[0];return r>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,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});s.u_dem_size=this.sourceCache.getSource().tileSize,s.u_exaggeration=this.exaggeration();var l=this.painter.transform,u=l.projection,c=t.tileID.canonical;s.u_tile_tl_up=u.upVector(c,0,0),s.u_tile_tr_up=u.upVector(c,e.EXTENT,0),s.u_tile_br_up=u.upVector(c,e.EXTENT,e.EXTENT),s.u_tile_bl_up=u.upVector(c,0,e.EXTENT),s.u_tile_up_scale=r&&r.useDe
1normalizedUpVectorScale?e.GLOBE_METERS_TO_ECEF:u.upVectorScale(c,l.center.lat,l.worldSize).metersToTile;var h=null,f=null,p=1;if(r&&r.morphing&&this._useVertexMorphing){var d=r.morphing.srcDemTile,m=r.morphing.dstDemTile;p=r.morphing.phase,d&&m&&(this._prepareDemTileUniforms(t,d,s,"_prev")&&(f=d),this._prepareDemTileUniforms(t,m,s)&&(h=m))}if(f&&h?(a.activeTexture.set(o.TEXTURE2),h.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.activeTexture.set(o.TEXTURE4),f.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),s.u_dem_lerp=p):(h=this.terrainTileForTile[t.tileID.key],a.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(t,h,s)?h.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&&h){var v=(1<<h.tileID.canonical.z)*e.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=v}r&&r.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=r.labelPlaneMatrixInv),i.setTerrainUniformValues(a,s)}},{key:"renderToBackBuffer",value:function(t){var i=this.painter,r=this.painter.context;0!==t.length&&(r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),i.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(t,i,r,n,a){if("globe"===t.transform.projection.name)!function(t,i,r,n,a){var o,s,l=t.context,u=l.gl,c=t.options.showTerrainWireframe?2:0,p=t.transform,d=e.globeUseCustomAntiAliasing(t,l,p),m=function(e,i){if(s!==e){var r=[Oi[e],"PROJECTION_GLOBE_VIEW"];d&&r.push("CUSTOM_ANTIALIASING"),i&&r.push(Oi[c]),o=t.useProgram("globeRaster",null,r),s=e}},v=t.colorModeForRenderPass(),y=new e.DepthMode(u.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);Fi.update(a);var _=e.calculateGlobeMercatorMatrix(p),g=[e.mercatorXfromLng(p.center.lng),e.mercatorYfromLat(p.center.lat)],x=c?[!1,!0]:[!1],b=t.globeSharedBuffers,w=[p.width*e.exported.devicePixelRatio,p.height*e.exported.devicePixelRatio],k=Float32Array.from(p.globeMatrix),T={useDenormalizedUpVectorScale:!0};if(x.forEach((function(c){s=-1;var d,x=c?u.LINES:u.TRIANGLES,E=f(n);try{for(E.s();!(d=E.n()).done;){var S=d.value,A=r.getTile(S),M=e.StencilMode.disabled,I=i.prevTerrainTileForTile[S.key],C=i.terrainTileForTile[S.key];Ri(I,C)&&Fi.newMorphing(S.key,I,C,a,250),l.activeTexture.set(u.TEXTURE0),A.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);var z=Fi.getMorphValuesForProxy(S.key),P=z?1:0;z&&e.extend$1(T,{morphing:{srcDemTile:z.from,dstDemTile:z.to,phase:e.easeCubicInOut(z.phase)}});var D=e.tileCornersToBounds(S.canonical),L=e.getLatitudinalLod(D.getCenter().lat),B=e.getGridMatrix(S.canonical,D,L),R=e.globeNormalizeECEF(e.globeTileBounds(S.canonical)),F=Bi(p.projMatrix,k,_,R,e.globeToMercatorTransition(p.zoom),g,p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.globeCenterInViewSpace,p.globeRadius,w,B);if(m(P,c),i.setupElevationDraw(A,o,T),t.prepareDrawProgram(l,o,S.toUnwrapped()),b){var O=c?b.getWirefameBuffers(t.context,L):b.getGridBuffers(L),U=h(O,3),V=U[0],j=U[1],N=U[2];o.draw(l,x,y,M,v,e.CullFaceMode.backCCW,F,"globe_raster",V,j,N)}}}catch(G){E.e(G)}finally{E.f()}})),b){var E=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];d&&E.push("CUSTOM_ANTIALIASING"),o=t.useProgram("globeRaster",null,E);var S,A=f(n);try{var M=function(){var n=S.value,a=n.canonical,s=a.x,c=a.y,f=a.z,d=0===c,m=c===(1<<f)-1,_=b.getPoleBuffers(f),x=h(_,4),k=x[0],E=x[1],A=x[2],M=x[3];if(M&&(d||m)){var I=r.getTile(n);l.activeTexture.set(u.TEXTURE0),I.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);var C=e.globePoleMatrixForTile(f,s,p),z=e.globeNormalizeECEF(e.globeTileBounds(n.canonical)),P=function(t,i){return t.draw(l,u.TRIANGLES,y,e.StencilMode.disabled,v,e.CullFaceMode.disabled,Bi(p.projMatrix,C,C,z,0,g,p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.globeCenterInViewSpace,p.globeRadius,w),"globe_pole_raster",i,A,M)};i.setupElevationDraw(I,o,T),t.prepareDrawProgram(l,o,n.toUnwrapped()),d&&P(o,k),m&&(C=e.scale(e.create(),C,[1,-1,1]),P(o,E))}};for(A.s();!(S=A.n()).done;)M()}catch(I){A.e(I)}finally{A.f()}}}(t,i,r,n,a);
1else{var o,s,l=t.context,u=l.gl,c=t.options.showTerrainWireframe?2:0,p=function(e,i){if(s!==e){var r=[Oi[e]];i&&r.push(Oi[c]),o=t.useProgram("terrainRaster",null,r),s=e}},d=t.colorModeForRenderPass(),m=new e.DepthMode(u.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);Fi.update(a);var v=t.transform,y=6*Math.pow(1.5,22-v.zoom)*i.exaggeration();(c?[!1,!0]:[!1]).forEach((function(c){s=-1;var _,g=c?u.LINES:u.TRIANGLES,x=c?i.getWirefameBuffer():[i.gridIndexBuffer,i.gridSegments],b=h(x,2),w=b[0],k=b[1],T=f(n);try{for(T.s();!(_=T.n()).done;){var E=_.value,S=r.getTile(E),A=e.StencilMode.disabled,M=i.prevTerrainTileForTile[E.key],I=i.terrainTileForTile[E.key];Ri(M,I)&&Fi.newMorphing(E.key,M,I,a,250),l.activeTexture.set(u.TEXTURE0),S.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST);var C=Fi.getMorphValuesForProxy(E.key),z=C?1:0,P=void 0;C&&(P={morphing:{srcDemTile:C.from,dstDemTile:C.to,phase:e.easeCubicInOut(C.phase)}});var D=Li(E.projMatrix,Ui(E.canonical,v.renderWorldCopies)?y/10:y);p(z,c),i.setupElevationDraw(S,o,P),t.prepareDrawProgram(l,o,E.toUnwrapped()),o.draw(l,g,m,A,d,e.CullFaceMode.backCCW,D,"terrain_raster",i.gridBuffer,w,k)}}catch(L){T.e(L)}finally{T.f()}}))}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}},{key:"renderBatch",value:function(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;var i,r=this.painter,n=this.painter.context,a=this.proxySourceCache,o=this.proxiedCoords[a.id],s=this._drapedRenderBatches.shift(),l=[],u=r.style.order,c=0,h=f(o);try{for(h.s();!(i=h.n()).done;){var p=i.value,d=a.getTileByID(p.proxyTileKey),m=a.proxyCachedFBO[p.key]?a.proxyCachedFBO[p.key][t]:void 0,v=void 0!==m?a.renderCache[m]:this.pool[c++],y=void 0!==m;if(d.texture=v.tex,!y||v.dirty){var _=void 0;n.bindFramebuffer.set(v.fb.framebuffer),this.renderedToTile=!1,v.dirty&&(n.clear({color:e.Color.transparent,stencil:0}),v.dirty=!1);for(var g=s.start;g<=s.end;++g){var x=r.style._layers[u[g]];if(!x.isHidden(r.transform.zoom)){var b=r.style._getLayerSourceCache(x),w=b?this.proxyToSource[p.key][b.id]:[p];if(w){var k=w;n.viewport.set([0,0,v.fb.width,v.fb.height]),_!==(b?b.id:null)&&(this._setupStencil(v,w,x,b),_=b?b.id:null),r.renderLayer(r,b,x,k)}}}this.renderedToTile?(v.dirty=!0,l.push(d.tileID)):y||--c,5===c&&(c=0,this.renderToBackBuffer(l))}else l.push(d.tileID)}}catch(T){h.e(T)}finally{h.f()}return this.renderToBackBuffer(l),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,r.width,r.height]),s.end+1}},{key:"postRender",value:function(){}},{key:"renderCacheEfficiency",value:function(e){var t=e.order.length;if(0===t)return{efficiency:100};for(var i,r=0,n=0,a=!1,o=0;o<t;++o){var s=e._layers[e.order[o]];this._style.isLayerDraped(s)?(a&&++r,++n):a||(a=!0,i=s.id)}return 0===n?{efficiency:100}:{efficiency:100*(1-r/n),firstUndrapedLayer:i}}},{key:"getMinElevationBelowMSL",value:function(){var e=0;return this._visibleDemTiles.filter((function(e){return e.dem})).forEach((function(t){e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}},{key:"raycast",value:function(e,t,i){if(!this._visibleDemTiles)return null;var r=this._visibleDemTiles.filter((function(e){return e.dem})).map((function(r){var n=r.tileID,a=1<<n.overscaledZ,o=n.canonical,s=o.x,l=o.y,u=s/a,c=(s+1)/a,h=l/a,f=(l+1)/a;return{minx:u,miny:h,maxx:c,maxy:f,t:r.dem.tree.raycastRoot(u,h,c,f,e,t,i),tile:r}}));r.sort((function(e,t){return(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)}));var n,a=f(r);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(null==o.t)return null;var s=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,e,t,i);if(null!=s)return s}}catch(l){a.e(l)}finally{a.f()}return null}},{key:"_createFBO",value:function(){var t=this.painter.context,i=t.gl,r=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);var n=new e.Texture(t,{width:r[0],height:r[1],data:null},i.RGBA);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);var a=t.createFramebuffer(r[0],r[1],!1);
1return a.colorAttachment.set(n.texture),a.depthAttachment=new Oe(t,a.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,a.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):a.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&!t.extTextureFilterAnisotropicForceOff&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:a,tex:n,dirty:!1}}},{key:"_initFBOPool",value:function(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}},{key:"_shouldDisableRenderCache",value:function(){var e=this;if(this._style.light&&this._style.light.hasTransition())return!0;for(var t in this._style._sourceCaches)if(this._style._sourceCaches[t].hasTransition())return!0;return this._style.order.some((function(t){var i=e._style._layers[t],r=i.isHidden(e.painter.transform.zoom),n=i.getCrossfadeParameters(),a=!!n&&1!==n.t,o=i.hasTransition();return"custom"!==i.type&&!r&&(a||o)}))}},{key:"_clearRasterFadeFromRenderCache",value:function(){var e=!1;for(var t in this._style._sourceCaches)if(this._style._sourceCaches[t]._source instanceof je){e=!0;break}if(e)for(var i=0;i<this._style.order.length;++i){var r=this._style._layers[this._style.order[i]],n=r.isHidden(this.painter.transform.zoom),a=this._style._getLayerSourceCache(r);if("raster"===r.type&&!n&&a){var o,s=r.paint.get("raster-fade-duration"),l=f(this.proxyCoords);try{for(l.s();!(o=l.n()).done;){var u=o.value,c=this.proxyToSource[u.key][a.id];if(c){var h,p=f(c);try{for(p.s();!(h=p.n()).done;){var d=h.value,m=ji(a.getTile(d),a.findLoadedParent(d,0),a,this.painter.transform,s);(1!==m.opacity||0!==m.mix)&&this._clearRenderCacheForTile(a.id,d)}}catch(v){p.e(v)}finally{p.f()}}}}catch(v){l.e(v)}finally{l.f()}}}}},{key:"_setupDrapedRenderBatches",value:function(){var e=this._style.order,t=e.length;if(0!==t){for(var i,r=[],n=0,a=this._style._layers[e[n]];!this._style.isLayerDraped(a)&&a.isHidden(this.painter.transform.zoom)&&++n<t;)a=this._style._layers[e[n]];for(;n<t;++n){var o=this._style._layers[e[n]];o.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(o)?void 0===i&&(i=n):void 0!==i&&(r.push({start:i,end:n-1}),i=void 0))}void 0!==i&&r.push({start:i,end:n-1}),this._drapedRenderBatches=r}}},{key:"_setupRenderCache",value:function(e){var t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){var i=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(var r=0;r<i.length;++r){var n,a=Object.values(i[r]);(n=t.renderCachePool).push.apply(n,a)}}}else{this._clearRasterFadeFromRenderCache();for(var o=this.proxyCoords,s=this._tilesDirty,l=o.length-1;l>=0;l--){var u=o[l];if(t.getTileByID(u.key),void 0!==t.proxyCachedFBO[u.key]){var h=e[u.key],p=this.proxyToSource[u.key],d=0,m=function(e){var t=p[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 d=-1,"break";++d};for(var v in p)if("break"===m(v))break;for(var y in t.proxyCachedFBO[u.key])t.renderCache[t.proxyCachedFBO[u.key][y]].dirty=d<0||d!==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>
1t[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,p=r.getTile(h),d=Li(h.projMatrix,0);i.setupElevationDraw(p,l),l.draw(a,o.TRIANGLES,u,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.backCCW,d,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}catch(m){c.e(m)}finally{c.f()}}}(t,this,r,this.proxyCoords)}},{key:"_setupProxiedCoordsForOrtho",value:function(e,t,i){if(e.getSource()instanceof Ge)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;a<n.length;a++){var o=n[a],s=this._findTileCoveringTileID(o,e);if(s){var l=this._createProxiedId(o,s,i[o.key]&&i[o.key][e.id]);r.push(l),this.proxyToSource[o.key][e.id]=[l]}}for(var u=!1,c=0;c<t.length;c++){var h=e.getTile(t[c]);if(h&&h.hasData()){var f=this._findTileCoveringTileID(h.tileID,this.proxySourceCache);if(f&&f.tileID.canonical.z!==h.tileID.canonical.z){var p=this.proxyToSource[f.tileID.key][e.id],d=this._createProxiedId(f.tileID,h,i[f.tileID.key]&&i[f.tileID.key][e.id]);p?p.splice(p.length-1,0,d):this.proxyToSource[f.tileID.key][e.id]=[d],r.push(d),u=!0}}}this._sourceTilesOverlap[e.id]=u}},{key:"_setupProxiedCoordsForImageSource",value:function(t,i,r){if(t.getSource().loaded())for(var n=this.proxiedCoords[t.id]=[],a=this.proxyCoords,o=t.getSource(),s=new e.pointGeometry(o.tileID.x,o.tileID.y)._div(1<<o.tileID.z),l=o.coordinates.map(e.MercatorCoordinate.fromLngLat).reduce((function(e,t){return e.min.x=Math.min(e.min.x,t.x-s.x),e.min.y=Math.min(e.min.y,t.y-s.y),e.max.x=Math.max(e.max.x,t.x-s.x),e.max.y=Math.max(e.max.y,t.y-s.y),e}),{min:new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=function(t,i){var r=t.wrap+t.canonical.x/(1<<t.canonical.z),n=t.canonical.y/(1<<t.canonical.z),a=e.EXTENT/(1<<t.canonical.z),o=i.wrap+i.canonical.x/(1<<i.canonical.z),s=i.canonical.y/(1<<i.canonical.z);return r+a<o+l.min.x||r>o+l.max.x||n+a<s+l.min.y||n>s+l.max.y},c=0;c<a.length;c++)for(var h=a[c],f=0;f<i.length;f++){var p=t.getTile(i[f]);if(p&&p.hasData()&&!u(h,p.tileID)){var d=this._createProxiedId(h,p,r[h.key]&&r[h.key][t.id]),m=this.proxyToSource[h.key][t.id];m?m.push(d):this.proxyToSource[h.key][t.id]=[d],n.push(d)}}}},{key:"_createProxiedId",value:function(t,i,r){var n=this.orthoMatrix;if(r){var a=r.find((function(e){return e.key===i.tileID.key}));if(a)return a}if(i.tileID.key!==t.key){var o,s,l,u=t.canonical.z-i.tileID.canonical.z;n=e.create();var c=i.tileID.wrap-t.wrap<<t.overscaledZ;u>0?(s=(o=e.EXTENT>>u)*((i.tileID.canonical.x<<u)-t.canonical.x+c),l=o*((i.tileID.canonical.y<<u)-t.canonical.y)):(o=e.EXTENT<<-u,s=e.EXTENT*(i.tileID.canonical.x-(t.canonical.x+c<<-u)),l=e.EXTENT*(i.tileID.canonical.y-(t.canonical.y<<-u))),e.ortho(n,0,o,0,o,0,1),e.translate(n,n,[s,l,0])}return new Zi(i.tileID,t.key,n)}},{key:"_findTileCoveringTileID",value:function(t,i){var r=i.getTile(t);if(r&&r.hasData())return r;var n=this._findCoveringTileCache[i.id],a=n[t.key];if((r=a?i.getTileByID(a):null)&&r.hasData()||null===a)return r;var o=r?r.tileID:t,s=o.overscaledZ,l=i.getSource().minzoom,u=[];if(!a){var c=i.getSource().maxzoom;if(t.canonical.z>=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());
1s--){r&&f(r.tileID.key);var p=o.calculateScaledKey(s);if((r=i.getTileByID(p))&&r.hasData())break;var d=n[p];if(null===d)break;void 0===d?u.push(p):r=i.getTileByID(d)}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]}},{key:"style",set:function(e){e.on("data",this._onStyleDataEvent.bind(this)),e.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=e,this._checkRenderCacheEfficiency()}},{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:"emptyDEMTexture",get:function(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}},{key:"emptyDepthBufferTexture",get:function(){var t=this.painter.context,i=t.gl;if(!this._emptyDepthBufferTexture){var r=new e.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.Texture(t,r,i.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}}]),r}(e.Elevation),Wi=function(){function t(i,r,n,a,o,s){v(this,t);var l=i.gl;this.program=l.createProgram();var u=function(e){for(var t=[],i=0;i<e.length;i++)if(null!==e[i]){var r=e[i].split(" ");t.push(r.pop())}return t}(n.staticAttributes),c=a?a.getBinderAttributes():[],h=u.concat(c),f=a?a.defines():[],p=(f=f.concat(s.map((function(e){return"#define ".concat(e)})))).concat(i.extStandardDerivatives?"#extension GL_OES_standard_derivatives : enable\n".concat(Ti):Ti,Ti,ki,wi.fragmentSource,xi.fragmentSource,n.fragmentSource).join("\n"),d=f.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",ki,wi.vertexSource,xi.vertexSource,gi.vertexSource,n.vertexSource).join("\n"),m=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(m,p),l.compileShader(m),l.attachShader(this.program,m);var y=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(y,d),l.compileShader(y),l.attachShader(this.program,y),this.attributes={},this.numAttributes=h.length;for(var _=0;_<this.numAttributes;_++)h[_]&&(l.bindAttribLocation(this.program,_,h[_]),this.attributes[h[_]]=_);l.linkProgram(this.program),l.deleteShader(y),l.deleteShader(m),this.fixedUniforms=o(i),this.binderUniforms=a?a.getUniforms(i):[],-1!==s.indexOf("TERRAIN")&&(this.terrainUniforms=function(t){return{u_dem:new e.Uniform1i(t),u_dem_prev:new e.Uniform1i(t),u_dem_unpack:new e.Uniform4f(t),u_dem_tl:new e.Uniform2f(t),u_dem_scale:new e.Uniform1f(t),u_dem_tl_prev:new e.Uniform2f(t),u_dem_scale_prev:new e.Uniform1f(t),u_dem_size:new e.Uniform1f(t),u_dem_lerp:new e.Uniform1f(t),u_exaggeration:new e.Uniform1f(t),u_depth:new e.Uniform1i(t),u_depth_size_inv:new e.Uniform2f(t),u_meter_to_dem:new e.Uniform1f(t),u_label_plane_matrix_inv:new e.UniformMatrix4f(t),u_tile_tl_up:new e.Uniform3f(t),u_tile_tr_up:new e.Uniform3f(t),u_tile_br_up:new e.Uniform3f(t),u_tile_bl_up:new e.Uniform3f(t),u_tile_up_scale:new e.Uniform1f(t)}}(i)),-1!==s.indexOf("FOG")&&(this.fogUniforms=function(t){return{u_fog_matrix:new e.UniformMatrix4f(t),u_fog_range:new e.Uniform2f(t),u_fog_color:new e.Uniform4f(t),u_fog_horizon_blend:new e.Uniform1f(t),u_fog_temporal_offset: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_globe_transition:new e.Uniform1f(t),u_is_globe:new e.Uniform1i(t),u_viewport:new e.Uniform2f(t)}}(i))}}}return y(t,null,[{key:"cacheKey",value:function(e,t,i,r){var n,a="".concat(t).concat(r?r.cacheKey:""),o=f(i);try{for(o.s();!(n=o.n()).done;){var s=n.value;e.usedDefines.includes(s)&&(a+="/".concat(s))}}catch(l){o.e(l)}finally{o.f()}return a}}]),y(t,[{key:"setTerrainUniformValues",value:function(e,t){if(this.terrainUniforms){var i=this.terrainUniforms;if(!this.failedToCreate)for(var r in e.program.set(this.program),t)i[r].set(this.program,r,t[r])}}},{key:"setFogUniformValues",value:function(e,t){if(this.fogUniforms){var i=this.fogUniforms;if(!this.failedToCreate)for(var r in e.program.set(this.program),t)i[r].set(this.program,r,t[r])}}},{key:"draw",value:function(e,t,i,n,a,o,s,l,u,c,h,p,d,m,v){var y,_=e.gl;if(!this.failedToCreate){e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(a),e.setCullFace(o);for(var g=0,x=Object.keys(this.fixedUniforms);
1g<x.length;g++){var b=x[g];this.fixedUniforms[b].set(this.program,b,s[b])}m&&m.setUniforms(this.program,e,this.binderUniforms,p,{zoom:d});var w,k=(y={},r(y,_.LINES,2),r(y,_.TRIANGLES,3),r(y,_.LINE_STRIP,1),y)[t],T=f(h.get());try{for(T.s();!(w=T.n()).done;){var E=w.value,S=E.vaos||(E.vaos={});(S[l]||(S[l]=new Mi)).bind(e,this,u,m?m.getPaintVertexBuffers():[],c,E.vertexOffset,v||[]),_.drawElements(t,E.primitiveLength*k,_.UNSIGNED_SHORT,E.primitiveOffset*k*2)}}catch(A){T.e(A)}finally{T.f()}}}}]),t}();function Xi(e,t,i){var r=1/W(i,1,t.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,t.transform.tileZoom)/n,o=a*(i.tileID.canonical.x+i.tileID.wrap*n),s=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}var Hi=e.create(),Yi=function(t,i,r,n,a,o,s,l,u,c,h){var f=i.style.light,p=f.properties.get("position"),d=[p.x,p.y,p.z],m=e.create$1();"viewport"===f.properties.get("anchor")&&(e.fromRotation(m,-i.transform.angle),e.transformMat3(d,d,m));var v=f.properties.get("color"),y=i.transform,_={u_matrix:t,u_lightpos:d,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.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<<s.canonical.z],_.u_zoom_transition=u,_.u_inv_rot_matrix=h,_.u_merc_center=c,_.u_up_dir=y.projection.upVector(new e.CanonicalTileID(0,0,0),c[0]*e.EXTENT,c[1]*e.EXTENT),_.u_height_lift=l),_},Ki=function(t,i,r,n,a,o,s,l,u,c,h,f,p){var d=Yi(t,i,r,n,a,o,s,c,h,f,p),m={u_height_factor:-Math.pow(2,s.overscaledZ)/u.tileSize/8};return e.extend(d,Xi(l,i,u),m)},Ji=function(e){return{u_matrix:e}},$i=function(t,i,r,n){return e.extend(Ji(t),Xi(r,i,n))},Qi=function(e,t){return{u_matrix:e,u_world:t}},er=function(t,i,r,n,a){return e.extend($i(t,i,r,n),{u_world:a})},tr=e.create(),ir=function(t,i,r,n,a,o){var s,l=t.transform,u="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment"))if(u){var c=e.globePixelsToTileUnits(l.zoom,i.canonical)*l._pixelsPerMercatorPixel;s=Float32Array.from([c,0,0,c])}else s=l.calculatePixelsToTileUnitsMatrix(r);else s=new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]);var h={u_camera_to_center_distance:l.cameraToCenterDistance,u_matrix:t.translatePosMatrix(i.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:e.exported.devicePixelRatio,u_extrude_scale:s,u_inv_rot_matrix:tr,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<<i.canonical.z],h.u_zoom_transition=e.globeToMercatorTransition(l.zoom);var f=a[0]*e.EXTENT,p=a[1]*e.EXTENT;h.u_up_dir=l.projection.upVector(new e.CanonicalTileID(0,0,0),f,p)}return h},rr=function(e){var t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t},nr=function(t,i,r,n){var a=e.EXTENT/r.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(n),u_extrude_scale:[i.pixelsToGLUnits[0]/a,i.pixelsToGLUnits[1]/a]}},ar=function(e,t){return{u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:arguments.length>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<<i.canonical.z],h.u_zoom_transition=e.globeToMercatorTransition(l.zoom);var f=a[0]*e.EXTENT,p=a[1]*e.EXTENT;h.u_up_dir=l.projection.upVector(new e.CanonicalTileID(0,0,0),f,p)}return h},lr=function(e,t,i,r,n,a,o,s){var l=e.transform,u=l.calculatePixelsToTileUnitsMatrix(t),c={u_matrix:hr(e,t,i,n),u_pixels_to_tile_units:u,u_device_pixel_ratio:o,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0,u_trim_offset:s};if(fr(i)){var h=cr(t,e.transform);c.u_texsize=t.lineAtlasTexture.size,c.u_scale=[h,r.fromScale,r.toScale],c.u_mix=r.t}return c},ur=function(e,t,i,r,n,a){var o=e.transform,s=cr(t,o);return{u_matrix:hr(e,t,i,n),u_texsize:t.imageAtlasTexture.size,u_pixels_to_tile_units:o.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:a,u_image:0,u_scale:[s,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]],u_alph
vendor: 13,324 bytes, line 1
1a_discard_threshold:0}};function cr(e,t){return 1/W(e,1,t.tileZoom)}function hr(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function fr(e){var t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}var pr=function(e,t,i,r,n,a){return{u_matrix:e,u_tl_parent:t,u_scale_parent:i,u_fade_t:r.mix,u_opacity:r.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(s=n.paint.get("raster-saturation"),s>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:dr(n.paint.get("raster-hue-rotate")),u_perspective_transform:a};var o,s};function dr(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 mr,vr=e.create(),yr=function(t,i,r,n,a,o,s,l,u,c,h,f,p,d,m,v){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:vr,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:vr,u_up_vector:[0,-1,0]};return"globe"===v.name&&(_.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],_.u_zoom_transition=f,_.u_inv_rot_matrix=d,_.u_merc_center=p,_.u_camera_forward=y._camera.forward(),_.u_ecef_origin=e.globeECEFOrigin(y.globeMatrix,h.toUnwrapped()),_.u_tile_matrix=Float32Array.from(y.globeMatrix),_.u_up_vector=m),_},_r=function(t,i,r,n,a,o,s,l,u,c,h,f,p,d,m,v,y){return e.extend(yr(t,i,r,n,a,o,s,l,u,c,f,p,d,m,v,y),{u_gamma_scale:n?a.transform.cameraToCenterDistance*Math.cos(a.terrain?0:a.transform._pitch):1,u_device_pixel_ratio:e.exported.devicePixelRatio,u_is_halo:+h})},gr=function(t,i,r,n,a,o,s,l,u,c,h,f,p,d,m,v){return e.extend(_r(t,i,r,n,a,o,s,l,!0,u,!0,h,f,p,d,m,v),{u_texsize_icon:c,u_texture_icon:1})},xr=function(e,t,i){return{u_matrix:e,u_opacity:t,u_color:i}},br=function(t,i,r,n,a,o){return e.extend(function(e,t,i,r){var n=i.imageManager.getPattern(e.from.toString()),a=i.imageManager.getPattern(e.to.toString()),o=i.imageManager.getPixelSize(),s=o.width,l=o.height,u=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,i.transform.tileZoom)/u,h=c*(r.tileID.canonical.x+r.tileID.wrap*u),f=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:t.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/W(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,f>>16],u_pixel_coord_lower:[65535&h,65535&f]}}(n,o,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_scale:new e.Uniform3f(t),u_fade: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_scale:new e.Uniform3f(t),u_fade: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_scale:new e.Uniform3f(t),u_fade: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_scale:new e.Uniform3f(t),u_mix: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_scale:new e.Uniform3f(t),u_fade: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_a:new e.Uniform2f(t),u_pattern_br_a:new e.Uniform2f(t),u_pattern_tl_b:new e.Uniform2f(t),u_pattern_br_b:new e.Uniform2f(t),u_texsize:new e.Uniform2f(t),u_mix:new e.Uniform1f(t),u_pattern_size_a:new e.Uniform2f(t),u_pattern_size_b:new e.Uniform2f(t),u_scale_a:new e.Uniform1f(t),u_scale_b:new e.Uniform1f(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:Di,terrainDepth:Di,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_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=[],p=0,d=0,m=0;m<n.length;m++){var v=n[m],y=i.getTile(v),_=y.getBucket(r);
1if(_){var g=Lt(v,_,c),x=g;0===a[0]&&0===a[1]||(x=t.translatePosMatrix(g,y,a,o));var b=s?_.textCollisionBox:_.iconCollisionBox,w=_.collisionCircleArray;if(w.length>0){var k=e.create(),T=x;e.mul(k,_.placementInvProjMatrix,c.glCoordMatrix),e.mul(k,k,_.placementViewportMatrix),f.push({circleArray:w,circleOffset:d,transform:T,invTransform:k,projection:_.getProjection()}),d=p+=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*p),S._trim();for(var A=0,M=0,I=f;M<I.length;M++)for(var C=I[M],z=0;z<C.circleArray.length/4;z++){var P=4*z,D=C.circleArray[P+0],L=C.circleArray[P+1],B=C.circleArray[P+2],R=C.circleArray[P+3];S.emplace(A++,D,L,B,R,0),S.emplace(A++,D,L,B,R,1),S.emplace(A++,D,L,B,R,2),S.emplace(A++,D,L,B,R,3)}(!mr||mr.length<2*p)&&(mr=function(t){var i=2*t,r=new e.StructArrayLayout3ui6;r.resize(i),r._trim();for(var n=0;n<i;n++){var a=6*n;r.uint16[a+0]=4*n+0,r.uint16[a+1]=4*n+1,r.uint16[a+2]=4*n+2,r.uint16[a+3]=4*n+2,r.uint16[a+4]=4*n+3,r.uint16[a+5]=4*n+0}return r}(p));for(var F,O=l.createIndexBuffer(mr,!0),U=l.createVertexBuffer(S,e.collisionCircleLayout.members,!0),V=0,j=f;V<j.length;V++){var N=j[V],G={u_matrix:N.transform,u_inv_matrix:N.invTransform,u_camera_to_center_distance:(F=c).getCameraToCenterDistance(N.projection),u_viewport_size:[F.width,F.height]};E.draw(l,u.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,G,r.id,U,O,e.SegmentVector.simpleSegment(0,2*N.circleOffset,N.circleArray.length,N.circleArray.length/2),null,c.zoom)}U.destroy(),O.destroy()}}var Tr=e.create();function Er(t,i,r,n,a,o){var s=e.getAnchorAlignment(t),l=-(s.horizontalAlign-.5)*i,u=-(s.verticalAlign-.5)*r,c=e.evaluateVariableOffset(t,n);return new e.pointGeometry((l/a+c[0])*o,(u/a+c[1])*o)}function Sr(t,i,r,n,a,o,s,l,u,c,h){var f=t.text.placedSymbolArray,p=t.text.dynamicLayoutVertexArray,d=t.icon.dynamicLayoutVertexArray,m={}
1,v=Bt(l,t.getProjection(),o),y=o.elevation,_=t.getProjection().upVectorScale(l.canonical,o.center.lat,o.worldSize);p.clear();for(var g=0;g<f.length;g++){var x=f.get(g),b=t.allowVerticalPlacement&&!x.placedOrientation,w=x.hidden||!x.crossTileID||b?null:n[x.crossTileID];if(w){var k=new e.pointGeometry(x.tileAnchorX,x.tileAnchorY),T=t.getProjection().upVector(l.canonical,k.x,k.y),E=y?y.getAtTileOffset(l,k.x,k.y):0,S=_t([x.projectedAnchorX+E*T[0]*_.metersToTile,x.projectedAnchorY+E*T[1]*_.metersToTile,x.projectedAnchorZ+E*T[2]*_.metersToTile],r?v:s),A=gt(o.getCameraToCenterDistance(t.getProjection()),S.signedDistanceFromCamera),M=a.evaluateSizeForFeature(t.textSizeData,c,x)*A/e.ONE_EM;r&&(M*=t.tilePixelRatio/u);var I=w.width,C=w.height,z=Er(w.anchor,I,C,w.textOffset,w.textScale,M),P=void 0;if(r){var D=k.add(z),L=t.getProjection().projectTilePoint(D.x,D.y,l.canonical),B=L.x,R=L.y,F=L.z;P=_t([B+E*T[0]*_.metersToTile,R+E*T[1]*_.metersToTile,F+E*T[2]*_.metersToTile],s).point}else{var O=i?z.rotate(-o.angle):z;P=[S.point[0]+O.x,S.point[1]+O.y,0]}for(var U=t.allowVerticalPlacement&&x.placedOrientation===e.WritingMode.vertical?Math.PI/2:0,V=0;V<x.numGlyphs;V++)e.addDynamicAttributes(p,P[0],P[1],P[2],U);h&&x.associatedIconIndex>=0&&(m[x.associatedIconIndex]={shiftedAnchor:P,angle:U})}else It(x.numGlyphs,p)}if(h){d.clear();for(var j=t.icon.placedSymbolArray,N=0;N<j.length;N++){var G=j.get(N);if(G.hidden)It(G.numGlyphs,d);else{var Z=m[N];if(Z)for(var q=0;q<G.numGlyphs;q++)e.addDynamicAttributes(d,Z.shiftedAnchor[0],Z.shiftedAnchor[1],Z.shiftedAnchor[2],Z.angle);else It(G.numGlyphs,d)}}t.icon.dynamicLayoutVertexBuffer.updateData(d)}t.text.dynamicLayoutVertexBuffer.updateData(p)}function Ar(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Mr(t,i,r,n,a,o,s,l,u,c,h,p){var d=t.context,m=d.gl,v=t.transform,y="map"===l,_="map"===u,g=y&&"point"!==r.layout.get("symbol-placement"),x=y&&!_&&!g,b=void 0!==r.layout.get("symbol-sort-key").constantOr(1),w=!1,k=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),T=[e.mercatorXfromLng(v.center.lng),e.mercatorYfromLat(v.center.lat)],E=r.layout.get("text-variable-anchor"),S="globe"===v.projection.name,A=[],M=[0,-1,0],I=M;!S&&!v.mercatorFromTransition||y||(I=function(t){var i=t._camera.getWorldToCamera(t.worldSize,1),r=e.multiply([],i,t.globeMatrix);e.invert(r,r);var n=[0,0,0],a=[0,1,0,0];return e.transformMat4$1(a,a,r),n[0]=a[0],n[1]=a[1],n[2]=a[2],e.normalize(n,n),n}(v));var C,z=f(n);try{for(z.s();!(C=z.n()).done;){var P=C.value,D=i.getTile(P),L=D.getBucket(r);if(L&&("mercator"!==L.projection.name||!S)){var B=a?L.text:L.icon;if(B&&!L.fullyClipped&&B.segments.get().length){var R=B.programConfigurations.get(r.id),F=a||L.sdfIcons,O=a?L.textSizeData:L.iconSizeData,U=_||0!==v.pitch,V=e.evaluateSizeForZoom(O,v.zoom),j=void 0,N=void 0,G=void 0,Z=void 0,q=[0,0],W=null;if(a){if(N=D.glyphAtlasTexture,G=m.LINEAR,j=D.glyphAtlasTexture.size,L.iconsInText){q=D.imageAtlasTexture.size,W=D.imageAtlasTexture;var X="composite"===O.kind||"camera"===O.kind;Z=U||t.options.rotating||t.options.zooming||X?m.LINEAR:m.NEAREST}}else{var H=1!==r.layout.get("icon-size").constantOr(0)||L.iconsNeedLinear;N=D.imageAtlasTexture,G=F||t.options.rotating||t.options.zooming||H||U?m.LINEAR:m.NEAREST,j=D.imageAtlasTexture.size}var Y="globe"===L.projection.name,K=Y?I:M,J=Y?e.globeToMercatorTransition(v.zoom):0,$=Bt(P,L.getProjection(),v),Q=v.calculatePixelsToTileUnitsMatrix(D),ee=dt($,D.tileID.canonical,_,y,v,L.getProjection(),Q),te=t.terrain&&_&&g?e.invert(e.create(),ee):Tr,ie=vt($,D.tileID.canonical,_,y,v,L.getProjection(),Q),re=E&&L.hasTextData(),ne="none"!==r.layout.get("icon-text-fit")&&re&&L.hasIconData();if(g){var ae=v.elevation,oe=ae?ae.getAtTileOffsetFunc(P,v.center.lat,v.worldSize,L.getProjection()):function(e){return[0,0,0]},se=mt($,D.tileID.canonical,_,y,v,L.getProjection(),Q);bt(L,$,t,a,se,ie,_,c,oe,P)}var le=g||a&&E||ne,ue=t.translatePosMatrix($,D,o,s),ce=le?Tr:ee,he=t.translatePosMatrix(ie,D,o,s,!0),fe=L.getProjection().createInversionMatrix(v,P.canonical),pe=[];t.terrain&&_&&pe.push("PITCH_WITH_MAP_TERRAIN"),Y&&pe.push("PROJECTION_GLOBE_VIEW"),le&&pe.push("PROJECTED_POS_ON_VIEWPORT");var de=F&&0!==r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1),me=void 0;me=F?L.iconsInText?gr(O.kind,V,x,_,t,ue,ce,he,j,q,P,J,T,fe,K,L.getProjection()):_r(O.kind,V,x,_,t,ue,ce,he,a,j,!0,P,J,T,fe,K,L.getProjection()):yr(O.kind,V,x,_,t,ue,ce,he,a,j,P,J,T,fe,K,L.getProjection());var ve={program:t.useProgram(Ar(F,a,L),R,pe),buffers:B,uniformValues:me,atlasTexture:N,atlasTextureIcon:W,atlasInterpolation:G,atlasInterpolationIcon:Z,isSDF:F,hasHalo:de,tile:D,labelPlaneMatr
1ixInv:te};if(b&&L.canOverlap){w=!0;var ye,_e=B.segments.get(),ge=f(_e);try{for(ge.s();!(ye=ge.n()).done;){var xe=ye.value;A.push({segments:new e.SegmentVector([xe]),sortKey:xe.sortKey,state:ve})}}catch(Se){ge.e(Se)}finally{ge.f()}}else A.push({segments:B.segments,sortKey:0,state:ve})}}}}catch(Se){z.e(Se)}finally{z.f()}w&&A.sort((function(e,t){return e.sortKey-t.sortKey}));for(var be=0,we=A;be<we.length;be++){var ke=we[be],Te=ke.state;if(t.terrain&&t.terrain.setupElevationDraw(Te.tile,Te.program,{useDepthForOcclusion:!S,labelPlaneMatrixInv:Te.labelPlaneMatrixInv}),d.activeTexture.set(m.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,m.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(d.activeTexture.set(m.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),Te.isSDF){var Ee=Te.uniformValues;Te.hasHalo&&(Ee.u_is_halo=1,Ir(Te.buffers,ke.segments,r,t,Te.program,k,h,p,Ee)),Ee.u_is_halo=0}Ir(Te.buffers,ke.segments,r,t,Te.program,k,h,p,Te.uniformValues)}}function Ir(t,i,r,n,a,o,s,l,u){var c=n.context,h=[t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer,t.globeExtVertexBuffer];a.draw(c,c.gl.TRIANGLES,o,s,l,e.CullFaceMode.disabled,u,r.id,t.layoutVertexBuffer,t.indexBuffer,i,r.paint,n.transform.zoom,t.programConfigurations.get(r.id),h)}function Cr(t,i,r,n,a,o,s){var l,u,c,h,p,d=t.context.gl,m=r.paint.get("fill-pattern"),v=m&&m.constantOr(1),y=r.getCrossfadeParameters();s?(u=v&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=d.LINES):(u=v?"fillPattern":"fill",l=d.TRIANGLES);var _,g=f(n);try{for(g.s();!(_=g.n()).done;){var x=_.value,b=i.getTile(x);if(!v||b.patternsLoaded()){var w=b.getBucket(r);if(w){t.prepareDrawTile();var k=w.programConfigurations.get(r.id),T=t.useProgram(u,k);v&&(t.context.activeTexture.set(d.TEXTURE0),b.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),k.updatePaintBuffers(y));var E=m.constantOr(null);if(E&&b.imageAtlas){var S=b.imageAtlas,A=S.patternPositions[E.to.toString()],M=S.patternPositions[E.from.toString()];A&&M&&k.setConstantPatternPositions(A,M)}var I=t.translatePosMatrix(x.projMatrix,b,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(s){h=w.indexBuffer2,p=w.segments2;var C=t.terrain&&t.terrain.renderingToTexture?t.terrain.drapeBufferSize:[d.drawingBufferWidth,d.drawingBufferHeight];c="fillOutlinePattern"===u&&v?er(I,t,y,b,C):Qi(I,C)}else h=w.indexBuffer,p=w.segments,c=v?$i(I,t,y,b):Ji(I);t.prepareDrawProgram(t.context,T,x.toUnwrapped()),T.draw(t.context,l,a,t.stencilModeForClipping(x),o,e.CullFaceMode.disabled,c,r.id,w.layoutVertexBuffer,h,p,r.paint,t.transform.zoom,k)}}}}catch(z){g.e(z)}finally{g.f()}}function zr(t,i,r,n,a,o,s){var l=t.context,u=l.gl,c=t.transform,h=r.paint.get("fill-extrusion-pattern"),p=h.constantOr(1),d=r.getCrossfadeParameters(),m=r.paint.get("fill-extrusion-opacity"),v=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),r.paint.get("fill-extrusion-ambient-occlusion-radius")],y=r.layout.get("fill-extrusion-edge-radius"),_="globe"===c.projection.name?e.fillExtrusionHeightLift():0,g="globe"===c.projection.name,x=g?e.globeToMercatorTransition(c.zoom):0,b=[e.mercatorXfromLng(c.center.lng),e.mercatorYfromLat(c.center.lat)],w=[];g&&(w.push("PROJECTION_GLOBE_VIEW"),t.style.terrainSetForDrapingOnly()&&w.push("TERRAIN")),v[0]>0&&w.push("FAUX_AO");var k,T=f(n);try{for(T.s();!(k=T.n()).done;){var E=k.value,S=i.getTile(E),A=S.getBucket(r);if(A&&A.projection.name===c.projection.name){var M=A.programConfigurations.get(r.id),I=t.useProgram(p?"fillExtrusionPattern":"fillExtrusion",M,w);if(t.terrain){var C=t.terrain;if(t.style.terrainSetForDrapingOnly())C.setupElevationDraw(S,I,{useMeterToDem:!0});else{if(!A.enableTerrain)continue;if(C.setupElevationDraw(S,I,{useMeterToDem:!0}),Pr(l,i,E,A,r,C),!A.centroidVertexBuffer){var z=I.attributes.a_centroid_pos;void 0!==z&&u.vertexAttrib2f(z,0,0)}}}p&&(t.context.activeTexture.set(u.TEXTURE0),S.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),M.updatePaintBuffers(d));var P=h.constantOr(null);if(P&&S.imageAtlas){var D=S.imageAtlas,L=D.patternPositions[P.to.toString()],B=D.patternPositions[P.from.toString()];L&&B&&M.setConstantPatternPositions(L,B)}var R=t.translatePosMatrix(E.projMatrix,S,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),F=c.projection.createInversionMatrix(c,E.canonical),O=r.paint.get("fill-extrusion-vertical-gradient"),U=p?Ki(R,t,O,m,v,y,E,d,S,_,x,b,F):Yi(R,t,O,m,v,y,E,_,x,b,F);t.prepareDrawProgram(l,I,E.toUnwrapped());var V=[];t.terrain&&V.push(A.centroidVertexBuffer),g&&V.push(A.layoutVertexExtBuffer),I.draw(l,l.gl.TRIANGLES,a,o,s,e.CullFaceMode.backCCW,U,r.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,r.paint,t.transform.zoom,M,V)}}}catch(j){T.e(j)}finally{T.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.canonical.z)-1,r--),new e.OverscaledTileID(t.overscaledZ,r,t.canonical.z,i,t.canonical.y)},function(t){var i=t.canonical.x+1,r=t.wrap;return i===1<<t.canonical.z&&(i=0,r++),new e.OverscaledTileID(t.overscaledZ,r,t.canonical.z,i,t.canonical.y)},function(t){return new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<<t.canonical.z:t.canonical.y)-1)},function(t){return new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<<t.canonical.z)-1?0:t.canonical.y+1)}],h=function(e){for(var t=i.getSource().minzoom,r=function(e){var t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(a)},n=0,o=[0,-1,1];n<o.length;n++){var s=o[n];if(!(e.overscaledZ+s<t)){var l=r(e.calculateScaledKey(e.overscaledZ+s));if(l)return l}}},p=[0,0,0],d=function(t,i){return p[0]=Math.min(t.min.y,i.min.y),p[1]=Math.max(t.max.y,i.max.y),p[2]=e.EXTENT-i.min.x>t.max.x?i.min.x-e.EXTENT:t.max.x,p},m=function(t,i){return p[0]=Math.min(t.min.x,i.min.x),p[1]=Math.max(t.max.x,i.max.x),p[2]=e.EXTENT-i.min.y>t.max.y?i.min.y-e.EXTENT:t.max.y,p},v=[function(e,t){return d(e,t)},function(e,t){return d(t,e)},function(e,t){return m(e,t)},function(e,t){return m(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,p=[a?f:(t+i)/2,a?(t+i)/2:f,0];return 0===n&&c<0||0!==n&&c>0?o.getForTilePoints(u,[p],!0,l):h.push(p),o.getForTilePoints(r,h,!0,s),Math.max(h[0][2],h[1][2],p[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,A=k.borderDoneWithNeighborZ[x]!==n.canonical.z;if(n.canonical.z===k.canonical.z){for(var M=0;M<b.length;M++){for(var I=n.featuresOnBorder[b[M]],C=I.borders[g],z=void 0;S<E.length&&!((z=k.featuresOnBorder[E[S]]).borders[x][1]>C[0]+3);)A&&k.encodeCentroid(void 0,z,!1),S++;if(z&&S<E.length){for(var P=S,D=0;!(z.borders[x][0]>C[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),A&&k.encodeCentroid(void 0,z,!1);continue}var L=v[g](I,z),B=g%2?e.EXTENT-1:0;y.x=_(L[0],Math.min(e.EXTENT-1,L[1]),B,g<2,L[2]),y.y=0,n.encodeCentroid(y,I,!1),A&&k.encodeCentroid(y,z,!1)}else n.encodeCentroid(void 0,I,!1)}n.borderDoneWithNeighborZ[g]=k.canonical.z,n.needsCentroidUpdate=!0,A&&(k.borderDoneWithNeighborZ[x]=n.canonical.z,k.needsCentroidUpdate=!0)}else{var R,F=f(b);try{for(F.s();!(R=F.n()).done;){var O=R.value;n.encodeCentroid(void 0,n.featuresOnBorder[O],!1)}}catch(N){F.e(N)}finally{F.f()}if(A){var U,V=f(E);try{for(V.s();!(U=V.n()).done;){var j=U.value;k.encodeCentroid(void 0,k.featuresOnBorder[j],!1)}}catch(N){V.e(N)}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),Br=new e.Color(0,0,1,1),Rr=new e.Color(1,0,1,1),Fr=new e.Color(0,1,1,1);function Or(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),p=i.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(p,f);var d=e.DepthMode.disabled,m=e.StencilMode.disabled,v=t.colorModeForRenderPass(),y="$debug";n.activeTexture.set(o.TEXTURE0),t.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s?p._makeGlobeTileDebugBuffers(t.context,a):p._makeDebugTileBoundsBuffers(t.context,a.projection);var _=p._tileDebugBuffer||t.debugBuffer,g=p._tileDebugIndexBuffer||t.debugIndexBuffer,x=p._tileDebugSegments||t.debugSegments;f.draw(n,o.LINE_STRIP,d,m,v,e.CullFaceMode.disabled,ar(u,e.Color.red),y,_,g,x,null,null,null,[p._globeTileDebugBorderBuffer]);var b=p.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+=" =>
1 ".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=p._tileDebugTextBuffer||t.debugBuffer,A=p._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,M=p._tileDebugTextSegments||t.debugSegments;f.draw(n,o.TRIANGLES,d,m,e.ColorMode.alphaBlended,e.CullFaceMode.disabled,ar(u,e.Color.transparent,T),y,S,A,M,null,null,null,[p._globeTileDebugTextBuffer])}function Ur(e,t,i,r){jr(e,0,t+i/2,e.transform.width,i,r)}function Vr(e,t,i,r){jr(e,t-i/2,0,i,e.transform.height,r)}function jr(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 Nr=e.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]).members;function Gr(e,t,i,r){e.emplaceBack(t,i,r)}var Zr=function t(i){v(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,Nr),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){v(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 y(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,p=f(t);try{for(p.s();!(l=p.n()).done;){var d=l.value,m=n.getTile(d),v=m.getBucket(r);if(v&&v.text&&v.text.segments.get().length){var y=e.evaluateSizeForZoom(v.textSizeData,u.zoom),_=Bt(d,v.getProjection(),u),g=u.calculatePixelsToTileUnitsMatrix(m),x=dt(_,m.tileID.canonical,h,c,u,v.getProjection(),g),b="none"!==r.layout.get("icon-text-fit")&&v.hasIconData();
1if(y){var w=Math.pow(2,u.zoom-m.tileID.overscaledZ);Sr(v,c,h,s,e.symbolSize,u,x,d,w,y,b)}}}}catch(k){p.e(k)}finally{p.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)&&Mr(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)&&Mr(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,p=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),d=e.StencilMode.disabled,m=t.colorModeForRenderPass(),v="globe"===h.projection.name,y=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],_=[],g=0;g<n.length;g++){var x=n[g],b=i.getTile(x),w=b.getBucket(r);if(w&&w.projection.name===h.projection.name){var k=w.programConfigurations.get(r.id),T=rr(r);v&&T.push("PROJECTION_GLOBE_VIEW");var E=t.useProgram("circle",k,T),S=w.layoutVertexBuffer,A=w.globeExtVertexBuffer,M=w.indexBuffer,I=h.projection.createInversionMatrix(h,x.canonical),C={programConfiguration:k,program:E,layoutVertexBuffer:S,globeExtVertexBuffer:A,indexBuffer:M,uniformValues:ir(t,x,b,I,y,r),tile:b};if(l){var z,P=w.segments.get(),D=f(P);try{for(D.s();!(z=D.n()).done;){var L=z.value;_.push({segments:new e.SegmentVector([L]),sortKey:L.sortKey,state:C})}}catch(H){D.e(H)}finally{D.f()}}else _.push({segments:w.segments,sortKey:0,state:C})}}l&&_.sort((function(e,t){return e.sortKey-t.sortKey}));for(var B={useDepthForOcclusion:!v},R=0,F=_;R<F.length;R++){var O=F[R],U=O.state,V=U.programConfiguration,j=U.program,N=U.layoutVertexBuffer,G=U.globeExtVertexBuffer,Z=U.indexBuffer,q=U.uniformValues,W=U.tile,X=O.segments;t.terrain&&t.terrain.setupElevationDraw(W,j,B),t.prepareDrawProgram(u,j,W.tileID.toUnwrapped()),j.draw(u,c.TRIANGLES,p,d,m,e.CullFaceMode.disabled,q,r.id,N,Z,X,r.paint,h.zoom,V,[G])}}}},heatmap:function(t,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){var a=t.context,o=a.gl,s=e.StencilMode.disabled,l=new e.ColorMode([o.ONE,o.ONE],e.Color.transparent,[!0,!0,!0,!0]);!function(e,t,i,r){var n=e.gl,a=t.width*r,o=t.height*r;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,a,o]);var s=i.heatmapFbo;if(!s||s&&(s.width!==a||s.height!==o)){s&&s.destroy();var l=n.createTexture();n.bindTexture(n.TEXTURE_2D,l),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
1INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),s=i.heatmapFbo=e.createFramebuffer(a,o,!1),function(e,t,i,r,n,a){var o=e.gl;o.texImage2D(o.TEXTURE_2D,0,o.RGBA,n,a,0,o.RGBA,e.extRenderToTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:o.UNSIGNED_BYTE,null),r.colorAttachment.set(i)}(e,0,l,s,a,o)}else n.bindTexture(n.TEXTURE_2D,s.colorAttachment.get()),e.bindFramebuffer.set(s.framebuffer)}(a,t,r,"globe"===t.transform.projection.name?.5:.25),a.clear({color:e.Color.transparent});for(var u=t.transform,c="globe"===u.projection.name,h=c?["PROJECTION_GLOBE_VIEW"]:null,f=c?e.CullFaceMode.frontCCW:e.CullFaceMode.disabled,p=[e.mercatorXfromLng(u.center.lng),e.mercatorYfromLat(u.center.lat)],d=0;d<n.length;d++){var m=n[d];if(!i.hasRenderableParent(m)){var v=i.getTile(m),y=v.getBucket(r);if(y&&y.projection.name===u.projection.name){var _=y.programConfigurations.get(r.id),g=t.useProgram("heatmap",_,h),x=t.transform.zoom;t.terrain&&t.terrain.setupElevationDraw(v,g),t.prepareDrawProgram(a,g,m.toUnwrapped());var b=u.projection.createInversionMatrix(u,m.canonical);g.draw(a,o.TRIANGLES,e.DepthMode.disabled,s,l,f,sr(t,m,v,b,p,x,r.paint.get("heatmap-intensity")),r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,r.paint,t.transform.zoom,_,c?[y.globeExtVertexBuffer]:null)}}}a.viewport.set([0,0,t.width,t.height])}else"translucent"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,i){var r=t.context,n=r.gl,a=i.heatmapFbo;if(a){r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);var o=i.colorRampTexture;o||(o=i.colorRampTexture=new e.Texture(r,i.colorRamp,n.RGBA)),o.bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,n.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,function(e,t,i,r){return{u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}}(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}}(t,r))},line:function(t,i,r,n){if("translucent"===t.renderPass){var a=r.paint.get("line-opacity"),o=r.paint.get("line-width");if(0!==a.constantOr(1)&&0!==o.constantOr(1)){var s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),u=t.terrain&&t.terrain.renderingToTexture?1:e.exported.devicePixelRatio,c=r.paint.get("line-dasharray"),p=c.constantOr(1),d=r.layout.get("line-cap"),m=r.paint.get("line-pattern"),v=m.constantOr(1),y=r.paint.get("line-gradient"),_=r.getCrossfadeParameters(),g=v?"linePattern":"line",x=t.context,b=x.gl,w=function(e){var t=[];fr(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");var i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET");var r=e.paint.get("line-pattern").constantOr(1),n=1!==e.paint.get("line-opacity").constantOr(1);return!r&&n&&t.push("RENDER_LINE_ALPHA_DISCARD"),t}(r),k=w.includes("RENDER_LINE_ALPHA_DISCARD");t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(k=!1);var T,E=f(n);try{var S=function(){var n=T.value,a=i.getTile(n);if(v&&!a.patternsLoaded())return"continue";var o=a.getBucket(r);if(!o)return"continue";t.prepareDrawTile();var f=o.programConfigurations.get(r.id),E=t.useProgram(g,f,w),S=m.constantOr(null);if(S&&a.imageAtlas){var A=a.imageAtlas,M=A.patternPositions[S.to.toString()],I=A.patternPositions[S.from.toString()];M&&I&&f.setConstantPatternPositions(M,I)}var C=c.constantOr(null),z=d.constantOr(null);if(!v&&C&&z&&a.lineAtlas){var P=a.lineAtlas,D=P.getDash(C.to,z),L=P.getDash(C.from,z);D&&L&&f.setConstantPatternPositions(D,L)}var B=r.paint.get("line-trim-offset"),R=h(B,2),F=R[0],O=R[1];if("round"===z||"square"===z){var U=1;F!==O&&(0===F&&(F-=U),1===O&&(O+=U))}var V=t.terrain?n.projMatrix:null,j=v?ur(t,a,r,_,V,u):lr(t,a,r,_,V,o.lineClipsArray.length,u,[F,O]);if(y){var N=o.gradients[r.id],G=N.texture;if(r.gradientVersion!==N.version){var Z=256;if(r.stepInterpolant){var q=i.getSource().maxzoom,W=n.canonical.z===q?Math.ceil(1<<t.transform.maxZoom-n.canonical.z):1;Z=e.clamp(e.nextPowerOfTwo(o.maxLineLength/e.EXTENT*1024*W),256,x.maxTextureSize)}N.gradient=e.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:Z,image:N.gradient||void 0,clips:o.lineClipsArray}),N.texture?N.texture.update(N.gradient):N.texture=new e.Texture(x,N.gradient,b.RGBA),N.version=r.gradientVersion,G=N.texture}x.activeTexture.set(b.TEXTURE1),G.bind(r.stepInterpolant?b.NEAREST:b.LINEAR,b.CLAMP_TO_EDGE)}p&&(x.activeTexture.set(b.TEXTURE0),a.lineAtlasTexture.bind(b.LINEAR,b.REPEAT),f.updatePaintBuffers(_)),v&&(x.activeTexture.set(b.TEXTURE0),a.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),f.updatePaintBuffers(_)),t.prepareDrawProgram(x,E,n.toUnwrapped());var X=function(i){E.draw(x,b.TRIANGLES,s,i,l,e.CullFaceMode.disabled,j,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,t.transform.zoom,f,[o.layoutVertexBuffer2])};if(k){var H=t.stencilModeForClipping(n).ref;0===H&&t.terrain&&x.clear({stencil:0});var Y={func:b.EQUAL,mask:255};
1j.u_alpha_discard_threshold=.8,X(new e.StencilMode(Y,H,255,b.KEEP,b.KEEP,b.INVERT)),j.u_alpha_discard_threshold=0,X(new e.StencilMode(Y,H,255,b.KEEP,b.KEEP,b.KEEP))}else X(t.stencilModeForClipping(n))};for(E.s();!(T=E.n()).done;)S()}catch(A){E.e(A)}finally{E.f()}k&&(t.resetStencilClippingMasks(),t.terrain&&x.clear({stencil:0}))}}},fill:function(t,i,r,n){var a=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0!==o.constantOr(1)){var s=t.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===a.constantOr(e.Color.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(t.renderPass===u){var c=t.depthModeForSublayer(1,"opaque"===t.renderPass?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly);Cr(t,i,r,n,c,s,!1)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){var h=t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,e.DepthMode.ReadOnly);Cr(t,i,r,n,h,s,!0)}}},"fill-extrusion":function(t,i,r,n){var a=r.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===t.renderPass){var o=new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);if(1!==a||r.paint.get("fill-extrusion-pattern").constantOr(1))zr(t,i,r,n,o,e.StencilMode.disabled,e.ColorMode.disabled),zr(t,i,r,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass()),t.resetStencilClippingMasks();else{var s=t.colorModeForRenderPass();zr(t,i,r,n,o,e.StencilMode.disabled,s)}}},hillshade:function(t,i,r,n){if("offscreen"===t.renderPass||"translucent"===t.renderPass){var a,o=t.context,s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),u=t.terrain&&t.terrain.renderingToTexture,c="translucent"!==t.renderPass||u?[{},n]:t.stencilConfigForOverlap(n),p=h(c,2),d=p[0],m=p[1],v=f(m);try{for(v.s();!(a=v.n()).done;){var y=a.value,_=i.getTile(y);if(_.needsHillshadePrepare&&"offscreen"===t.renderPass)Pi(t,_,r,s,e.StencilMode.disabled,l);else if("translucent"===t.renderPass){var g=u&&t.terrain?t.terrain.stencilModeForRTTOverlap(y):d[y.overscaledZ];Ci(t,y,_,r,s,g,l)}}}catch(x){v.e(x)}finally{v.f()}o.viewport.set([0,0,t.width,t.height]),t.resetStencilClippingMasks()}},raster:function(t,i,r,n,a,o){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity")&&n.length){var s,l=t.context,u=l.gl,c=i.getSource(),p=t.useProgram("raster"),d=t.colorModeForRenderPass(),m=t.terrain&&t.terrain.renderingToTexture,v=c instanceof Ge||m?[{},n]:t.stencilConfigForOverlap(n),y=h(v,2),_=y[0],g=y[1],x=g[g.length-1].overscaledZ,b=!t.options.moving,w=f(g);try{for(w.s();!(s=w.n()).done;){var k=s.value,T=m?e.DepthMode.disabled:t.depthModeForSublayer(k.overscaledZ-x,1===r.paint.get("raster-opacity")?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly,u.LESS),E=k.toUnwrapped(),S=i.getTile(k);if(!m||S&&S.hasData()){var A=m?k.projMatrix:t.transform.calculateProjMatrix(E,b),M=t.terrain&&m?t.terrain.stencilModeForRTTOverlap(k):_[k.overscaledZ],I=o?0:r.paint.get("raster-fade-duration");S.registerFadeDuration(I);var C=i.findLoadedParent(k,0),z=ji(S,C,i,t.transform,I),P=void 0,D=void 0;t.terrain&&t.terrain.prepareDrawTile();var L="nearest"===r.paint.get("raster-resampling")?u.NEAREST:u.LINEAR;l.activeTexture.set(u.TEXTURE0),S.texture.bind(L,u.CLAMP_TO_EDGE),l.activeTexture.set(u.TEXTURE1),C?(C.texture.bind(L,u.CLAMP_TO_EDGE),P=Math.pow(2,C.tileID.overscaledZ-S.tileID.overscaledZ),D=[S.tileID.canonical.x*P%1,S.tileID.canonical.y*P%1]):S.texture.bind(L,u.CLAMP_TO_EDGE);var B=pr(A,D||[0,0],P||1,z,r,c instanceof Ge?c.perspectiveTransform:[0,0]);if(t.prepareDrawProgram(l,p,E),c instanceof Ge)c.boundsBuffer&&c.boundsSegments&&p.draw(l,u.TRIANGLES,T,e.StencilMode.disabled,d,e.CullFaceMode.disabled,B,r.id,c.boundsBuffer,t.quadTriangleIndexBuffer,c.boundsSegments);else{var R=t.getTileBoundsBuffers(S),F=R.tileBoundsBuffer,O=R.tileBoundsIndexBuffer,U=R.tileBoundsSegments;p.draw(l,u.TRIANGLES,T,M,d,e.CullFaceMode.disabled,B,r.id,F,O,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 p=!h&&1===a.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===p){var d,m=e.StencilMode.disabled,v=t.depthModeForSublayer(0,"opaque"===p?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly),y=t.colorModeForRenderPass(),_=t.useProgram(h?"backgroundPattern":"background"),g=n;
1g||(d=t.getBackgroundTiles(),g=Object.values(d).map((function(e){return e.tileID}))),h&&(s.activeTexture.set(l.TEXTURE0),t.imageManager.bind(t.context));var x,b=r.getCrossfadeParameters(),w=f(g);try{for(w.s();!(x=w.n()).done;){var k=x.value,T=k.toUnwrapped(),E=n?k.projMatrix:t.transform.calculateProjMatrix(T);t.prepareDrawTile();var S=i?i.getTile(k):d?d[k.key]:new e.Tile(k,c,u.zoom,t),A=h?br(E,o,t,h,{tileID:k,tileSize:c},b):xr(E,o,a);t.prepareDrawProgram(s,_,T);var M=t.getTileBoundsBuffers(S),I=M.tileBoundsBuffer,C=M.tileBoundsIndexBuffer,z=M.tileBoundsSegments;_.draw(s,l.TRIANGLES,v,m,y,e.CullFaceMode.disabled,A,r.id,I,C,z)}}catch(P){w.e(P)}finally{w.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;r<i.length;r++)Or(e,t,i[r])},custom:function(t,i,r){var n=t.context,a=r.implementation;if(t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes("custom"))e.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if("offscreen"===t.renderPass){var o=a.prerender;o&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),o.call(a,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(e.StencilMode.disabled);var s="3d"===a.renderingMode?new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,e.DepthMode.ReadOnly);n.setDepthMode(s),a.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}},Yr=function(){function t(i,r){v(this,t),this.context=new Ve(i),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 si,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}
1return y(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:"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];l<u.length;l++){var c=u[l];s.emplaceBack(c)}this.debugIndexBuffer=t.createIndexBuffer(s),this.emptyTexture=new e.Texture(t,new e.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.create();var h=this.context.gl;this.stencilClearMode=new e.StencilMode({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.loadTimeStamps.push(e.window.performance.now()),this.atmosphereBuffer=new Xr(this.context)}},{key:"getMercatorTileBoundsBuffers",value:function(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}},{key:"getTileBoundsBuffers",value:function(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}},{key:"clearStencil",value:function(){var t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(t,i.TRIANGLES,e.DepthMode.disabled,this.stencilClearMode,e.ColorMode.disabled,e.CullFaceMode.disabled,Vi(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}},{key:"resetStencilClippingMasks",value:function(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}},{key:"_renderTileClippingMasks",value:function(t,i,r){if(i&&this.currentStencilSource!==i.id&&t.isTileClipped()&&r&&0!==r.length){if(this._tileClippingMaskIDs&&!this.terrain){var n,a=!1,o=f(r);try{for(o.s();!(n=o.n()).done;){var s=n.value;if(void 0===this._tileClippingMaskIDs[s.key]){a=!0;break}}}catch(b){o.e(b)}finally{o.f()}if(!a)return}this.currentStencilSource=i.id;var l=this.context,u=l.gl;this.nextStencilID+r.length>256&&this.clearStencil(),l.setColorMode(e.ColorMode.disabled),l.setDepthMode(e.DepthMode.disabled);var c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};var h,p=f(r);try{for(p.s();!(h=p.n()).done;){var d=h.value,m=i.getTile(d),v=this._tileClippingMaskIDs[d.key]=this.nextStencilID++,y=this.getTileBoundsBuffers(m),_=y.tileBoundsBuffer,g=y.tileBoundsIndexBuffer,x=y.tileBoundsSegments;c.draw(l,u.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:u.ALWAYS,mask:0}
1,v,255,u.KEEP,u.KEEP,u.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,Vi(d.projMatrix),"$clipping",_,g,x)}}catch(b){p.e(b)}finally{p.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<o;l++)s[l+a]=new e.StencilMode({func:i.GEQUAL,mask:255},l+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=o,[s,n]}return[r({},a,e.StencilMode.disabled),n]}},{key:"colorModeForRenderPass",value:function(){var t=this.context.gl;if(this._showOverdrawInspector){var i=1/8;return new e.ColorMode([t.CONSTANT_COLOR,t.ONE],new e.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?e.ColorMode.unblended:e.ColorMode.alphaBlended}},{key:"depthModeForSublayer",value:function(t,i,r){if(!this.opaquePassEnabledForLayer())return e.DepthMode.disabled;var n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new e.DepthMode(r||this.context.gl.LEQUAL,i,[n,n])}},{key:"opaquePassEnabledForLayer",value:function(){return this.currentLayer<this.opaquePassCutoff}},{key:"render",value:function(t,i){var r=this;this.style=t,this.options=i,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.exported.now()),this.imageManager.beginFrame();var n=this.style.order,a=this.style._sourceCaches;for(var o in a){var s=a[o];s.used&&s.prepare(this.context)}var l={},u={},c={};for(var h in a){var p=a[h];l[h]=p.getVisibleCoordinates(),u[h]=l[h].slice().reverse(),c[h]=p.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var d=0;d<n.length;d++)if(this.style._layers[n[d]].is3D()){this.opaquePassCutoff=d;break}if(this.terrain&&(this.terrain.updateTileBinding(c),this.opaquePassCutoff=0),"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.GlobeSharedBuffers(this.context)),e.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";var m,v=f(n);try{for(v.s();!(m=v.n()).done;){var y=m.value,_=this.style._layers[y],g=t._getLayerSourceCache(_);if(_.hasOffscreenPass()&&!_.isHidden(this.transform.zoom)){var x=g?u[g.id]:void 0;("custom"===_.type||_.isSky()||x&&x.length)&&this.renderLayer(this,g,_,x)}}}catch(C){v.e(C)}finally{v.f()}if(this.depthRangeFor3D=[0,1-(t.order.length+2)*this.numSublayers*this.depthEpsilon],this.terrain&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&this.terrain.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]),this.context.clear({color:i.showOverdrawInspector?e.Color.black:e.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){var b=this.style._layers[n[this.currentLayer]],w=t._getLayerSourceCache(b);if(!b.isSky()){var k=w?u[w.id]:void 0;this._renderTileClippingMasks(b,w,k),this.renderLayer(this,w,b,k)}}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 p=e.fromQuat(new Float32Array(16),f),d=e.mapValue(i.properties.get("star-intensity"),0,1,0,.25),m=5e-4,v=e.mapValue(i.properties.get("horizon-blend"),0,1,m,.25),y=e.globeUseCustomAntiAliasing(t,r,a)&&v===m?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,p,d){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:p,u_rotation_matrix:d}}(a.frustumCorners.TL,a.frustumCorners.TR,a.frustumCorners.BR,a.frustumCorners.BL,a.frustumCorners.horizon,l,v,u,c,h,d,_,b,p);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.isH
1orizonVisible())for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){var T=this.style._layers[n[this.currentLayer]],E=t._getLayerSourceCache(T);T.isSky()&&this.renderLayer(this,E,T,E?u[E.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;){var S=this.style._layers[n[this.currentLayer]],A=t._getLayerSourceCache(S);if(S.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(S)){if(S.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer)}else{var M=A?("symbol"===S.type?c:u)[A.id]:void 0;this._renderTileClippingMasks(S,A,A?l[A.id]:void 0),this.renderLayer(this,A,S,M),++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry){var I=null;e.values(this.style._layers).forEach((function(e){var i=t._getLayerSourceCache(e);i&&!e.isHidden(r.transform.zoom)&&(!I||I.getSource().maxzoom<i.getSource().maxzoom)&&(I=i)})),I&&this.options.showTileBoundaries&&Hr.debug(this,I,I.getVisibleCoordinates())}this.options.showPadding&&function(e){var t=e.transform.padding;Ur(e,e.transform.height-(t.top||0),3,Dr),Ur(e,t.bottom||0,3,Lr),Vr(e,t.left||0,3,Br),Vr(e,e.transform.width-(t.right||0),3,Rr);var i=e.transform.centerPoint;!function(e,t,i,r){jr(e,t-1,i-10,2,20,r),jr(e,t-10,i-1,20,2,r)}(e,i.x,e.transform.height-i.y,Fr)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(e.window.performance.now()),this.saveC
1anvasCopy())}}},{key:"renderLayer",value:function(e,t,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"sky"===i.type||"custom"===i.type||r&&r.length)&&(this.id=i.id,this.gpuTimingStart(i),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(i.type)||Hr[i.type](e,t,i,r,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}},{key:"gpuTimingStart",value:function(e){if(this.options.gpuTiming){var t=this.context.extTimerQuery,i=this.gpuTimers[e.id];i||(i=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:t.createQueryEXT()}),i.calls++,t.beginQueryEXT(t.TIME_ELAPSED_EXT,i.query)}}},{key:"gpuTimingDeferredRenderStart",value:function(){if(this.options.gpuTimingDeferredRender){var e=this.context.extTimerQuery,t=e.createQueryEXT();this.deferredRenderGpuTimeQueries.push(t),e.beginQueryEXT(e.TIME_ELAPSED_EXT,t)}}},{key:"gpuTimingDeferredRenderEnd",value:function(){if(this.options.gpuTimingDeferredRender){var e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}}},{key:"gpuTimingEnd",value:function(){if(this.options.gpuTiming){var e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}}},{key:"collectGpuTimers",value:function(){var e=this.gpuTimers;return this.gpuTimers={},e}},{key:"collectDeferredRenderGpuQueries",value:function(){var e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}},{key:"queryGpuTimers",value:function(e){var t={};for(var i in e){var r=e[i],n=this.context.extTimerQuery,a=n.getQueryObjectEXT(r.query,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(r.query),t[i]=a}return t}},{key:"queryGpuTimeDeferredRender",value:function(e){if(!this.options.gpuTimingDeferredRender)return 0;var t,i=this.context.extTimerQuery,r=0,n=f(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;r+=i.getQueryObjectEXT(a,i.QUERY_RESULT_EXT)/1e6,i.deleteQueryEXT(a)}}catch(o){n.e(o)}finally{n.f()}return r}},{key:"translatePosMatrix",value:function(t,i,r,n,a){if(!r[0]&&!r[1])return t;var o=a?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(o){var s=Math.sin(o),l=Math.cos(o);r=[r[0]*l-r[1]*s,r[0]*s+r[1]*l]}var u=[a?r[0]:W(i,r[0],this.transform.zoom),a?r[1]:W(i,r[1],this.transform.zoom),0],c=new Float32Array(16);return e.translate(c,t,u),c}},{key:"saveTileTexture",value:function(e){var t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}},{key:"getTileTexture",value:function(e){var t=this._tileTextures[e];return t&&t.length>0?t.pop():null}},{key:"isPatternMissing",value:function(e){if(!e)return!1;if(!e.from||!e.to)return!0;var t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}},{key:"currentGlobalDefines",value:function(){var e=this.terrain&&this.terrain.renderingToTexture,t=this.style&&this.style.fog,i=[];return this.terrain&&!this.terrain.renderingToTexture&&i.push("TERRAIN"),t&&!e&&0!==t.getOpacity(this.transform.pitch)&&i.push("FOG"),e&&i.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&i.push("OVERDRAW_INSPECTOR"),i}},{key:"useProgram",value:function(e,t,i){this.cache=this.cache||{};var r=i||[],n=this.currentGlobalDefines().concat(r),a=Wi.cacheKey(Ei[e],e,n,t);return this.cache[a]||(this.cache[a]=new Wi(this.context,e,Ei[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,p=i.properties.get("color").toArray01();p[3]=n;var d=t.frameCounter/1e3%1;return{u_fog_matrix:r?f.calculateFogTileMatrix(r):t.identityMat,u_fog_range:i.getFovAdjustedRange(f._fov),u_fog_color:p,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_temporal_offset:d,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(){this.frameCopies.push(this.canvasCopy()),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)}}
1,{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={}}},{key:"terrain",get:function(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}}]),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(v(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 y(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){v(this,t),this.position=e,this.orientation=i}return y(t,[{key:"lookAtPoint",value:function(t,i){if(this.orientation=null,this.position){var r=this._elevation?this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)):0,n=this.position,a=e.MercatorCoordinate.fromLngLat(t,r),o=[a.x-n.x,a.y-n.y,a.z-n.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))}},{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]);
1this._renderWorldCopies&&(i.x=e.wrap(i.x,0,1)),this._position=i}else this._position=null}}]),t}(),tn=function(){function t(i,r){v(this,t),this._transform=e.identity([]),this.orientation=r,this.position=i}return y(t,[{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=0===t?0:e.mercatorZfromAltitude(t,this.position[1]),r=this.forward();return(i-this.position[2])/r[2]}},{key:"clone",value:function(){return new t(c(this.position),c(this.orientation))}},{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)}}]),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(),p=t.project(f.lng,f.lat),d=e.MercatorCoordinate.fromLngLat(f);d.x+=on;var m=d.toLngLat(),v=t.project(m.lng,m.lat),y=ln(v.x-p.x,v.y-p.y,c),_=e.MercatorCoordinate.fromLngLat(f);_.y+=on;var g=_.toLngLat(),x=t.project(g.lng,g.lat),b=ln(x.x-p.x,x.y-p.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,p=u.y-l.y,d=Math.sqrt((f*f+p*p)/(c*c+h*h));return Math.log(d)/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){v(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 y(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._centerAltitudeValidForE
1xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,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:"updateElevation",value:function(e){var t=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||t)&&this._updateCameraOnTerrain(),(e||t)&&this._constrainCameraAltitude(),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:"_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._centerAltitudeValidForE
1xaggeration=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;o<i.length;o++){var s=new e.pointGeometry(i[o][0]*this.width,r+i[o][1]*(this.height-r)),l=t.pointCoordinate(s);if(l){var u=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);n+=l[3]*u,a+=u}}return 0===a?NaN:n/a}},{key:"_updateZoomFromElevation",value:function(){if(null!=this._seaLevelZoom&&this._elevation){var e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),i=this.pixelsPerMeter/this.worldSize*t,r=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom),a=Math.max(r-i,n);this._setZoom(this._zoomFromMercatorZ(a))}}},{key:"computeZoomRelativeTo",value:function(t){var i,r=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));i=t.z<this._camera.position[2]?[r.x,r.y,r.z]:[t.x,t.y,t.z];var n=e.length(e.sub([],this._camera.position,i));return e.clamp(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}},{key:"setFreeCameraOptions",value:function(t){if(this.height&&(t.position||t.orientation)){this._updateCameraState();var i=!1;if(t.orientation&&!e.exactEquals(t.orientation,this._camera.orientation)&&(i=this._setCameraOrientation(t.orientation)),t.position){var r=[t.position.x,t.position.y,t.position.z];e.exactEquals$1(r,this._camera.position)||(this._setCameraPosition(r),i=!0)}i&&(this._updateStateFromCamera(),this.recenterOnTerrain())}}},{key:"getFreeCameraOptions",value:function(){this._updateCameraState();var t=this._camera.position,i=new en;return i.position=new e.MercatorCoordinate(t[0],t[1],t[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this.renderWorldCopies,i}},{key:"_setCameraOrientation",value:function(t){if(!e.length$1(t))return!1;e.normalize$1(t,t);var i=e.transformQuat([],[0,0,-1],t),r=e.transformQuat([],[0,-1,0],t);if(r[2]<0)return!1;var n=Qr(i,r);return!!n&&(this._camera.orientation=n,!0)}},{key:"_setCameraPosition",value:function(t){var i=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;t[2]=e.clamp(t[2],n/r,n/i),this._camera.position=t}},{key:"isPaddingEqual",value:function(e){return this._edgeInsets.equals(e)}},{key:"interpolatePadding",value:function(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}},{key:"coveringZoomLevel",value:function(e){var t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}},{key:"getVisibleUnwrappedCoordinates",value:function(t){var i=[new e.UnwrappedTileID(0,t)];if(this.renderWorldCopies)for(var r=this.pointCoordinate(new e.pointGeometry(0,0)),n=this.pointCoordinate(new e.pointGeometry(this.width,0)),a=this.pointCoordinate(new e.pointGeometry(this.width,this.height)),o=this.pointCoordinate(new e.pointGeometry(0,this.height)),s=Math.floor(Math.min(r.x,n.x,a.x,o.x)),l=Math.floor(Math.max(r.x,n.x,a.x,o.x)),u=1,c=s-u;c<=l+u;c++)0!==c&&i.push(new e.UnwrappedTileID(c,t));return i}},{key:"coveringTiles",value:function(t){var i=this,r=this.coveringZoomLevel(t),n=r,a=this.elevation&&!t.isTerrainDEM,o="mercator"===this.projection.name;if(void 0!==t.minzoom&&r<t.minzoom)return[];void 0!==t.maxzoom&&r>t.maxzoom&&(r=t.maxzoom);var s=this.locationCoordinate(this.center),l=this.center.lat,u=1<<r,c=[u*s.x,u*s.y,0],h="globe"===this.projection.name,f=!h,p=e.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,f),d=h?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),m=u*e.mercatorZfromAltitude(1,this.center.lat),v=this._camera.position[2]/e.mercatorZfromAltitude(1,this.center.lat),y=[u*d.x,u*d.y,v*(f?1:m)],_=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),g=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?r:0,x=t.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,b=t.isTerrainDEM?-x:this._elevation?this._elevation.getMinElevationBelowMSL():0,w=this.projection.isReprojectedInTileSpace?nn(this):1,k=function(t){var r=1/4e4,n=new e.MercatorCoordinate(t.x+r,t.y,t.z),a=new e.MercatorCoordinate(t.x,t.y+r,t.z),o=t.toLngLat(),s=n.toLngLat(),l=a.toLngLat(),u=i.locationCoordinate(o),c=i.locationCoordinate(s),h=i.locationCoordinate(l),f=Math.hypot(c.x-u.x,c.y-u.y),p=Math.hypot(h.x-u.x,h.y-u.
1y);return Math.sqrt(f*p)*w/r},T=function(t){var r=x,n=b;return{aabb:e.tileAABB(i,u,0,0,0,t,n,r,i.projection),zoom:0,x:0,y:0,minZ:n,maxZ:r,wrap:t,fullyVisible:!1}},E=[],S=[],A=r,M=t.reparseOverscaled?n:r,I=function(e){return e*e},C=I((v-this._centerAltitude)*m),z=function(e){if(i._elevation&&e.tileID&&o){var t=i._elevation.getMinMaxForTile(e.tileID),r=e.aabb;t?(r.min[2]=t.min,r.max[2]=t.max,r.center[2]=(r.min[2]+r.max[2])/2):(e.shouldSplit=P(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=i._centerAltitude))}},P=function(t){if(t.zoom<g)return!0;if(t.zoom===A)return!1;if(null!=t.shouldSplit)return t.shouldSplit;var r=t.aabb.distanceX(y),o=t.aabb.distanceY(y),s=C,u=1;if(h){s=I(t.aabb.distanceZ(y));var c=Math.pow(2,t.zoom),f=e.latFromMercatorY((t.y+1)/c),p=e.latFromMercatorY(t.y/c),d=Math.min(Math.max(l,f),p),v=e.circumferenceAtLatitude(d)/e.circumferenceAtLatitude(l);if(u=d===l?1/Math.max(1,i._mercatorScaleRatio-.3):Math.min(1,v/i._mercatorScaleRatio),i.zoom<=e.GLOBE_ZOOM_THRESHOLD_MIN&&t.zoom===A-1&&v>=.9)return!0}else if(a&&(s=I(t.aabb.distanceZ(y)*m)),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;return w<I((1<<A-t.zoom)*_*u*function(e,t){if(t*I(.707)<e)return 1;var i=Math.sqrt(t/e);return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)}(Math.max(s,C),w))};if(this.renderWorldCopies)for(var D=1;D<=3;D++)E.push(T(-D)),E.push(T(D));for(E.push(T(0));E.length>0;){var L=E.pop(),B=L.x,R=L.y,F=L.fullyVisible;if(!F){var O=L.aabb.intersects(p);if(0===O)continue;F=2===O}if(L.zoom!==A&&P(L))for(var U=0;U<4;U++){var V=(B<<1)+U%2,j=(R<<1)+(U>>1),N={aabb:o?L.aabb.quadrant(U):e.tileAABB(this,u,L.zoom+1,V,j,L.wrap,L.minZ,L.maxZ,this.projection),zoom:L.zoom+1,x:V,y:j,wrap:L.wrap,fullyVisible:F,tileID:void 0,shouldSplit:void 0,minZ:L.minZ,maxZ:L.maxZ};a&&!h&&(N.tileID=new e.OverscaledTileID(L.zoom+1===A?M:L.zoom+1,L.wrap,L.zoom+1,V,j),z(N)),E.push(N)}else{var G=L.zoom===A?M:L.zoom;if(t.minzoom&&t.minzoom>G)continue;var Z=c[0]-(.5+B+(L.wrap<<L.zoom))*(1<<r-L.zoom),q=c[1]-.5-R,W=L.tileID?L.tileID:new e.OverscaledTileID(G,L.wrap,L.zoom,B,R);S.push({tileID:W,distanceSq:Z*Z+q*q})}}if(this.fogCullDistSq){var X=this.fogCullDistSq,H=this.horizonLineFromTop();S=S.filter((function(r){var n=[0,0,0,1],a=[e.EXTENT,e.EXTENT,0,1],o=i.calculateFogTileMatrix(r.tileID.toUnwrapped());e.transformMat4$1(n,n,o),e.transformMat4$1(a,a,o);var s=e.getAABBPointSquareDist(n,a);if(0===s)return!0;var l=!1,u=i._elevation;if(u&&s>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),p=[f[0]*e.EXTENT,f[1]*e.EXTENT,c.max];e.transformMat4(p,p,h),l=(1-p[1])*i.height*.5<H}return s<X||l}))}return S.sort((function(e,t){return e.distanceSq-t.distanceSq})).map((function(e){return e.tileID}))}},{key:"resize",value:function(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}},{key:"zoomScale",value:function(e){return Math.pow(2,e)}},{key:"scaleZoom",value:function(e){return Math.log(e)/Math.LN2}},{key:"project",value:function(t){var i=e.clamp(t.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),r=this.projection.project(t.lng,i);return new e.pointGeometry(r.x*this.worldSize,r.y*this.worldSize)}},{key:"unproject",value:function(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}},{key:"setLocationAtPoint",value:function(t,i){var r,n,a=this.centerPoint;if("globe"===this.projection.name){var o=this.worldSize;r=(i.x-a.x)/o,n=(i.y-a.y)/o}else{var s=this.pointCoordinate(i),l=this.pointCoordinate(a);r=s.x-l.x,n=s.y-l.y}var u=this.locationCoordinate(t);this.setLocation(new e.MercatorCoordinate(u.x-r,u.y-n))}},{key:"setLocation",value:function(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}},{key:"locationPoint",value:function(e){return this.projection.locationPoint(this,e)}},{key:"locationPoint3D",value:function(e){return this.projection.locationPoint(this,e,!0)}},{key:"pointLocation",value:function(e){return this.coordinateLocation(this.pointCoordinate(e))}},{key:"pointLocation3D",value:function(e){return this.coordinateLocation(this.pointCoordinate3D(e))}},{key:"locationCoordinate",value:function(t,i){var r=i?e.mercatorZfromAltitude(i,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new e.MercatorCoordinate(n.x,n.y,r)}},{key:"coordinateLocation",value:function(e){return this.projection.unproject(e.x,e.y)}},{key:"pointRayIntersection",value:function(t,i){var r=null!=i?i:this._centerAltitude,n=[t.x,t.y,0,1],a=[t.x,t.y,1,1];e.transformMat4$1(n,n,this.pixelMatrixInverse),e.transformMat4$1(a,a,this.pixelMatrixInverse);var o=a[3];e.scale$1(n,n,1/n[3]),e.scale$1(a,a,1/o);var s=n[2],l=a[2];return{p0:n,p1:a,t:s===l?0:(r-s)/(l-s)}}},{key:"screenPointToMercatorRay",value:function(t){var i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return e.transformMat4$1(i,i,this.pixelMatrixInverse),e.transformMat4$1(r,r,this.pixelMatrixInverse),e.scale$1(i,i,1/i[3]),e.scale$1(r,r,1/r[3]),i[2]=e.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,r[2]=e.mercatorZfromAltitude(r[2],this._center.lat)*this.worldSize,e.scale$1(i,i,1/this.worldSize),e.scale$1(r,r,1/this.worldSize),new e.Ray([i[0],i[1],i[2]],e.normalize([],e.sub([],r,i)))}},{key:"rayIntersectionCoordinate",value:function(t){var i=t.p0,r=t.p1,n=t.t,a=e.mercatorZfromAltitude(i[2],this._center.lat),o=e.mercatorZfromAltitude(r[2],this._center.lat);return new e.MercatorCoordinate(e.number(i[0],r[0],n)/this.worldSize,e.number(i[1],r[1],n)/this.worldSize,e.number(a,o,n))}},{key:"pointCoordinate",value:function(e){var t=arguments.length>1&&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]>
10?new e.pointGeometry(n[0]/n[3],n[1]/n[3]):new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}},{key:"_getBounds",value:function(t,i){var r=new e.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),n=new e.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),a=new e.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),o=new e.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom),s=this.pointCoordinate(r,t),l=this.pointCoordinate(n,t),u=this.pointCoordinate(a,i),c=this.pointCoordinate(o,i),h=function(e,t){return(t.y-e.y)/(t.x-e.x)};return s.y>1&&l.y>=0?s=new e.MercatorCoordinate((1-c.y)/h(c,s)+c.x,1):s.y<0&&l.y<=1&&(s=new e.MercatorCoordinate(-c.y/h(c,s)+c.x,0)),l.y>1&&s.y>=0?l=new e.MercatorCoordinate((1-u.y)/h(u,l)+u.x,1):l.y<0&&s.y<=1&&(l=new e.MercatorCoordinate(-u.y/h(u,l)+u.x,0)),(new e.LngLatBounds).extend(this.coordinateLocation(s)).extend(this.coordinateLocation(l)).extend(this.coordinateLocation(c)).extend(this.coordinateLocation(u))}},{key:"_getBounds3D",value:function(){var e=this.elevation;if(!e.visibleDemTiles.length)return this._getBounds(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._getBounds(t.min*e.exaggeration(),t.max*e.exaggeration())}},{key:"getBounds",value:function(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}},{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.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=e.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=e.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=e.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}},{key:"calculatePosMatrix",value:function(e,t){return this.projection.createTileMatrix(this,t,e)}},{key:"calculateDistanceTileData",value:function(t){var i=t.key,r=this._distanceTileDataCache;if(r[i])return r[i];var n=t.canonical,a=1/this.height,o=this.cameraWorldSize/this.zoomScale(n.z),s=(n.x+Math.pow(2,n.z)*t.wrap)*o,l=n.y*o,u=this.point,c=this.angle,h=Math.sin(-c),f=-Math.cos(-c);return r[i]={bearing:[h,f],center:[(u.x-s)*a,(u.y-l)*a],scale:o/e.EXTENT*a},r[i]}},{key:"calculateFogTileMatrix",value:function(t){var i=t.key,r=this._fogTileMatrixCache;if(r[i])return r[i];var n=this.projection.createTileMatrix(this,this.cameraWorldSize,t);return e.multiply(n,this.worldToFogMatrix,n),r[i]=new Float32Array(n),r[i]}},{key:"calculateProjMatrix",value:function(t){var i=arguments.length>1&&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:"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:"_constrainCameraAltitude",value:function(){if(this._elevation){var t=this._elevation;this._updateCameraState();var i=e.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=t.getAtPointOrZero(a(e.MercatorCoordinate,c(r))),o=this._minimumHeightOverTerrain()*M
1ath.cos(e.degToRad(this._maxPitch)),s=this._camera.position[2]-this.pixelsPerMeter/this.worldSize*n;if(s<o){var l=this.locationCoordinate(this._center,this._centerAltitude),u=[l.x-r[0],l.y-r[1],l.z-r[2]],h=e.length(u);u[2]-=(o-s)/this._pixelsPerMercatorPixel;var f=e.length(u);if(0===f)return;e.scale$2(u,u,h/f*this._pixelsPerMercatorPixel),this._camera.position=[l.x-u[0],l.y-u[1],l.z*this._pixelsPerMercatorPixel-u[2]],this._camera.orientation=Qr(u,this._camera.up()),this._updateStateFromCamera()}}}},{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,p=this.worldMaxY*this.scale;if(o-h<f&&(u=f+h),o+h>p&&(u=p-h),p-f<this.height&&(s=Math.max(s,this.height/(p-f)),u=(p+f)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){var d=this.worldMinX*this.scale,m=this.worldMaxX*this.scale,v=this.worldSize/2-(d+m)/2;(l=(a+v+this.worldSize)%this.worldSize-v)-c<d&&(l=d+c),l+c>m&&(l=m-c),m-d<this.width&&(s=Math.max(s,this.width/(m-d)),l=(m+d)/2)}l===a&&u===o||(this.center=this.unproject(new e.pointGeometry(l,u))),s&&(this.zoom+=this.scaleZoom(s)),this._constrainCameraAltitude(),this._unmodified=r,this._constraining=!1}}},{key:"_minZoomForBounds",value:function(){var e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}},{key:"_maxCameraBoundsDistance",value:function(){return this._mercatorZfromZoom(this._minZoomForBounds())}},{key:"_calcMatrices",value:function(){if(this.height){var t=this.centerOffset,i=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.mercatorZfromAltitude(1,this.center.lat)/e.mercatorZfromAltitude(1,e.GLOBE_SCALE_MATCH_LATITUDE));var r=an(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,r),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;var n=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?i:1),a=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height;var o=e.mul([],a,n);if(this.projection.isReprojectedInTileSpace){var s=this.locationCoordinate(this.center),l=e.identity([]);e.translate(l,l,[s.x*this.worldSize,s.y*this.worldSize,0]),e.multiply(l,l,rn(this)),e.translate(l,l,[-s.x*this.worldSize,-s.y*this.worldSize,0]),e.multiply(o,o,l),this.inverseAdjustmentMatrix=function(e){var t=rn(e,!0);return z([],[t[0],t[1],t[4],t[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=e.scale([],o,[this.worldSize,this.worldSize,this.worldSize/i,1]),this.projMatrix=o,this.invProjMatrix=e.invert(new Float64Array(16),this.projMatrix);var u=e.invert([],a);this.frustumCorners=e.FrustumCorners.fromInvProjectionMatrix(u,this.horizonLineFromTop(),this.height);var c=new Float32Array(16);e.identity(c),e.scale(c,c,[1,-1,1]),e.rotateX(c,c,this._pitch),e.rotateZ(c,c,this.angle);var h=e.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),f=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;h[8]=2*-t.x/this.width,h[9]=2*(t.y+f)/this.height,this.skyboxMatrix=e.multiply(c,h,c);var p=this.point,d=p.x,m=p.y,v=this.width%2/2,y=this.height%2/2,_=Math.cos(this.angle),g=Math.sin(this.angle),x=d-Math.round(d)+_*v+g*y,b=m-Math.round(m)+_*y+g*v,w=new Float64Array(o);if(e.translate(w,w,[x>.5?x-1:x,b>.5?b-1:b,0]),this.alignedProjMatrix=w,o=e.create(),e.scale(o,o,[this.width/2,-this.height/2,1]),e.translate(o,o,[1,-1,0]),this.labelPlaneMatr
1ix=o,o=e.create(),e.scale(o,o,[1,-1,1]),e.translate(o,o,[-1,-1,0]),e.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o,this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(o=e.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=o,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.calculateGlobeMatrix(this);var k=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.transformMat4(k,k,n),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=o;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}}},{key:"_calcFogMatrices",value:function(){this._fogTileMatrixCache={};var t=this.cameraWorldSize,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=t[2],n=1;r>0&&(n=Math.min((i-this._camera.position[2])/r,1)),this._camera.position=e.scaleAndAdd([],this._camera.position,t,n),this._updateStateFromCamera(),this.projection.wrap&&(this.center=this.center.wrap())}},{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)+2,this._maxZoom);return this._mercatorZfromZoom(e)}},{key:"_zoomFromMercatorZ",value:function(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}},{key:"_terrainEnabled",value:function(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}},{key:"anyCornerOffEdge",value:function(t,i){var r=Math.min(t.x,i.x),n=Math.max(t.x,i.x),a=Math.min(t.y,i.y),o=Math.max(t.y,i.y);if(a<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;for(var s=[new e.pointGeometry(r,a),new e.pointGeometry(n,o),new e.pointGeometry(r,o),new e.pointGeometry(n,a)],l=this.renderWorldCopies?-3:0,u=this.renderWorldCopies?4:1,c=0,h=s;c<h.length;c++){var f=h[c],p=this.pointRayIntersection(f);if(p.t<0)return!0;var d=this.rayIntersectionCoordinate(p);if(d.x<l||d.y<0||d.x>u||d.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=[t[0],t[1],t[2],1];e.transformMat4$1(r,r,i);var n=Math.max(r[3],1e-6);return[r[0]/n,r[1]/n,r[2]/n,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=an(e,this.zoom,this.width,this.height,1024),i=e.pixelSpaceConversion(this.center.lat,this.worldSize,t);return.5/Math.tan(.5*this._fov)*this.height*i}},{key:"elevation",get:function(){return this._elevation},set:function(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}}
1,{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:"cameraWorldSize",get:function(){var e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),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.cameraWorldSize)}},{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:"fov",get:function(){return this._fov/Math.PI*180},set:function(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}},{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:"center",get:function(){return this._center},set:function(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}},{key:"padding",get:function(){return this._edgeInsets.toJSON()},set:function(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}},{key:"centerPoint",get:function(){return this._edgeInsets.getCenter(this.width,this.height)}},{key:"fovAboveCenter",get:function(){return this._fov*(.5+this.centerOffset.y/this.height)}},{key:"unmodified",get:function(){return this._unmodified}},{key:"point",get:function(){return this.project(this.center)}}]),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){v(this,t),this._hashName=i&&encodeURIComponent(i),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=cn(this._updateHashUnthrottled.bind(this),300)}return y(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("=")}
1)).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 pn={linearity:.3,easing:e.bezier(0,0,.3,1)},dn=e.extend({deceleration:2500,maxSpeed:1400},pn),mn=e.extend({deceleration:20,maxSpeed:1400},pn),vn=e.extend({deceleration:1e3,maxSpeed:360},pn),yn=e.extend({deceleration:1e3,maxSpeed:90},pn),_n=function(){function t(e){v(this,t),this._map=e,this.clear()}return y(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(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(d){n.e(d)}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({},dn,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,mn);s.zoom=this._map.transform.zoom+u.amount,gn(s,u)}if(r.bearing){var c=xn(r.bearing,o,vn);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 p=void 0===r.pinchAround?r.around:r.pinchAround;s.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),s.noMoveStart=!0,s}}}]),t}();function gn(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function xn(t,i,r){var n=r.maxSpeed,a=r.linearity,o=r.deceleration,s=e.clamp(t*a/(i/1e3),-n,n),l=Math.abs(s)/(o*a);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}var bn=function(t){d(r,t);var i=m(r);function r(t,n,a){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};v(this,r);var l=A(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 y(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(e.Event),wn=function(t){d(r,t);var i=m(r);function r(t,n,a){var o;v(this,r);var s="touchend"===t?a.changedTouches:a.touches,l=M(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 y(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(e.Event),kn=function(e){d(i,e);var t=m(i);function i(e,r,n){var a;return v(this,i),(a=t.call(this,e,{originalEvent:n}))._defaultPrevented=!1,a}
1return y(i,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),i}(e.Event),Tn=function(){function t(e,i){v(this,t),this._map=e,this._clickTolerance=i.clickTolerance}return y(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){v(this,e),this._map=t}return y(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){v(this,t),this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}return y(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;if(!(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)){var n=this._startPos;this._lastPos=r,this._box||(this._box=_("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));var a=Math.min(n.x,r.x),o=Math.max(n.x,r.x),s=Math.min(n.y,r.y),l=Math.max(n.y,r.y);this._map._requestDomTask((function(){i._box&&(i._box.style.transform="translate(".concat(a,"px,").concat(s,"px)"),i._box.style.width=o-a+"px",i._box.style.height=l-s+"px")}))}}}},{key:"mouseupWindow",value:function(t,i){var r=this;if(this._active&&0===t.button){var n=this._startPos,a=i;if(this.reset(),S(),n.x!==a.x||n.y!==a.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:function(e){return e.fitScreenCoordinates(n,a,r._map.getBearing(),{linear:!1})}};this._fireEvent("boxzoomcancel",t)}}}
1,{key:"keydown",value:function(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}},{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),T(),delete this._startPos,delete this._lastPos}},{key:"_fireEvent",value:function(t,i){return this._map.fire(new e.Event(t,{originalEvent:i}))}}]),t}();function An(e,t){for(var i={},r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}var Mn=function(){function t(e){v(this,t),this.reset(),this.numTouches=e.numTouches}return y(t,[{key:"reset",value:function(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}},{key:"touchstart",value:function(t,i,r){(this.centroid||r.length>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=An(r,i)))}},{key:"touchmove",value:function(e,t,i){if(!this.aborted&&this.centroid){var r=An(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){v(this,e),this.singleTap=new Mn(t),this.numTaps=t.numTaps,this.reset()}return y(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(){v(this,e),this._zoomIn=new In({numTouches:1,numTaps:2}),this._zoomOut=new In({numTouches:2,numTaps:1}),this.reset()}return y(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){v(this,e),this.reset(),this._clickTolerance=t.clickTolerance||1}return y(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)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(i,t)}},{key:"mouseupWindow",value:function(e){this._lastPoint&&I(e)===this._eventButton&&(this._moved&&S(),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}(),Dn=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"mousedown",value:function(e,t){o(s(i.prototype),"mousedown",this).call(this,e,t),this._lastPoint&&(this._active=!0)}},{key:"_correctButton",value:function(e,t){return 0===t&&!e.ctrlKey}},{key:"_move",value:function(e,t){return{around:t,panDelta:t.sub(e)}}}]),i}(Pn),Ln=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"_correctButton",value:function(e,t){return 0===t&&e.ctrlKey||2===t}},{key:"_move",value:function(e,t){var i=.8*(t.x-e.x);if(i)return this._active=!0,{bearingDelta:i}}},{key:"contextmenu",value:function(e){e.preventDefault()}}]),i}(Pn),Bn=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"_correctButton",value:function(e,t){return 0===t&&e.ctrlKey||2===t}},{key:"_move",value:function(e,t){var i=-.5*(t.y-e.y);if(i)return this._active=!0,{pitchDelta:i}}},{key:"contextmenu",value:function(e){e.preventDefault()}}]),i}(Pn),Rn=function(){function t(i,r){v(this,t),this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}
1return y(t,[{key:"reset",value:function(){this._active=!1,this._touches={},this._sum=new e.pointGeometry(0,0)}},{key:"touchstart",value:function(e,t,i){return this._calculateTransform(e,t,i)}},{key:"touchmove",value:function(t,i,r){if(this._active&&!(r.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===r.length&&!e.isFullscreen())return void this._showTouchPanBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,i,r)}}},{key:"touchend",value:function(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this._minTouches&&this.reset()}},{key:"touchcancel",value:function(){this.reset()}},{key:"_calculateTransform",value:function(t,i,r){r.length>0&&(this._active=!0);var n=An(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,!(s<this._minTouches)&&o.mag()){var h=o.div(s);return this._sum._add(h),this._sum.mag()<this._clickTolerance?void 0:{around:a.div(s),panDelta:h}}}},{key:"enable",value:function(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}},{key:"disable",value:function(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}},{key:"isEnabled",value:function(){return!!this._enabled}},{key:"isActive",value:function(){return!!this._active}},{key:"_addTouchPanBlocker",value:function(){this._map&&!this._alertContainer&&(this._alertContainer=_("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize="".concat(Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth))),"px"))}},{key:"_showTouchPanBlockerAlert",value:function(){var e=this;this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout((function(){e._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),e._alertContainer.setAttribute("role","null")}),500)}}]),t}(),Fn=function(){function e(){v(this,e),this.reset()}return y(e,[{key:"reset",value:function(){this._active=!1,this._firstTwoTouches=void 0}},{key:"_start",value:function(e){}},{key:"_move",value:function(e,t,i){return{}}},{key:"touchstart",value:function(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}},{key:"touchmove",value:function(e,t,i){var r=this._firstTwoTouches;if(r){e.preventDefault();var n=h(r,2),a=n[0],o=n[1],s=On(i,t,a),l=On(i,t,o);if(s&&l){var u=this._aroundCenter?null:s.add(l).div(2);return this._move([s,l],u,e)}}}},{key:"touchend",value:function(e,t,i){if(this._firstTwoTouches){var r=h(this._firstTwoTouches,2),n=r[0],a=r[1],o=On(i,t,n),s=On(i,t,a);o&&s||(this._active&&S(),this.reset())}}},{key:"touchcancel",value:function(){this.reset()}},{key:"enable",value:function(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}();function On(e,t,i){for(var r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function Un(e,t){return Math.log(e/t)/Math.LN2}var Vn=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"reset",value:function(){o(s(i.prototype),"reset",this).call(this),this._distance=0,this._startDistance=0}},{key:"_start",value:function(e){this._startDistance=this._distance=e[0].dist(e[1])}},{key:"_move",value:function(e,t){var i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Un(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Un(this._distance,i),pinchAround:t}}}]),i}(Fn);function jn(e,t){return 180*e.angleWith(t)/Math.PI}var Nn=function(e){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return y(i,[{key:"reset",value:function(){o(s(i.prototype),"reset",this).call(this),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}},{key:"_start",value:function(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}},{key:"_move",value:function(e,t){var i=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:jn(this._vector,i),pinchAround:t}}},{key:"_isBelowThreshold",value:function(e){this._minDiameter=Math.min(this._minDiameter,e.mag());var t=25/(Math.PI*this._minDiameter)*360,i=jn(e,this._startVector);return Math.abs(i)<t}}]),i}(Fn);function Gn(e){return Math.abs(e.y)>Math.abs(e.x)}var Zn=function(e){d(i,e);var t=m(i);function i(e){var r;return v(this,i),(r=t.call(this))._map=e,r}return y(i,[{key:"reset",value:function(){o(s(i.prototype),"reset",this).call(this),this._val
1id=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(e,t,i){var r=this._lastPoints;if(r){var n=e[0].sub(r[0]),a=e[1].sub(r[1]);return this._map._cooperativeGestures&&i.touches.length<3||(this._valid=this.gestureBeginsVertically(n,a,i.timeStamp),!this._valid)?void 0:(this._lastPoints=e,this._active=!0,{pitchDelta:(n.y+a.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}}}]),i}(Fn),qn={panStep:100,bearingStep:15,pitchStep:10},Wn=function(){function e(){v(this,e);var t=qn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}return y(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){v(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 y(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=A(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._triggerRe
1nderFrame())}}},{key:"renderFrame",value:function(){var t=this;if(this._frameId&&(this._frameId=null,this.isActive())){var i=this._map.transform,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,p=!1;if("wheel"===this._type&&h&&f){var d=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),m=f(d);u=e.number(h,c,m),d<1?this._frameId||(this._frameId=!0):p=!0}else u=c,p=!0;return this._active=!0,p&&(this._active=!1,this._finishTimeout=setTimeout((function(){t._zooming=!1,t._handler._triggerRenderFrame(),delete t._targetZoom,delete t._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!p,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){v(this,e),this._clickZoom=t,this._tapZoom=i}return y(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(){v(this,e),this.reset()}return y(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(){v(this,e),this._tap=new In({numTouches:1,numTaps:1}),this.reset()}return y(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){v(this,e),this._el=t,this._mousePan=i,this._touchPan=r}return y(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){v(this,e),this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}return y(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){v(this,e),this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}return y(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){d(i,e);var t=m(i);function i(){return v(this,i),t.apply(this,arguments)}return i}(e.Event),na=function(){function t(){v(this,t),this.constants=[1,1,.01],this.radius=0}
1return y(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){v(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 y(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 Bn(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 Rn(t,e);t.dragPan=new Qn(i,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);var f=new Nn,p=new Vn;t.touchZoomRotate=new ta(i,p,f,o),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new En(t));var d=t.scrollZoom=new Yn(t,this);this._add("scrollZoom",d,["mousePan"]);var m=t.keyboard=new Wn;this._add("keyboard",m);for(var v=0,y=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];v<y.length;v++){var _=y[v];e.interactive&&e[_]&&t[_].enable(e[_])}}},{key:"_add",value:function(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}},{key:"stop",value:function(e){if(!this._updatingCamera){var t,i=f(this._handlers);try{for(i.s();!(t=i.n()).done;)t.value.handler.reset()}catch(r){i.e(r)}finally{i.f()}this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}},{key:"isActive",value:function(){var e,t=f(this._handlers);try{for(t.s();!(e=t.n()).done;)if(e.value.handler.isActive())return!0}catch(i){t.e(i)}finally{t.f()}return!1}},{key:"isZooming",value:function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}},{key:"isRotating",value:function(){return!!this._eventsInProgress.rotate}},{key:"isMoving",value:function(){return!!ia(this._eventsInProgress)||this.isZooming()}},{key:"_blockedByActive",value:function(e,t,i){for(var r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}},{key:"handleWindowEvent",value:function(e){this.handleEvent(e,"".concat(e.type,"Window"))}}
1,{key:"_getMapTouches",value:function(e){var t,i=[],r=f(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;this._el.contains(n.target)&&i.push(n)}}catch(a){r.e(a)}finally{r.f()}return i}},{key:"handleEvent",value:function(e,t){this._updatingCamera=!0;var i,r="renderFrame"===e.type,n=r?void 0:e,a={needsRenderFrame:!1},o={},s={},l=e.touches?this._getMapTouches(e.touches):void 0,u=l?M(this._el,l):r?void 0:A(this._el,e),c=f(this._handlers);try{for(c.s();!(i=c.n()).done;){var h=i.value,p=h.handlerName,d=h.handler,m=h.allowed;if(d.isEnabled()){var v=void 0;this._blockedByActive(s,m,p)?d.reset():d[t||e.type]&&(v=d[t||e.type](e,u,l),this.mergeHandlerResult(a,o,v,p,n),v&&v.needsRenderFrame&&this._triggerRenderFrame()),(v||d.isActive())&&(s[p]=d)}}}catch(x){c.e(x)}finally{c.f()}var y={};for(var _ in this._previousActiveHandlers)s[_]||(y[_]=n);this._previousActiveHandlers=s,(Object.keys(y).length||aa(a))&&(this._changes.push([a,o,y]),this._triggerRenderFrame()),(Object.keys(s).length||aa(a))&&this._map._stop(!0),this._updatingCamera=!1;var g=a.cameraAnimation;g&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],g(this._map))}},{key:"mergeHandlerResult",value:function(t,i,r,n,a){if(r){e.extend(t,r);var o={handlerName:n,originalEvent:r.originalEvent||a};void 0!==r.zoomDelta&&(i.zoom=o),void 0!==r.panDelta&&(i.drag=o),void 0!==r.pitchDelta&&(i.pitch=o),void 0!==r.bearingDelta&&(i.rotate=o)}}},{key:"_applyChanges",value:function(){var t,i={},r={},n={},a=f(this._changes);try{for(a.s();!(t=a.n()).done;){var o=h(t.value,3),s=o[0],l=o[1],u=o[2];s.panDelta&&(i.panDelta=(i.panDelta||new e.pointGeometry(0,0))._add(s.panDelta)),s.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(i.around=s.around),void 0!==s.aroundCoord&&(i.aroundCoord=s.aroundCoord),void 0!==s.pinchAround&&(i.pinchAround=s.pinchAround),s.noInertia&&(i.noInertia=s.noInertia),e.extend(r,l),e.extend(n,u)}}catch(c){a.e(c)}finally{a.f()}this._updateMapTransform(i,r,n),this._changes=[]}},{key:"_updateMapTransform",value:function(t,i,r){var n=this,a=this._map,o=a.transform,s=function(e){return[e.x,e.y,e.z]};if(function(e){var t=n._eventsInProgress.drag;return t&&!n._handlersById[t.handlerName].isActive()}()&&!aa(t)){var l=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",l!==o.zoom&&this._map._update(!0)}if(aa(t)){var u=t.panDelta,c=t.zoomDelta,h=t.bearingDelta,f=t.pitchDelta,p=t.around,d=t.aroundCoord,m=t.pinchAround;void 0!==m&&(p=m),i.drag&&!n._eventsInProgress.drag&&p&&(this._dragOrigin=s(o.pointCoordinate3D(p)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",a._stop(!0),p=p||a.transform.centerPoint,h&&(o.bearing+=h),f&&(o.pitch+=f),o._updateCameraState();var v=[0,0,0];if(u)if("mercator"===o.projection.name){var y=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(p).dir),_=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(p.sub(u)).dir);v[0]=_[0]-y[0],v[1]=_[1]-y[1]}else{var g=o.pointCoordinate(p);if("globe"===o.projection.name){u=u.rotate(-o.angle);var x=o._pixelsPerMercatorPixel/o.worldSize;v[0]=-u.x*e.mercatorScale(e.latFromMercatorY(g.y))*x,v[1]=-u.y*e.mercatorScale(o.center.lat)*x}else{var b=o.pointCoordinate(p.sub(u));g&&b&&(v[0]=b.x-g.x,v[1]=b.y-g.y)}}var w=o.zoom,k=[0,0,0];if(c){var T=s(d||o.pointCoordinate3D(p)),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 A=e.add(v,v,k);o._translateCameraConstrained(A),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 p,d={};for(var m in this._eventsInProgress){var v=this._eventsInProgress[m],y=v.handlerName,_=v.originalEvent;this._handlersById[y].isActive()||(delete this._eventsInProgress[m],p=i[y]||_,d["".concat(m,"end")]=p)}for(var g in d)this._fireEvent(g,d[g]);var x=ia(this._eventsInProgress);
1if(r&&(a||o)&&!x){this._updatingCamera=!0;var b=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),w=function(e){return 0!==e&&-n._bearingSnap<e&&e<n._bearingSnap};b?(w(b.bearing||this._map.getBearing())&&(b.bearing=0),this._map.easeTo(b,{originalEvent:p})):(this._map.fire(new e.Event("moveend",{originalEvent:p})),w(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}},{key:"_fireEvent",value:function(t,i){this._map.fire(new e.Event(t,i?{originalEvent:i}:{}))}},{key:"_requestFrame",value:function(){var e=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(t){e._frameId=void 0,e.handleEvent(new ra("renderFrame",{timeStamp:t})),e._applyChanges()}))}},{key:"_triggerRenderFrame",value:function(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}]),t}(),sa="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.",la=function(t){d(r,t);var i=m(r);function r(t,a){var o;return v(this,r),(o=i.call(this))._moving=!1,o._zooming=!1,o.transform=t,o._bearingSnap=a.bearingSnap,e.bindAll(["_renderFrameCallback"],n(o)),o}return y(r,[{key:"getCenter",value:function(){return new e.LngLat(this.transform.center.lng,this.transform.center.lat)}},{key:"setCenter",value:function(e,t){return this.jumpTo({center:e},t)}},{key:"panBy",value:function(t,i,r){return t=e.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},i),r)}},{key:"panTo",value:function(t,i,r){return this.easeTo(e.extend({center:t},i),r)}},{key:"getZoom",value:function(){return this.transform.zoom}},{key:"setZoom",value:function(e,t){return this.jumpTo({zoom:e},t),this}},{key:"zoomTo",value:function(t,i,r){return this.easeTo(e.extend({zoom:t},i),r)}},{key:"zoomIn",value:function(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}},{key:"zoomOut",value:function(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}},{key:"getBearing",value:function(){return this.transform.bearing}},{key:"setBearing",value:function(e,t){return this.jumpTo({bearing:e},t),this}},{key:"getPadding",value:function(){return this.transform.padding}},{key:"setPadding",value:function(e,t){return this.jumpTo({padding:e},t),this}},{key:"rotateTo",value:function(t,i,r){return this.easeTo(e.extend({bearing:t},i),r)}},{key:"resetNorth",value:function(t,i){return this.rotateTo(0,e.extend({duration:1e3},t),i),this}},{key:"resetNorthPitch",value:function(t,i){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),i),this}},{key:"snapToNorth",value:function(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}},{key:"getPitch",value:function(){return this.transform.pitch}},{key:"setPitch",value:function(e,t){return this.jumpTo({pitch:e},t),this}},{key:"cameraForBounds",value:function(t,i){"globe"===this.transform.projection.name&&e.warnOnce('Globe projection does not support cameraForBounds API, this API may behave unexpectedly."'),t=e.LngLatBounds.convert(t);var r=i&&i.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,i)}},{key:"_extendCameraOptions",value:function(t){var i={top:0,bottom:0,right:0,left:0};if("number"==typeof(t=e.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding){var r=t.padding;t.padding={top:r,bottom:r,right:r,left:r}}return t.padding=e.extend(i,t.padding),t}},{key:"_cameraForBoxAndBearing",value:function(t,i,r,n){var a=this._extendCameraOptions(n),o=this.transform,s=o.padding,l=o.project(e.LngLat.convert(t)),u=o.project(e.LngLat.convert(i)),c=new e.pointGeometry(l.x,u.y),h=new e.pointGeometry(u.x,l.y),f=-e.degToRad(r),p=l.rotate(f),d=u.rotate(f),m=c.rotate(f),v=h.rotate(f),y=new e.pointGeometry(Math.max(p.x,d.x,m.x,v.x),Math.max(p.y,d.y,m.y,v.y)),_=new e.pointGeometry(Math.min(p.x,d.x,m.x,v.x),Math.min(p.y,d.y,m.y,v.y)),g=y.sub(_),x=(o.width-((s.left||0)+(s.right||0)+a.padding.left+a.padding.right))/g.x,b=(o.height-((s.top||0)+(s.bottom||0)+a.padding.top+a.padding.bottom))/g.y;if(!(b<0||x<0)){var w=Math.min(o.scaleZoom(o.scale*Math.min(x,b)),a.maxZoom),k="number"==typeof a.offset.x&&"number"==typeof a.offset.y?new e.pointGeometry(a.offset.x,a.offset.y):e.pointGeometry.convert(a.offset),T=new e.pointGeometry((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(r*Math.PI/180),E=k.add(T).mult(o.scale/o.zoomScale(w));return{center:o.unproject(l.add(u).div(2).sub(E)),zoom:w,bearing:r}}e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}},{key:"_cameraForBox",value:function(t,i,r,n,a){var o=this._extendCameraOptions(a);r=r||0,n=n||0,t=e.LngLat.convert(t),i=e.LngLat.convert(i);var s=this.transform.clone();s.padding=o.padding;var l=this.getFreeCameraOptions(),u=new e.LngLat(.5*(t.lng+i.lng),.5*(t.lat+i.lat)),c=.5*(r+n);if(!(s._camera.position[2]<e.mercatorZfromAltitude(c,u.lat))){l.lookAtPoint(u),s.setFreeCameraOptions(l);var h,f,p=e.MercatorCoordinate.fromLngLat(t),d=e.MercatorCoordinate.fromLngLat(i),m=s.pointRayIntersection(s.centerPoint,c),v=[(h=s.rayIntersectionCoordinate(m)).x,h.y,h.z],y=s.screenPointToMercatorRay(s.centerPoint),_="globe"!==s.projection.name,g=0;do{var x=Math.floor(s.zoom),b=1<<x,w=Math.min(b*p.x,b*d.x),k=Math.min(b*p.y,b*d.y),T=Math.max(b*p.x,b*d.x),E=Math.max(b*p.y,b*d.y),S=new e.Aabb([w,k,r],[T,E,n]),A=e.Frustum.fromInvProjectionMatrix(s.invProjMatrix,s.worldSize,x,_);if(2!==S.intersects(A)){f&&(s._camera.position=e.scaleAndAdd([],s._camera.position,y.dir,-f),s._updateStateFromCamera());break}var M=e.sub([],s._camera.position,v);f=.5*e.length(M),s._camera.position=e.scaleAndAdd([],s._camera.position,y.dir,f);try{s._updateStateFromCamera()}catch(t){return void e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}}while(++g<10);return{center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch}}e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}},{key:"fitBounds",value:function(t,i,r){return"globe"===this.transform.projection.name&&e.warnOnce("Globe projection does not support fitBounds API, this API may behave unex
1pectedly."),this._fitInternal(this.cameraForBounds(t,i),i,r)}},{key:"_raycastElevationBox",value:function(t,i){var r=this.transform.elevation;if(r){var n=new e.pointGeometry(t.x,i.y),a=new e.pointGeometry(i.x,t.y),o=r.pointCoordinate(t);if(o){var s=r.pointCoordinate(i);if(s){var l=r.pointCoordinate(n);if(l){var u=r.pointCoordinate(a);if(u){var c=new e.MercatorCoordinate(o[0],o[1]).toLngLat(),h=new e.MercatorCoordinate(s[0],s[1]).toLngLat(),f=new e.MercatorCoordinate(l[0],l[1]).toLngLat(),p=new e.MercatorCoordinate(u[0],u[1]).toLngLat(),d=Math.min(c.lng,Math.min(h.lng,Math.min(f.lng,p.lng))),m=Math.min(c.lat,Math.min(h.lat,Math.min(f.lat,p.lat))),v=Math.max(c.lng,Math.max(h.lng,Math.max(f.lng,p.lng))),y=Math.max(c.lat,Math.max(h.lat,Math.max(f.lat,p.lat))),_=Math.min(o[3],Math.min(s[3],Math.min(l[3],u[3]))),g=Math.max(o[3],Math.max(s[3],Math.max(l[3],u[3])));return{minLngLat:new e.LngLat(d,m),maxLngLat:new e.LngLat(v,y),minAltitude:_,maxAltitude:g}}}}}}}},{key:"fitScreenCoordinates",value:function(t,i,r,n,a){var o,s,l,u;"globe"===this.transform.projection.name&&e.warnOnce("Globe projection does not support fitScreenCoordinates API, this API may behave unexpectedly.");var c=e.pointGeometry.convert(t),h=e.pointGeometry.convert(i),f=this._raycastElevationBox(c,h);if(f)o=f.minLngLat,s=f.maxLngLat,l=f.minAltitude,u=f.maxAltitude;else{if(this.transform.anyCornerOffEdge(c,h))return this;o=this.transform.pointLocation(c),s=this.transform.pointLocation(h)}return this._fitInternal(0===this.transform.pitch?this._cameraForBoxAndBearing(this.transform.pointLocation(e.pointGeometry.convert(t)),this.transform.pointLocation(e.pointGeometry.convert(i)),r,n):this._cameraForBox(o,s,l,u,n),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,p="bearing"in t?this._normalizeBearing(t.bearing,u):u,d="pitch"in t?+t.pitch:c,m="padding"in t?t.padding:s.padding,v=e.pointGeometry.convert(t.offset);if("globe"===s.projection.name){var y=e.MercatorCoordinate.fromLngLat(s.center),_=v.rotate(-s.angle);
1y.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(v);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,A=this._rotating||u!==p,M=this._pitching||d!==c,I=!s.isPaddingEqual(m),C=function(s){return function(y){if(S&&(s.zoom=e.number(l,f,y)),A&&(s.bearing=e.number(u,p,y)),M&&(s.pitch=e.number(c,d,y)),I&&(s.interpolatePadding(h,m,y),n=s.centerPoint.add(v)),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=A,this._pitching=M,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,p="padding"in t?t.padding:a.padding,d=a.zoomScale(c-o),m=e.pointGeometry.convert(t.offset),v=a.centerPoint.add(m),y=a.pointLocation(v),_=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/d,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 A=b*b;function M(e){var t=(k*k-w*w+(e?-1:1)*A*A*T*T)/(2*(e?k:w)*A*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=M(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))/A)/T;var t},L=(M(1)-z)/b;if(Math.abs(T)<1e-6||!isFinite(L)){if(Math.abs(w-k)<1e-6)return this.easeTo(t,i);var B=k<w?-1:1;L=Math.abs(Math.log(k/w))/b,D=function(){return 0},P=function(e){return Math.exp(B*b*e)}}t.duration="duration"in t?+t.duration:1e3*L/("screenSpeed"in t?+t.screenSpeed/b:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);var R=s!==h,F=f!==l,O=!a.isPaddingEqual(p),U=function(n){return function(a){var d=a*L,y=1/P(d);n.zoom=1===a?c:o+n.scaleZoom(y),R&&(n.bearing=e.number(s,h,a)),F&&(n.pitch=e.number(l,f,a)),O&&(n.interpolatePadding(u,p,a),v=n.centerPoint.add(m));
1var b=1===a?_:n.unproject(g.add(x.mult(D(d))).mult(y));return n.setLocationAtPoint(n.renderWorldCopies?b.wrap():b,v),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=R,this._pitching=F,this._padding=O,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)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}},{key:"_normalizeCenter",value:function(e){var t=this.transform;if(t.renderWorldCopies&&!t.maxBounds){var i=e.lng-t.center.lng;e.lng+=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]:{};v(this,t),this.options=i,e.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}return y(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<i.length-1?"&":"")),e}),"?");t.href="".concat(e.config.FEEDBACK_URL,"/").concat(r,"#").concat(fn(this._map,!0)),t.rel="noopener nofollow",this._setElementTitle(t,"MapFeedback")}}},{key:"_updateData",value:function(e){!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType||(this._updateAttributions(),this._updateEditLink())}},{key:"_updateAttributions",value:function(){if(this._map.style){var e=[];
1if(this._map.style.stylesheet){var t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}var i=this._map.style._sourceCaches;for(var r in i){var n=i[r];if(n.used){var a=n.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e.sort((function(e,t){return e.length-t.length})),e=e.filter((function(t,i){for(var r=i+1;r<e.length;r++)if(e[r].indexOf(t)>=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(){v(this,t),e.bindAll(["_updateLogo","_updateCompact"],this)}return y(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(){v(this,e),this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}return y(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)<s&&(l||Math.abs(n.lng-r.center.lng)<o)?t=n:r.locationPoint(a).distSqr(i)<s&&(l||Math.abs(a.lng-r.center.lng)<o)&&(t=a)}for(;Math.abs(t.lng-r.center.lng)>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 pa={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%)"},da=function(t){d(r,t);var i=m(r);function r(t,a){var o;
1if(v(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)},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 pa)f.remove("mapboxgl-marker-anchor-".concat(p));return f.add("mapboxgl-marker-anchor-".concat(o._anchor)),o._popup=null,l(o)}return y(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","fal
1se")}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;if(!e)return!1;var t=e.unproject(this._pos),i=e.getFreeCameraOptions();if(!i.position)return!1;var r=i.position.toLngLat();return r.distanceTo(t)<.9*r.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*=.2)),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(pa[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;
1r&&(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){if(!this._isDragging){var r=this._clickTolerance||i._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=i.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.Event("dragstart"))),this.fire(new e.Event("drag")))}}},{key:"_onUp",value:function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;var t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.Event("dragend")),this._state="inactive"}},{key:"_addDragHandler",value:function(e){var t=this._map;t&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos),this._pointerdownPos=e.point,this._state="pending",t.on("mousemove",this._onMove),t.on("touchmove",this._onMove),t.once("mouseup",this._onUp),t.once("touchend",this._onUp))}},{key:"setDraggable",value:function(e){this._draggable=!!e;var t=this._map;return t&&(e?(t.on("mousedown",this._addDragHandler),t.on("touchstart",this._addDragHandler)):(t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler))),this}},{key:"isDraggable",value:function(){return this._draggable}},{key:"setRotation",value:function(e){return this._rotation=e||0,this._update(),this}},{key:"getRotation",value:function(){return this._rotation}},{key:"setRotationAlignment",value:function(e){return this._rotationAlignment=e||"auto",this._update(),this}},{key:"getRotationAlignment",value:function(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}},{key:"setPitchAlignment",value:function(e){return this._pitchAlignment=e||"auto",this._update(),this}},{key:"getPitchAlignment",value:function(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}}]),r}(e.Evented),ma=function(){function t(e){v(this,t),this.jumpTo(e)}return y(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}(),va={"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"},ya={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,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileC
1acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function _a(e){e.parentNode&&e.parentNode.removeChild(e)}var ga={showCompass:!0,showZoom:!0,visualizePitch:!1},xa=function(){function t(i,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];v(this,t),this._clickTolerance=10,this.element=r,this.mouseRotate=new Ln({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,n&&(this.mousePitch=new Bn({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 y(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()}}),A(this.element,t)),e.window.addEventListener("mousemove",this.mousemove),e.window.addEventListener("mouseup",this.mouseup)}},{key:"mousemove",value:function(e){this.move(e,A(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=M(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=M(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)<this._clickTolerance&&this.element.click(),this.reset()}},{key:"reset",value:function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}]),t}(),ba={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},wa={maxWidth:100,unit:"metric"};function ka(e,t,i){var r=this,n=Ta(t),a=n/t,o={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[i];this._map._requestDomTask((function(){r._container.style.width=e*a+"px",r._container.innerHTML="".concat(n," ").concat(o)}))}function Ta(e){var t=Math.pow(10,"".concat(Math.floor(e)).length-1),i=e/t;return t*(i=i>=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))}var Ea={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Sa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Aa(){var t=arguments.length>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 Ma={version:e.version,supported:i,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:function(t){d(c,t);var a=m(c);function c(t){var i;if(v(this,c),null!=(t=e.extend({},ya,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._maxTileC
1acheSize=t.maxTileCacheSize,i._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,i._preserveDrawingBuffer=t.preserveDrawingBuffer,i._antialias=t.antialias,i._trackResize=t.trackResize,i._bearingSnap=t.bearingSnap,i._refreshExpiredTiles=t.refreshExpiredTiles,i._fadeDuration=t.fadeDuration,i._isInitialLoad=!0,i._crossSourceCollisions=t.crossSourceCollisions,i._crossFadingFactor=1,i._collectResourceTiming=t.collectResourceTiming,i._optimizeForTerrain=t.optimizeForTerrain,i._language="auto"===t.language?e.window.navigator.language:t.language,i._worldview=t.worldview,i._renderTaskQueue=new ha,i._domRenderTaskQueue=new ha,i._controls=[],i._markers=[],i._mapId=e.uniqueId(),i._locale=e.extend({},va,t.locale),i._clickTolerance=t.clickTolerance,i._cooperativeGestures=t.cooperativeGestures,i._containerWidth=0,i._containerHeight=0,i._averageElevationLastSampledAt=-1/0,i._averageElevationExaggeration=0,i._averageElevation=new ma(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."))}
1else{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","_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)),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 y(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"globe"===this.transform.projection.name&&e.warnOnce('Globe projection does not support getBounds API, this API may behave unexpectedly."'),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()<t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}},{key:"getMinZoom",value:function(){return this.transform.minZoom}},{key:"setMaxZoom",value:function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;
1throw 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()<t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}},{key:"getMinPitch",value:function(){return this.transform.minPitch}},{key:"setMaxPitch",value:function(t){if((t=null==t?85:t)>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._update()}},{key:"getLanguage",value:function(){return this._language}},{key:"setLanguage",value:function(t){if(this._language="auto"===t?e.window.navigator.language:t,this.style)for(var i in this.style._sourceCaches){var r=this.style._sourceCaches[i]._source;r._setLanguage&&r._setLanguage(this._language)}var n,a=f(this._controls);try{for(a.s();!(n=a.n()).done;){var o=n.value;o._setLanguage&&o._setLanguage(this._language)}}catch(s){a.e(s)}finally{a.f()}return this}},{key:"getWorldview",value:function(){return this._worldview}},{key:"setWorldview",value:function(e){if(this._worldview=e,this.style)for(var t in this.style._sourceCaches){var i=this.style._sourceCaches[t]._source;i._setWorldview&&i._setWorldview(e)}return 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>
1=e.GLOBE_ZOOM_THRESHOLD_MAX?(i.setMercatorFromTransition(),t=!0):"mercator"===r&&i.zoom<e.GLOBE_ZOOM_THRESHOLD_MAX&&(i.setProjection({name:"globe"}),t=!0),t&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}}},{key:"_prioritizeAndUpdateProjection",value:function(e,t){return this._updateProjection(e||t||{name:"mercator"})}},{key:"_updateProjection",value:function(t){var i;if(i="globe"===t.name&&this.transform.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)}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:"_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;a<e.length;a++){var o=e[a];if(o.listener===i&&n(o.layers,t)){for(var s in o.delegates)r.off(s,o.delegates[s]);return e.splice(a,1),r}}}(a),this}},{key:"queryRenderedFeatures",value:function(t,i){return this.style?(void 0!==i||void 0===t||t instanceof e.pointGeometry||Array.isArray(t)||(i=t,t=void 0),this.style.queryRenderedFeatures(t=t||[[0,0],[this.transform.width,this.transform.height]],i=i||{},this.transform)):[]}},{key:"querySourceFeatures",value:function(e,t){return this.style.querySourceFeatures(e,t)}},{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:"setStyle",value:function(t,i){return!1!==(i=e.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&i.localFontFamily===this._localFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}},{key:"_getUIString",value:function(e){var t=this._locale[e];if(null==t)throw new Error("Missing UI string '".concat(e,"'"));return t}},{key:"_updateStyle",value:function(e,t){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),e&&(this.style=new pi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e):this.style.loadJSON(e)),this._updateTerrain(),this}},{key:"_lazyInitEmptyStyle",value:function(){this.style||(this.style=new pi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}},{key:"_diffStyle",value:function(t,i){var r=this;if("string"==typeof t){var n=this._requestManager.normalizeStyleURL(t),a=this._requestManager.transformRequest(n,e.ResourceType.Style);e.getJSON(a,(function(t,n){t?r.fire(new e.ErrorEvent(t)):n&&r._updateDiff(n,i)}))}else"object"==typeof t&&this._updateDiff(t,i)}},{key:"_updateDiff",value:function(t,i){try{this.style.setState(t)&&this._update(!0)}catch(u){e.warnOnce("Unable to perform style diff: ".concat(u.message||u.error||u,". Rebuilding the style from scratch.")),this._updateStyle(t,i)}}},{key:"getStyle",value:function(){if(this.style)return this.style.serialize()}},{key:"isStyleLoaded",value:function(){return this.style?this.style.loaded():(e.warnOnce("There is no style added to the map."),!1)}},{key:"addSource",value:function(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}},{key:"isSourceLoaded",value:function(e){return!!this.style&&this.style._isSourceCacheLoaded(e)}},{key:"areTilesLoaded",value:function(){var e=this.style&&this.style._sourceCaches;for(var t in e){var i=e[t]._tiles;for(var r in i){var n=i[r];if("loaded"!==n.state&&"errored"!==n.state)return!1}}return!0}},{key:"addSourceType",value:function(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}},{key:"removeSource",value:function(e){return this.style.removeSource(e),this._updateTerrain(),this._update(!0)}},{key:"getSource",value:function(e){return this.style.getSource(e)}},{key:"addImage",value:function(t,i){var r=arguments.length>2&&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;
1if(this._lazyInitEmptyStyle(),i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap){var h=e.exported.getImageData(i),f=h.width,p=h.height,d=h.data;this.style.addImage(t,{data:new e.RGBAImage({width:f,height:p},d),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 m=i.width,v=i.height,y=i;this.style.addImage(t,{data:new e.RGBAImage({width:m,height:v},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.
1window.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.
1window.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:"_setupPainter",value:function(){var t=this,r=e.extend({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);n?(e.storeAuthState(n,!0),this.painter=new Yr(n,this.transform),this.on("data",(function(e){"source"===e.dataType&&t.painter.setTileLoadedFlag(!0)})),e.exported$1.testSupport(n)):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._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),!this._removed){this._updateProjectionTransition();var o=!1,s=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;var l=this.transform.zoom,u=this.transform.pitch,c=e.exported.now();this.style.zoomHistory.update(l,c);var h=new e.EvaluationParameters(l,{now:c,fadeDuration:s,pitch:u,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=h.crossFadingFactor();1===f&&f===this._crossFadingFactor||(o=!0,this._crossFadingFactor=f),this.style.update(h)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedU
1pdate=!0,this._sourcesDirty=!0);var p=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),p=this._updateAverageElevation(a),this.style._updateSources(this.transform),this._forceMarkerUpdate()):p=this._updateAverageElevation(a),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){var d=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:d,gpuTime:t})),e.window.performance.mark("frame-gpu",{startTime:a,detail:{gpuTime:t}})}),50)}if(this.listens("gpu-timing-layer")){var m=this.painter.collectGpuTimers();setTimeout((function(){var t=r.painter.queryGpuTimers(m);r.fire(new e.Event("gpu-timing-layer",{layerTimes:t}))}),50)}if(this.listens("gpu-timing-deferred-render")){var v=this.painter.collectDeferredRenderGpuQueries();setTimeout((function(){var t=r.painter.queryGpuTimeDeferredRender(v);r.fire(new e.Event("gpu-timing-deferred-render",{gpuTime:t}))}),50)}var y=this._sourcesDirty||this._styleDirty||this._placementDirty||p;if(y||this._repaint)this.triggerRepaint();else{var _=!this.isMoving()&&this.loaded();if(_&&(p=this._updateAverageElevation(a,!0)),p)this.triggerRepaint();else if(this._triggerFrame(!1),_&&(this.fire(new e.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){var g=this._calculateSpeedIndex();this.fire(new e.Event("speedindexcompleted",{speedIndex:g})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,this._authenticate())}}},{key:"_forceMarkerUpdate",value:function(){var e,t=f(this._markers);try{for(t.s();!(e=t.n()).done;)e.value._update()}catch(i){t.e(i)}finally{t.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(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}},{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;a<t.length;a++){for(var o=t[a],s=0,l=0;l<o.length;
1l+=4)o[l]===e[l]&&o[l+1]===e[l+1]&&o[l+2]===e[l+2]&&o[l+3]===e[l+3]&&(s+=1);r+=(i[a+2]-i[a+1])*(1-s/n)}return r}},{key:"remove",value:function(){this._hash&&this._hash.remove();var t,i=f(this._controls);try{for(i.s();!(t=i.n()).done;)t.value.onRemove(this)}catch(n){i.e(n)}finally{i.f()}this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),void 0!==e.window&&(e.window.removeEventListener("resize",this._onWindowResize,!1),e.window.removeEventListener("orientationchange",this._onWindowResize,!1),e.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),e.window.removeEventListener("online",this._onWindowOnline,!1));var r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),_a(this._canvasContainer),_a(this._controlContainer),_a(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),e.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new e.Event("remove"))}},{key:"triggerRepaint",value:function(){this._triggerFrame(!0)}},{key:"_triggerFrame",value:function(t){var i=this;this._renderNextFrame=this._renderNextFrame||t,this.style&&!this._frame&&(this._frame=e.exported.frame((function(e){var t=!!i._renderNextFrame;i._frame=null,i._renderNextFrame=null,t&&i._render(e)})))}},{key:"_preloadTiles",value:function(t){var i=this,r=this.style?Object.values(this.style._sourceCaches):[];return e.asyncAll(r,(function(e,i){return e._preloadTiles(t,i)}),(function(){i.triggerRepaint()})),this}},{key:"_onWindowOnline",value:function(){this._update()}},{key:"_onWindowResize",value:function(e){this._trackResize&&this.resize({originalEvent:e})._update()}},{key:"_setCacheLimits",value:function(t,i){e.setCacheLimits(t,i)}},{key:"showTileBoundaries",get:function(){return!!this._showTileBoundaries},set:function(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}},{key:"showTerrainWireframe",get:function(){return!!this._showTerrainWireframe},set:function(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}},{key:"speedIndexTiming",get:function(){return!!this._speedIndexTiming},set:function(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}},{key:"showPadding",get:function(){return!!this._showPadding},set:function(e){this._showPadding!==e&&(this._showPadding=e,this._update())}},{key:"showCollisionBoxes",get:function(){return!!this._showCollisionBoxes},set:function(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}},{key:"showOverdrawInspector",get:function(){return!!this._showOverdrawInspector},set:function(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}},{key:"repaint",get:function(){return!!this._repaint},set:function(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}},{key:"vertices",get:function(){return!!this._vertices},set:function(e){this._vertices=e,this._update()}},{key:"version",get:function(){return e.version}}]),c}(la),NavigationControl:function(){function t(i){var r=this;v(this,t),this.options=e.extend({},ga,i),this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(function(e){return e.preventDefault()})),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(function(e){r._map&&r._map.zoomIn({},{originalEvent:e})})),_("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(function(e){r._map&&r._map.zoomOut({},{originalEvent:e})})),_("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(function(e){var t=r._map;t&&(r.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=_("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}
1return y(t,[{key:"_updateZoomButtons",value:function(){var e=this._map;if(e){var t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}}},{key:"_rotateCompassArrow",value:function(){var e=this,t=this._map;if(t){var i=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(t.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(t.transform.pitch,"deg) rotateZ(").concat(t.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(t.transform.angle*(180/Math.PI),"deg)");t._requestDomTask((function(){e._compassIcon&&(e._compassIcon.style.transform=i)}))}}},{key:"onAdd",value:function(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new xa(e,this._compass,this.options.visualizePitch)),this._container}},{key:"onRemove",value:function(){var e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}},{key:"_createButton",value:function(e,t){var i=_("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},{key:"_setButtonTitle",value:function(e,t){if(this._map){var i=this._map._getUIString("NavigationControl.".concat(t));e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}}}]),t}(),GeolocateControl:function(t){d(r,t);var i=m(r);function r(t){var a;return v(this,r),(a=i.call(this)).options=e.extend({geolocation:e.window.navigator.geolocation},ba,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],n(a)),a._updateMarkerRotationThrottled=cn(a._updateMarkerRotation,20),a._numberOfWatches=0,a}return y(r,[{key:"onAdd",value:function(e){return this._map=e,this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}},{key:"onRemove",value:function(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}},{key:"_checkGeolocationSupport",value:function(t){var i=this;void 0!==this._supportsGeolocation?t(this._supportsGeolocation):void 0!==e.window.navigator.permissions?e.window.navigator.permissions.query({name:"geolocation"}).then((function(e){i._supportsGeolocation="denied"!==e.state,t(i._supportsGeolocation)})):(this._supportsGeolocation=!!this.options.geolocation,t(this._supportsGeolocation))}},{key:"_isOutOfMapMaxBounds",value:function(e){var t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.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_E
1RROR":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(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","fal
1se"),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 da({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=_("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new da({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","fal
1se"),this.options.showUserLocation&&this._updateMarker(null)}}]),r}(e.Evented),AttributionControl:ua,ScaleControl:function(){function t(i){v(this,t),this.options=e.extend({},wa,i),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(e){return!1}}()||(this._setScale=ka.bind(this)),e.bindAll(["_update","_setScale","setUnit"],this)}return y(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=Ta(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){v(this,t),this._fullscreen=!1,i&&i.container&&(i.container instanceof e.
1window.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 y(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){d(r,t);var i=m(r);function r(t){var a;return v(this,r),(a=i.call(this)).options=e.extend(Object.create(Ea),t),e.bindAll(["_update","_onClose","remove","_onMouseEvent"],n(a)),a._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[]),a}return y(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(),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),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}}
1,{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}}
1,{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.x<n/2,s=r.x>t.transform.width-n/2;if(r.y+e<a)return o?"top-left":s?"top-right":"top";if(r.y>t.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=Aa(this.options.offset),l=this._anchor=this._getAnchor(s.y),u=Aa(this.options.offset,l),c=o.add(u).round();r._requestDomTask((function(){i._container&&l&&(i._container.style.transform="".concat(pa[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(Sa);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:da,Style:pi,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.pointGeometry,MercatorCoordinate:e.MercatorCoordinate,FreeCameraOptions:en,Evented:e.Evented,config:e.config,prewarm:function(){et().acquire($e)},clearPrewarmedResources:function(){var e=Je;e&&(e.isPreloaded()&&1===e.numActive()?(e.release($e),Je=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 Qe.workerCount},set workerCount(e){Qe.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}()},368:function(e,t){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}},369:function(e,t,i){var r=i(256),n=i(255),a=i(232),o=i(257);e.exports=function(e){return r(e)||n(e)||a(e)||o()}},370:function(e,t,i){var r=i(231),n=i(243),a=i(371),o=i(296);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)},s(t)}e.exports=s},371:function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}}}]); 2//# sourceMappingURL=9.9eac40f5.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.